text stringlengths 3.09k 13.9k |
|---|
extern crate blas_src;
extern crate minifb;
extern crate mnist;
extern crate ndarray;
use minifb::{Window, WindowOptions};
pub mod activations;
pub mod loss;
mod network;
mod test;
use crate::activations::Activation;
use crate::loss::Loss;
use crate::network::Network;
use mnist::{Mnist, MnistBuilder};
use ndarray::prel... |
extern crate nix;
extern crate clap;
extern crate terminal_size;
extern crate chrono;
#[macro_use]
extern crate execute;
extern crate ffmpeg_screen_recorder;
use std::borrow::Cow;
use std::error::Error;
use std::process;
use clap::{App, Arg};
use terminal_size::terminal_size;
use chrono::prelude::*;
use nix::sy... |
use std::{
fmt,
fmt::{Debug, Formatter},
iter,
};
use serde::{ser::SerializeSeq, Serialize, Serializer};
use crate::{
error::{Error, Result},
gc::{GarbageCollect, Gc, GcRef},
obj::{BanjoString, Function, List, NativeFunction},
vm::Vm,
};
#[derive(Clone, Copy)]
pub enum Value {
Nil,
... |
//!
//! # Layout21 Placement Module
//!
// Local imports
use crate::{
array::ArrayInstance,
cell::Cell,
coords::{HasUnits, Int, PrimPitches, UnitSpeced, Xy},
group::GroupInstance,
instance::Instance,
raw::{Dir, LayoutError, LayoutResult},
utils::Ptr,
};
/// # Placement Enumeration
///
/// ... |
use std::collections::HashMap;
use ark_ec::{PairingEngine, ProjectiveCurve};
use ark_ff::UniformRand;
use rand::RngCore;
/// Key pair
#[derive(Clone, Copy, Debug)]
pub struct KeyPair<E: PairingEngine> {
/// Public Key
public_key: E::G2Projective,
/// Private Key
private_key: E::G1Projective,
}
impl<E... |
use engine::{
components::{CollisionHandle, DataStoreComponent, Pos, Shape},
resources::SkyCollisionWorld,
};
use specs::prelude::*;
use ncollide::math::Point as P2;
use std::collections::HashMap;
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
pub struct UnitType {
pub tag: String,
pub max... |
use crate::challenges::day7::amplifier::AmplifierCircut;
use crate::util::parse_intcode;
use anyhow::Result;
use itertools::Itertools;
pub fn part1(input: &str) -> Result<String> {
let intcode = parse_intcode(input)?;
let m = (0..5)
.permutations(5)
.map(|phases| {
let c = Amplifier... |
use crate::*;
use ic_types::crypto::canister_threshold_sig::idkg::IDkgComplaint;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::convert::TryFrom;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct IDkgComplaintInternal {
proof: zk::ProofOfDLogEquivalence,
s... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - control register"]
pub cr: crate::Reg<cr::CR_SPEC>,
#[doc = "0x04 - software trigger register"]
pub swtrigr: crate::Reg<swtrigr::SWTRIGR_SPEC>,
#[doc = "0x08 - channel1 12-bit right-aligned data holding register"]
p... |
use super::Collector;
use collector::top_collector::TopCollector;
use collector::top_collector::TopSegmentCollector;
use collector::SegmentCollector;
use collector::TopDocsByField;
use fastfield::FastValue;
use schema::Field;
use DocAddress;
use DocId;
use Result;
use Score;
use SegmentLocalId;
use SegmentReader;
/// ... |
use crate::debug_ln;
use std::rc::Rc;
use std::cell::RefCell;
use std::future::Future;
use std::pin::Pin;
use wasm_bindgen::prelude::*;
use js_sys::{Array, ArrayBuffer, Object, Reflect};
use web_sys::{Blob, BlobPropertyBag, Url};
use super::atw::Thread as AtwThread;
use super::job;
use super::encode_task_msg;
type Res... |
use crate::{
ast::{SrcSpan, TypedModule, UntypedModule},
build::{dep_tree, project_root::ProjectRoot, Module, Origin, Package},
config::PackageConfig,
error,
fs::FileWriter,
grammar, parser, typ, CodeGenerator, Error, GleamExpect, Warning,
};
use std::collections::HashMap;
use std::path::{Path, ... |
extern crate bulletproofs;
extern crate curve25519_dalek;
extern crate merlin;
extern crate rand;
use bulletproofs::r1cs::{ConstraintSystem, R1CSError, R1CSProof, Variable, Prover, Verifier};
use curve25519_dalek::scalar::Scalar;
use bulletproofs::{BulletproofGens, PedersenGens};
use curve25519_dalek::ristretto::Compr... |
use ::gamepad::{
GamepadDescription,
GamepadStateChange,
};
use ::mapping::{
Axis,
Button,
Mapping,
};
use std::fmt::{
self,
Display,
Formatter
};
use std::rc::Rc;
/// The data associated with an event, not including the gamepad itself.
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum... |
/*
* Copyright (c) 2020, 2021, 2022 Valve Corporation
* All rights reserved.
*
* 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
* l... |
/// Status code used to indicate why an endpoint is closing the WebSocket
/// connection.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum CloseCode {
/// Indicates a normal closure, meaning that the purpose for
/// which the connection was established has been fulfilled.
Normal,
/// Indicates that... |
//! This library demonstrates a minimal usage of Rust's C data interface to pass
//! arrays from and to Python.
mod c_stream;
use std::error;
use std::fmt;
use pyo3::exceptions::PyOSError;
use pyo3::ffi::Py_uintptr_t;
use pyo3::prelude::*;
use pyo3::wrap_pyfunction;
use arrow2::{array::Array, datatypes::Field, error... |
//! This is an example of a simple application
//! which calculates the Collatz conjecture.
//!
//! The function itself is trivial on purpose,
//! so that we can focus on understanding how
//! the application can be made localizable
//! via Fluent.
//!
//! To try the app launch `cargo run --example simple-fallback NUM ... |
use gtk;
use gtk::prelude::*;
use std::cell::RefCell;
use std::rc::Rc;
use neovim_lib::neovim::Neovim;
use neovim_lib::neovim_api::NeovimApi;
use crate::nvim_bridge;
use crate::ui::ui::HlDefs;
const MAX_HEIGHT: i32 = 500;
#[derive(Default)]
struct State {
/// Currently selected row in wildmenu.
selected: i3... |
//
// Vidoxide - Image acquisition for amateur astronomy
// Copyright (c) 2020-2021 <NAME> <<EMAIL>>
//
// This project is licensed under the terms of the MIT license
// (see the LICENSE file for details).
//
//!
//! Program configuration.
//!
use std::path::{Path, PathBuf};
mod groups {
pub const UI: &str = "UI... |
use crate::{
diagnostics::DatamodelError,
schema_ast::ast::{self, WithName},
transform::ast_to_dml::{
db::{
walkers::{ModelWalker, RelationFieldWalker, RelationName},
ReferentialAction,
},
validation_pipeline::context::Context,
},
};
use itertools::Itertoo... |
use heck::*;
use once_cell::sync::Lazy;
use serde::Deserialize;
use crate::*;
pub const DATA_STR: &str =
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/declarations/Book.toml"));
pub static DATA: Lazy<BookDeclarations> = Lazy::new(|| toml::from_str(DATA_STR).unwrap());
#[derive(Deserialize, Debug)]
#[serde(den... |
mod existing {
use std::convert::{TryFrom, TryInto};
use git_ref::{PartialName, PartialNameRef};
use git_testtools::hex_to_id;
use crate::file::store_at;
#[test]
fn with_packed_refs() -> crate::Result {
let store = store_at("make_packed_ref_repository_for_overlay.sh")?;
let c1... |
use cgmath::{ Point3, Point2, Vector3 };
use crate::RGBA;
use super::{ Face, Mesh, Texture, Vertex };
//use rand::random;
const LIGHTING: [u32; 6] = [
3, // back
4, // right
5, // top
3, // front
4, // left
1, // bottom
];
const LIGHTING_VERT: [u32; 8] = [
LIGHTING[0],
LIGHTING[4],
... |
// Copyright (c) 2017-present PyO3 Project and Contributors
use crate::defs;
use crate::method::{FnSpec, FnType};
use crate::proto_method::impl_method_proto;
use crate::pyfunction::PyFunctionOptions;
use crate::pymethod;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use quote::ToTokens;
use std::collections:... |
//!
use super::{
push::{remote_callbacks, AsyncProgress},
utils,
};
use crate::{
error::Result, progress::ProgressPercent,
sync::cred::BasicAuthCredential,
};
use crossbeam_channel::Sender;
use git2::{Direction, PushOptions};
use scopetime::scope_time;
use std::collections::HashSet;
///
#[derive(Debug... |
use ark_poly::EvaluationDomain;
use crate::gate_vector::fp::WasmGateVector;
use crate::srs::fp::WasmFpSrs as WasmSrs;
use kimchi::circuits::{constraints::ConstraintSystem, gate::CircuitGate};
use kimchi::linearization::expr_linearization;
use kimchi::prover_index::ProverIndex as DlogIndex;
use mina_curves::pasta::{fp:... |
#[allow(unused_imports)]
use log::{debug, info, warn};
use crate::{Device, Environment};
use half::f16;
use img2raw::{ColorSpace, DataFormat, Header};
use js_sys::Error;
use zerocopy::{AsBytes, FromBytes, LayoutVerified};
#[repr(align(16), C)]
#[derive(AsBytes, FromBytes, Debug, Default)]
pub struct EnvironmentData {... |
use crate::core::algebra::Vector2;
use crate::message::MessageData;
use crate::ttf::SharedFont;
use crate::{
brush::Brush,
core::{color::Color, pool::Handle},
draw::DrawingContext,
formatted_text::{FormattedText, FormattedTextBuilder},
message::UiMessage,
message::{TextMessage, UiMessageData},
... |
//! Interface for dealing with Roblox Studio's JSON API Dump. Isn't specific to
//! this crate and could probably turn into a separate crate.
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::fs;
use std::process::Command;
use anyhow::Context;
use rbx_dom_weak::types::VariantType;
use rbx_refle... |
// Copyright 2017 <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... |
// Std
use std::io::Write;
// Internal
use app::parser::Parser;
use args::{ArgSettings, OptBuilder};
use completions;
pub struct BashGen<'a, 'b>
where 'a: 'b
{
p: &'b Parser<'a, 'b>,
}
impl<'a, 'b> BashGen<'a, 'b> {
pub fn new(p: &'b Parser<'a, 'b>) -> Self { BashGen { p: p } }
pub fn generate_to<W:... |
/*
* Copyright (c) 2015-2021, SALT.
* This file is part of HashtagBlessedII and is distributed under the 3-clause BSD license.
* See LICENSE.md for terms of use.
*/
use core::{future::Future, pin::Pin};
use crate::hos::{hport::HPort, hhandle::HHandle, hclientsession::HClientSession, hclientsession::HClientSessionH... |
extern crate failure;
#[macro_use]
extern crate failure_derive;
extern crate getopts;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate varlink;
use std::env;
use std::process::exit;
use std::sync::{Arc, RwLock};
use varlink::{Connection, OrgVarlinkServiceInterface, VarlinkService};
mod io... |
use atty::Stream;
use clap;
use error_chain::error_chain;
use log::{debug, trace};
use mailparse;
use std::io::{self, BufRead};
use crate::{ctx::Ctx, imap::model::ImapConnector, msg::tpl::model::Tpl};
error_chain! {
links {
Imap(crate::imap::model::Error, crate::imap::model::ErrorKind);
}
foreign_... |
//! Module for return earning per share for a company
//!
//! This API returns the annual and quarterly earnings (EPS) for the company of
//! interest. Quarterly data also includes analyst estimates and surprise
//! metrics.
use serde::Deserialize;
use crate::{
api::ApiClient,
deserialize::{from_none_str, fro... |
use std::net::SocketAddr;
use super::super::agent;
use super::super::common_rpc_types;
use super::super::common_rpc_types::{
BlackList, BlockId, GraphNetworkOutAllAVGRow, GraphNetworkOutAllRow, GraphNetworkOutNodeExtensionRow,
GraphNetworkOutNodePeerRow, HardwareInfo, HardwareUsage, NodeName, NodeStatus, NodeV... |
// 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>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Congestion contr... |
use bytesstr::BytesStr;
use digest::{DigestAuthenticator, DigestCredentials};
use sip_types::header::typed::{AuthChallenge, AuthResponse};
use sip_types::msg::RequestLine;
use sip_types::{Headers, Name};
use std::collections::HashMap;
pub mod digest;
mod error;
pub use error::Error;
/// Information about the request... |
extern crate chip8_emu;
extern crate sdl2;
extern crate rand;
use std::env;
use std::fs::File;
use std::io::Read;
use std::sync::atomic::{AtomicBool, Ordering};
use chip8_emu::Chip8;
use rand::{Rng, XorShiftRng};
use sdl2::EventPump;
use sdl2::audio::{AudioCallback, AudioSpecDesired};
use sdl2::event::Event;
use sd... |
use crate::payload;
use crate::prelude::*;
use vec_map::VecMap;
#[derive(Serialize, Deserialize)]
pub struct Sharder {
txs: Vec<(LocalNodeIndex, ReplicaAddr)>,
sharded: VecMap<Box<Packet>>,
shard_by: usize,
}
impl Clone for Sharder {
fn clone(&self) -> Self {
assert!(self.txs.is_empty());
... |
// Copyright 2019 Intel Corporation. All Rights Reserved.
// Copyright 2019-2021 Alibaba Cloud Computing. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
//! A simple framework to run a vhost-user backend service.
#[macro_use]
extern crate log;
use std::fmt::{Display, Formatter};
use std::sync::{Arc, ... |
// Copyright 2019 <NAME>, Inc.
//
// 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... |
#[allow(unused_attributes)]
#[macro_use]
#[allow(unused_imports)]
use assert_hex::assert_eq_hex;
use crate::util::{IterWriteBack, ROCursor, RWCursor};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use alloc::prelude::v1::*;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum RelocationType {
// For now... |
// Copyright 2015-2020 <NAME> <<EMAIL>>
// Copyright (C) 2017 Google LLC.
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modifie... |
extern crate discord;
extern crate redis;
extern crate rustc_serialize;
use std::env;
use std::thread;
use std::process::exit;
use discord::{Discord, State, ChannelRef, Connection};
use discord::model::{Event, ChannelType};
use redis::Commands;
use rustc_serialize::json;
///////////////////
//// REDIS QUEUE
/////////... |
use crate::Direction;
use crate::{
fragment::{marker_line::Marker, Bounds},
Cell, Point,
};
use nalgebra::Point2;
use parry2d::shape::{shape::Shape, Polyline};
use sauron::{
html::attributes::*,
svg::{attributes::*, *},
Node,
};
use std::{cmp::Ordering, fmt};
#[derive(Debug, Clone, PartialEq)]
pub ... |
use crate::{utils, Error, Result};
use regex::bytes::Regex;
use std::{fs::File, io::prelude::*, path::Path};
pub(crate) struct Replacer {
regex: Regex,
replace_with: Vec<u8>,
is_literal: bool,
replacements: usize,
}
impl Replacer {
pub(crate) fn new(
look_for: String,
replace_with:... |
use crate::cli::Cli;
use anyhow::{bail, format_err, Error};
use lazy_static::lazy_static;
use regex::Regex;
use std::borrow::Cow;
use std::fs;
use std::iter;
use std::path::Path;
pub fn generate_commit(
cli: &Cli,
// (path, start_hash, end_hash)
submodules: &[(&str, impl AsRef<str>, impl AsRef<str>)],
) ->... |
// Copyright 2018 Google Inc.
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
use std::error::Error;
use std::fs::File;
use std::io::{self, BufWriter, Write};
use std::path::PathBuf;
use std::process;
use clap::{
ErrorKind::{DisplayHelp, DisplayVersion},
Parser,
};
use xt::Format;
fn main() {
let args = match Cli::try_parse() {
Ok(args) => args,
Err(err) => match err.kind() {
... |
use std::cell::RefCell;
use std::collections::HashMap;
use crate::syntax::source_map::Span;
use miri::{Frame, FrameData, Tag};
use rustc::ty::TyCtxt;
use horrorshow::prelude::*;
use syntect::easy::HighlightLines;
use syntect::highlighting::{Style, ThemeSet};
use syntect::html::{styled_line_to_highlighted_html, Includ... |
use crate::config::config_toml::TcpConfig;
use crate::quic::endpoints;
use crate::stream::connect;
use crate::stream::stream_any::StreamAny;
use crate::stream::stream_flow;
use crate::tcp::util as tcp_util;
use crate::util::util;
use crate::Protocol7;
use any_tunnel2::client as tunnel_client;
use any_tunnel2::peer_stre... |
use std::{
cell::RefCell,
ops::Deref as _,
rc::Rc,
sync::{Arc, Mutex},
};
use wayland_server::{
protocol::{wl_shell, wl_shell_surface, wl_surface},
Filter, Main,
};
use crate::wayland::compositor::{roles::Role, CompositorToken};
use super::{ShellRequest, ShellState, ShellSurface, ShellSurface... |
use crate::{Commit, Error, File};
/// A reference to a branch on the git repo.
pub struct Branch<'a> {
pub(crate) repo: &'a git2::Repository,
pub(crate) branch: git2::Branch<'a>,
pub(crate) tree: git2::Tree<'a>,
}
impl<'a> Branch<'a> {
pub(crate) fn new(repo: &'a git2::Repository, branch: &str) -> Res... |
//! Keymaps
// Upper-case acronyms are generated by pest.
#![allow(clippy::upper_case_acronyms)]
use pest::Parser;
use pest_derive::Parser;
use termwiz::input::{KeyCode, Modifiers};
use crate::bindings::{Binding, BindingConfig, BindingError};
use crate::keymap_error::{KeymapError, Result};
#[derive(Parser)]
#[gramm... |
use super::types::AddrInfo;
use rand::Rng;
use std::{
collections::{HashMap, HashSet},
net::SocketAddr,
};
use tentacle::{
multiaddr::Multiaddr,
secio::PeerId,
utils::{extract_peer_id, multiaddr_to_socketaddr},
};
#[derive(Default)]
pub struct Manager {
next_id: u64,
addr_to_id: Ha... |
#[derive(PartialEq)]
pub enum LineKind {
SubHeader,
Arg,
Option,
Text,
}
fn get_line_kind(line: &str) -> LineKind {
if SUBHEADERS.contains(&line) {
LineKind::SubHeader
} else if is_args_line(line) {
LineKind::Arg
} else if is_options_line(line) {
LineKind::Option
... |
mod credentials;
mod error;
mod shell;
use anyhow::Context;
use anyhow::Result;
use credentials::*;
use error::CliError;
use shell::Shell;
use google_authenticator::GoogleAuthenticator;
use rusoto_core::request::HttpClient;
use rusoto_core::{Client, Region};
use rusoto_credential::ProfileProvider;
use rusoto_iam::{Ge... |
// Copyright 2021 Balaji (<EMAIL>)
//
// 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 t... |
use specs::{Component, VecStorage};
use serde::{Deserialize, Serialize};
use server_common::vec::Vec3;
use super::rigidbody::RigidBody;
pub struct BrainState {
pub heading: f32,
pub running: bool,
pub jumping: bool,
pub jump_count: u32,
pub is_jumping: bool,
pub current_jump_time: f32,
}
i... |
prelude!();
mod entry;
use ::mem::paging::PAGE_SIZE;
use ::mem::{ get_mut_ptr, memory_map };
use ::utility::{ round_up, round_down, log2_floor };
use ::core::slice;
use ::core::cmp::{min, max};
use self::entry::*;
use ::mem::inplace_list::*;
const MIN_SIZE: usize = PAGE_SIZE * 10;
const MAX_HEIGHT: usize = 32;
co... |
//! Managing the `crate2nix.json` config.
use anyhow::{bail, Context, Error};
use serde::{Deserialize, Serialize};
use std::{
collections::BTreeMap,
fmt::Display,
fs::File,
io::{BufReader, BufWriter},
path::Path,
str::FromStr,
};
impl Config {
/// Read config from path.
pub fn read_fro... |
use itertools::Itertools;
use model::ExitStatus;
use northstar::api::model::{
self, ContainerData, MountResult, Notification, RepositoryId, Response, UmountResult,
};
use prettytable::{format, Attr, Cell, Row, Table};
use std::collections::HashSet;
use tokio::time;
pub(crate) fn notification(notification: &Notific... |
use crate::{ops::Signed, IntoInner};
/// The error produced when a negative or NaN value is encountered.
#[derive(Debug, Clone, Copy)]
pub struct NegativeError;
impl std::fmt::Display for NegativeError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "encountered a negative or N... |
use std::error;
use std::fmt;
pub const MEMORY_SIZE: usize = 4096; //support 4k of memory
pub const FONT_CHARACTERS: [u8; 80] = [
0xF0, 0x90, 0x90, 0x90, 0xF0, //"0" Character
0x20, 0x60, 0x20, 0x20, 0x70, //"1" Character
0xF0, 0x10, 0xF0, 0x80, 0xF0, //"2" Character
0xF0, 0x10, 0xF0, 0x10, 0... |
//! Entry point of the program.
mod cache;
mod error;
mod eval;
mod identifier;
mod label;
mod merge;
mod operation;
mod parser;
mod position;
mod program;
mod repl;
mod serialize;
mod stack;
mod stdlib;
mod term;
mod transformations;
mod typecheck;
mod types;
use crate::error::{Error, IOError, SerializationError};
us... |
use super::*;
use std::ffi::CStr;
#[derive(Debug, Copy, Clone)]
pub struct Local<T> {
local_: V8::Local<T>,
}
impl<T> Local<T> {
pub fn from(local_: V8::Local<T>) -> Local<T> {
Local { local_ }
}
pub unsafe fn inner_mut(&mut self) -> &mut T {
self.local_.val_.as_mut().unwrap()
}
}... |
use std::convert::TryFrom;
use bwasm::ValueType;
use wasmdbg::value::Integer;
use wasmdbg::Debugger;
use super::context;
use super::{CmdArg, CmdResult, Command, Commands};
pub fn add_cmds(commands: &mut Commands) {
commands.add(
Command::new_subcommand("set")
.description("Modify various valu... |
use crate::{from_lsp, state::LanguageServerSnapshot, to_lsp, FilePosition};
use lsp_types::{CompletionContext, CompletionItem, DocumentSymbol};
use mun_syntax::{AstNode, TextSize};
/// Computes the document symbols for a specific document. Converts the LSP types to internal
/// formats and calls [`LanguageServerSnapsh... |
use std::collections::HashMap;
use bevy::{prelude::*, tasks::prelude::*};
use crossbeam_channel::{unbounded, Receiver};
use derive_more::{Deref, DerefMut};
use pathfinding::prelude::*;
use crate::{
core::{Coordinates, PointLike},
map::Map,
navigation::{MotionBlocked, RotationSpeed, Speed, Velocity},
};
#... |
#![feature(step_by)]
extern crate getopts;
extern crate rustc_serialize;
extern crate image as piston_image;
extern crate time;
use std::str::FromStr;
use std::path::Path;
use std::fs::File;
use getopts::Options;
mod cnn;
mod model;
mod image;
fn main() {
let args: Vec<String> = std::env::args().collect();
... |
use crate::{setting_value::SettingValueEnum, settings::Settings, Error};
use cgmath::Vector3;
use std::{
fs::File,
io::{BufRead, BufReader, BufWriter, Write},
};
pub struct KeyframeList {
keyframes: Vec<Settings>,
}
fn interpolate_float(p0: f64, p1: f64, p2: f64, p3: f64, t: f64, linear: bool) -> f64 {
... |
//! ## 布隆过滤器
//!
//! #### 算法说明
//! - partial bloom filter
//! - 较原始版本准确率更高,且分区间互相独立,可并发计算哈希,效率也更高;
//! - 用于快速检索大数据集,以允许少量错判为代价,兼顾时间与空间两方面的效率;
//! - 难点在于如何根据具体的场景,选定最优的哈希函数、哈希次数及索引数组的容量;
//! - 合适的索引数组容量计算公式:m = kn/ln2, k指哈希函数数量,n指被索引的数据总量。
//!
//! #### 应用场景
//! - 区块链轻节点校验交易:由于轻节点仅有区块头信息,并无完整的交易数据,故首先要粗略定位至可能含有目标交易的区块,之后... |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use crate::{
specification::Format,
target::{Target, TargetSet},
Error,
};
use anyhow::anyhow;
use core::{fmt, ops::Range, str::FromStr};
use serde::Serialize;
use std::{
collections::{BTreeSet,... |
use core::marker::PhantomData;
use crate::common::{DebugInfoOffset, Format};
use crate::read::{parse_debug_info_offset, Error, Reader, ReaderOffset, Result, UnitOffset};
// The various "Accelerated Access" sections (DWARF standard v4 Section 6.1) all have
// similar structures. They consist of a header with metadata ... |
use ash::vk;
use anyhow::*;
use crate::vulkan::{
context::NodeRendererType, draw_system::Vertex, GfaestusVk,
};
pub struct NodeVertices {
pub(crate) vertex_count: usize,
pub(crate) vertex_buffer: vk::Buffer,
allocation: vk_mem::Allocation,
allocation_info: Option<vk_mem::AllocationInfo>,
r... |
use bitflags::bitflags;
use crate::error::{errcode_to_result, Result};
use ffi::BLRuntimeBuildType::*;
bl_enum! {
/// Blend2D runtime build type.
pub enum BuildType {
/// Describes a Blend2D debug build.
Debug = BL_RUNTIME_BUILD_TYPE_DEBUG,
/// Describes a Blend2D release build.
... |
/*
*
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GcloudVoiceChatCallSt... |
use crate::codec::GetSize;
use crate::datatypes::{Bytes, Signature, Sv2DataType, B016M, B0255, B032, B064K, U24, U256};
use crate::Error;
use alloc::vec::Vec;
#[cfg(not(feature = "no_std"))]
use std::io::{Error as E, Write};
pub trait Encodable {
#[allow(clippy::wrong_self_convention)]
fn to_bytes(self, dst: &... |
use std::{collections::BTreeMap, fs::File, io::Read, marker::PhantomData, path::Path};
use base64;
use flate2::read::GzDecoder;
use crate::dawg::{completer::Completer, dictionary::Dictionary, guide::Guide, value::DawgValue};
const PAYLOAD_SEPARATOR: &str = "\x01";
#[derive(Debug, Clone)]
pub struct Dawg {
dict:... |
#![allow(dead_code)]
//! PDF constants for tags for reducing typing mistakes
/*
/// Special graphics state
"q";
"Q";
"cm";
/// Text objects
"BT";
"ET";
/// Text state
"Tc";
"Tw";
"Tz";
"TL";
"Tf";
"Tr";
"Ts";
/// Text positioning
"Td";
"TD";
"Tm";
"Tm";
"T*";
/// Text showing
"Tj";
"TJ";
/// Type 3 fonts
"d0";
... |
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use cop_codegen::AggrFunction;
use cop_datatype::{FieldTypeFlag, FieldTypeTp};
use tipb::expression::{Expr, ExprType, FieldType};
use crate::coprocessor::codec::data_type::*;
use crate::coprocessor::codec::mysql::Tz;
use crate::coprocessor::dag::expr:... |
use rayon::prelude::*;
use crate::Ray;
use super::aabb::*;
use super::{Geometry, RayHit};
#[derive(Clone)]
pub enum KdTree<T> {
Leaf {
bounds: AABB,
geoms: Vec<T>,
},
Node {
bounds: AABB,
left: Box<KdTree<T>>,
right: Box<KdTree<T>>,
},
}
struct Split {
dim... |
use std::env;
use std::fs;
use std::convert::AsRef;
use std::io::Read;
use std::path::{Path, PathBuf};
use std::collections::HashMap;
use url::Url;
use errors::Result;
use types::{SourceMap, RawToken, Token};
/// Helper for sourcemap generation
///
/// This helper exists because generating and modifying `SourceMap`... |
use crate::util::{print_part_1, print_part_2};
use std::fs::read_to_string;
use std::time::Instant;
#[derive(Copy, Clone, PartialEq)]
enum GridType {
Floor,
Empty,
Occupied,
Wall,
}
#[derive(Copy, Clone, PartialEq)]
enum Direction {
Up,
Down,
Left,
Right,
TopLeft,
TopRight,
... |
use serde_json::{Value};
use std::io::prelude::*;
use std::fs::{File};
use std::path::Path;
use std::process::Command;
use crate::utils::Target;
#[derive(Default, Builder, Debug)]
#[builder(setter(into))]
pub struct Build {
app: Option<String>,
dir: Option<String>,
target: Option<String>,
}
impl Build {
... |
extern crate clap;
extern crate num_integer;
// Time Start: Tue, 10 Dec 2019 16:01:02 -0500
// Time Finish 1: Tue, 10 Dec 2019 17:26:44 -0500 (1 hour, 25 minutes, 42 seconds)
// Time Finish 2: Tue, 10 Dec 2019 19:03:18 -0500 (1 hour, 36 minutes, 34 seconds)
// Time Total: 3 hours, 2 minutes, 16 seconds
use std::fs;
... |
use std::fmt;
use std::io;
use thiserror::Error;
use beserial::{Deserialize, Serialize};
use nimiq_collections::bitset::BitSet;
use nimiq_hash::{Blake2bHash, Blake2sHash, Hash, SerializeContent};
use nimiq_nano_primitives::pk_tree_construct;
use nimiq_primitives::policy;
use nimiq_primitives::slots::Validators;
use n... |
#![warn(missing_docs)]
#![allow(clippy::redundant_closure)]
/*!
This library is for accessing and manipulating a Cargo registry index.
A very basic example:
```rust
# fn main() -> Result<(), failure::Error> {
# std::env::set_var("GIT_AUTHOR_NAME", "Index Admin");
# std::env::set_var("GIT_AUTHOR_EMAIL", "<EMAIL>");
#... |
use crate::{Error, Protection, Region, Result};
use std::cmp::{max, min};
use std::io;
use std::mem::{size_of, MaybeUninit};
use std::sync::Once;
use winapi::um::memoryapi::{
VirtualAlloc, VirtualFree, VirtualLock, VirtualProtect, VirtualQuery, VirtualUnlock,
};
use winapi::um::sysinfoapi::{GetNativeSystemInfo, SYSTE... |
use std::sync::mpsc::{Receiver, Sender};
use std::{io::ErrorKind, io::Read, io::Write, sync::mpsc};
use mpsc::TryRecvError;
use raiot_buffers::CircularBuffer;
pub struct MockSocket {}
pub struct MockClientSocket {
write_data_tx: Sender<Vec<u8>>,
read_data_rx: Receiver<Vec<u8>>,
read_ctl_rx: Receiver<std:... |
use std::time::Instant;
mod day01;
mod day02;
mod day03;
mod day04;
mod day05;
mod day06;
mod day07;
mod day08;
mod day09;
mod day10;
mod day11;
mod day12;
mod day13;
mod day14;
mod day15;
mod day16;
mod day17;
mod day18;
mod day19;
mod day20;
mod day21;
mod day22;
mod day23;
mod day24;
mod day25;
pub struct Solution... |
//! Implements Black-Scholes related calculation logic.
pub mod op_calc {
use crate::option::BSOption;
pub struct OptionResults {
pub call: f64,
pub put: f64,
}
pub fn calculate_option_values(&option: &BSOption) -> OptionResults {
crate::utils::set_panic_hook();
// ca... |
// Copyright 2020 <NAME> <<EMAIL>>
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agr... |
use super::tarjan::Vertex;
use crate::protocol::common::graph::Dependency;
use fantoch::config::Config;
use fantoch::hash_map::{Entry, HashMap};
use fantoch::id::{Dot, ProcessId, ShardId};
use fantoch::info;
use fantoch::shared::{SharedMap, SharedMapRef};
use fantoch::time::SysTime;
use fantoch::HashSet;
use parking_lo... |
//! Module containing the structures used to define a plugin prior to its
//! construction (callbacks etc.).
use crate::{
common::{
error::{inv_op, Result},
types::{
ArbCmd, ArbData, Gate, PluginMetadata, PluginType, QubitMeasurementResult, QubitRef,
},
},
plugin::state:... |
use brotli;
use byteorder::{BigEndian, ReadBytesExt};
use chrono::Local;
use env_logger::Builder;
use log::{LevelFilter, Record};
use rocket::http::{ContentType, Status};
use rocket::response::{self, Responder};
use rocket::{fairing, Data, Request, Response};
use serde_json;
use std::env;
use std::io::{self, BufRead, ... |
//! Proposer
use message::{AcceptData, AcceptedData, Message, Messenger, PromiseData, ProposalData};
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
use std::sync::Arc;
/// A Proposer advocates a client request, attempting to convince the Acceptors
/// to agree on it, and acting as a coordinator to mov... |
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
use walkdir::WalkDir;
use dcmpipe_dict::dict::stdlookup::STANDARD_DICOM_DICTIONARY;
use dcmpipe_lib::core::dcmobject::{DicomNode, DicomObject, DicomRoot};
use dcmpipe_lib::core::read::{
Parser, ParserBuilder, Result, DICOM_PREFIX, DICOM_PREFIX_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.