text stringlengths 3.09k 13.9k |
|---|
use std::vec::Vec;
use std::fmt;
#[derive(Clone, Copy)]
enum Operation {
Add, // +
Subtract, // -
Read, // ,
Write, // .
Left, // <
Right, // >
Start, // [
End // ]
}
impl fmt::Display for Operation {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
... |
use std::collections::{BTreeMap, HashMap};
use either::Either;
use libeir_intern::Ident;
use libeir_ir::pattern::PatternContainer;
use libeir_ir::{FunctionBuilder, PatternNode};
use super::super::{ClauseLowerCtx, EqGuard};
use super::{ConstraintKind, Tree, TreeNode, TreeNodeKind};
impl Tree {
pub(in super::supe... |
use embedded_graphics::{prelude::*, primitives::Rectangle};
use nom::{bytes::complete::take, IResult};
use crate::{
color_map::ColorMap,
footer::TgaFooter,
header::{Bpp, ImageOrigin, ImageType, TgaHeader},
parse_error::ParseError,
pixels::Pixels,
raw_pixels::RawPixels,
};
/// Raw TGA image.
//... |
use crate::{
hittable_list::HittableList,
material::{Dielectric, Lambertian, Metal},
ray::Point3,
sphere::Sphere,
Color, Vec3,
};
use rand::Rng;
use std::sync::Arc;
/// Re-exports the definition of the constant PI.
pub use std::f64::consts::PI;
/// Re-exports the definition of the constant MAX as ... |
// Copyright 2006 The Android Open Source Project
// Copyright 2020 <NAME>
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use alloc::vec::Vec;
use crate::{Point, Shader, GradientStop, SpreadMode, Transform, Color};
use crate::scalar::Scalar;
use super::grad... |
#![deny(warnings, rust_2018_idioms)]
#![allow(clippy::inconsistent_struct_constructor)]
mod level;
mod tasks;
pub mod test;
mod uptime;
use self::uptime::Uptime;
use hyper::body::HttpBody;
use linkerd_error::Error;
use std::{env, str};
use tokio_trace::tasks::TasksLayer;
use tracing::Dispatch;
use tracing_subscriber:... |
use crate::constants;
use lazy_static::lazy_static;
use tiny_keccak::{Hasher, Keccak};
use web3::contract::{Contract, Options};
use web3::futures::Future;
use web3::types::{Address, H256};
struct EnsSetting {
mainnet_addr: Address,
}
lazy_static! {
static ref ENS_SETTING: EnsSetting = EnsSetting {
ma... |
use futures::prelude::*;
use hyper::client;
use hyper::header;
use hyper::{self, Body, Chunk, Method, Request, StatusCode, Uri};
use percent_encoding::{utf8_percent_encode, QUERY_ENCODE_SET};
use serde::de::DeserializeOwned;
use serde_json;
use std::marker::PhantomData;
use std::str::FromStr;
use std::time::Duration;
... |
use std::{
collections::{HashMap, HashSet},
io::{self, Write},
};
use colored::Colorize;
use float_ord::{self, FloatOrd};
use text_io::read;
pub trait EasyUpdate<K, V> {
fn update(&mut self, key: K, value: V);
}
impl<K: Eq + core::hash::Hash, V: std::ops::AddAssign> EasyUpdate<K, V> for HashMap<K, V> {
... |
use crate::internal::*;
#[derive(Debug, Clone, new)]
pub struct RmDims {
pub axes: Vec<usize>,
}
impl RmDims {
fn compute_shape<D: DimLike>(&self, input: &[D]) -> TVec<D> {
input
.iter()
.enumerate()
.filter(|(ix, _d)| !self.axes.contains(ix))
.map(|(_ix... |
use crate::css::Value;
use crate::value::{ListSeparator, Quotes, Unit};
use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum Operator {
And,
Or,
Equal,
NotEqual,
Greater,
GreaterE,
Lesser,
LesserE,
Plus,
Minus,
Multiply,
Div,
Modulo,
N... |
// Using temporary allows for cleaner development.
#![allow(unused_imports)]
#![allow(dead_code)]
use std::net::{TcpListener, TcpStream};
use std::io::{BufRead, BufReader, Write};
use std::string::*;
use std::borrow::*;
use std::rc::*;
use std::cell::*;
use std::sync::*;
use std::ops::Deref;
use std::iter:... |
use std::iter::FromIterator;
use std::str::FromStr;
use crate::advents::Advent;
pub struct AdventDay16;
#[derive(Debug)]
enum ValidValue {
Single(usize),
Range(usize, usize),
}
#[derive(Debug)]
struct PossibleField {
name: String,
valid_values: Vec<ValidValue>,
}
impl PossibleField {
fn fits(&s... |
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use proc_macro2::TokenStream;
use quote::{quote, ToTokens, TokenStreamExt};
use std::convert::TryFrom;
use syn::{spanned::Spanned, FnArg, Ident, ItemFn, Pat, ReturnType, Type, Vi... |
use crate::debug::Debug;
use crate::graphics::window::winit;
use crate::graphics::{Window, WindowSettings};
use crate::input::{self, gamepad, keyboard, mouse, window, Input};
use crate::load::{Join, LoadingScreen, Task};
use crate::{Result, Timer};
use std::convert::TryInto;
pub trait Loop<Game: super::Game> {
typ... |
use evm_state::{Context, ExitSucceed};
use primitive_types::H160;
mod abi_parse;
mod builtins;
mod errors;
pub use abi_parse::*;
use builtins::BUILTINS_MAP;
pub use builtins::{ETH_TO_VLX_ADDR, ETH_TO_VLX_CODE};
pub use errors::PrecompileErrors;
use crate::account_structure::AccountStructure;
pub type Result<T, Err =... |
//! Simple 'counter' example
//!
//!
//! A user can maintain their own personal counter in the state store. This example uses the default
//! (testing) authenticator that allows all transactions (don't need to signed). User's can increase
//! and decrease their Counters and check the current count.
//!
use borsh::{Bor... |
use core::fmt;
use std::time::UNIX_EPOCH;
use std::{fs::read_dir, thread};
use gtk::glib;
use gtk::prelude::Continue;
use gtk::{CellRendererText, ListStore, TreeView, TreeViewColumn, glib::{MainContext, PRIORITY_DEFAULT, clone}, prelude::{CellLayoutExt, GtkListStoreExtManual, StaticType, ToValue, TreeViewColumnExt, Tre... |
use anyhow::Error;
use async_std::task;
use async_tungstenite::tungstenite::Message as WsMessage;
use futures::channel::mpsc;
use futures::prelude::*;
use futures::{AsyncRead, AsyncWrite};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use tracing::{i... |
use std::{cmp::Ordering, convert::TryFrom};
use quick_error::quick_error;
use crate::{oid, ObjectId, Prefix};
const MIN_HEX_LEN: usize = 4;
quick_error! {
/// The error returned by [Prefix::try_from_id()][super::Prefix::try_from_id()].
#[derive(Debug)]
#[allow(missing_docs)]
pub enum Error {
... |
use crate::ast;
use crate::ast::pp_visitor::*;
use crate::codegen::backend;
use crate::codegen::settings::Settings;
use crate::compiler;
use crate::compiler::sources::Sources;
use crate::lexer;
use crate::parser;
use crate::runtime;
use crate::ssa;
use crate::ssa::passes;
use std::cell::RefCell;
use std::path::{Path, P... |
use crate::settings::file;
use std::collections::HashMap;
use std::collections::HashSet;
use std::error::Error;
use std::path::PathBuf;
use std::process::Command;
use configparser::ini;
/// Check if a process is running. If `print_pid` is `true`, then print the pid of found process
/// to stdout.
pub(crate) fn is_r... |
/*
* Copyright 2019 Fluence Labs Limited
*
* 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 a... |
use std::collections::BTreeMap;
use mime::Mime;
use crate::util;
#[derive(Debug, PartialEq)]
pub struct Feed {
pub title: String,
pub id: String,
pub entries: Vec<Entry>,
}
#[derive(Debug, PartialEq)]
pub struct Entry {
pub title: Option<String>,
pub id: Option<String>,
pub link: Option<Stri... |
#![allow(warnings)]
extern crate foreach;
use crate::foreach::ForEach;
use std::time::{Duration, Instant};
extern crate rayon; // 1.0.3
use rayon::prelude::*;
use std::mem::size_of;
use std::env;
type TriadFunc = fn(&mut Vec<f64>, &Vec<f64>, &Vec<f64>, &Vec<f64>, usize, usize) -> ();
fn triad_serial_iter(A: &mut Vec... |
use std::{
iter::{self, Skip, Zip},
slice::Iter,
};
use crate::{
mania::{strain::Strain, SECTION_LEN},
parse::HitObject,
Beatmap, GameMode, Mods,
};
use super::{DifficultyHitObject, ManiaDifficultyAttributes, STAR_SCALING_FACTOR};
/// Gradually calculate the difficulty attributes of an osu!mania ... |
extern crate bindgen;
extern crate avr_mcu;
#[macro_use] extern crate lazy_static;
use avr_mcu::Mcu;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, fs};
const BINDINGS_DEST: &'static str = "src/bindings.rs";
/// Headers which can't be used from Rust.
const HEADER_BLACKLIST: &'static [&'st... |
//! Integration for plugin ports.
//!
//! This module contains a `PortType` for plugin ports that supports atom IO. This will most common
//! way to use atoms and is also used in most examples.
//!
//! # Example
//!
//! ```
//! use lv2_core::prelude::*;
//! use lv2_atom::prelude::*;
//!
//! #[derive(PortCollection)]
//... |
use std::io;
use std::io::Write;
mod network;
fn main() {
// end_function();
let circle1 = Circle { radius: 10 };
println!("Circle1's diameter: {}", circle1.diameter()); // (&circle1).diameter()
let circle2 = Circle::small_circle();
println!("Circle2's diameter: {}", circle2.diameter());
le... |
#![allow(clippy::needless_range_loop)]
use crate::vec3::*;
use std::f64::consts::PI;
pub fn degree_to_radians(degrees: f64) -> f64 {
degrees * PI / 180.0
}
pub fn clamp(x: f64, min: f64, max: f64) -> f64 {
// anti-aliasing
if x < min {
min
} else if x > max {
max
} else {
... |
//Day 12: Subterranean Sustainability
//
// Run with `RUST_LOG=debug` to get debug statments for garden visualisation.
//
use std::collections::BTreeMap;
use std::fmt;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum Pot {
Plant,
Empty,
}
impl Pot {
fn parse(input: &str) -> Vec<Pot> {
input
... |
use crate::readers::{Index, Value, RAReader};
use crate::models::{Slice, Location};
use std::borrow::BorrowMut;
///
/// Iterate through index of a location, and insert value to the index
///
///
pub struct InsertIterator<'a, R: RAReader> {
/// The random access reader that contains data
reader: &'a R,
has_more: ... |
use crate::boards::cursor::Cursor;
use crate::boards::idx_coord::BoardCoord;
use crate::boards::set_board_size;
use crate::constants::{AI_MOVE_DELAY, ANIMATION_DURATION};
use crate::senet::ai::process;
use crate::senet::init::INIT_BOARD;
use crate::senet::renderer::render;
use crate::senet::rules::{calc_valid_moves, HO... |
use hyper::header;
use reqwest::Result;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::{env, fs};
use tokio::time::{sleep, Duration};
#[tokio::main]
async fn main() -> Result<()> {
// ///////////////////////////////////////////////////////////////... |
//! This is modified from the `common_basic.rs` example (which uses the full
//! `kul` crate), to contrast how similar usage is achieved when using only the
//! `kul_core` crate with only values allocated on the stack.
#![allow(clippy::match_single_binding, clippy::dbg_macro)]
use core::str::FromStr;
use kul_core::{... |
// Philosophical note: These two main structs (Invocation and InvocationResponse) exist inside
// the wasmcloud-host crate. If this crate were to refer to that, we'd create a cyclical reference
// and all perish inside a black hole.
//
// The other alternative is to create a new, third crate shared by the two, but that... |
extern crate notify;
extern crate ini;
extern crate ansi_term;
use notify::{RecommendedWatcher, Watcher};
use std::sync::mpsc::channel;
use std::fs::File;
use std::path::Path;
use std::io::prelude::*;
use ini::Ini;
use ansi_term::Colour::*;
use std::thread::sleep;
use std::time::Duration;
// Sometimes a... |
/* Copyright 2015 <NAME>
*
* Licensed under the MIT license <LICENSE or
* http://opensource.org/licenses/MIT>. This file may not be copied,
* modified, or distributed except according to those terms.
*/
use std::cell::{Cell, RefCell};
use std::collections::{HashMap, hash_map};
use std::ops::Deref;
use std::rc::{R... |
use super::OutputFormat;
use super::{find_customer, find_project, find_service};
use acari_lib::{AcariError, Client, Day, Minutes, TimeEntry, Tracker};
use clap::Clap;
use prettytable::{cell, format, row, table};
use serde_json::json;
#[derive(Clap, PartialEq, Eq)]
pub struct StartCmd {
#[clap(about = "Customer name... |
/*
* 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... |
// Copyright (c) 2022 Alibaba Cloud
//
// SPDX-License-Identifier: Apache-2.0
//
use anyhow::{anyhow, Result};
use oci_distribution::Reference;
use serde::{Deserialize, Serialize};
use signature::{Image, Policy, SignatureScheme};
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fs;
use std::path::{Pa... |
use std::fmt;
// A.2 Profiles ( Page 306 )
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Profile {
Baseline,
Main,
Extended,
High,
ProgressiveHigh,
ConstrainedHigh,
// A.2.5 High 10 profile (Page 309)
High10,
// A.2.5.1 Progressive High 10 profile
ProgressiveHigh10,
... |
//! # Introduction
//! The Jadis crate is a Java Virtual Machine language disassembler written in Rust.
//! This project has been written for educational purposes, however, Jadis can theoretically be used as a drop-in replacement of [`javap`](https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javap.html).
//... |
use cgmath::{vec3, Vector3, Zero};
use winit::event::{MouseButton, VirtualKeyCode};
use crate::{
graphics::{Canvas, LineMesh, LineMeshDescriptor, Share},
logic::{
common::Axis,
elements::{ElementKind, Movable},
scene::{self, Action},
},
math::{Intersects, Plane, Ray, Snap},
};
... |
// preprocessing our search function
use errors::*;
use chrono_english::*;
use chrono::prelude::*;
use chrono::Duration;
use glob::Pattern;
use regex::{Regex,RegexBuilder,Captures};
use std::env;
use std::error::Error;
pub use GlobIgnoreCase;
static DATE_METHODS: &[&str] = &["before","after","since","on","between"];
... |
use crate::layout::coverage::Coverage;
use crate::layout::valuerecord::{ValueRecord, ValueRecordFlags};
use crate::tables::GPOS::GPOSSubtable;
use crate::types::*;
use crate::Deserializer;
use otspec_macros::Serialize;
#[derive(Debug, PartialEq, Clone, Serialize)]
#[allow(missing_docs, non_snake_case, non_camel_case_t... |
use std::fs::{File, OpenOptions};
use std::io::{Seek, SeekFrom};
use serde::{Serialize, Deserialize};
use crate::blob::{read_u64, write_u64, Blob};
use crate::error::BlobError;
const CONT_SIZE: u64 = 32;
pub struct BlobStore{
file: File,
hseed: u64,
block_size: u64,
nblocks: u64,
elems: u64,
}
impl BlobSt... |
use ghost::Ghost;
use int_seq::{IntSeq, A};
use g::G;
use parser_state::ParserState;
use compilation_error::CompErr;
use lalrpop_util::ParseError;
use lalrpop_util::lexer::Token;
use repl_command::{ReplCommand, repl_print_help, repl_eval, repl_ls, repl_unset, repl_unset_all, repl_funcs};
use std::collections::HashMap;
... |
use anyhow::Result;
use crdt_engine::{Delta, Engine, Patch, Rope, ValueOp};
use druid::Point;
use serde::{Deserialize, Serialize};
use sound_garden_types::*;
use std::{
collections::{HashMap, HashSet},
convert::TryFrom,
};
/// Repository is a source of truth for a distributed state in SGD.
/// We encode text p... |
use amiquip::AmqpProperties;
use amiquip::Connection;
use amiquip::Exchange;
use amiquip::QueueDeclareOptions;
use amiquip::{Channel, Publish};
use amiquip::{ConsumerMessage, ConsumerOptions, Queue};
use async_std::sync::Arc;
use crossbeam_channel::Receiver;
use crossbeam_channel::Sender;
use log::{info, trace};
use se... |
use tuix::*;
use femtovg::{
Canvas, renderer::OpenGl, Align, Baseline, FillRule, FontId, ImageFlags, ImageId, LineCap, LineJoin,
Paint, Path, Renderer, Solidity,
};
use super::socket_widget::*;
pub struct NodeWidget {
selected: bool,
moving: bool,
mouse_down_x: f32,
mouse_down_y: f32,
... |
#![warn(clippy::all, clippy::pedantic)]
mod gamecore;
mod element;
mod player;
use rand::Rng;
use bracket_lib::prelude::*;
use gamecore::{Render, Camera};
use crate::element::{Obstacle, Terrain, Power, PowerUp};
use crate::player::Player;
const FRAME_DURATION: f32 = 75.0;
const FLAP_DURATION: f32 = FRAME_DURATION *... |
use crate::common::control::TestResults;
use crate::common::data::Direction;
use colored::Colorize;
// Bytes
const KBYTES: usize = 1024;
const MBYTES: usize = 1024 * KBYTES;
const GBYTES: usize = 1024 * MBYTES;
const TBYTES: usize = 1024 * GBYTES;
// Bitrates
const KBITS: usize = 1000;
const MBITS: usize = 1000 * KBI... |
#![recursion_limit="200"]
#[macro_use]
extern crate stdweb;
#[macro_use]
extern crate serde_derive;
extern crate serde;
const GRAVITY: f64 = 0.025;
const RANGE: f64 = 10.0;
const RANGE2: f64 = RANGE * RANGE;
const PRESSURE: f64 = 1.0;
const VISCOSITY: f64 = 0.05;
const DENSITY: f64 = 0.2;
const N: usize = 100;
fn m... |
use crate::{
sync::{AccountUpdate, SolanaChangeListener, SubRequest},
Error, Network, Result,
};
use dashmap::DashMap;
use solana_client::rpc_client::RpcClient;
use solana_sdk::{account::Account, pubkey::Pubkey};
use std::{sync::Arc, time::Duration};
use tokio::{
sync::{
broadcast::{self, Receiver, Sender},
... |
use std::fmt;
use super::{CharIndex, ToChar};
use constants::{ROTORS, NOTCHES};
#[derive(Clone, Debug)]
pub struct Rotor {
mapping: Vec<char>,
inverse: Vec<char>,
notches: Vec<usize>,
pub offset: usize,
pub key_setting: usize,
pub ring_setting: usize,
}
impl Rotor {
/// Creates a new `Rot... |
#![cfg(feature = "test_utils")]
use holochain::sweettest::SweetAgents;
use holochain::sweettest::SweetConductor;
use holochain::sweettest::SweetDnaFile;
use holochain::test_utils::consistency_10s;
use holochain_serialized_bytes::prelude::*;
use holochain_types::prelude::*;
use holochain_wasm_test_utils::TestWasm;
use ... |
// allows e.g. raw_data[dst_off + x * 4 + 2] = buf[src_off + x * 4 + 0];
#![allow(clippy::identity_op)]
//! Support for piet CoreGraphics back-end.
use std::marker::PhantomData;
use std::path::Path;
#[cfg(feature = "png")]
use std::{fs::File, io::BufWriter};
use core_graphics::{color_space::CGColorSpace, context::CG... |
// `error_chain!` can recurse deeply
#![recursion_limit = "1024"]
mod app;
mod assets;
mod clap_app;
mod config;
mod directories;
use std::collections::HashSet;
use std::ffi::OsStr;
use std::io;
use std::io::Write;
use std::path::Path;
use std::process;
use ansi_term::Colour::Green;
use ansi_term::Style;
use crate:... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
// Copyright 2018 The Grin Developers
// Modifications Copyright 2019 The Gotts Developers
//
// 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... |
use std::sync::Arc;
use async_recursion::async_recursion;
use datafusion::{
error::{DataFusionError, Result},
logical_plan::{Expr, Operator},
prelude::{Column, DataFrame, ExecutionContext},
scalar::ScalarValue,
};
use substrait::protobuf::{
expression::{field_reference::ReferenceType::MaskedRefer... |
use comrak::nodes::{AstNode, NodeCodeBlock, NodeHeading, NodeHtmlBlock, NodeLink, NodeValue};
use comrak::{self, Arena, ComrakOptions};
use serde_json;
use std::env;
use std::error::Error;
use std::fs::{self, File};
use std::io::{self, BufReader};
use std::mem;
use std::path::Path;
use std::string::FromUtf8Error;
use s... |
use crate::rest::contact::Contact;
use crate::rest::documentation::Documentation;
use crate::rest::license::License;
use crate::rest::scheme::Scheme;
use crate::rest::server::Server;
pub trait ApplicationBuilder {
fn new(name: String, version: String) -> Self;
fn set_base_url(self, base_url: String) -> Self;
... |
//! Interface for symmetric-cipher encryption
//!
//! see boards/imix/src/aes_test.rs for example usage
use crate::ErrorCode;
/// Implement this trait and use `set_client()` in order to receive callbacks from an `AES128`
/// instance.
pub trait Client<'a> {
fn crypt_done(&'a self, source: Option<&'static mut [u8]... |
use std::fmt;
use crate::address::Address;
use crate::disassembly::VarnodeData;
use crate::register::RegisterNames;
use crate::space::AddressSpaceId;
use crate::space_manager::SpaceManager;
use crate::translator::Translator;
use fugue_bv::BitVec;
use ustr::Ustr;
use super::Register;
#[derive(Debug, Clone, Eq, Parti... |
use core::ops::{BitAnd, BitOr};
use kernel::common::cells::VolatileCell;
#[repr(C)]
pub struct Registers {
pub otg_control: VolatileCell<u32>,
pub otg_interrupt: VolatileCell<u32>,
pub ahb_config: VolatileCell<u32>,
pub configuration: VolatileCell<u32>,
pub reset: VolatileCell<u32>,
pub interru... |
use super::misc::MiscMethods;
use super::Backend;
use super::HasCodegen;
use crate::common::TypeKind;
use crate::mir::place::PlaceRef;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Ty};
use rustc_span::DUMMY_SP;
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
use rustc_target::a... |
use core::bbox;
use core::matrix;
use core::ray;
use core::vector;
pub struct Xform {
mat: matrix::Mat,
inv_mat: matrix::Mat,
}
static IDENTITY: Xform = Xform {
mat: matrix::Mat {
storage: [
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
... |
use std::fs::File;
use std::io::prelude::*;
use std::collections::HashMap;
use std::collections::HashSet;
type Claim = (u32, u32, u32, u32, u32);
type ClaimArea = Vec<(u32, u32)>;
type ClaimAreaId = (u32, ClaimArea);
fn parse_claim(st: &str) -> Claim {
let r = st.split(|c| c == ' ' || c == '@' || c == ',' || c ==... |
use crate::config::TopicType::{DiscoveryTopic, SetAttributeTopic, SetJsonTopic, StatusTopic};
use crate::controller::{AttributeId, DeviceId};
use crate::utils::Numberish;
use regex::Regex;
use rumqttc::MqttOptions;
use simple_error::bail;
use std::error::Error;
use std::fmt;
use std::ops::Add;
#[derive(Debug, Clone)]
... |
use std::io::{Cursor, Read};
use std::time::Duration;
use criterion::{criterion_group, criterion_main, Criterion, Throughput};
use filecoin_proofs::{
add_piece, get_seal_inputs, PaddedBytesAmount, PoRepConfig, PoRepProofPartitions,
SectorShape2KiB, SectorSize, UnpaddedBytesAmount, POREP_PARTITIONS, SECTOR_SIZE... |
use crate::actor::{ActorHandler, get_actor_attribute};
use crate::model::frame_data::FrameData;
use boxcars::Attribute;
use crate::model::team_paint::TeamPaint;
use crate::model::frame_state::FrameState;
use crate::model::boost_pad_data::BoostPadData;
pub struct CarHandler {}
impl CarHandler {}
impl ActorHandler for... |
macro_rules! poll_req {
($ty: ty, $ret: ty) => {
impl std::future::Future for $ty {
type Output = ::std::result::Result<$ret, $crate::error::Error>;
fn poll(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> ::std::... |
use std::collections::HashMap;
use time::format_description;
use ansi_term::Color;
// use chrono::{NaiveDateTime, TimeZone};
use flexi_logger::{DeferredNow, FlexiLoggerError, Level, Logger, LoggerHandle, Record};
use flexi_logger::filter::{LogLineFilter, LogLineWriter};
pub struct LogConfig {
module_levels: HashM... |
use crate::config::*;
use crate::errors::*;
use crate::test_loader::TracerData;
use crate::traces::*;
use log::{error, info};
use serde::Serialize;
use std::fs::{create_dir_all, File};
use std::io::BufReader;
pub mod cobertura;
pub mod coveralls;
pub mod html;
pub mod json;
pub mod lcov;
mod safe_json;
/// Trait for r... |
use {
std::{
collections::HashMap,
hash::Hash,
//iter::FromIterator,
pin::Pin,
},
//async_stream::try_stream,
futures::{
future::Future,
stream::{
self,
//FuturesUnordered,
Stream,
StreamExt as _,
... |
// Copyright 2021 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::manifest::BlobManifest;
use anyhow::{Context, Result};
use assembly_util::PathToStringExt;
use fuchsia_pkg::PackageManifest;
use std::fs::File;
... |
use crate::appx_dbscan::counting_tree::TreeStructure;
use crate::AppxDbscanValidParams;
use linfa::Float;
use linfa_nn::distance::{Distance, L2Dist};
use ndarray::{Array1, ArrayView1, ArrayView2, ArrayViewMut1};
use partitions::PartitionVec;
#[derive(Clone)]
/// A point in a D dimensional euclidean space that memorize... |
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
mod readdir;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
mod readdir_impl;
use std::fs::{FileType, Metadata};
use std::io;
use std::io::Error;
use std::path::{Path, PathBuf};
use std::task::{Context, Poll}... |
use std::collections::HashSet;
use std::env;
use std::io::Write;
use assets::{HighlightingAssets, PRETTYPRINT_THEME_DEFAULT};
use console::Term;
use errors::*;
use inputfile::{InputFile, InputFileReader};
use line_range::RangeCheckResult;
use output::OutputType;
use printer::{InteractivePrinter, Printer};
#[cfg(windo... |
use crate::aead::{
generic_array::{
sequence::{Concat, Split},
typenum::{Diff, Sum, Unsigned},
ArrayLength, GenericArray,
},
Error as AeadError,
};
use alloc::vec::Vec;
use core::ops::{Add, Sub};
use displaydoc::Display;
use mc_crypto_keys::{Kex, KeyError};
use mc_oblivious_aes_gcm::... |
use crate::{
audio_key::{AudioKey, AudioKeyDispatcher},
connection::{
codec::{ShannonDecoder, ShannonEncoder, ShannonMessage},
Credentials, Transport,
},
error::Error,
item_id::{FileId, ItemId},
mercury::{MercuryDispatcher, MercuryRequest},
util::deserialize_protobuf,
};
use ... |
use crate::behaviour::{Behaviour, BehaviourEvent};
use crate::error;
use crate::multiaddr::Protocol;
use crate::rpc::RPCEvent;
use crate::NetworkConfig;
use futures::prelude::*;
use futures::Stream;
use libp2p::core::{
muxing::StreamMuxerBox,
nodes::Substream,
transport::boxed::Boxed,
upgrade::{InboundU... |
// Translated from C to Rust. The original C code can be found at
// https://github.com/ulfjack/ryu and carries the following license:
//
// Copyright 2018 <NAME>
//
// The contents of this file may be used under the terms of the Apache License,
// Version 2.0.
//
// (See accompanying file LICENSE-Apache or copy at
... |
//! Packet types.
use std::convert::TryInto;
use std::io::{Cursor, Read, Write};
use flate2::read::ZlibDecoder;
use flate2::write::ZlibEncoder;
use flate2::Compression;
use nom::Err;
use serde::Deserialize;
use serde_json::json;
pub use types::*;
use crate::config::StreamConfig;
use crate::errors::{IncompleteResult... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - DAC Data Low Register"]
pub dat0l: DATL,
#[doc = "0x01 - DAC Data High Register"]
pub dat0h: DATH,
#[doc = "0x02 - DAC Data Low Register"]
pub dat1l: DATL,
#[doc = "0x03 - DAC Data High Register"]
pub dat1h:... |
//! Type definitions for wrappers which represent a layer of indirection within
//! a file.
use core::fmt;
use core::ops::{Deref, DerefMut};
use crate::{
io::{Read, Seek, SeekFrom},
BinRead, BinResult, ReadOptions,
};
/// A wrapper type which represents a layer of indirection within a file.
///
/// `FilePtr<... |
use core::future::Future;
use core::marker::PhantomData;
use core::sync::atomic::{compiler_fence, Ordering};
use core::task::Poll;
use embassy::interrupt::InterruptExt;
use embassy::util::{AtomicWaker, Unborrow};
use embassy_hal_common::unborrow;
use futures::future::poll_fn;
use crate::interrupt;
use crate::{pac, per... |
// BEGIN - Embark standard lints v0.4
// do not change or add/remove here, but one can add exceptions after this section
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
#![deny(unsafe_code)]
#![warn(
clippy::all,
clippy::await_holding_lock,
clippy::char_lit_as_u8,
clipp... |
// 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... |
//! # Connector
//!
//! Respresents the physical output, such as a DisplayPort or VGA connector.
//!
//! A Connector is the physical connection between the display controller and
//! a display. These objects keep track of connection information and state,
//! including the modes that the current display supports.
use ... |
use std::collections::{BTreeMap, BTreeSet};
use failure::{format_err, Error};
use neutopia::{self, rom, Neutopia};
use serde::{Deserialize, Serialize};
static CHECKS_DATA: &[u8] = include_bytes!("checks.json");
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[serde(rename_all = "keba... |
// Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
use error::{Error, WrapperError};
use log::{error, info, trace};
use prost::Message;
use std::convert::TryInto;
use std::ffi::{c_void, CString};
use std::io::{self};
use std::ptr::null_mut;
use std::slice;
use std::sync::Mutex;... |
use crate::message;
use crate::message::MessageId;
use crate::tracker::Peer;
use crate::utility::encode_hex;
use std::io::prelude::*;
use std::net::{SocketAddr, TcpStream};
#[allow(non_upper_case_globals)]
const pstr: &str = "BitTorrent protocol";
pub enum MessageReturn {
Have(u32),
Piece((u32, u32, Vec<u8>)... |
//! Provides functions related to factorial calculations (e.g. binomial
//! coefficient, factorial, multinomial)
use crate::error::StatsError;
use crate::function::gamma;
use crate::Result;
use core::f64::INFINITY as INF;
/// The maximum factorial representable
/// by a 64-bit floating point without
/// overflowing
p... |
use tls_codec::{SecretTlsVecU16, Serialize, TlsSliceU16, TlsVecU16, TlsVecU32};
use tls_codec_derive::{TlsSerialize, TlsSize};
#[derive(TlsSerialize, TlsSize, Debug)]
#[repr(u16)]
pub enum ExtensionType {
Reserved = 0,
Capabilities = 1,
Lifetime = 2,
KeyId = 3,
ParentHash = 4,
RatchetTree = 5,
... |
//! Syntax for literal values.
use diagnostic::Span;
use parser::{
lexer::{Delimiter, TokenKind},
Error, Parse, Parser,
};
use crate::*;
/// The different kinds of literal values that can appear in source code.
///
/// These aren't quite the same as types, since both `0` an `0x0` produce the
/// same value ... |
use crate::BAD_MESSAGE_BAN_TIME;
use ckb_logger::{debug, info, warn};
use ckb_network::{CKBProtocolContext, CKBProtocolHandler, PeerIndex};
use ckb_protocol::{get_root, TimeMessage};
use ckb_util::RwLock;
use flatbuffers::FlatBufferBuilder;
use std::collections::VecDeque;
use std::sync::Arc;
const TOLERANT_OFFSET: u64... |
//! Defines a matrix-matrix multiply kernel.
#![allow(dead_code)]
#![cfg(feature = "real_gpu")]
use lazy_static::lazy_static;
use rand::Rng;
use std::sync::Arc;
use telamon::explorer::choice::ActionEx;
use telamon::search_space::*;
use telamon::{explorer, helper, ir};
use telamon_cuda as cuda;
lazy_static! {
/// ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.