text stringlengths 3.09k 13.9k |
|---|
use anyhow::*;
use evdev_rs::enums::EventType;
use nom::Err as NomErr;
use nom::branch::*;
use nom::bytes::complete::*;
use nom::character::complete::*;
use nom::combinator::{map, opt};
use nom::error::{ParseError};
use nom::IResult;
use nom::multi::many0;
use nom::sequence::*;
use tap::Tap;
use continue_statement::*;... |
use crate::pixel::Pixel;
use getset::Getters;
use itertools::Itertools;
use retain_mut::RetainMut;
use speedy::Writable;
use std::collections::HashMap;
use std::io::Write;
use std::net::SocketAddrV4;
use std::net::UdpSocket;
use std::num::Wrapping;
use std::time::Duration;
use zerocopy::AsBytes;
#[derive(Writable)]
st... |
//! Based on `cortex-m-template`
//!
//! https://github.com/japaric/cortex-m-template
// #![deny(missing_docs)]
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
// #![deny(warnings)]
#![feature(asm)]
#![feature(lang_items)]
#![feature(linkage)]
#![feature(naked_functions)]
#![no_std]
/// Copied... |
extern crate glutin_window;
extern crate graphics;
extern crate opengl_graphics;
extern crate piston;
use std::process;
use piston::window::WindowSettings;
use piston::event_loop::{EventSettings, Events};
use piston::input::{Button, Key, PressEvent, ReleaseEvent, RenderArgs, RenderEvent, UpdateArgs, UpdateEvent};
use... |
use crate::db::FollowersDatabase;
use crate::models::followers::FollowersList;
use crate::network::ApiClient;
use crate::printer::{
print_followers_unfollowers, print_following_metric, print_following_unfollowing,
print_follwers_metric, print_heading, print_ok,
};
use console::style;
use dialoguer::{theme::Colo... |
use core::{any::Any, ptr};
extern crate alloc;
use alloc::sync::Arc;
use alloc::vec;
use embedded_svc::storage::Storage;
use esp_idf_sys::*;
use crate::nvs::*;
use crate::private::cstr::*;
pub struct EspNvsStorage(Arc<dyn Any>, nvs_handle_t);
impl EspNvsStorage {
pub fn new_default(
default_nvs: Arc<... |
use {
crate::tab_close_button::{TabCloseButtonAction, TabCloseButton},
makepad_render::*,
};
live_register!{
use makepad_render::shader::std::*;
use crate::theme::*;
Tab: {{Tab}} {
name_text: {
instance hover: 0.0
instance selected: 0.0
fn get_color(... |
//! Various background utilities
use eframe::egui::{
self,
epaint::{RectShape, Shadow},
vec2, Color32, Painter, Pos2, Rect, Response, Shape, Stroke, Ui, Vec2,
};
use std::ops::Rem;
use crate::platform::{platform_colors, PlatformColors};
/// This will draw Ui with a background color and margins.
/// This ... |
use reqwest::Client;
use serde::{Deserialize, Serialize};
use std::fmt::Display;
/// ``` json
/// {
/// "id": 3,
/// "description": null,
/// "default_branch": "master",
/// "visibility": "internal",
/// "ssh_url_to_repo": "<EMAIL>:diaspora/diaspora-project-site.git",
/// "http_url_to_repo": "http://exampl... |
use crate::core::{
geometry::{Bounds3f, Bounds3i, IntersectP, Point3f, Point3i, Ray, Vector3i},
interaction::MediumInteraction,
medium::{HenyeyGreenstein, Medium},
pbrt::{lerp, Float},
sampler::SamplerDtRw,
spectrum::Spectrum,
transform::Transformf,
};
use derive_more::{Deref, DerefMut};
use... |
#[cfg(not(feature="KATs"))]
use crate::rng::randombytes;
use rand_core::{RngCore, CryptoRng};
use crate::{
params::*,
indcpa::*,
symmetric::*,
error::KyberError,
verify::*
};
// Name: crypto_kem_keypair
//
// Description: Generates public and private key
// for CCA-secure Ky... |
//! A data structure for aggregating spans for servicing hovers
use std::mem::MaybeUninit;
use std::collections::BTreeMap;
use crate::AtomId;
use super::local_context::LocalContext;
use crate::Span;
/// A `Spans<T>` object is created for each declaration, and maintains data on the
/// spans of objects occurring in th... |
/*
* Copyright 2018-2020 TON DEV SOLUTIONS LTD.
*
* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
* this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS I... |
// Copyright (c) 2020 , Texas Instruments.
// Licensed under the BSD-3-Clause license
// (see LICENSE or <https://opensource.org/licenses/BSD-3-Clause>) All files in the project
// notice may not be copied, modified, or distributed except according to those terms.
use clap::{App, AppSettings, Arg, SubCommand};
pub fn... |
extern crate lv2_atom as atom;
extern crate lv2_core as core;
extern crate lv2_sys as sys;
extern crate lv2_units as units;
extern crate lv2_urid as urid;
use atom::prelude::*;
use core::prelude::*;
use units::prelude::*;
use urid::prelude::*;
#[derive(PortContainer)]
struct Ports {
input: InputPort<AtomPort>,
... |
use std::{
collections::{HashMap, HashSet},
fmt,
str::FromStr,
};
use itertools::Itertools;
use crate::helpers::input_parsing::ParseError;
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
pub enum SignalNumber {
A,
B,
C,
D,
E,
F,
G,
}
impl fmt::Display for SignalNumber {
... |
use solana_vote_api::vote_state::MAX_LOCKOUT_HISTORY;
pub const MINIMUM_SLOTS_PER_EPOCH: u64 = (MAX_LOCKOUT_HISTORY + 1) as u64;
#[derive(Default, Debug, Clone, Copy, PartialEq, Deserialize, Serialize)]
pub struct EpochSchedule {
/// The maximum number of slots in each epoch.
pub slots_per_epoch: u64,
//... |
use aho_corasick::AhoCorasick;
use enum_as_inner::EnumAsInner;
#[derive(Debug, EnumAsInner)]
pub enum PatItem {
Byte(u8),
Any,
Group(String, VarType),
}
impl PatItem {
#[inline]
fn size(&self) -> usize {
match self {
PatItem::Byte(_) => 1,
PatItem::Any => 1,
... |
// @copyright
// Copyright (C) 2020 Assured Information Security, Inc.
//
// @copyright
// 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 th... |
/*******************************************************************************
*
* kit/kernel/paging/generic.rs
*
* vim:ft=rust:ts=4:sw=4:et:tw=80
*
* Copyright (C) 2015-2021, <NAME>
* Redistribution of this file is permitted under the terms of the simplified
* BSD license. See LICENSE for more information.
... |
// Copyright 2020 The Tink-Rust Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
use crate::sdl::SdlTextureManager;
use sdl2::pixels::Color;
use sdl2::rect::{Point, Rect};
use sdl2::render::{BlendMode, WindowCanvas};
use sdl2::ttf::*;
use teki_common::game::RGBA;
use teki_common::traits::Renderer;
use teki_common::utils::{consts::*, SpriteSheet};
use vector2d::Vector2D;
pub struct SdlRenderer {
... |
pub enum Text<'a> {
EmptyString,
Settings,
Affinities,
CodeNow,
Schedule,
Security,
Messages,
AffinitiesTableDescription,
NoMatchingUsersFound,
ExtendYourLanguageSelection,
YourCurrentWeeklySchedule,
SetYourAvailability,
YouHaventScheduled,
ChatWith(&'a str),
... |
//! http-client implementation for fetch
use super::{Body, HttpClient, Request, Response};
use futures::future::BoxFuture;
use futures::prelude::*;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
/// WebAssembly HTTP Client.
#[derive(Debug)]
pub struct WasmClient {
_priv: (),
}
impl WasmClient ... |
use crate::compiling::v1::assemble::prelude::*;
/// Compile a binary expression.
impl Assemble for ast::ExprBinary {
fn assemble(&self, c: &mut Compiler<'_>, needs: Needs) -> CompileResult<Asm> {
let span = self.span();
log::trace!("ExprBinary => {:?}", c.source.source(span));
log::trace!(
... |
use wasmparser::Parser;
use wasmparser::Payload::CodeSectionEntry;
use wasmparser::Payload::GlobalSection;
use wasmparser::Payload::MemorySection;
use wasmparser::Payload::ImportSection;
use wasmparser::ImportSectionEntryType;
use wasmparser::Operator::{GlobalSet, GlobalGet};
use indicatif::ProgressIterator;
use std:... |
// Copyright 2016 <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, ... |
#[allow(unused_imports)]
use fluvio_command::CommandExt;
use crate::test_meta::{TestCase, TestOption, TestResult};
use crate::test_meta::environment::{EnvDetail, EnvironmentSetup};
use crate::test_meta::derive_attr::TestRequirements;
use fluvio::{Fluvio, FluvioError};
use std::sync::Arc;
use fluvio::metadata::topic::To... |
use std;
use libc;
pub trait Sexp {
/* checked converters */
fn as_bool(&self) -> Option<bool>;
fn as_fixnum(&self) -> Option<isize>;
fn as_flonum(&self) -> Option<f32>;
fn as_char(&self) -> Option<char>;
fn as_string(&self) -> Option<&str>;
fn as_bytes(&self) -> Option<&[u8]>;
// fn as... |
use std::{convert::TryInto, mem};
use crate::tunnel::{proto::*, Error};
use bytes::{Buf, BufMut, Bytes, BytesMut};
use futures::{sink::SinkExt, stream::TryStreamExt, Sink, Stream};
use tokio::{
io,
io::{AsyncRead, AsyncWrite},
};
use tokio_util::codec::length_delimited::LengthDelimitedCodec;
fn parse_client_h... |
use std::cmp::{Ord, Ordering, PartialOrd};
use std::collections::btree_map::Entry;
use std::collections::{BTreeMap, BTreeSet, VecDeque};
use std::fmt::Debug;
use std::iter;
use failure::Fail;
use serde::{Deserialize, Serialize};
use crate::hash::{compute_hash, Error as HashError, Hash};
/// A peer node's unique iden... |
use nalgebra::base::DMatrix;
use nalgebra::base::DVector;
use nalgebra::Complex;
use rand::distributions::Standard;
use rand::prelude::*;
use rand_pcg::Pcg64;
use plotters::prelude::*;
const OUT_FILE_NAME: &str = "out/dist.gif";
const FRAME_DELAY: u32 = 10;
// After a bit of trial and error, I like this one.
const R... |
use std::cmp::max;
use hashbrown::HashMap;
struct CacheEntry<K, V> {
key: K,
value: V,
index: usize,
}
const DEFAULT_MOVE: usize = 50;
struct Lru<K> {
ring: Vec<K>,
top: usize,
max_pointer: usize,
move_ratio: usize,
min_update_distance: usize,
min_update_l... |
// Copyright 2019 nblistener 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>, at your
//... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control Register"]
pub qspi_cr: crate::Reg<qspi_cr::QSPI_CR_SPEC>,
#[doc = "0x04 - Mode Register"]
pub qspi_mr: crate::Reg<qspi_mr::QSPI_MR_SPEC>,
#[doc = "0x08 - Receive Data Register"]
pub qspi_rdr: crate::Reg<qsp... |
use std::{
path::{self, PathBuf},
sync::Arc,
};
use anyhow::Error;
use futures::executor::ThreadPool;
use log::info;
use regex::RegexBuilder;
use structopt::StructOpt;
mod utils;
use crate::utils::display::{DisplayTerminal, Format, PathFormat};
use crate::utils::filters::Filters;
use crate::utils::grep;
use ... |
//! Module to provide pulse shaping features.
use crate::filter::fir::*;
use crate::prelude::*;
use num::complex::Complex;
use num::Zero;
use num_traits::Num;
/// A node that implements a pulse shaping filter of a specified sort.
///
/// This node type is really a combination of a couple of the other existing
/// nod... |
// Copyright 2019 <NAME><<EMAIL>>
//
// 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... |
use crate::{
error::SdkError,
mp::event::{
xmlutil::{get_number_from_root, get_text_from_root},
ReceivedMessageParser,
},
SdkResult,
};
pub struct SendPicsEvent {
pub event_key: String,
pub count: u16,
pub pic_md5_sum_list: Vec<String>,
}
impl ReceivedMessageParser for Send... |
#![allow(dead_code)]
const ICON_LEFT_OPEN_BIG: &str = "\u{e761}";
const ICON_RIGHT_OPEN_BIG: &str = "\u{e762}";
const ICON_DOWN_OPEN_MINI: &str = "\u{e760}";
const ICON_UP_OPEN_MINI: &str = "\u{e763}";
use crate::entity::Entity;
use crate::events::*;
use crate::state::style::*;
use crate::{PropSet, State, WindowEven... |
extern crate serde;
use std;
use std::fmt::{self, Debug, Display};
use serde::{de};
use serde::ser::{self,Serialize, Serializer, SerializeMap};
use std::io;
pub type Result<T> = ::std::result::Result<T, Error>;
pub struct Error {
pub err: Box<ErrorImpl>,
}
pub enum ErrorCode {
Eof,
Io(io::Error),
Me... |
use std::path::Path;
use std::path::PathBuf;
use std::io;
use std::fs;
use std::fs::File;
use std::io::Write;
use crate::error::{Error};
use crate::new_io_error;
/// Abstracts directory containing keys
// TODO(mkl): Maybe it should be more specific like LndHome or BitcoindHome
#[derive(Debug, Clone)]
pub struct Home ... |
extern crate i2cdev;
#[macro_use] extern crate log;
use i2cdev::core::I2CDevice;
use std::{thread, time};
const COMMAND_STOP: u8 = 0x00;
const COMMAND_PLAY_TRACK: u8 = 0x01;
const COMMAND_PLAY_FILENUMBER: u8 = 0x02;
const COMMAND_PAUSE: u8 = 0x03;
const COMMAND_PLAY_NEXT: u8 = 0x04;
const COMMAND_PLAY_PREVIOUS: u8 = ... |
//! Rust implementation of the Fizyr RPC procotol.
//!
//! The Fizyr RPC protocol is a request/response protocol,
//! with bi-directional feedback as long as a request is open.
//! Additionally, you can send individual stream messages that do not initiate a request.
//!
//! # Overview
//!
//! ## Peer and PeerHandle
//!... |
use crate::IntSpan;
use regex::Regex;
use std::collections::{BTreeMap, HashMap};
#[derive(Default, Clone)]
pub struct Range {
name: String,
chr: String,
strand: String,
start: i32,
end: i32,
others: BTreeMap<String, String>,
}
impl Range {
// Immutable accessors
pub fn name(&self) -> &... |
use std::collections::{BTreeSet, HashMap, HashSet};
use std::fs::File;
use std::io;
use std::io::Read;
pub fn show_freq(freq: &HashMap<char, usize>) {
let mut by_freq = Vec::from_iter(freq.iter());
by_freq.sort_by_key(|(_, v)| *v);
by_freq.reverse();
println!("Letter | Count");
for (letter, count) ... |
extern crate sdl2;
use sdl2::pixels::{Color};
use super::globals::*;
use sdl2::gfx::primitives::DrawRenderer;
use sdl2::keyboard::{Scancode};
use super::shooting::Shot;
pub struct RocketShip {
x: f32,
y: f32,
semi_width: f32, // the distance from center to edges
semi_height: f32, ... |
use crate::error::{Error, Result};
use crate::raw;
use crate::{IoctlFlags, Uffd};
use bitflags::bitflags;
use nix::errno::Errno;
cfg_if::cfg_if! {
if #[cfg(any(feature = "linux5_7", feature = "linux4_14"))] {
bitflags! {
/// Used with `UffdBuilder` to determine which features are available in t... |
pub use super::*;
#[derive(Debug)]
enum InnerEvent<T> {
NewPeer {
id: Id,
stream: Arc<TcpStream>,
shutdown: Receiver<()>,
},
Data((Id, T)),
}
/// The wrapper event for the server.
/// It allow you to know when there is a new connection, a data or and drop receive by the server
#[de... |
use crate::data::{PInputData, POutputData};
use crate::score::Action::{Driving, Waiting};
use nom::lib::std::collections::VecDeque;
use ahash::AHashMap;
use fxhash::FxBuildHasher;
use indexmap::IndexMap;
use log::debug;
type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;
pub(crate) type Score = usize;
type Street... |
use std::any::Any;
use std::fmt::Debug;
use std::ops::Range;
use gfx_hal::{Backend, MemoryProperties, MemoryType, MemoryTypeId};
use gfx_hal::memory::{Properties, Requirements};
use {MemoryAllocator, MemoryError};
use block::Block;
use combined::{CombinedAllocator, CombinedBlock, Type};
/// Allocator that can choose... |
//! Extra algorithms over terms (e.g. substitutions)
use super::*;
use std::cmp::Ordering;
use std::fmt::{self, Display, Formatter};
/// Convert `t` to width `w`, though unsigned extension or extraction
pub fn to_width(t: &Term, w: usize) -> Term {
let old_w = check(t).as_bv();
match old_w.cmp(&w) {
O... |
use std::{
fs,
path::{Path, PathBuf},
};
use color_eyre::eyre::{Context, Result};
use displaydoc::Display;
use git2::Repository;
use log::{debug, error, info, trace};
use rayon::prelude::*;
use thiserror::Error;
use walkdir::WalkDir;
use self::GenerateGitError as E;
use super::GENERATED_PRELUDE_COMMENT;
use c... |
use serde::Serialize;
use crate::{bodies, cpu::sim_cpu};
#[derive(Debug, Serialize)]
pub struct SolarObjectOut {
pub name: String, // Name of the solar object
pub sim_time: f64, // Simulation time
pub x_coord: f32, // Coordinate of object in the x axis
pub y_coord: f32, // Coordinate of obj... |
use std::clone::Clone;
use std::cmp::Eq;
use std::cmp::PartialEq;
use std::convert::TryInto;
use std::io;
use std::io::Write;
use std::process;
use std::vec;
struct Area {
rows: usize,
columns: usize,
data: Vec<u8>
}
impl Clone for Area {
fn clone(&self) -> Self {
let capacity = self.rows * self.column... |
use std::io::{Cursor, Seek, SeekFrom};
use crate::meta::make_row_from_dicom_metadata;
use dicom::object::StandardDataDictionary;
use dicom::object::{self as dicom_object, DefaultDicomObject};
use indexmap::IndexMap;
use nu_errors::ShellError;
use nu_plugin::Plugin;
use nu_protocol::{
CallInfo, ColumnPath, Primiti... |
mod segment;
use segment::*;
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = console)]
fn log(s: &JsValue);
}
#[wasm_bindgen]
pub struct Graph {
points: Vec<Point>,
segments: Vec<Segment>,
matrix: Vec<Vec<Option<usize>>... |
use futures::{Async, Future, Stream};
use hotwatch::{
blocking::{Flow, Hotwatch},
Event,
};
use log::Level;
use tokio::timer::Interval;
use std::collections::HashMap;
use std::rc::{Rc, Weak};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Mutex, Once};
use std::thread;
use std::time::{Duration... |
// Definition for a binary tree node.
#[derive(Debug, PartialEq, Eq)]
pub struct TreeNode {
pub val: i32,
pub left: Option<Rc<RefCell<TreeNode>>>,
pub right: Option<Rc<RefCell<TreeNode>>>,
}
impl TreeNode {
#[inline]
pub fn new(val: i32) -> Self {
TreeNode {
val,
lef... |
use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{Field, PrimeField};
use ark_std::{rand::Rng, sync::Mutex, One, UniformRand, Zero};
use rayon::prelude::*;
use std::ops::MulAssign;
/// PairingCheck represents a check of the form e(A,B)e(C,D)... = T. Checks can
/// be aggregated together using ra... |
mod arm64simd;
pub mod cortex_a53;
mod cortex_a55;
//mod cortex_a72;
//mod cortex_a73;
pub use arm64simd::*;
use crate::Ops;
use crate::frame::mmm::kernel::MatMatMulKer;
use crate::frame::ElementWiseImpl;
lazy_static::lazy_static! {
static ref KIND: Kind = Kind::choose();
}
// https://en.wikipedia.org/wiki/Comp... |
use core::fmt;
use crate::internal_prelude::*;
/// System information returned by [`sysinfo()`].
#[cfg_attr(docsrs, doc(cfg(any(target_os = "linux", target_os = "android"))))]
#[derive(Copy, Clone)]
pub struct SysInfo(libc::sysinfo);
macro_rules! sysinfo_raw_getters {
($($(#[doc = $doc:literal])* $name:ident, $t... |
// Copyright 2018 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
/... |
extern crate chrono;
#[macro_use]
extern crate clap;
extern crate fern;
#[macro_use]
extern crate log;
extern crate os_info;
extern crate regex;
extern crate reqwest;
extern crate scraper;
extern crate select;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate vec_map;
us... |
use std::borrow::Cow;
use std::error::Error;
use std::str::FromStr;
use std::{fmt, io};
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u64)]
pub enum CompressionType {
None = 0,
Snappy = 1,
Zlib = 2,
Lz4 = 3,
Lz4hc = 4,
Zstd = 5,
}
impl CompressionType {
pub(cra... |
use std::fs::File;
use std::io::{self, BufRead, Read};
use std::panic::panic_any;
use std::ptr;
use std::slice;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct IoByte {
byte: u8,
eof: bool,
}
impl IoByte {
pub const EOF: IoByte = IoByte { byte: 0, eof: true };
#[inline(always)]
pub fn fro... |
//! Database used for testing `hir`.
use std::{
fmt, panic,
sync::{Arc, Mutex},
};
use hir_def::{db::DefDatabase, AssocItemId, ModuleDefId, ModuleId};
use hir_expand::{db::AstDatabase, diagnostics::DiagnosticSink};
use ra_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast};
us... |
#![allow(dead_code)]
pub const PRIORITY_CACHE_PACKED_START: u8 = 0x80; //128
pub const PRIORITY_CACHE_PACKED_END: u8 = 0xA0; // 160
pub const STRUCT_CACHE_PACKED_START: u8 = 0xA0;
pub const STRUCT_CACHE_PACKED_END: u8 = 0xB0; //176
pub const LONG_ARRAY: u8 = 0xB0;
pub const DOUBLE_ARRAY: u8 = 0xB1;
pub const BOOLEAN_A... |
//
// Copyright 2018-2019 <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 w... |
use std::collections::HashMap;
use glium::glutin;
use glutin::{MouseButton, ElementState, MouseScrollDelta};
pub (crate) struct InputHandler {
pub (crate) keys_down_previous: HashMap<String, bool>,
pub (crate) keys_down: HashMap<String, bool>,
pub (crate) mouse_pos: (f64, f64),
pub (crate) mouse_delta... |
use std::collections::HashMap;
use crate::{
get_internal_deps,
structs::package_info::{PackageInfo, PackageInfos}, PackageJsonMetadata,
};
mod get_transitive_consumers {
use std::collections::HashMap;
use crate::{
dependencies::{get_transitive_consumers, get_transitive_consumers_with_scope},
... |
#![cfg_attr(feature = "unstable", feature(test))]
#[cfg(feature = "libwebkit2gtk")]
#[macro_use]
extern crate lazy_static;
#[cfg(feature = "libwebkit2gtk")]
extern crate ammonia;
#[cfg(feature = "libwebkit2gtk")]
extern crate pulldown_cmark;
extern crate structopt;
#[cfg(feature = "libwebkit2gtk")]
extern crate syntec... |
use anyhow::Result;
use crate::MatLinAlgBound;
use super::LinAlgError;
/// Solves for a vector u[0..n-1] the tridiagonal linear set given by the equation:
pub fn tridiag<T>(a: &Vec<T>, b: &Vec<T>, c: &Vec<T>, r: &Vec<T>, u: &mut Vec<f32>) -> Result<()>
where
T: MatLinAlgBound,
{
if b[0] == T::zero() {
... |
use crate::font::Font;
use crate::util::{Buffer, ReadBuffer};
use read_buffer_derive::ReadBuffer;
/// ## `EBLC` — Embedded Bitmap Location Table
///
/// Specification: <https://docs.microsoft.com/en-us/typography/opentype/spec/eblc>.
///
/// The `EBLC` provides embedded bitmap locators. It is used together with ... |
mod cli;
mod mmap;
use crate::{
cli::Opt,
mmap::{FileMmap, SharedFileMmap},
};
use encoding::{DecoderTrap, EncodingRef};
use rayon::prelude::*;
use std::{
fs::{self, File},
io::{self, BufWriter},
path::{Path, PathBuf},
};
use structopt::StructOpt;
use zip::{read::ZipFile, ZipArchive};
// TODO: han... |
#![no_std]
#![no_main]
#![warn(unused_unsafe)]
use gd32vf103_pac::USART1;
use panic_halt as _;
#[riscv_rt::entry]
fn main() -> ! {
let mut peripherals = gd32vf103_pac::Peripherals::take().unwrap();
init_clock(&mut peripherals);
// do something here
init_ports(&mut peripherals);
// blink_led(&mu... |
mod palette;
use std::hash::Hash;
use std::mem;
use std::fmt::Debug;
use crate::packed::{PackedStorage, PackedIndex, Setter};
use crate::position::{CubePosition, LayerPosition};
pub use self::palette::Palette;
pub type IndexedCube<B> = IndexedStorage<B, CubePosition>;
pub type IndexedLayer<B> = IndexedStorage<B, Lay... |
#[macro_use]
extern crate impl_ops;
use indicatif::ProgressBar;
use rand::Rng;
use rayon::prelude::*;
use std::time::Instant;
use string_builder::Builder;
mod camera;
mod hittable;
mod hittable_list;
mod materials;
mod ray;
mod sampling;
mod sphere;
mod vec3;
const ASPECT_RATIO: f64 = 3.0 / 2.0;
const IMAGE_WIDTH: u3... |
extern crate lalrpop;
extern crate pico_args;
use std::io::Write;
use std::path::PathBuf;
use std::process;
use std::str::FromStr;
use pico_args::Arguments;
use lalrpop::Configuration;
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
const USAGE: &str = "
Usage: lalrpop [options] <inputs>...
lalrpo... |
use crate::types::CheckResult;
use std::collections::HashSet;
use std::fs;
use std::path::Path;
use toml::Value;
// This trait comes from https://github.com/gtk-rs/gir
pub trait TomlHelper
where
Self: Sized,
{
fn lookup<'a>(&'a self, option: &str) -> Option<&'a toml::Value>;
fn lookup_str<'a>(&'a self, o... |
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
use aptos_types::transaction::Version;
use schemadb::{SchemaBatch, DB};
use crate::pruner::db_pruner::DBPruner;
use aptos_infallible::Mutex;
use crate::{
pruner::{
event_store::event_store_pruner::EventStorePruner,
ledger_store::ledger_... |
use ::core::sync::atomic::{AtomicUsize,Ordering};
use super::fdt_devices;
use super::gic;
macro_rules! array {
(@1024 $($e:tt)*) => { array!(@512 $($e)*, $($e)*) };
(@512 $($e:tt)*) => { array!(@256 $($e)*, $($e)*) };
(@256 $($e:tt)*) => { array!(@128 $($e)*, $($e)*) };
(@128 $($e:tt)*) => { array!(@ 64 $($e)*, $(... |
use super::*;
use serde::{Deserialize, Serialize};
use std::ops;
use parity_codec::{Decode, Encode};
pub type EthereumAddress = [u8; 20];
#[derive(Encode, Decode, Clone, PartialEq)]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct EcdsaSignature(pub [u8; 32], pub [u8; 32], pub i8);
#[derive(Debug, Clone, Part... |
// 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... |
#![feature(test)]
extern crate test;
use anyhow::{Context as AnyhowContext, Error};
use copyless::BoxHelper;
use pretty_assertions::assert_eq;
use std::{
env, fs,
path::{Path, PathBuf},
sync::Arc,
};
use swc::Compiler;
use swc_babel_ast::File;
use swc_babel_compat::babelify::normalize::normalize;
use swc_b... |
use super::common::*;
use crate::module::_groups::cards::lookup::Side;
use dominator::{html, Dom, DomBuilder};
use futures_signals::signal::{Always, Signal, SignalExt};
use shared::domain::jig::module::body::{
ModeExt,
_groups::cards::{Card, Mode},
};
use utils::prelude::*;
use web_sys::HtmlElement;
//For the ... |
// Copyright 2020 The Exonum Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
/* Copyright (c) Fortanix, Inc.
*
* Licensed under the GNU General Public License, version 2 <LICENSE-GPL or
* https://www.gnu.org/licenses/gpl-2.0.html> or the Apache License, Version
* 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0>, at your
* option. This file may not be copied, modified, or ... |
// SPDX-License-Identifier: MIT OR Apache-2.0
//
// Copyright (c) 2020-2022 <NAME> <<EMAIL>>
//! GICD Driver - GIC Distributor.
//!
//! # Glossary
//! - SPI - Shared Peripheral Interrupt.
use crate::{
bsp::device_driver::common::MMIODerefWrapper,
memory::{Address, Virtual},
state, synchronization,
s... |
use num::*;
use sound::*;
use std::fmt;
use std::ops::{Div, Mul};
/// unison (1:1)
pub const INTERVAL_UNISON: Interval = Interval {
numerator: 1,
denominator: 1,
ratio: 1.0,
reciprocal: 1.0,
};
/// Harmonic musical interval (of frequencies), represented by a rational number.
#[derive(Debug, Copy, Clon... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::slice::Chunks;
use std::convert::TryFrom;
use bytes::BufMut;
use crypto::{
crypto_box::{PrecomputedKey, PublicKey, SecretKey},
hash::{BlockHash, ContextHash, CryptoboxPublicKeyHash, OperationListL... |
//! # Trace Provider SDK
//!
//! ## Tracer Creation
//!
//! New `Tracer` instances are always created through a `TracerProvider`.
//!
//! All configuration objects and extension points (span processors,
//! propagators) are provided by the `TracerProvider`. `Tracer` instances do
//! not duplicate this data to avoid tha... |
#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(
nonstandard_style,
rust_2018_idioms,
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links
)]
#![forbid(non_ascii_idents, unsafe_code)]
#![warn(
deprecated_in_future,
missing_copy_implementations,
... |
use std::collections::HashMap;
use std::io::Write;
use liquid_core::error::{ResultLiquidExt, ResultLiquidReplaceExt};
use liquid_core::parser::TagToken;
use liquid_core::parser::TryMatchToken;
use liquid_core::Expression;
use liquid_core::Language;
use liquid_core::Renderable;
use liquid_core::Runtime;
use liquid_core... |
use std::{pin::Pin, sync::Arc};
use async_trait::async_trait;
use futures::{
future, ready, stream,
stream::{BoxStream, FusedStream, SelectAll},
task::{Context, Poll},
Stream, StreamExt, TryFutureExt,
};
use tokio::sync::broadcast;
use beserial::{Deserialize, Serialize};
use crate::message::Message;
... |
//! Implement Mailchimp Authorized Apps Endpoint
//!
//! Manage registered, connected apps for your Mailchimp account with the Authorized Apps endpoints.
//!
//! ```
//! use mailchimp::{AuthorizedApps, AuthorizedFilter, MailchimpApi};
//! use std::collections::HashMap;
//!
//! fn main() {
//! let ap... |
extern crate proj_self;
#[derive(Debug, Clone, Eq, PartialEq)]
enum Status {
Clean,
Infected,
Weak,
Flagged,
}
#[derive(Debug, Clone, Eq, PartialEq)]
enum Direction {
U,
D,
L,
R,
}
#[derive(Debug, Clone, Eq, PartialEq)]
struct Carrier {
x: i32,
y: i32,
dir: Direction,
... |
use std::{
io::Stdout,
str::FromStr,
time::Duration,
};
use color_eyre::Help;
use grapl_observe::metric_reporter::MetricReporter;
use rusoto_core::{
Region,
RusotoError,
};
use rusoto_s3::S3;
use rusoto_sqs::{
ListQueuesRequest,
Sqs,
};
use sqs_executor::{
make_ten,
redis_cache::Red... |
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
use core::any::Any;
use crate::rsp::rsp::RSP;
use crate::rsp::rsp_assembler::{E, Element, GPR, RSPAssembler, VR, VSARAccumulator};
use crate::rsp::spmem::SPMEM;
use crate::tests::{Level, Test};
use crate::tests::soft_asserts::soft_assert_eq;
fn ru... |
const USAGE: &'static str = "
Usage: sieve bench
sieve --help
Sieve of Eratosthenes
A sieve finds prime numbers by first assuming all candidates are prime,
then progressively using small primes to mark their multiples composite.
Note that a given prime p only needs to start marking its multiples >=p²,
as anyt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.