text stringlengths 3.09k 13.9k |
|---|
use super::{get_integer, get_string, Error, FunctionMap};
use crate::css::Value;
use crate::value::Quotes;
use crate::Scope;
use lazy_static::lazy_static;
use std::cmp::max;
use std::sync::Mutex;
pub fn create_module() -> Scope {
let mut f = Scope::builtin_module("sass:string");
def!(f, quote(string), |s| {
... |
use nonzero_ext::nonzero;
use std::{
collections::{BTreeMap, HashMap},
num::NonZeroU32,
};
use tokio_tungstenite::tungstenite::Message;
use log::*;
use serde_json::Value;
use crate::common::{
command_translator::CommandTranslator,
message_handler::{MessageHandler, MiscMessage},
utils::ensure_frame... |
use std::collections::HashSet;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::net::Ipv4Addr;
use std::path::Path;
use std::str::FromStr;
use regex::Regex;
use crate::error::Result;
use crate::socks5::Socks5Target;
use crate::util::{IntoResult, TrimInPlace};
struct Section {
domain: HashSet<String... |
/// bam-unique -- Remove duplicate rows from BAM files (as created by scanbam)
use std::collections::HashSet;
use std::fs;
use std::path::Path;
use clap::{App, Arg, ArgMatches};
use git_version::git_version;
use log::{debug, info, LevelFilter};
use rust_htslib::{bam, bam::Read};
use lib_common::bam::guess_bam_format;... |
use log::{error, info};
use crate::{
comms::playercomm::{
PlayerComm,
PlayerConnectEvent,
PlayerMessageExternal,
PlayerReceiver,
PlayerSender,
},
engine::player::PlayerId,
};
use std::net::SocketAddr;
use futures::{
stream::{SplitSink, SplitStream},
SinkExt,... |
use bevy::prelude::*;
use core::fmt;
use crate::util::PredicateContainer;
use super::arena::*;
use super::mob::GenePool;
use super::shooter;
/// Component to tag an entity as only needed in one game state
#[derive(Clone)]
pub enum ForStates<T: 'static> {
Func(PredicateContainer<T>),
}
impl<T: PartialEq> ForState... |
use crate::{
cpu::Stats,
inst::{ExecutedInst, Inst, ReadyInst, Tag, Tagged},
mem::MemoryHierarchy,
};
#[derive(Debug, Clone, Default)]
pub struct EuResult {
pub val: u32,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum EuType {
Alu,
LoadStore,
Branch,
Special, // Halt and such.... |
mod utils;
use chrono::prelude::*;
use chrono::Duration;
use js_sys::Date;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
... |
use crate::pgconn::establish_connection;
use color_eyre::eyre::{eyre, Result};
use diesel::pg::PgConnection;
use diesel::prelude::*;
use diesel::sql_query;
use log::{info, trace};
use notify::{watcher, DebouncedEvent, INotifyWatcher, RecursiveMode, Watcher};
use serde_json::{from_str, Map, Value};
use std::fs::File;
us... |
use std::env;
use std::ffi::OsString;
use std::io;
use std::ops::Deref;
use std::os::unix::io::{IntoRawFd, RawFd};
use std::os::unix::net::UnixStream;
use std::path::PathBuf;
use std::sync::Arc;
use nix::fcntl;
use {EventQueue, Proxy};
use imp::DisplayInner;
#[cfg(feature = "native_lib")]
use wayland_sys::client::w... |
use crate::db::{delete_order, CreateOrder, UpdateOrder};
use crate::validation_schema::{VALIDATION_SCHEMA_CREATE, VALIDATION_SCHEMA_UPDATE};
use crate::KafkaTopics;
use futures::stream::Stream;
use r2d2_redis::{r2d2, RedisConnectionManager};
use rdkafka::client::ClientContext;
use rdkafka::consumer::stream_consumer::St... |
//! High-level receiver for receiving P25 voice, data, and trunking messages.
use error::P25Error;
use message::data_unit::{DataUnitReceiver, ReceiverEvent};
use message::nid::NetworkId;
use message::status::StreamSymbol;
use trunking::tsbk::{TsbkFields, TsbkReceiver};
use voice::control::LinkControlFields;
use voice:... |
use crate::point_z::BBoxZ;
use crate::Error;
use byteorder::{BigEndian, LittleEndian, ReadBytesExt};
use std::fmt;
use std::io::Read;
pub(crate) const HEADER_SIZE: i32 = 100;
const FILE_CODE: i32 = 9994;
/// Size of reserved bytes in the header, that have do defined use
const SIZE_OF_SKIP: usize = std::mem::size_of::<... |
use std::borrow::Cow;
use chrono::{DateTime, Utc};
use shared::domain::{
jig::{Jig, JigId, LiteModule, ModuleId, ModuleKind},
meta::ContentTypeId,
};
use sqlx::{PgConnection, PgPool};
use uuid::Uuid;
// todo: move this to a `module` mod.
async fn module_of_kind(
conn: &mut PgConnection,
kind: Option<M... |
extern crate shadowrocks;
use shadowrocks::utils::create_any_tcp_listener;
use std::io::{Read, Write};
use std::net::{SocketAddr, TcpListener, TcpStream};
// A local tcp server that writes 1209 to all incoming connections.
pub fn run_local_tcp_server() -> std::io::Result<SocketAddr> {
let tcp_listener = TcpListen... |
mod error;
mod handle;
mod metadata;
#[macro_use]
mod util;
mod config;
use crate::config::Config;
use clap::Parser;
use config::{Args, HALF_NUM_CPUS};
use error::Error;
use handle::handle;
use hive_core::service::Service;
use hive_core::source::DirSource;
use hive_core::{Hive, HiveOptions};
use hyper::service::{make_... |
use tarantool::tlua::{
self,
function,
AsLua,
Lua,
LuaError,
LuaFunction,
Function,
function0,
function1,
function2,
};
use std::sync::Arc;
pub fn simple_function() {
let lua = tarantool::global_lua();
fn ret5() -> i32 {
5
}
let f: function![() -> i32] =... |
use crate::config::Config;
use crate::display_action::DisplayAction;
use crate::display_servers::DisplayServer;
use crate::models::Window;
use crate::models::WindowHandle;
use crate::models::Workspace;
use crate::state::State;
use crate::utils::child_process::Children;
use std::sync::{atomic::AtomicBool, Arc};
/// Mai... |
use async_std::fs::{self, File, Metadata};
use async_std::io::BufReader;
use futures::future::{BoxFuture, FutureExt};
use futures::io::Cursor;
use http::{header, StatusCode};
use httpdate::HttpDate;
use tide::{Request, Response};
use std::io;
use std::path::{Component, Path, PathBuf};
use std::time::UNIX_EPOCH;
const... |
//! Diminishing "experience" tracking services.
use crate::command::chat::Arguments;
use crate::impl_service;
use crate::model::xp::{Guild, Record};
use crate::service::{Context, Error, Service};
use std::fmt::Write;
use std::sync::Arc;
use std::time::{Duration, Instant};
use dashmap::DashMap;
use twilight_model::a... |
use std::rc::Rc;
use std::cell::RefCell;
type LLink = Rc<RefCell<LNode>>;
pub struct LNode {
elem: i32,
next: Option<LLink>,
}
pub struct LList {
head: Option<LLink>,
}
impl LNode {
pub fn new(elem: i32) -> Rc<RefCell<Self>> {
Rc::new(RefCell::new(LNode {
elem: elem,
... |
extern crate ndarray;
extern crate ndarray_rand;
extern crate num_traits;
extern crate numpy;
extern crate pyo3;
extern crate rand;
extern crate audio_featrs;
use ndarray::prelude::*;
use ndarray_rand::RandomExt;
use num_traits::Float;
use numpy::{IntoPyArray, PyArrayDyn, TypeNum};
use pyo3::{prelude::*, types::PyDic... |
use core::{fmt, result};
use core::option::NoneError;
pub type Result<T> = result::Result<T, Error>;
#[derive(Eq, PartialEq, Clone, Copy)]
pub struct Error {
pub errno: i32,
}
impl Error {
pub const fn new(errno: i32) -> Error {
Error {
errno,
}
}
pub fn ... |
#![doc(html_root_url = "http://docs.rs/qapi-spec/0.2.2")]
use std::{io, error, fmt};
use serde::Serialize;
use serde::de::DeserializeOwned;
use serde_derive::{Deserialize, Serialize};
pub use serde_json::Value as Any;
pub type Dictionary = serde_json::Map<String, Any>;
#[derive(Debug, Copy, Clone, Serialize, Deseria... |
//! A [`List`] object represents a requested sequence of other objects (Cards,
//! Sets, etc). List objects may be paginated, and also include information
//! about issues raised when generating the list.
//!
//! This module also defines [`ListIter`], which can iterate over the contents
//! of a `List`. If the list is ... |
// Copyright 2020 <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 writi... |
/// CPU registers, including registers specific to the ALU
///
/// The registers on the NES CPU are just like on the 6502. There is the accumulator, 2 indexes, a
/// program counter, the stack pointer, and the status register. Unlike many CPU families, members
/// do not have generic groups of registers like say, R0 th... |
use std::{path::PathBuf, process::Command};
use anyhow::{bail, Context};
use cfg_expr::targets::TargetInfo;
use tracing::debug;
use crate::TaiResult;
use super::{platform::Options, tools::AndroidSdk};
#[cfg(target_os = "macos")]
const HOST_ARCH: &str = "darwin-x86_64";
#[cfg(target_os = "linux")]
const HOST_ARCH: &... |
use crate::entity::object::Object;
use crate::game::{self, env, ObjectStore, State};
use crate::raws;
use crate::ui::menu::main::new;
use crate::ui::palette;
use crate::world_gen::{Tile, WorldGen};
use rand::Rng;
use std::{cmp, thread, time};
// room generation constraints
const ROOM_MAX_SIZE: i32 = 10;
const ROOM_MIN... |
use std::sync::Arc;
use std::time::SystemTime;
use json::{JsonValue, Null, object};
use beserial::{Deserialize, Serialize};
use block::{Block, BlockHeader};
use block_production::BlockProducer;
use hash::{Blake2bHash, Blake2bHasher, Hash};
use keys::Address;
use nimiq_blockchain::Blockchain;
use nimiq_blockchain::Pus... |
use shared;
use std::collections::HashMap;
fn main() {
let lines = shared::read_file("input.txt");
let decoded_sum_v1 = decode_program(&lines, Version::V1);
println!("Decoded value sum is {} for version v1", decoded_sum_v1);
let decoded_sum_v2 = decode_program(&lines, Version::V2);
println!("Decod... |
extern crate gstreamer as gst;
use gst::prelude::*;
use std::env;
use std::process;
use std::thread;
fn gst_init() {
if let Err(e) = gst::init() {
eprintln!("{}", e);
process::exit(1);
}
}
fn source(port: i32, user_id: u32) {
gst_init();
let pipeline = gst::Pipeline::new(Some(&format!... |
use fnv::{FnvHashMap, FnvHashSet};
use hlt::constants::*;
use hlt::state::*;
pub struct Scout {
ships: FnvHashMap<ID, Vec<Ship>>,
groups: Vec<Vec<Ship>>,
distress: FnvHashSet<ID>,
assist: FnvHashMap<ID, usize>,
attack: FnvHashMap<ID, usize>,
assign: FnvHashMap<ID, ID>,
planets: FnvHashMap<I... |
//! Test module for `cripes::util::graph::transform`, which provides utilities
//! for incremental construction and transformation of graphs.
use std::iter::{self, Iterator};
use cripes::util::graph::{Graph,
ConcreteGraphMut,
DirectedGraph,
... |
use bellperson::{
bls::Fr,
util_cs::{metric_cs::MetricCS, test_cs::TestConstraintSystem},
Circuit,
};
use ff::Field;
use filecoin_hashers::{poseidon::PoseidonHasher, Hasher};
use fr32::fr_into_bytes;
use merkletree::store::StoreConfig;
use pretty_assertions::assert_eq;
use rand::SeedableRng;
use rand_xorshi... |
//! File logger.
use std::fmt::Debug;
use std::fs::{File, OpenOptions};
use std::io::{self, Write, LineWriter};
use std::path::{Path, PathBuf};
use slog::{Drain, FnValue, Logger};
use slog_async::Async;
use slog_term::{CompactFormat, FullFormat, PlainDecorator};
use {Build, Config, Result};
use misc::{module_and_line,... |
// STD Dependencies -----------------------------------------------------------
use std::cmp;
use std::sync::mpsc::Sender;
// Discord Dependencies -------------------------------------------------------
use discord::model::UserId;
// Internal Dependencies ------------------------------------------------------
use :... |
use crate::config::CommandLineRewriter;
use crate::{
bazel_command_line_parser::{BuiltInAction, ParsedCommandLine},
config::command_line_rewriter::TestActionMode,
};
use thiserror::Error;
#[derive(Error, Debug)]
pub enum RewriteCommandLineError {
#[error("Reporting user error: `{0}`")]
UserErrorReport... |
use super::controller;
use super::defs::{
GQLAlertEvent, GQLAlertList, GQLAlertSource, GQLAlertSourceList, GQLIncidentReport,
GQLIncidentReportList, GQLNewAlertSource,
};
use crate::models::NewAlertSourceInfo;
use bigdecimal::ToPrimitive;
use juniper::{EmptySubscription, RootNode};
use juniper::{FieldError, Fie... |
#![windows_subsystem = "windows"]
extern crate native_windows_gui as nwg;
use std::cell::RefCell;
use std::ops::Deref;
use std::rc::Rc;
use std::sync::mpsc::{Receiver, Sender};
use std::thread;
use std::time::Duration;
use nwg::{HTextAlign, NativeUi, Notice, NoticeSender, NwgError};
use once_cell::sync::Lazy;
use cr... |
use crate::{
error,
imagebuffer::ImageBuffer,
rgbimage::RgbImage
};
// G at R locations
// G at B locations
#[allow(non_upper_case_globals)]
pub const GR_GB : [f32; 25] = [
0.0, 0.0, -1.0, 0.0, 0.0,
0.0, 0.0, 2.0, 0.0, 0.0,
-1.0, 2.0, 4.0, 2.0, -1.0,
0.0, 0.0, 2.0, 0.0, 0.0,... |
use super::{
ClauseDatabase,
ClauseHeader,
ClauseLength,
ClauseRef,
ClauseWord,
ResolvedClause,
ResolvedClauseMut,
};
use crate::Literal;
use core::{
fmt,
fmt::{
Debug,
Formatter,
},
mem,
};
impl ClauseDatabase {
/// The maximum possible clause reference ... |
#[macro_use]
extern crate itertools;
use std::u32;
#[derive(Debug, Clone)]
struct Character {
hp: u32,
damage: u32,
armor: u32,
}
impl Character {
fn new(inv: &Inventory) -> Character {
Character {
hp: 100,
damage: inv.weapon.damage +
inv.armor.dam... |
use std::collections::BTreeMap;
use std::fmt;
use serde::ser::{Serialize, SerializeMap, SerializeSeq, Serializer};
use serde_derive::Deserialize;
use crate::types::{Annotated, Meta};
/// Alias for typed arrays.
pub type Array<T> = Vec<Annotated<T>>;
/// Alias for maps.
pub type Map<K, T> = BTreeMap<K, Annotated<T>>... |
pub mod cpu;
pub mod dma;
pub mod io;
pub mod mappers;
pub mod palette;
pub mod ppu;
use cpu::{CpuHostAccess, CPU};
use dma::DMA;
use io::IO;
use ppu::{PPUHostAccess, PPU};
use std::cell::Cell;
use self::mappers::Cartridge;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Cycle {
T1,
T2,
T3,
}
pub ... |
use {syn, quote};
use tiny_keccak::Keccak;
use byteorder::{BigEndian, ByteOrder};
construct_fixed_hash!{
/// Uninterpreted 32 byte (256 bit) large hash type.
pub struct H256(32);
}
pub struct SignatureIterator<'a> {
method_sig: &'a syn::MethodSig,
position: usize,
}
impl<'a> Iterator for SignatureIterator<'a> {
... |
use bevy::prelude::*;
use bevy_inspector_egui::{Inspectable, RegisterInspectable};
use std::collections::VecDeque;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use crate::debug::ENABLE_INSPECTOR;
use crate::graphics::GraphicsHandles;
use crate::player::Player;
use crate::screen_fadeout::{... |
use crate::{
control_flow::{AndersonPFG, ForwardCFG, InterproceduralCFG, MethodIndex},
ifds::problem::{FlowFunction, IfdsProblem},
known_names::KnownNames,
};
use either::*;
use log::*;
use rustc_middle::{
mir::{BasicBlockData, Operand, TerminatorKind},
ty::{Ty, TyCtxt, TyKind},
};
use std::{
co... |
#![allow(dead_code)]
use std::ffi::c_void;
use super::cf::MachPortRef;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
#[non_exhaustive]
pub enum EventTapLocation {
Hid,
Session,
AnnotatedSession,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
#[non_exhaustive]
pub enum EventTapPlacement {
HeadInsertEventTap,
... |
use std::error::Error;
use yarner_lib::{Context, Document, Node};
fn main() {
std::process::exit(match run() {
Ok(()) => 0,
Err(err) => {
eprintln!("ERROR: {}", err);
1
}
});
}
fn run() -> Result<(), Box<dyn Error>> {
let mut data = yarner_lib::parse_input()... |
// Copyright 2017 The Australian National University
//
// 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 applicab... |
use actix::Actor;
use chrono::Local;
use futures::Future;
use libcommon::kafka::HandlerError;
use libcommon::kafka::HandlerResult;
use libcommon::message::DownloadEnd;
use libcommon::message::DownloadResult;
use libcommon::message::DownloadStart;
use libcommon::message::HtmlDownloadResult;
use libcommon::message::UrlDo... |
extern crate sdl2;
extern crate rand;
#[macro_use]
extern crate bitflags;
mod canvas;
mod vec_math;
mod hitable;
mod color;
mod random;
mod material;
mod texture;
use self::vec_math::*;
use self::hitable::*;
use self::material::*;
use self::color::*;
use self::random::*;
use self::texture::*;
use std::rc::Rc;
fn... |
#![allow(dead_code, unreachable_code, unused_variables)]
pub fn flow_control() {
println!("***Flow Control***");
if_else();
loops();
whiles();
for_ranges();
matching();
if_let();
while_let();
println!("");
}
fn if_else() {
let n = 5;
if n < 0 {
print!("{} is nega... |
use crate::error::unauthorized;
use fmerk::Op;
use many::server::module::abci_backend::AbciCommitInfo;
use many::{Identity, ManyError};
use std::collections::BTreeMap;
use std::path::Path;
pub type AclBTreeMap = BTreeMap<Vec<u8>, Vec<Identity>>;
pub struct KvStoreStorage {
/// Simple ACL scheme. Any prefix that m... |
use std::fmt;
const SETTING_DESC_PREFIX: &str = "[SETTING:";
const SETTING_DESC_SUFFIX: &str = "]";
/// Description of a single setting entry
#[derive(Clone, PartialEq, Eq)]
pub struct DeviceSettingDescription {
index: u32,
group_index: u32,
description: Option<String>,
unit: Option<String>,
valu... |
use fere::prelude::*;
use fere_window::*;
use parking_lot::RwLock;
use rand::prelude::*;
use rops::*;
use std::sync::Arc;
use std::time::Instant;
use surface::{no_normal_map, GeneralI, TexVar};
struct SceneState {
/// radius, angle_speed, num, angle
rings: Vec<(f32, f32, usize, f32)>,
frame: u64,
}
impl S... |
//! A utility datastructure to store and render a log of keystrokes. This is mostly used to give
//! the viewers of my streams feedback for what I'm typing.
use crate::core::keystrokes_to_string;
#[allow(unused_imports)] // Only used by doc-comments, which rustc can't see
use super::normal_mode::Action;
use tuikit:... |
use chardet::{charset2encoding, detect};
use encoding::label::encoding_from_whatwg_label;
use encoding::DecoderTrap;
use futures::{future::ready, stream::futures_unordered::FuturesUnordered, FutureExt, StreamExt};
use tokio::process::Command;
use crate::consts::{basic_runtime, space_fix};
use std::process::Output;
#[... |
//! A search controller that mimics forward search for HTN planning.
use crate::encoding::refinements_of;
use crate::Model;
use aries_backtrack::{Backtrack, DecLvl};
use aries_core::{Lit, VarRef};
use aries_model::extensions::{AssignmentExt, Shaped};
use aries_model::lang::{Atom, IVar};
use aries_planning::chronicles:... |
use aoc_utils::PuzzleInput;
const DAY: u8 = 11;
fn main() {
let input = PuzzleInput::get_input(DAY);
println!("A: {}", solve_a(&input));
println!("B: {}", solve_b(&input));
}
fn parse_grid(input: &PuzzleInput) -> Vec<Vec<u8>> {
let lines = input.lines();
lines
.iter()
.map(|line| {... |
use dirs;
use std::env;
use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct Directories {
pub log_dir: PathBuf,
pub themes_dir: PathBuf,
pub fonts_dir: PathBuf,
pub config_dir: PathBuf,
pub project_dir: PathBuf,
}
impl Directories {
pub fn new(config_dir: Option<String>, project_dir: Op... |
// -*- mode:rust; coding:utf-8-unix; -*-
//! blur.rs
// Copyright 2016 hanepjiv
// @author hanepjiv <<EMAIL>>
// @copyright The MIT License (MIT) / Apache License Version 2.0
// @since 2017/01/19
// @date 2020/03/19
// ////////////////////////////////////////////////////////////////////////////
// use ========... |
/* Copyright (c) 2016
* <NAME>
*
* Licensed under the MIT license (http://opensource.org/licenses/MIT). This
* file may not be copied, modified, or distributed except according to those
* terms
*/
extern crate regex;
use std::collections::HashMap;
use regex::Regex;
use crate::request::*;
use crate::response::*... |
extern crate test;
mod xxhash3;
const ALPHA1: f64 = 0.7213;
const ALPHA2: f64 = 1.079;
pub struct LogLogBeta {
precision_bits: u64,
max_precision_bits: u64,
max_x: u64,
register_count: u64,
alpha: f64,
registers: Vec<u8>,
}
impl LogLogBeta {
pub fn new(error_rate: f64) -> LogLogBeta {
... |
use std::path::Path;
use anyhow::{Context, Result};
use hex::encode;
use regex::Regex;
use tokio::{
fs::{read, read_to_string, write},
process::Command,
};
use wasmprinter::print_file;
use cargo_sewup::config::CargoToml;
use cargo_sewup::deploy_wasm;
async fn check_cargo_toml() -> Result<String> {
let co... |
use adventofcode2021::{default_sub_command, parse_usize, CommandResult, Problem};
use clap::{App, Arg, ArgMatches};
use nom::{
bytes::complete::{tag, take_until, take_while},
character::complete::newline,
combinator::{map, map_parser},
multi::{many1, separated_list0, separated_list1},
sequence::{pre... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
use {
crate::{
events::{
error::EventError,
types::{ComponentIdentifier, Moniker, UniqueKey, ValidatedSourceIdentity},
... |
//! A multi-producer, single-consumer, futures-aware, FIFO queue with back
//! pressure, for use communicating between tasks on the same thread.
//!
//! These queues are the same as those in `futures::sync`, except they're not
//! intended to be sent across threads.
use std::any::Any;
use std::cell::RefCell;
use std::... |
//! Code for translating bezier paths into CPatches, as described in
//! "Hierarchical Rasterization of Curved Primitives for Vector Graphics
//! Rendering on the GPU" by <NAME> al., 2019.
//!
//! The process for this conversion is quite involved, and is broken down to the
//! following steps:
//! 1. Graph flattening: ... |
use std::borrow::Borrow;
use std::rc::Rc;
use im_rc::{self, hashmap};
use pest::Span;
mod parser;
mod pattern;
mod term;
mod types;
mod value;
use parser::parse;
use term::Term;
use value::Value;
type Scope<'src, T> = im_rc::HashMap<&'src str, Rc<T>>;
type VScope<'src> = Scope<'src, Value<'src>>;
fn eval<'a>(scope... |
// Copyright 2022 37 Miners, LLC
//
// 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 ... |
use core::fmt;
use std::collections::HashSet;
use crate::shared::{Day, PartSolution};
#[derive(PartialEq, Eq, Debug)]
enum Cucumber {
East,
South,
}
impl fmt::Display for Cucumber {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Cucumber::East => write!(f, ">"... |
#[rustfmt::skip]
use proc_macro2::{Span, TokenStream};
use proc_macro_crate::{crate_name, FoundCrate};
use quote::quote;
use syn::{
Attribute, Data, DataStruct, DeriveInput, Field, Fields, Ident, Lit, LitStr, Meta, NestedMeta,
};
struct StructField {
field: Field,
skip: bool,
rename: String,
strat... |
//! 自定义序列化 json Formatter
//!
//! [`serde_json`] 主要有两种 [`Formatter`][`serde_json::ser::Formatter`]:
//! 1. [`CompactFormatter`][`serde_json::ser::CompactFormatter`],不含空格或换行的格式:
//!
//! ```json
//! {"Source":"en","Target":"zh","ProjectId":0,"SourceTextList":["hi","there"]}`
//! ```
//! 2. [`PrettyFormatter`][`serd... |
use super::bus::CpuBusDevice;
use std::fs;
use std::ops::Range;
use std::path::PathBuf;
use super::mappers::{Mapper, Mapper0, Mapper3};
pub struct Cartridge {
prg_rom: Vec<u8>,
chr_rom: Vec<u8>,
prg_ram: Vec<u8>,
mapper: Box<dyn Mapper>,
vertical_mirror: bool,
}
impl CpuBusDevice for Cartridge {
... |
//! Cycle-removal for copy-propagation (swap problem) & function call arguments.
use std::{
collections::{HashMap, HashSet, VecDeque},
ops::{Deref, DerefMut},
};
#[derive(Clone)]
pub struct Node<R> {
reg: R,
in_: Option<R>,
outs: HashSet<R>,
}
impl<R: std::hash::Hash + Eq> Node<R> {
fn new(r... |
// Copyright 2017 <NAME> (IRCAM)
// 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 wri... |
//! ktest-parser is a utility to parse `.ktest` binaries which is the output of KLEE,
//! into a Rust friendly struct instead.
//!
//! ## KTest File Format Description
//! The KTest binary is structured as follows,
//! 1. A header
//! 2. KLEE arguments
//! 3. Symbolic arguments
//! 4. KTest objects.
//!
//! The followi... |
use crate::shared::ExecOptions;
use crate::AsyncExecutable;
use futures::future::select_all;
use futures::FutureExt;
use petgraph::algo::toposort;
use petgraph::graph::NodeIndex;
use petgraph::visit::EdgeRef;
use petgraph::EdgeDirection;
use std::collections::{BinaryHeap, HashMap, HashSet};
use std::fmt::Debug;
use std... |
use std::collections::HashMap;
use std::time::Duration;
use failure::Error;
use serde_json::from_reader;
use reqwest::{self, Url, Method, RequestBuilder, StatusCode};
use ::database::*;
use ::types::*;
use ::error::SofaError;
/// Client handles the URI manipulation logic and the HTTP calls to the CouchDB REST API.
/... |
// Copyright 2021, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// di... |
// Copyright (c) 2019 Ant Financial
//
// SPDX-License-Identifier: Apache-2.0
//
use nix::mount::MsFlags;
use nix::sched::{unshare, CloneFlags};
use nix::unistd::{getpid, gettid};
use std::fmt;
use std::fs;
use std::fs::File;
use std::os::unix::io::AsRawFd;
use std::path::{Path, PathBuf};
use std::thread;
use crate::... |
pub mod monitor;
pub mod spawn;
use alloc::sync::Arc;
use hashbrown::HashMap;
use liblumen_core::locks::RwLockWriteGuard;
use liblumen_alloc::erts::exception::runtime;
use liblumen_alloc::erts::exception::system::Alloc;
use liblumen_alloc::erts::process::alloc::heap_alloc::HeapAlloc;
use liblumen_alloc::erts::proce... |
use std::cmp::Eq;
use std::future::{ready, Future};
use std::hash::Hash;
use std::pin::Pin;
use std::sync::atomic::{AtomicPtr, Ordering};
use std::sync::Arc;
use std::task::{Context, Poll, Waker};
use im::HashMap;
use tokio::sync::mpsc::{self, UnboundedSender};
enum MapAction<K, V>
where
K: Clone + Hash + Eq + ... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
#![forbid(unsafe_code)]
use diem_config::config::NodeConfig;
use diem_genesis_tool::config_builder::FullnodeType;
use diem_swarm::{client, faucet, swarm::DiemSwarm};
use diem_temppath::TempPath;
use diem_types::chain_id::ChainId;
use s... |
use rand::Rng;
use alloc::vec;
use alloc::vec::Vec;
use alloc::string::String;
use digest::DynDigest;
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
use crate::algorithms::mgf1_xor;
use crate::errors::{Error, Result};
use crate::key::{self, PrivateKey, PublicKey};
// 2**61 -1 (pow is not co... |
use anyhow::Result;
use noodles_bam::record::Record as NoodlesRecord;
use noodles_bam::{AsyncReader as NoodlesAsyncReader, AsyncWriter as NoodlesAsyncWriter};
use noodles_bgzf::AsyncReader as BgzfAsyncReader;
use noodles_bgzf::AsyncWriter as BgzfAsyncWriter;
use noodles_sam::header::{self, Header as BamHeader, Referenc... |
//! Provides functionality to group jobs in some vicinity radius.
#[cfg(test)]
#[path = "../../../../tests/unit/construction/clustering/vicinity/vicinity_test.rs"]
mod vicinity_test;
use crate::construction::heuristics::*;
use crate::models::common::*;
use crate::models::common::{Dimensions, ValueDimension};
use crat... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use std::collections::BTreeMap;
use std::path::Path;
use inflector::Inflector;
#[derive(Deserialize, Clone, Debug)]
pub struct JsonSchema {
pub id: Option<String>,
pub title: Option<String>,
#[serde(rename = "$schema")]
pub schema_ref: Option<String>,
pub description: Option<String>,
#[serde(r... |
use crate::collector::Collector;
use crate::collector::SegmentCollector;
use crate::core::Executor;
use crate::core::InvertedIndexReader;
use crate::core::SegmentReader;
use crate::query::Query;
use crate::query::Scorer;
use crate::query::Weight;
use crate::schema::Document;
use crate::schema::Schema;
use crate::schema... |
fn main() {
println!(
"Part 1: {}",
solve(include_str!("input").split("\n\n").collect())
);
println!(
"Part 2: {}",
solve_2(include_str!("input").split("\n\n").collect())
);
}
const NECESSARY_FIELDS: &[&str] = &["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"];
const OPT... |
// Copyright 2018-2022 Cargill Incorporated
//
// 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... |
use bitcoin::util::bip32::{ExtendedPubKey, ChildNumber, Fingerprint, ChainCode};
use std::str::FromStr;
use bitcoin::util::base58;
use bitcoin::{Network, PublicKey};
use std::convert::TryInto;
struct ElectrumExtendedPubKey {
xpub: ExtendedPubKey,
kind: String,
}
fn main() -> Result<(), String> {
let mut a... |
use anyhow::{anyhow, Result};
use ckb_fixed_hash::H256;
use ckb_jsonrpc_types::JsonBytes;
use ckb_types::prelude::{Builder, Entity};
use gw_config::Config;
use gw_types::{
core::ScriptHashType,
packed::{CreateAccount, Fee, L2Transaction, MetaContractArgs, RawL2Transaction, Script},
};
use crate::{
account:... |
//! Route object and DSL
use std::sync::Arc;
use fnv::FnvHashMap;
use http::StatusCode;
use crate::{
http::Method, route_recognizer::Router, Body, Endpoint, EndpointExt, IntoEndpoint,
IntoResponse, Request, Response,
};
/// Routing object
#[derive(Default)]
pub struct Route {
router: Router<Box<dyn Endp... |
// Copyright 2020 The Fuchsia Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
super::error::ModelError,
crate::{
model::collection::DataCollection,
store::{embedded::EmbeddedStore, memory::MemoryStore, sto... |
mod choice_parameter;
mod command;
use proc_macro::TokenStream;
/**
This macro transforms plain functions into poise bot commands.
Documentation comments are used as help text. The first line is a single-line description,
displayed in listings of your bot's commands (i.e. `~help`). Following paragraphs are detailed ... |
// Copyright 2019 The Exonum Team
//
// 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 i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.