text stringlengths 3.09k 13.9k |
|---|
use std::collections::HashMap;
use std::net::SocketAddr;
use std::sync::Arc;
use futures_util::{SinkExt, StreamExt, TryFutureExt};
use librad::{git::Urn, PeerId};
use serde::Serialize;
use tokio::sync::RwLock;
use tokio::{
sync::mpsc::{self},
task::spawn,
};
use tokio_stream::wrappers::UnboundedReceiverStream;... |
use core::str;
use std::{cmp, str::FromStr};
#[derive(Debug)]
struct Ingredient {
name: String,
capacity: i32,
durability: i32,
flavor: i32,
texture: i32,
calories: i32,
}
fn next_value(split: &mut str::Split<&str>) -> i32 {
split
.next()
.unwrap()
.split(' ')
... |
use super::{FromArgs, FuncArgs};
use crate::{
convert::ToPyResult, object::PyThreadingConstraint, PyPayload, PyRef, PyResult, VirtualMachine,
};
use std::marker::PhantomData;
/// A built-in Python function.
pub type PyNativeFunc = Box<py_dyn_fn!(dyn Fn(&VirtualMachine, FuncArgs) -> PyResult)>;
/// Implemented by ... |
// Copyright 2016-2018 <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 wr... |
//! Error handling
use cuda_driver_sys::*;
use std::error::Error as StdError;
use std::ffi::CStr;
use std::mem::MaybeUninit;
use std::num::NonZeroU32;
use std::result::Result as StdResult;
use std::{fmt, mem, str};
/// Check the result of a CUDA driver API function.
///
/// All functions in the CUDA driver API return... |
use std::f32::consts::PI;
use rand::prelude::Distribution;
#[cfg(feature = "small-rng")]
use rand::{rngs::SmallRng, SeedableRng};
use crate::canvas::{OmniCanvas, VectorCanvas};
use crate::sketchers::Sketcher;
use barium::{Color, LineEnd, Stroke, Vec2};
#[derive(Clone)]
pub struct CelestialSketcherSettings<P, S, V>
w... |
//!
//! The compiler lexer.
//!
#[cfg(test)]
mod tests;
pub mod error;
pub mod lexeme;
use self::error::Error;
use self::lexeme::comment::Comment;
use self::lexeme::keyword::Keyword;
use self::lexeme::literal::boolean::Boolean as BooleanLiteral;
use self::lexeme::literal::integer::Integer as IntegerLiteral;
use self... |
use std::time::{Duration, Instant};
use std::sync::{Arc, Mutex};
use std::sync::mpsc::{Receiver, TryRecvError, RecvTimeoutError};
use log::{info, error};
use enum_map::{EnumMap};
use epics::{Scan};
use ksfc_lxi::{
self as ksfc,
KsFc,
types::{ChannelNo, TriggerSource},
};
const RECV_TIMEOUT: Duration =... |
#![allow(
dead_code,
unused_imports,
unused_variables,
unused_macros,
unused_assignments
)]
extern crate ansi_term;
extern crate console;
extern crate fstrings;
extern crate libc;
// extern crate variadic;
// to use aesthetics you need to
// write mod aesthetics before
// using it like on line 21
... |
use std::cmp::min;
use std::collections::vec_deque;
use std::collections::VecDeque;
use std::io::Result;
pub use std::io::{Read, Write};
use std::mem::MaybeUninit;
const BLOCK_SIZE: usize = 0x10000 - 0x100;
type Block = [u8; BLOCK_SIZE];
#[derive(Default)]
pub struct MemStream {
size: usize,
blocks: VecDeque... |
use crate::{
constants::{Class, RCode, RecordsSection, Type},
message::{
reader::{MessageReader, NameRef, RecordHeaderRef},
MessageType, RCodeValue,
},
names::Name,
records::{data::RData, Opt},
Error, Result,
};
/// A set of similar records.
///
/// [`RecordSet`] (or RRset) is a... |
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::fs;
type Position = (i32, i32);
type Cost = i32;
type RiskMap = HashMap<Position, Cost>;
type CostMap = HashMap<Position, Cost>;
#[derive(Copy, Clone, Eq, PartialEq)]
struct State {
cost: i32,
position: Position,... |
use std::collections::{HashMap, HashSet};
use std::collections::btree_map::BTreeMap;
use failure::Error;
use t_ba3g::reverse_adjacency_list;
use t_ba3g::EulerianPath;
use t_ba3f::EulerianCycle;
use t_ba3l::{
get_string_spelled_by_gapped_patterns, PairedRead, read_paired_reads,
};
use utility;
/// Reconstruct a S... |
use super::*;
#[derive(Debug, Clone, Copy, PartialEq)]
enum Lit {
Pos,
Neg,
Empty,
}
#[derive(Debug, Clone)]
pub struct Clause {
eliminated: bool,
num_non_empty_lits: isize,
lits: Vec<Lit>,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct Field {
num_vars: usize,
num_clause: u... |
//! --- Day 3: Binary Diagnostic ---
use std::cmp::Ordering;
use twentyone::{stdin::read_from_stdin, util::transpose_vec};
fn main() {
let input = read_from_stdin().unwrap();
let parsed = parse(&input);
let report = solve(parsed);
println!("Part 1: Power consumption is {}", report.power_consumption);... |
use crate::{
database::{
abstraction::{watchers::Watchers, DatabaseEngine, Tree},
Config,
},
Result,
};
use persy::{ByteVec, OpenOptions, Persy, Transaction, TransactionConfig, ValueMode};
use std::{future::Future, pin::Pin, sync::Arc};
use tracing::warn;
pub struct Engine {
persy: Pe... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
//
// @generated SignedSource<<c0ab5494d686169abd032291f4418a84>>
//
// To regenerate this file, run:
// hphp/hack/src/oxidized/regen.s... |
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIAB... |
use statrs::function::beta::ln_beta as logbeta;
use statrs::function::gamma::ln_gamma as loggamma;
struct CountVariant {
events: u32,
exposure: u32,
}
pub struct CountTest {
variants: Vec<CountVariant>,
}
impl CountTest {
pub fn new() -> Self {
Self {
variants: Vec::with_capacity(... |
//! Iterate over all samples in a track.
use std::io;
use crate::boxes::*;
use crate::boxes::ctts::CompositionOffsetIterator;
use crate::boxes::stsc::SampleToChunkIterator;
use crate::boxes::stss::SyncSampleIterator;
use crate::boxes::stsz::SampleSizeIterator;
use crate::boxes::stts::TimeToSampleIterator;
/// Inform... |
use std::cmp::Reverse;
use std::collections::{ BinaryHeap, HashSet };
fn main()
{
let mut input = Burrow::parse(include_str!("../input.txt"));
println!("{}", input.dijkstra().unwrap());
input.depth += 2;
input.rooms[Amphipod::A.index()].insert(1, Amphipod::D);
input.rooms[Amphipod::A.index()].inse... |
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
extern crate libc;
use std::os::raw::c_void;
use std::ffi::CString;
pub mod sys {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
// Types
pub type Clampf = sys::GLclampf;
pub type Bitfield = sys::GLbitfield;
pub ... |
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::iter::FromIterator;
// Rules
//##################
#[derive(Debug, Default, Clone, Eq, PartialEq)]
pub struct Rules {
rules: HashMap<BagInfo, Vec<BagCount>>,
}
impl Rules {
pub fn can_contain(&self, bag: &BagInfo) -> Vec<&BagInfo> {
// C... |
use crate::util::prelude::*;
use crate::state::prelude::*;
use crate::gfx;
use crate::gfx::glyph_gfx::*;
use std::collections::{HashMap, HashSet};
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub enum RenderModifier {
GravityInverse,
}
struct CachedRegion {
tick: Tick,
region: GfxRegion
}
pub stru... |
//! Definition of FRP Network – set of FRP nodes with a common lifetime.
use crate::debug;
use crate::node::*;
use crate::prelude::*;
use crate::stream;
use crate::stream::Stream;
// ==========
// === Id ===
// ==========
/// Globally unique identifier of an frp network.
#[derive(Clone, CloneRef, Copy, Debug, Defa... |
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use anyhow::{bail, Result};
use move_binary_format::{
file_format::{AddressIdentifierIndex, IdentifierIndex},
CompiledModule,
};
use move_core_types::{
account_address::AccountAddress, identifier::IdentStr, language_storage::Mo... |
use crate::uses::asyn::{pre::*, *};
use crate::uses::*;
use path::PathBuf;
pub mod Save {
use super::*;
pub fn Write(p: impl Into<PathBuf>, data: impl Into<Vec<u8>>) {
let sender = setup_impl();
sender.send((p.into(), MessageType::Write, data.into())).unwrap();
}
pub fn Append(p: impl Into<PathBuf>, data: imp... |
use std::fmt;
use std::path;
use url::{Url};
use semver::{Version, VersionReq};
use console::style;
use termimad;
use crossterm;
#[derive(Debug, Clone)]
pub struct PackageVersion {
raw: String,
version_req: Option<VersionReq>,
latest: bool,
}
impl PackageVersion {
pub fn new(s: &String) -> PackageVer... |
use crate::structs::ConnectionState::Disconnected;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DefaultOnError};
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Debug)]
/// Defines the states a Cwtch connection can be in
pub enum ConnectionState {
/// The Cwtch connection is not ... |
//! Local server that establish a TCP tunnel with server
use std::{
io,
io::ErrorKind,
net::SocketAddr,
sync::{
atomic::{AtomicU64, Ordering},
Arc,
},
};
use futures::future::{self, Either};
use log::{debug, error, info, trace};
use tokio::net::{TcpListener, TcpStream};
use crate:... |
use nom::*;
use std::collections::{HashMap, HashSet};
#[derive(Debug, Clone)]
enum Pattern {
Directions(Vec<char>),
Group(Vec<Pattern>),
Seq(Vec<Pattern>),
Empty,
}
named!(directions<&[u8], Pattern>,
map!(
many1!(alt!(char!('N') | char!('S') | char!('W') | char!('E'))),
Pattern::Di... |
use crate::layout::{DynamicIds, WidgetHolder, WidgetId};
use conrod_core::{Point, UiCell};
use conrod_core::widget;
use conrod_core::widget::Widget;
use conrod_core::Scalar;
#[derive(WidgetCommon)]
#[allow(missing_copy_implementations)]
pub struct Matrix<'a, T> {
#[conrod(common_builder)]
common: widget::Com... |
//! This module is part of the second day of advent of code. This involves the submarine problem in which
//! a submarine is given a set of directions to take to move the submarine by changing its depth and
//! x offset from the origin. Then at the final destination one must multiply the final depth and final x offset
... |
use ggez::*;
use graphics::*;
use std::time::Duration;
// helper function to test if smaller rectangle is inside a bigger rectangle
fn contains(bigger: &Rect, smaller: &Rect) -> bool {
bigger.x <= smaller.x
&& bigger.y <= smaller.y
&& bigger.w >= smaller.x + smaller.w
&& bigger.h >= smaller... |
//! --- Day 24: Planet of Discord ---
//!
//! You land on Eris, your last stop before reaching Santa. As soon as you do, your sensors start
//! picking up strange life forms moving around: Eris is infested with bugs! With an over 24-hour
//! roundtrip for messages between you and Earth, you'll have to deal with this pr... |
use clipboard::{ClipboardContext, ClipboardProvider};
use ruffle_core::backend::ui::{MouseCursor, UiBackend};
use ruffle_core::events::KeyCode;
use std::rc::Rc;
use tinyfiledialogs::{message_box_ok, MessageBoxIcon};
use winit::event::VirtualKeyCode;
use winit::window::Window;
pub struct DesktopUiBackend {
window: ... |
mod spawner;
use self::spawner::Spawner;
use crate::states::play_state::PlayState;
use crate::states::shared::option::{Option, OptionInputCommand};
use crate::states::{Assets, State, Transition};
use crate::util::{play_click_sfx, DurationExt};
use ggez::event::{Button, Keycode, Mod};
use ggez::graphics::{Color, Point2... |
use cmake::Config as CmakeConfig;
use std::collections::HashMap;
/// Utilities for configuring the sel4_kernel CMake build based
/// on fel4 configuration data
///
use std::env;
use std::path::Path;
use types::*;
#[derive(Clone, Debug, Fail, PartialEq)]
pub enum CmakeConfigurationError {
#[fail(display = "Missing t... |
use serde_derive::Deserialize;
use std::io::prelude::*;
use std::path::{Path, PathBuf};
const NETWORKCTL: &str = "networkctl";
const DEFAULT_TUNDEV: &str = "tun0";
const SYSTEMD_NETWORKD_CONFIG_DIR: &str = "/etc/systemd/network/";
struct Changed(bool);
impl Changed {
fn yes() -> Changed {
Changed(true)
... |
use hc256;
use skein3fish;
pub const CTR_COUNTER_LEN: usize = 32;
pub const HC256_KEY_LEN: usize = 32;
pub const HC256_IV_LEN: usize = 32;
pub struct CTR {
t3f: skein3fish::Threefish,
hc256: hc256::HC256,
is_hc256_used: bool,
}
impl CTR {
pub fn new(
t3f_key: &[u8; skein3fish::T3F_KEY_LEN],
... |
// Copyright 2020-2021 bd_
//
// 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, publish, distribu... |
use super::bus::Bus;
use super::cartridge::Cartridge;
use super::ram::Ram;
pub struct Mmu {
state: State,
cart: Cartridge,
memory: Ram,
}
impl Mmu {
pub fn new() -> Self {
Mmu {
state: State::new(),
cart: Cartridge::new(vec![0x00; 1 << 15]),
memory: Ram::new... |
// Copyright 2017 <NAME>.
// Dual-licensed MIT and Apache 2.0 (see LICENSE files for details).
extern crate chrono;
extern crate rexiv2;
use std::process::Command;
use std::path::{Path, PathBuf};
use std::ascii::AsciiExt;
#[cfg(test)]
use std::env;
#[cfg(test)]
use std::ffi::OsStr;
use chrono::offset::TimeZone;
use... |
use std::collections::HashMap;
use std::fmt::{Display, Error, Formatter};
use std::str::FromStr;
use advent_of_code_2019::input::parse_list;
fn main() {
let input: Vec<Reaction> = parse_list(include_str!("input"), '\n');
println!("Answer to part 1: {}", part1(&input));
println!("Answer to part 2: {}", par... |
use std::collections::HashMap;
use std::convert::TryFrom;
use anyhow::Result;
use glium::backend::Facade;
use glium::texture::UncompressedFloatFormat;
use wvr_data::config::filter::FilterMode;
use wvr_data::config::rendering::RenderStageConfig;
use wvr_data::types::{Automation, BufferPrecision, DataHolder,... |
use crate::cmp::Ordering;
use crate::convert::TryInto;
use crate::fmt;
use crate::mem;
use crate::sys::c;
use crate::time::Duration;
use core::hash::{Hash, Hasher};
const NANOS_PER_SEC: u64 = 1_000_000_000;
const INTERVALS_PER_SEC: u64 = NANOS_PER_SEC / 100;
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debu... |
// 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... |
//! This is a binary running in the local environment
//!
//! You have to provide all needed configuration attributes via command line parameters,
//! or you could specify a configuration file. The format of configuration file is defined
//! in mod `config`.
use clap::{App, Arg};
use futures::{
future::{self, Eith... |
use std::io::prelude::*;
use std::path::Path;
use std::io;
use git2::{self, BranchType, Commit, Reference, Repository, Signature};
use super::Args;
use super::util;
use super::util::{cargo_build, CompilationStats, IncrementalOptions};
pub fn build(args: &Args) {
assert!(args.cmd_build);
let cargo_toml_pathb... |
// 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 futures::unsync::oneshot::Receiver;
use std::fmt;
use super::{ClientRef, DataObjectRef, DataObjectState, TaskRef, TaskState};
use common::convert::ToCapnp;
use common::id::{SessionId, TaskId};
use common::wrapped::WrappedRcRefCell;
use common::{ConsistencyCheck, FinishHook, RcSet};
use errors::Result;
#[derive(De... |
//! Geographic types.
use geo::{
haversine_destination::HaversineDestination, haversine_distance::*,
line_locate_point::LineLocatePoint,
};
use geo::{LineString, Point, Rect};
use s2::{cellid::CellID, latlng::LatLng, s1::angle::*};
#[doc(hidden)]
pub use geo::Coordinate;
pub type Position = Coordinate<f32>;
pu... |
use rustc_index::vec::{Idx, IndexVec};
use rustc_middle::mir::*;
use rustc_middle::ty::Ty;
use rustc_span::Span;
/// This struct represents a patch to MIR, which can add
/// new statements and basic blocks and patch over block
/// terminators.
pub struct MirPatch<'tcx> {
patch_map: IndexVec<BasicBlock, Option<Term... |
use crate::types::FileType;
use crate::Result;
use glob::glob_with;
use reqwest::Url;
use serde::Serialize;
use shellexpand::tilde;
use std::path::{Path, PathBuf};
use std::{fmt::Display, fs::read_to_string};
use tokio::io::{stdin, AsyncReadExt};
const STDIN: &str = "-";
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[... |
use crate::{
build_config::BuildConfig,
error::*,
parse_tree::{declaration::TypeParameter, ident, Visibility},
parser::Rule,
semantic_analysis::{
ast_node::{declaration::insert_type_parameters, TypedEnumDeclaration, TypedEnumVariant},
NamespaceRef, NamespaceWrapper,
},
style:... |
//! # Resource definitions for model weights, vocabularies and configuration files
//!
//! This crate relies on the concept of Resources to access the files used by the models.
//! This includes:
//! - model weights
//! - configuration files
//! - vocabularies
//! - (optional) merges files for BPE-based tokenizers
//!
... |
//! See `CargoTargetSpec`
use cfg::{CfgAtom, CfgExpr};
use ide::{FileId, RunnableKind, TestId};
use project_model::{self, TargetKind};
use vfs::AbsPathBuf;
use crate::{global_state::GlobalStateSnapshot, Result};
/// Abstract representation of Cargo target.
///
/// We use it to cook up the set of cli args we need to ... |
use bevy::{
core_pipeline::{draw_3d_graph, node, AlphaMask3d, Opaque3d, Transparent3d},
prelude::*,
render::{
camera::{ActiveCameras, ExtractedCameraNames},
render_graph::{Node, NodeRunError, RenderGraph, RenderGraphContext, SlotValue},
render_phase::RenderPhase,
renderer::Re... |
/* libbm25 (0.1.0)
* Author - <NAME>
*
* Desc -
* An implementation of the BM25 algorithm in rust, exported as a python library.
* It was created to speed up computation on the DMINR project in assessing
* retrieved term relevance to an intial search query. All the conversion from
* python to rust types and ... |
use crate::args::{Backend, ShellTrust};
use crate::config::{Config, Content, Option, OptionValue, Template, VariableDefinition};
use async_trait::async_trait;
use std::collections::BTreeMap;
use std::io::{Error, ErrorKind, Result};
#[cfg(feature = "backend+cli")]
mod cli;
#[cfg(feature = "backend+ui")]
mod ui;
pub as... |
use amethyst::{
core::{
shrev::EventChannel,
transform::{HierarchyEvent, ParentHierarchy},
},
ecs::prelude::*,
};
use crate::specs_ext::SpecsExt;
pub use super::blink::BlinkSystem;
pub use super::{components::*, ScreenSize};
pub enum TuiEvent {
Position {
entity: Entity,
... |
use super::MUT_RANGE_BOUND;
use clippy_utils::diagnostics::span_lint_and_note;
use clippy_utils::{get_enclosing_block, higher, path_to_local};
use if_chain::if_chain;
use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::{BindingAnnotation, Expr, ExprKind, HirId, Node, PatKind};
use rustc_infer::infer::TyCtxtInfer... |
use {
crate::{chunks::BodyChunks, setting, Result},
httparse::Header,
percent_encoding::utf8_percent_encode as urlencode,
rustls::{ClientConfig, ClientSession},
std::{
collections::HashMap,
fmt::{self, Formatter},
io::{self, Read, Write},
net::{SocketAddr, TcpStream, ... |
/*
src/form/fieldoptions.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 limitat... |
use rustc_hir::def_id::CrateNum;
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
use rustc_middle::mir::interpret::Allocation;
use rustc_middle::ty::{
self,
print::{PrettyPrinter, Print, Printer},
subst::{GenericArg, GenericArgKind},
Ty, TyCtxt,
};
use std::fmt::Write;
struct Absol... |
extern crate futures;
extern crate tokio_io;
use futures::future::ok;
use std::cell::RefCell;
use std::rc::Rc;
use super::{brokenpipe, simple_err, wouldblock, BoxedNewPeerFuture, Peer};
use std::io::{Error as IoError, Read, Write};
use tokio_io::{AsyncRead, AsyncWrite};
use super::{once, ConstructParams, PeerConstr... |
mod frame_buffer;
use anyhow::{anyhow, bail, Context};
use frame_buffer::{FrameBufferContext, RgbaFrameBuffer};
use rustzx_core::{
host::{
FrameBuffer, Host, HostContext, RomFormat, RomSet, Screen, Snapshot, StubIoExtender, Tape,
},
zx::machine::ZXMachine,
};
use rustzx_utils::{
io::{DynamicAss... |
//! This struct is used by systems that update transforms by making
//! it easy to restrict movement to a specified playable area. This
//! is intended for use by `gameplay.rs` and should be based on the
//! screen dimensions.
use amethyst::ecs::{storage::DenseVecStorage, Component};
/// Enum for easy matching on what... |
use rust_hdl_pcb_core::prelude::*;
// Source: https://www.chemi-con.co.jp/products/relatedfiles/capacitor/catalog/HXDRA-e.PDF
fn match_hxd_esr(voltage: f64, cap_pf: f64, size_code: &str) -> i32 {
let voltage = voltage.floor() as i32;
let cap = (cap_pf / 1.0e6).floor() as i32;
match (voltage, cap, size_code... |
use crate::lexer::Lexer;
use crate::token;
#[derive(Debug)]
pub enum AST {
Num {
value: i32,
},
BinOp {
left: Box<AST>,
right: Box<AST>,
op: token::Kind,
},
UnaryOp {
op: token::Kind,
expr: Box<AST>,
},
Compound {
children: Vec<Box<AST... |
use crate::processor::ProcessorState;
use std::cell::RefCell;
use std::rc::Rc;
use crate::processor::extensions::{HasCsr, NoStepCb};
use terminus_global::{RegT, InsnT};
pub mod float;
mod insns;
pub mod csrs;
use csrs::FCsrs;
use std::ops::Deref;
pub type FRegT = u128;
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
p... |
use crate::cli::pcap::PcapDumpOpts;
use crate::cli::unit::UnitOpts;
use crate::cli::vanity::VanityOpts;
use crate::cli::verify::VerifyOpts;
use crate::cli::wallet::WalletOpts;
use crate::cli::work::WorkOpts;
use crate::debug::parse_pcap_log_file_to_csv;
use crate::network::Network;
use crate::node::Node;
use crate::rpc... |
use std::io::{BufRead, Write};
use std::path::{Path, PathBuf};
use crate::coverage::{
BranchCoverage, CoverageReader, CoverageWriter, FileCoverage, LineCoverage, PackageCoverage,
TotalCoverage,
};
use crate::error::*;
/// Enumeration representing each line in 'lcov.info'
enum RawData<'a> {
/// Test Name
... |
use std::fs::File;
use std::io::Read;
use std::collections::hash_map::HashMap;
#[macro_use]
extern crate lazy_static;
extern crate regex;
use regex::Regex;
#[derive(Debug,Copy,Clone)]
enum Dest {
None,
Bot(i32),
Output(i32),
}
fn make_dest(name: &str, id: i32) -> Dest {
if name == "bot" {
De... |
use indoc::indoc;
use introspection_engine_tests::test_api::*;
use pretty_assertions::assert_eq;
use test_macros::test_each_connector_mssql as test_each_connector;
const TYPES: &[(&str, &str)] = &[
//fieldname, db datatype
("int", "Int"),
("smallint", "SmallInt"),
("tinyint", "TinyInt"),
("bigint",... |
mod utils;
use std::f64;
use std::cell::RefCell;
use std::rc::Rc;
use js_sys::Math;
use wasm_bindgen::JsCast;
use wasm_bindgen::prelude::*;
use web_sys::{Document, HtmlCanvasElement, Window, console};
// when the `wee_alloc` feature is enabled,
// use `wee_alloc` as the global allocator.
#[cfg(feature = "wee_alloc")... |
use std::fmt::Display;
use svg::node::element::{Group, Circle, Rectangle, Line};
use svg::node::Node;
use svg::node::Text as TextNode;
use svg::node::element::Text;
use crate::components::DatumRepresentation;
/// Define the possible types of points in a scatter plot.
#[derive(Debug, Copy, Clone)]
pub enum MarkerType {... |
#![no_std]
#![no_main]
use cortex_m::prelude::*;
use cortex_m_rt::entry;
use panic_halt as _;
#[link_section = ".boot_loader"]
#[used]
pub static BOOT_LOADER: [u8; 256] = rp2040_boot2::BOOT_LOADER;
/// Handle peripheral resets so the chip is usable.
unsafe fn setup_chip(p: &mut rp2040_pac::Peripherals) {
// Now ... |
use crate::solver::base::Outcome;
use crate::solver::base::Proba;
use crate::solver::rational::Rational;
use lazy_static::lazy_static;
pub static MAX_CARTWHEEL: u8 = 30;
pub static CARTWHEEL_LABEL: &[&str] = &[
"Cartwheel target 20",
"Cartwheel target 21",
"Cartwheel target 22",
"Cartwheel target 23",... |
/// Class used to hold dynamic configs. These are configs which have no physical manifestation
/// in the server.properties and can only be set dynamically.
/// RAFKA NOTES:
/// - The properties are LONG and must be at least 0. They have been set as u64 here.
use crate::common::config_def::{ConfigDef, ConfigDefImportan... |
use clap::{App, Arg, ArgGroup, ArgMatches};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct Migrations {
pub migrations: Vec<MigrationConfig>,
}
impl Migrations {
pub fn api_migration(&self) -> Result<ApiMigration, anyhow::Error> {
//... |
use cargo_registry::views::krate_publish as u;
use std::{collections::HashMap, io::Read};
use flate2::{write::GzEncoder, Compression};
use super::DependencyBuilder;
lazy_static! {
// The bytes of an empty tarball is not an empty vector of bytes because of tarball headers.
// Unless files are added to a Publi... |
//! example-data is created to easily load common datasets.
//!
//! We use the [Apache Arrow](https://docs.rs/arrow/3.0.0/arrow/index.html) memory format
//! which allows for simple conversion to multiple dataframe implementations.
//!
//! ```rust
//! use example_data::{Repo};
//! use arrow::record_batch::RecordBatch;
... |
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use ring::digest::Algorithm;
use hashutils::{HashUtils, Hashable};
use tree::{LeavesIntoIterator, LeavesIterator, Tree};
use serde::{Serialize, Deserialize};
use proof::{Lemma, Proof};
/// A Merkle tree is a binary tree, with values of type `T` at the leafs,
//... |
use chrono::{Local, DateTime};
use serde_json::Value;
use std::collections::{BTreeMap, HashMap};
use qifi_rs::{QIFI, Account, Order, Position, Trade, Transfer, BankDetail};
use websocket::OwnedMessage;
use crate::qaeventmq::MQPublish;
use crate::xmsg::XReqQueryBank;
use crate::scheduler::{Scheduler, OwnedMessageWrap};... |
// Copyright 2021 Xayn AG
//
// 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... |
//! Contains the methods to setup the camera.
use bevy::input::mouse::{MouseMotion, MouseScrollUnit, MouseWheel};
use bevy::prelude::*;
use bevy::render::camera::Camera;
use std::borrow::BorrowMut;
/// The plugin handling all input.
///
/// This plugin handles just camera controls at the moment, but when we set up
//... |
//! Define traits and instances for dealing with trust thresholds.
use core::fmt::{self, Debug, Display};
use crate::error::Error;
use crate::prelude::*;
use crate::serializers;
use core::convert::TryFrom;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
/// TrustThreshold defines how much of the total vot... |
#![allow(dead_code)]
#![no_std]
#![cfg_attr(feature = "nightly", feature(test))]
mod chacha;
mod matrix;
mod traits;
use crate::matrix::{chacha_20_rounds, Matrix};
use crate::traits::clear;
pub fn encrypt(plaintext: &mut [u8], key: [u8; 32], nonce: [u8; 12], mut ctr: u32) {
assert!(ctr <= 1);
let mut matrix =... |
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>,... |
use crate::{
builtin::{format::FormatError, sort::SortError},
typed::TypeLocError,
};
use jrsonnet_interner::IStr;
use jrsonnet_parser::{BinaryOpType, ExprLocation, UnaryOpType};
use jrsonnet_types::ValType;
use std::{path::PathBuf, rc::Rc};
use thiserror::Error;
#[derive(Error, Debug, Clone)]
pub enum Error {
#[er... |
#[macro_use]
extern crate cgmath;
extern crate chan;
extern crate image;
extern crate piston_window;
extern crate time;
mod tracer;
mod sphere;
mod floor;
mod ray;
mod light;
use std::sync::Arc;
use std::thread;
use std::sync::mpsc;
use image::ConvertBuffer;
use cgmath::vec3;
use tracer::{Background, Shape};
use sphe... |
use serde::Deserialize;
/// * `name` - Track name
/// * `t_q` - (s) Best qualifying lap time
/// * `t_gap_racepace` - (s) Estimated gap between t_q and best race lap time (due to engine mode
/// etc.)
/// * `s_mass` - (s/kg) Lap time mass sensitivity
/// * `t_drseffect` - (s) Lap time reduction when using DRS in all a... |
use yew::prelude::*;
use yew::virtual_dom::VNode;
use yew_agent::{Dispatched, Dispatcher};
use yew_router::prelude::*;
use crate::event_bus::{EventBus, Request};
use ost::context_remote_async::AsyncRemoteMonolith;
use crate::components::settings_individuals::SettingsIndividuals;
#[cfg(debug_assertions)]
use crate::... |
//! tokio-stomp - A library for asynchronous streaming of STOMP messages
#[macro_use]
extern crate nom;
use custom_debug_derive::CustomDebug;
use frame::Frame;
pub mod client;
mod frame;
pub(crate) type Result<T> = std::result::Result<T, failure::Error>;
/// A representation of a STOMP frame
#[derive(Debug)]
pub s... |
use std::io::Cursor;
use std::io::Read;
use std::iter::Iterator;
use crate::constants::MINIMUM_RESERVED_BYTES_FOR_PIECE_IN_FULLY_ALIGNED_SECTOR as MINIMUM_PIECE_SIZE;
use crate::types::{UnpaddedByteIndex, UnpaddedBytesAmount};
pub struct PieceAlignment {
pub left_bytes: UnpaddedBytesAmount,
pub right_bytes: U... |
//! Command-line tools (with browser-based visualization)
//! to inspect a timely-dataflow computation.
//!
//! See the README and --help for usage information.
use tdiag::*;
fn run() -> Result<(), DiagError> {
let args = clap::App::new("tdiag")
.about(
"Diagostic tools for timely-dataflow programs.
Run t... |
use std::fmt;
use console::Style;
use indicatif::{ProgressBar, ProgressStyle};
use crate::{
rt::{ProgressLimit, VisitStatus},
StationSpec,
};
/// Station progress to reaching the destination.
///
/// This is a high level item that is included in the user facing progress
/// report.
#[derive(Clone, Debug)]
pu... |
use crate::utils::{
add_extra_type_param_bound_op_output, named_to_vec, unnamed_to_vec,
};
use proc_macro2::{Span, TokenStream};
use quote::{quote, ToTokens};
use std::iter;
use syn::{Data, DataEnum, DeriveInput, Field, Fields, Ident, Index};
pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream {
... |
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec;
use alloc::vec::Vec;
/// Binary operator
#[derive(Debug)]
pub enum Operator {
Add,
Substract,
Multiply,
Divide,
Power,
Modulo
}
/// A node in the tree
#[derive(Debug)]
pub enum Node {
Value(f64),
SubNode(Box<Node>),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.