text stringlengths 3.09k 13.9k |
|---|
use crate::error::ContractError;
use crate::querier::{query_cumulative_prices, query_pair_info, query_prices};
use crate::state::{Config, PriceCumulativeLast, CONFIG, PRICE_LAST};
use astroport::asset::{addr_validate_to_lower, Asset, AssetInfo};
use astroport::oracle::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};... |
// day16 parse time: [235.90 us 241.36 us 247.52 us]
// day16 part 1 time: [52.535 us 53.690 us 55.173 us]
// day16 part 2 time: [266.19 us 270.68 us 275.73 us]
use super::*;
use std::collections::{BTreeMap, BTreeSet};
use std::ops::RangeInclusive;
type Input = String;
pub fn ... |
/* MIT License
Copyright (c) 2019 <NAME> - NightsWatch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
use chrono::Local;
use std::convert::TryFrom;
use std::io::Error;
use std::path::PathBuf;
use tui::backend::Backend;
use tui::layout::{Alignment, Constraint, Direction, Layout, Rect};
use tui::style::{Modifier, Style};
use tui::terminal::Frame;
use tui::widgets::{Block, Borders, Paragraph, Text, Widget};
use crate::me... |
// Copyright 2022 <NAME>.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... |
// Copyright 2018 Osspial
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... |
// This file is part of Sulis, a turn based RPG written in Rust.
// Copyright 2018 <NAME>
//
// Sulis is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your opt... |
// Copyright (C) 2021 lifning, licensed under the GNU Affero General Public License version 3.
use gba::vram::affine::AffineScreenblockEntry;
use gba::vram::text::TextScreenblockEntry;
use flowergal_proj_config::resources::{
Metamap, RoomData, RoomEntries4bpp, RoomEntries8bpp, ROOM_SIZE,
};
use super::{TILE_H, T... |
//! Runner for common routines like setting up an environment to manually run experiments. Note
//! that this is not setup as in "take a stock VM and install stuff" but rather "take a machine
//! with stuff installed and prepare the environment for an experiment (e.g. setting scaling
//! governor)".
//!
//! NOTE: This ... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0
use byteorder::LittleEndian;
use std::convert::TryInto;
use std::io::Read;
use crate::de::{Enum, LooselyTyped, MapAccess, SeqAccess};
use crate::error::{Error, Result};
use crate::value::layout::BinProtRule;
use crate::value::layout::Summand;
... |
use crate::ffi::*;
use crate::memory::*;
use crate::RvmResult;
use riscv::addr::{FrameWith, PageWith};
use riscv::paging::{Mapper, MapperFlushable, PageTableX64, Rv48PageTableX4};
#[derive(Debug)]
struct OwnedSv48PT {
root_virt_addr: HostVirtAddr,
linear_offset: usize,
}
impl OwnedSv48PT {
pub fn new() ->... |
// Copyright (c) 2020 Huawei Technologies Co.,Ltd. All rights reserved.
//
// StratoVirt is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWA... |
use super::{
tabs::{ConnectionEvent, ConnectionPanel, SettingsEvent, SettingsPanel},
theme::{ContainerStyle, ACCENT, BACKGROUND_SECONDARY, FOREGROUND},
};
use crate::dashboard::RequestHandler;
use alvr_session::{ServerEvent, SessionDesc};
use iced::{
alignment::Horizontal, button, image, Alignment, Button, ... |
#![allow(dead_code)]
use super::common;
use super::common::{Register};
use ::core::ptr::{write_volatile, read_volatile};
pub struct DMAChannelRegister {
// 0x00: DMA channel configuration register
pub ccr: Register,
// 0x04: DMA channel number of data register
pub cndtr: Register,
// 0x08: DMA c... |
/*
* Rust-music-player - Copyright (c) 2014 <NAME>.
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including... |
extern crate speexdsp_fft;
mod orig;
use std::ptr::null_mut;
use speexdsp_fft::*;
use crate::orig::fftwrap as original_fftwrap;
use crate::orig::smallft as original_smallft;
const INPUT: [f32; 64] = [
1.0,
1.999002,
2.832922,
3.3986773,
3.6254587,
3.484332,
2.992106,
2.2089396,
... |
use crate::tracing::{create_photon_map, do_raytrace};
use geometry::vector::Vector4;
use log::{info, warn};
use photonmap::PhotonMap;
use scene::Scene;
use std::fs;
use std::path::PathBuf;
use crate::geometry::normal::Normal;
use clap::{App, Arg, ArgMatches};
mod camera;
mod geometry;
mod lights;
mod photon;
mod photo... |
// Day 9: Smoke Basin
use std::{collections::HashSet, error::Error};
type Point = (usize, usize);
type Heightmap = Vec<Vec<u32>>;
#[allow(dead_code)]
pub fn part1(puzzle_input: &str) -> Result<u32, Box<dyn Error>> {
let heightmap: Heightmap = build_heightmap_from_input(puzzle_input);
let lowpoints: Vec<Poin... |
mod handle;
mod wasi_runtime;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use kube::client::APIClient;
use kubelet::pod::Pod;
use kubelet::{Phase, Provider, ProviderError, Status};
use log::{debug, info};
use tokio::fs::File;
use tokio::sync::RwLock;
use handle::RuntimeHandle;
use wasi... |
use crate::util::{self, logger::Logger};
use libcnb::{build::GenericBuildContext, layer::Layer};
use std::{convert::TryFrom, fs, path::Path, process::Command};
pub const RUNTIME_JAR_FILE_NAME: &str = "runtime.jar";
pub struct Builder<'a, 'b> {
logger: &'b Logger,
ctx: &'a GenericBuildContext,
}
impl<'a, 'b> ... |
use piston_window::*;
use piston_window::types::Color;
use rand::{thread_rng, Rng};
use snake::{Direction, Snake};
use draw::{draw_block, draw_rectangle};
/// Color of food that the player tries to collect with the snake.
const FOOD_COLOR: Color = [0.80, 0.00, 0.00, 1.0];
/// Color of the outer border of the game.
co... |
#[cfg(test)]
#[path = "../../../../tests/unit/solver/mutation/ruin/cluster_removal_test.rs"]
mod cluster_removal_test;
use super::*;
use crate::algorithms::dbscan::{create_clusters, Cluster, NeighborhoodFn};
use crate::algorithms::geometry::Point;
use crate::construction::heuristics::InsertionContext;
use crate::model... |
use std::collections::HashMap;
use std::fmt;
use std::fs;
use std::io::Read;
use std::path::Path;
use color_eyre::Report;
use flate2::read::GzDecoder;
use once_cell::sync::Lazy;
use serde::de::Visitor;
use tar::Archive;
pub mod db_dump;
pub mod diagnose;
use diagnose::diagnose;
#[derive(Clone, Debug, serde::Seriali... |
use muduo_rust::{CountdownLatch, Result};
use clap::Parser;
use tracing_subscriber;
use tracing::info;
use tokio::net::TcpStream;
use tokio_util::codec::{Framed, LinesCodec};
use futures::SinkExt;
use tokio_stream::StreamExt;
use std::time::Instant;
use tokio::sync::broadcast;
#[derive(Parser, Debug)]
#[clap(author, v... |
/*
src/panels/panel.rs
Copyright (c) 2019-2022 <NAME> All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
... |
extern crate std;
extern crate num;
use voxel::voxelstorage::*;
use voxel::voxelmath::*;
use std::default::Default;
/// A 3D packed array of voxels - it's a single flat buffer in memory,
/// which is indexed by voxel positions with some math done on them.
/// Should have a fixed, constant size after creatio... |
use std::num::NonZeroU32;
use abnf_core::streaming::SP;
use nom::{
branch::alt,
bytes::streaming::{tag, tag_no_case},
combinator::{map, opt, value},
multi::separated_list1,
sequence::{delimited, tuple},
IResult,
};
use crate::{
parse::{
body::body,
core::{nstring, number, n... |
use std::{
error::Error,
fmt::{Display, Formatter},
fs::File,
io::Seek,
ops::Range,
path::Path,
};
use kira::Frame;
#[derive(Debug)]
pub enum DecoderError {
UnsupportedChannelConfiguration,
VariableSampleRate,
UnknownSampleRate,
IoError(std::io::Error),
Mp3Error(minimp3::Error),
}
impl Display for Decoder... |
mod tests;
use std::collections::HashMap;
use regex;
use std::path::Path;
use std::fs::File;
use std::io::{BufReader, BufRead};
/*
We only keep the latest mask, and only store those memory locations which have been set to non-zero.
This let's us not have to allocate ~68GB of memory for it. Seems like a good thing.
*... |
// Copyright 2013 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, ... |
use crate::native;
use crate::oop::{self, Class, ValueType};
use crate::runtime::{self, ClassPathResult};
use crate::types::*;
use crate::util;
use class_parser::parse_class;
use classfile::{constant_pool, types::U2, BytesRef, ConstantPool};
use std::sync::{Arc, Mutex};
#[derive(Debug, Copy, Clone)]
pub enum ClassLoad... |
use crate::error::{Error, Result};
use crate::join::estimate::Estimate;
use crate::join::graph::{Edge, EdgeID, EdgeIDs, Graph, VertexSet};
use crate::join::reorder::{JoinEdge, Reorder};
use crate::join::{JoinKind, JoinOp};
use crate::op::Op;
use smallvec::smallvec;
use std::borrow::Cow;
use std::collections::BTreeMap;
... |
mod utils;
extern crate web_sys;
use wasm_bindgen::prelude::*;
use nalgebra::geometry::Point2;
use std::fmt;
use js_sys::Uint8Array;
use std::convert::TryInto;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_al... |
//! Bindings to [out123][1].
//!
//! [1]: https://www.mpg123.de/
#![allow(non_camel_case_types)]
extern crate libc;
extern crate mpg123_sys;
use libc::{c_char, c_double, c_int, c_long, c_void, size_t};
use mpg123_sys::mpg123_fmt;
pub enum out123_handle {}
#[derive(Clone, Copy)]
#[repr(C)]
pub enum out123_flags {
... |
//! A basic logger implementation for system-wide logging in Theseus.
//!
//! This enables Theseus crates to use the `log` crate's macros anywhere.
//! Currently, log statements are written to one or more serial ports.
#![no_std]
extern crate serial_port;
extern crate log;
extern crate spin;
extern crate irq_safety;... |
use std::fmt;
const LEVEL_SEPARATOR: char = '/';
#[derive(Hash, Debug, Eq, PartialEq, Clone)]
enum TopicLevel {
Empty,
Name(String),
Share(String),
Any,
MultipleAny,
}
/// A topic name a broker or client publishes to
#[derive(Hash, Debug, Eq, PartialEq, Clone)]
pub struct Topic {
spec: Vec<To... |
use std::fmt;
use std::fs::OpenOptions;
use std::hash::{Hash, Hasher};
use std::io::{Read, Write};
use git2::Repository;
use rand::os::OsRng;
use rand::{Rand, Rng};
use serde_json;
use errors::*;
#[derive(Eq, PartialEq, Debug, Copy, Clone, Serialize, Deserialize)]
pub struct Nonce {
bytes: [u8; 32],
}
impl Non... |
use std::{
borrow::{Borrow, Cow},
fmt::Debug,
iter::FromIterator,
};
use serde::{Deserialize, Serialize};
use crate::{RawArray, RawBsonRef, RawDocumentBuf};
use super::{bson::RawBson, serde::OwnedOrBorrowedRawArray, RawArrayIter};
/// An owned BSON array value (akin to [`std::path::PathBuf`]), backed by... |
//! The Emerald ParaTime.
use std::collections::{BTreeMap, BTreeSet};
use oasis_runtime_sdk::{
self as sdk, config, modules,
types::token::{BaseUnits, Denomination},
Module, Version,
};
/// Configuration of the various modules.
pub struct Config;
/// Determine whether the build is for Testnet.
///
/// If... |
use pcap::{Active, Capture};
use pktparse;
use serde::{Serialize,Deserialize};
use crate::packets::parser;
use crate::packets;
use std::io::Write;
use std::net::IpAddr;
use std::{
fs::{OpenOptions,File}
};
#[derive(Debug,Serialize,Deserialize)]
pub struct IndiviualData {
pub ipv4: pktparse::ipv4::IPv4Header,
... |
//! Aliasable `Vec`.
use core::mem::ManuallyDrop;
use core::ops::{Deref, DerefMut};
use core::pin::Pin;
use core::ptr::NonNull;
use core::{fmt, slice};
pub use alloc::vec::Vec as UniqueVec;
/// Basic aliasable (non `core::ptr::Unique`) alternative to
/// [`alloc::vec::Vec`].
pub struct AliasableVec<T> {
ptr: Non... |
extern crate time;
use time::*;
use std::f32::consts::PI as PI;
use std::sync::{Arc, Barrier, Mutex};
use std::ops::*;
use fixed::*;
use super::TEXTURE;
pub struct Job {
pbo: &'static mut[u8],
row: usize,
width: usize,
heigth: usize,
scale: (f8_120, f8_120),
center: (f8_120, f8_120),
}
impl J... |
//! Routines for powering the search
use game::{Board, Move};
use std::cmp::Ordering;
use std::collections::{BinaryHeap, HashMap};
/// Runs A* search to find a path from the `start` to the `goal`, if it exists.
///
/// This implementation assumes a small, consistent set of possible plays from
/// every node, as migh... |
// Copyright 2022 <NAME>
//! The outcome of running a command.
use std::fmt;
use std::fs;
use std::time::Duration;
use anyhow::Context;
use serde::ser::SerializeStruct;
use serde::Serialize;
use serde::Serializer;
use crate::exit_code;
use crate::log_file::LogFile;
use crate::*;
/// What phase of evaluating a tree... |
// Copyright (c) 2018-2022 The MobileCoin Foundation
use cargo_emit::rerun_if_env_changed;
use std::{
env, fs,
path::{Path, PathBuf},
process::Command,
};
/// Get git revision by running `git describe` in a given directory.
fn get_git_commit(current_dir: impl AsRef<Path>) -> String {
match Command::ne... |
use crate::{
block_handle_db::BlockHandle, lt_db::LtDb, lt_desc_db::LtDescDb,
types::{LtDbEntry, LtDbKey, LtDesc, ShardIdentKey}
};
use std::{cmp::Ordering, convert::TryInto, path::Path, sync::RwLock};
use ton_block::{AccountIdPrefixFull, BlockIdExt, MAX_SPLIT_DEPTH, ShardIdent, UnixTime32};
use ton_types::{fa... |
#![recursion_limit="1024"]
use failure::{Error, format_err};
use futures::Future;
use futures::channel::oneshot;
use async_std::future::timeout;
use async_std::sync::{channel, Sender};
use std::time::Duration;
use url::Url;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
// use wakey::WolPacke... |
use std::error;
use oauth2_client::{
authorization_code_grant::provider_ext::{
AccessTokenResponseErrorBody, AccessTokenResponseSuccessfulBody,
},
oauth2_core::re_exports::AccessTokenResponseErrorBodyError,
re_exports::{
serde_json, thiserror, Body, ClientId, ClientSecret, Deserialize, ... |
// LNP/BP Core Library implementing LNPBP specifications & standards
// Written in 2019 by
// Dr. <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed... |
use core::cell::Cell;
use embassy::blocking_mutex::kind::Noop;
use embassy::blocking_mutex::{CriticalSectionMutex, Mutex};
use embassy::channel::mpsc::{self, Channel};
use embassy::time::{Duration, Timer};
use embassy::util::Forever;
use shared::AirQuality;
use crate::board::Board;
use crate::drivers::sps30::PMInfo;
... |
// Copyright 2021 <NAME>
//! https://adventofcode.com/2021/day/16
use bitvec::prelude::*;
fn main() {
let input = input();
let (a, b) = solve(&input);
println!("{}", a);
println!("{}", b);
}
fn input() -> String {
std::fs::read_to_string("input/16.txt").unwrap()
}
fn to_u64(bv: &BitSlice) -> u6... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
type Link<T> = Option<Box<ListNode<T>>>;
#[derive(Debug)]
pub struct ListNode<T> {
value: T,
next: Link<T>,
}
#[derive(Debug)]
pub struct LinkedList<T> {
// Number of non-empty nodes in list
// @field length
// @type {usize}
pub length: usize,
// Pointer to first node in the list.
// @... |
use std::error::Error;
use std::fs::File;
use std::io::{self, BufWriter, Write};
use std::path::PathBuf;
use std::process;
use clap::ErrorKind::{HelpDisplayed, VersionDisplayed};
use structopt::StructOpt;
use jyt::{jyt, Format, InputHandle};
fn main() {
let opt = match Opt::from_args_safe() {
Ok(opt) => opt,
... |
//
// Copyright 2019 The Project Oak Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o... |
//! Sending data to the clipboard
use std::mem;
use std::{ffi::OsStr, os::windows::prelude::OsStrExt, slice};
use tokio::sync::oneshot;
use windows::Win32::System::Memory::GlobalFree;
use windows::Win32::{Foundation::HANDLE, System::{Memory::{GMEM_MOVEABLE, GlobalAlloc, GlobalLock, GlobalUnlock}, SystemServices::CLIP... |
use crate::error;
use crate::eval;
use crate::log;
use std::sync::{
atomic::{AtomicI32, Ordering::SeqCst},
Arc, Mutex, RwLock,
};
use std::time::{SystemTime, UNIX_EPOCH};
use tokio::time::{sleep, Duration};
pub const FUNCTIONS: &'static [&'static str] = &["out", "time", "wait", "string", "char"];
impl eval::C... |
use crate::util::err;
use evalexpr::{
ContextWithMutableVariables, EvalexprError, EvalexprResult, HashMapContext, Node, Value,
};
use regex::Regex;
use resistor_calc::{RCalc, RRes, RSeries};
use std::cell::RefCell;
use std::collections::HashSet;
use std::ops::Deref;
use std::panic::panic_any;
fn parse_series(str: ... |
//---------------------------------------------------------------------------//
// Copyright (c) 2017-2022 <NAME>. All rights reserved.
//
// This file is part of the Rusted PackFile Manager (RPFM) project,
// which can be found here: https://github.com/Frodo45127/rpfm.
//
// This file is licensed under the MIT license... |
use super::*;
fn frame_rect(x: i32, y: i32, w: i32, h: i32, bc: Color) {
// Draw the outline around the perimeter of the box
set_draw_color(Color::color_average(Color::Black, Color::BackGround, 0.1));
draw_line(x, y, x + w, y);
draw_line(x + w, y, x + w, y + h);
draw_line(x + w, y + h, x, y + h);
... |
use std::io::BufRead;
use std::str::FromStr;
use quick_xml::events::BytesStart;
use quick_xml::Reader;
use crate::error::Error;
use crate::error::InvalidValue;
use crate::parser::utils::attributes_to_hashmap;
use crate::parser::utils::decode_attribute;
use crate::parser::utils::get_evidences;
use crate::parser::FromX... |
use super::scrypt;
use crate::errors::CheckError;
use crate::ScryptParams;
use alloc::string::String;
use core::convert::TryInto;
use rand_core::RngCore;
use subtle::ConstantTimeEq;
#[cfg(not(features = "thread_rng"))]
type DefaultRng = rand_core::OsRng;
#[cfg(features = "thread_rng")]
type DefaultRng = rand::ThreadR... |
use std::fmt::Debug;
use std::io::Write;
use std::path::PathBuf;
use either::Either;
use either::Either::{Left, Right};
use oso::{ToPolar, ToPolarList};
use serde::de::DeserializeOwned;
use serde::Serialize;
use super::{PolicySettings, QueryResult};
use crate::elements::{PolicySource, PolicySourcePath};
use crate::er... |
use super::{FileResolveStrategy, LineMapper};
use crate::platform::PathConverter;
use once_cell::unsync::OnceCell;
use pdb::FallibleIterator as _;
use std::cell::RefMut;
use std::ops::Range;
use std::path::{Path, PathBuf};
pub struct PDBLineMapper<'a> {
section_addresses: Vec<u64>,
strings: pdb::StringTable<'a... |
use structure::matrix::*;
use structure::vector::*;
use std::convert::Into;
pub use self::ODEMethod::*;
use numerical::runge_kutta::rk4;
use numerical::bdf::bdf1;
use structure::dual::*;
use numerical::gauss_legendre::gl4;
use util::non_macro::zeros;
use util::non_macro::cat;
use numerical::runge_kutta::one_step_rk;
us... |
use crate::util::{ith_bit, little_endian};
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum ConditionalFlag {
Zero = 7,
Subtract = 6,
HalfCarry = 5,
Carry = 4,
}
#[derive(Debug, PartialEq, Copy, Clone)]
pub struct Flags {
pub z: bool,
pub n: bool,
pub h: bool,
pub c: bool,
}
#[derive... |
use super::*;
use ckb_standalone_debugger::transaction::{
MockCellDep, MockInfo, MockInput, MockTransaction, ReprMockTransaction,
};
use ckb_testtool::context::Context;
use ckb_tool::ckb_crypto::secp::Privkey;
use ckb_tool::ckb_hash::{blake2b_256, new_blake2b};
use ckb_tool::ckb_types::{
bytes::Bytes,
core:... |
use crate::errors::*;
use std::collections::BTreeMap;
use lopdf::{Document, Object, ObjectId};
use printpdf::*;
mod types;
pub mod constants;
mod tabular;
mod helper;
pub use self::helper::*;
use std::io::{BufRead, Read, Seek, SeekFrom};
use std::path::Path;
use fs_err as fs;
fn load_image(stream: impl BufRea... |
mod address_register;
mod control_register;
mod mask_register;
mod scroll_register;
mod status_register;
use std::fmt::Debug;
use address_register::AddressRegister;
use control_register::ControlRegister;
use mask_register::MaskRegister;
use scroll_register::ScrollRegister;
use status_register::StatusRegister;
use cr... |
use std::ops::*;
use std::fmt::{Display, Formatter};
extern crate num_traits;
#[derive(Debug, PartialEq, Copy, Clone)]
pub struct Vec3<T> {
pub x: T,
pub y: T,
pub z: T
}
impl<T> Vec3<T> {
pub fn new(x: T, y: T, z: T) -> Self {
Self {
x, y, z
}
}
pub fn iter(&self... |
mod checksum;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::{thread, time};
use std::error::Error;
use std::fs::{ReadDir, Metadata};
use error::PathError;
pub struct DirectoryWatcher {
/// Indicates how often should the directory be checked.
secs_interval: u64,
file_register: Ha... |
use std::error::Error;
use std::io::Read;
use std::path::Path;
use std::collections::{BTreeMap, HashMap};
use std::convert::TryInto;
use crate::graph::{Edge, Graph, Node};
use crate::EDGE_COST_DIMENSION;
use roxmltree::Document;
#[derive(Debug)]
enum GraphObject {
Node,
Edge,
}
#[derive(Debug)]
pub enum A... |
pub use ahash::{AHashMap, AHashSet};
pub use std::collections::{HashMap, HashSet};
use std::default::Default;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use itertools::Itertools;
/*
fn parse_next<I, U>(mut i: I) -> Option<U>
where
I: Iterator,
I::Item: AsRef<str>,
U: std::str::FromSt... |
//! This crate contains methods for generating, parsing and
//! interacting with the GBAM file format --- an efficient file format
//! for DNA/RNA sequence alignments. See the
//! [project](https://github.com/NickRoz1/gbam/blob/master/README.md).
#![allow(missing_docs)]
use self::Fields::*;
use std::mem;
use std::s... |
use crate::{create_temp_file, text_from_editor, EncryptionScheme, Entry};
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use std::{cmp, error::Error, fs, io::prelude::*, str::FromStr};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Notebook {
pub file: String,
pub dt_format: St... |
use druid::{im::Vector, ExtEventSink, Target};
use tokio::sync::mpsc;
use crate::{
core::{
config::Contact,
conversations::ConvsNotifications,
core::{CoreTaskHandle, CoreTaskHandleEvent},
},
data::{
app_state::AppState,
state::{
config_state::ConfigState,... |
use super::{tui_utils::Event, MainTab, OrdinaryFrame, Trans};
use crate::ledger::Ledger;
use num_derive::FromPrimitive;
use termion::event::Key;
use tui::{
layout::{Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
widgets::{Block, Borders, Paragraph, SelectableList, Text, Widget},
};
... |
use crate::archive::ArchivedRequest;
use crate::archive::HarLoader;
use failure::Error;
use hyper::Uri;
use serde_derive::Deserialize;
use slog::Logger;
use std::net::SocketAddr;
use std::path::PathBuf;
#[derive(Debug, Deserialize)]
pub struct Config {
#[serde(rename = "project")]
projects: Vec<ProjectConfig>,... |
extern crate hyper;
extern crate ansi_term;
extern crate libc;
mod args;
mod util;
mod cfi;
use hyper::Server;
use hyper::server::{Request, Response};
use hyper::uri::RequestUri;
use hyper::status::StatusCode;
use ansi_term::Colour::{Green, Red, Blue};
use std::env;
use std::thread;
use std::process::Command;
use st... |
use std::{
collections::{BTreeMap, BTreeSet},
fs,
path::{Path, PathBuf},
str::Lines,
};
#[derive(Debug, PartialEq)]
pub struct Protos {
protos: Vec<Proto>,
}
impl Protos {
pub fn from_dir(dir: impl AsRef<Path>) -> anyhow::Result<Self> {
let mut protos = Vec::new();
for entry in... |
//! ## Sparkline
//!
//! A sparkline over more lines
/**
* MIT License
*
* tui-realm - Copyright (C) 2021 <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction,... |
use client::{eat_err, DB};
use iced::{
button, executor, text_input, Application, Button, Clipboard, Column,
Command, Element, Settings, Text, TextInput, Radio
};
use std::sync::Mutex;
use std::time::Duration;
use std::sync::atomic::Ordering;
fn main() -> iced::Result {
pretty_env_logger::init_timed();
... |
use llvm_profparser::{merge_profiles, parse, parse_bytes};
use pretty_assertions::assert_eq;
use std::collections::HashSet;
use std::ffi::OsStr;
use std::fs::read_dir;
use std::path::PathBuf;
use std::process::Command;
#[cfg(llvm_11)]
fn get_data_dir() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("t... |
use std::env;
use std::fs;
use std::fs::{File, OpenOptions};
use std::io::prelude::*;
// Command: cargo r --bin doc-gen p00xx 17 generic
fn main() -> std::io::Result<()> {
let args: Vec<String> = env::args().collect();
let doc_module = args[1].clone();
let doc_problem = args[2].clone();
let doc_t... |
use super::TileOrientation;
use std::default::Default;
use std::fmt::Write;
#[test]
fn example_test_correct_answer() {
let example_result: u64 = super::find_corner_id_product::<Box<str>, _>(EXAMPLE_TILES_STRING_INPUT, Default::default())
.expect("failed to find corner id product");
assert!(example_res... |
use anyhow::{anyhow, Context, Result};
use clap::{App, Arg};
use regex::{Captures, Regex};
use std::{fs, io, process};
include!(concat!(env!("OUT_DIR"), "/buildinfo.rs"));
struct Config {
pub input_path: Option<String>,
pub output_path: Option<String>,
pub exec: String,
pub no_headers: bool,
pub d... |
use std::time::Duration;
use tui::{
layout::Rect,
style::Style,
symbols,
widgets::{Block, Widget},
};
/// This is a tui-rs widget to visualize a latency histogram in a small area.
/// It is based on the [`Sparkline`] widget, so it draws a mini bar chart with
/// some labels for clarity. Unlike Sparkli... |
/*
cpal (Captive Portal Auto Login).
Utility to automatically log in to a captive portal.
Copyright 2017 <NAME>.
Released under the MIT License.
*/
mod config;
extern crate clioptions;
extern crate ssid;
//#if USE_CURL_LIB
extern crate curl;
//#endif
extern crate serde;
extern crate serde_json;
#[macr... |
//! RTR Clients.
use std::io;
use std::sync::Arc;
use std::time::Duration;
use futures::pin_mut;
use futures::future::{select, Either};
use log::{debug, warn};
use rpki_rtr::client::{Client, VrpError, VrpTarget, VrpUpdate};
use rpki_rtr::payload::{Action, Payload, Timing};
use rpki_rtr::state::{Serial, State};
use ser... |
use faccess::PathExt;
use std::path::{Component, Path, PathBuf};
use glob::{self, PatternError};
/// Merge the prefix path with the completion path to restore any path
/// component lost during processing.
fn merge_prefix_with_completion(original_path: &Path, new: &Path) -> Option<PathBuf> {
if let Some(first) = ... |
use std::fmt;
use bacon_rajan_cc::{Cc, Trace, Tracer};
use downcast_rs::Downcast;
use downcast_rs::impl_downcast;
use crate::interpreter::Namespace;
#[derive(Clone, Debug)]
pub enum SExpr {
Atom(Atom),
List(Vec<Cc<SExpr>>)
}
impl Trace for SExpr {
fn trace(&mut self, tracer: &mut Tracer) {
match ... |
use crate::utils::{get_trait_def_id, paths, span_lint, span_lint_and_help};
use if_chain::if_chain;
use rustc_hir::def_id::DefId;
use rustc_hir::{Expr, ExprKind, StmtKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty;
use rustc_middle::ty::{GenericPredicates, PredicateAtom, ProjectionPredicate, Tr... |
use derive_more::From;
use ntex::util::{Buf, BufMut, ByteString, Bytes, BytesMut};
pub use crate::types::{ConnectAckFlags, ConnectFlags, QoS};
use super::{encode::*, property_type as pt, UserProperties};
use crate::error::{DecodeError, EncodeError};
use crate::types::packet_type;
use crate::utils::{take_properties, w... |
/*!
# Introduction
settings-committer can be called to commit a pending transaction in the API.
It logs any pending settings, then commits them to live.
By default, it commits the 'bottlerocket-launch' transaction, which is used to organize boot-time services - this program is typically run as a pre-exec command by a... |
use crate::options::{HttpClientType, Options, TargetParameters};
use crate::report_generator::ReportGenerator;
use crate::test_runner::{TestRunner, TestStatus};
use async_std::channel::Receiver;
use async_std::sync::Arc;
use async_std::task;
use femme::LevelFilter;
use http_client::HttpClient;
use itertools::Itertools;... |
use anyhow::{bail, Result};
use forc::test::{
forc_abi_json, forc_build, forc_deploy, forc_run, BuildCommand, DeployCommand, JsonAbiCommand,
RunCommand,
};
use fuel_tx::Transaction;
use fuel_vm::interpreter::Interpreter;
use fuel_vm::prelude::*;
use serde_json::Value;
use std::fs;
pub(crate) fn deploy_contract... |
use std::borrow::Cow;
use std::error;
use std::fmt;
use crate::core::{ClassRegistry, TryConvertMut, Value as _};
use crate::error::{Error, RubyException};
use crate::exception_handler;
use crate::extn::core::exception::{Fatal, TypeError};
use crate::sys::{self, protect};
use crate::types::{self, Ruby};
use crate::valu... |
use serde_json::{json, Map, Value};
use crate::datatypes::{DataType, Field, IntervalUnit, Metadata, Schema, TimeUnit};
use crate::io::ipc::IpcField;
use crate::io::json_integration::ArrowJsonSchema;
use super::super::{ArrowJsonField, ArrowJsonFieldDictionary, IntegerType};
fn serialize_data_type(data_type: &DataType... |
// Basically a table where the cell contents can be modified
use fltk::{
app, draw, enums, input,
prelude::{GroupExt, InputExt, TableExt, WidgetBase, WidgetExt},
table, window,
};
use std::cell::RefCell;
use std::rc::Rc;
pub type MyData = Vec<Vec<String>>;
// Needed to store cell information during the d... |
use crate::{
eth::*,
grpc::sentry::{
sentry_server::*, InboundMessage, MessageId as ProtoMessageId, OutboundMessageData,
PeerMinBlockRequest, SentPeers,
},
CapabilityServerImpl,
};
use async_trait::async_trait;
use devp2p::*;
use futures::{stream::FuturesUnordered, Stream};
use num_trait... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.