text stringlengths 3.09k 13.9k |
|---|
#[doc = "Reader of register EM4WUEN"]
pub type R = crate::R<u32, super::EM4WUEN>;
#[doc = "Writer for register EM4WUEN"]
pub type W = crate::W<u32, super::EM4WUEN>;
#[doc = "Register EM4WUEN `reset()`'s with value 0"]
impl crate::ResetValue for super::EM4WUEN {
type Type = u32;
#[inline(always)]
fn reset_va... |
//! A native rust implementation of a HyperBitBit algorithm introduced by
//! by <NAME> in [AC11-Cardinality.pdf](https://www.cs.princeton.edu/~rs/talks/AC11-Cardinality.pdf)
//!
//! # Feature
//! * HyperBitBit, for N < 2^64
//! * Uses 128 + 8 bit of space
//! * Estimated cardinality withing 10% or actuals for large N.... |
use crate::wrappers;
use proc_macro::TokenStream;
use quote::{format_ident, quote};
use syn::{parse::ParseStream, parse_macro_input, Ident, Token, Type};
pub fn extendr_module(item: TokenStream) -> TokenStream {
let module = parse_macro_input!(item as Module);
let Module {
modname,
fnnames,
... |
use std::cell::Cell;
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::time::Instant;
use log::debug;
/// Represents the core loop for the duration of the game.
///
/// # Example
///
/// ```
/// # use ::gameloop::*;;
/// // run at 20 ticks per second
/// let game_loop = GameLoop::new(20, 5).unwrap()... |
//! Tools to manage a workspace (update, check, status, ...)
mod apply;
mod check;
mod download;
pub mod progress;
mod updater;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use futures::prelude::*;
use serde::{Deserialize, Serialize};
use serde_json;
pub use self::check::CheckError;
pub use self::check:... |
//! # Futex
//! Futex or Fast Userspace Mutex is "a method for waiting until a certain condition becomes true."
//!
//! For more information about futexes, please read [this](https://eli.thegreenplace.net/2018/basics-of-futexes/) blog post, and the [futex(2)](http://man7.org/linux/man-pages/man2/futex.2.html) man page
... |
use iced_graphics::Viewport;
use iced_native::keyboard;
use iced_native::Debug;
use std::marker::PhantomData;
use crate::{Application, Color, Point, Size};
use baseview::WindowScalePolicy;
/// The state of a windowed [`Application`].
#[derive(Debug)]
pub struct State<A: Application + Send> {
background_color: Co... |
use crate::{Color, Position, Scale};
use anim::{animation::Interpolation, transition::Transition};
use core::{prefab::Prefab, Ignite, Scalar};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
pub type CharacterStyle = Transition<String>;
#[derive(Ignite, Debug, Clone, Serialize, Deserialize)]
pub s... |
use merlin::Transcript;
use crate::constraints::Commitment;
use crate::encoding;
use crate::encoding::SliceReader;
use crate::errors::VMError;
use crate::predicate::Predicate;
use crate::types::{Data, Value};
/// Prefix for the data type in the Output Structure
pub const DATA_TYPE: u8 = 0x00;
/// Prefix for the valu... |
/*
* Copyright 2018 ProximaX Limited. All rights reserved.
* Use of this source code is governed by the Apache 2.0
* license that can be found in the LICENSE file.
*/
use {::std::fmt, failure::_core::any::Any, serde_json::Value};
use crate::{
models::{
account::{Account, PublicAccount},
asset_... |
use std::fs;
use anyhow::{Result, Context};
use std::path::PathBuf;
use rusqlite::{params, Connection, OptionalExtension};
use std::fs::File;
use xml::reader::{EventReader, XmlEvent, ParserConfig};
use std::io::BufReader;
use epub::doc::EpubDoc;
use std::time::SystemTime;
#[derive(Debug, Clone)]
struct BookMeta {
... |
use crate::bullet::{Bullet, Owner};
use crate::frame::{Drawable, Frame};
use crate::{NUM_COLS, NUM_ROWS};
use rand::rngs::ThreadRng;
use rand::Rng;
use rusty_audio::Audio;
use rusty_time::timer::Timer;
use std::cmp::max;
use std::time::Duration;
// Individual aliens
pub struct Alien {
x: usize,
y: usize,
}
impl A... |
/*
* @Date: 2021-11-09 01:24:20
* @Author: <NAME>
* @LastEditors: <NAME>
* @LastEditTime: 2021-11-09 02:18:54
*/
struct Solution;
// impl Solution {
// pub fn find_min_step(mut board: String, hand: String) -> i32 {
// const MAX_COUNT: i32 = 6;
// fn remove_consecutive(s: &str) -> String {
// ... |
//! This module provides the backend API for the game logic
mod ascii_art;
mod dictionary;
pub mod game;
mod image;
mod secret;
use crate::dictionary::ConfigParseError;
use crate::dictionary::Dict;
use crate::game::Game;
use crate::game::State;
use crate::image::Image;
pub const VERSION: Option<&'static str> = option... |
#![feature(exclusive_range_pattern)]
#![feature(inclusive_range_syntax)]
#![feature(drop_types_in_const)]
#![feature(integer_atomics)]
#![feature(range_contains)]
#![feature(relaxed_adts)]
#![feature(box_syntax)]
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate clap;
extern crate clock_ticks;
extern crat... |
use std::f64::consts::PI;
use num_complex::Complex64;
use ndarray::{Array2, arr2};
#[derive(Clone)]
pub struct BlgMoireModel {
w: f64,
hbar_v: f64,
u: f64,
t: Array2<Complex64>,
sigma_t: Vec<Array2<Complex64>>,
sigma_b: Vec<Array2<Complex64>>,
}
impl BlgMoireModel {
pub fn new(theta: f64, ... |
use std::fmt;
use std::ops::Deref;
use chrono::{Datelike, TimeZone, Utc};
use serde::de::Visitor;
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use crate::types::dates::DBDateTime;
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct DBDate(pub chrono::Date<Utc>);
impl DBDate {
// CONSTRUCTORS... |
#![allow(unused)]
pub extern crate libc;
use super::session;
use std::mem::size_of;
#[repr(C)]
pub enum ssh_known_hosts {
SshKnownHostsError = -2,
SshKnownHostsNotFound = -1,
SshKnownHostsUnknown = 0,
SshKnownHostsOk,
SshKnownHostsChanged,
SshKnownHostsOther,
}
#[repr(C)]
pub enum ssh_result {... |
use super::{Out, OUT, ROUTE};
use crate::*;
use log::*;
use serde::Deserialize;
use std::{
collections::HashMap,
io::BufRead,
net::{IpAddr, Ipv4Addr, Ipv6Addr},
sync::Arc,
};
use treebitmap::IpLookupTable;
#[derive(Debug, Clone, Deserialize)]
struct RouteRaw {
#[serde(default)]
tag: Vec<String>... |
use std::fmt;
use std::fs::File;
use std::io::{prelude::*, BufReader};
use std::time::Instant;
const FILE: &str = "/home/markus/dev/skolarbete/eitn45/HandIn2/alice29.txt";
const BYTES: usize = 152_089;
#[derive(Debug, Eq, PartialEq)]
enum Type {
Byte,
Node,
}
struct Leaf {
ch: u8,
freq: u32,
leaf... |
use config::ConfOpts;
use failure::Error;
use htmlescape::decode_html;
use std::time::Duration;
use humansize::{file_size_opts as options, FileSize};
use image::{gif, jpeg, png, ImageDecoder};
use itertools::Itertools;
use mime::{Mime, HTML, IMAGE, TEXT};
use regex::Regex;
use reqwest::header::{ACCEPT_LANGUAGE, CONTENT... |
use crate::grabber::{
identify_byte_range, ByteRange, GrabError, GrabMetadata, GrabbedContent, GrabbedElement,
LineRange, MetadataSource, Slot,
};
use buf_redux::{policy::MinBuffered, BufReader as ReduxReader};
use indexer_base::{progress::ComputationResult, utils};
use std::{
fs,
io::{BufRead, Read, Se... |
use std::str::Chars;
/// https://beta.rustgym.com/longest-common-prefix/
/// TODO Update this from https://github.com/warycat/leetcode_rs/blob/master/src/_14_longest_common_prefix.rs
/// as the author indicated on discord that the git repo version is better
fn longest_common_prefix(strs: &[String]) -> String {
... |
/*!
One-line description.
More detailed description, with
# Example
*/
use crate::error::{Error, ErrorKind};
use crate::eval::{Environment, Evaluate, Expression};
use crate::read::syntax_str::{SYNTAX_CHAR_PREFIX, SYNTAX_HEX_CHAR_PREFIX};
use crate::types::new_type::NewType;
use crate::types::{MutableRef, SchemeRepr... |
//! Interface to the Tegra210 RTC and the timers.
//!
//! # Description
//!
//! The Real-Time Clock (RTC) module maintains seconds and milliseconds counters,
//! and five alarm registers. The RTC is in the 'always on' power domain, allowing
//! for the counters to run and alarms to trigger when the system is in low-pow... |
/*!
One-line description.
More detailed description, with
# Example
*/
use crate::config::current_configuration;
use crate::error::ErrorKind;
use crate::error::Result;
use crate::name::Name;
use crate::package::install::Action;
use crate::{Installable, Options};
use serde::export::Formatter;
use serde::{Deserialize... |
use std::task::{Context, Poll};
use bytes::{Buf, Bytes};
use futures::future::BoxFuture;
use http::{
header::{HeaderValue, CONTENT_ENCODING, CONTENT_TYPE},
Request, StatusCode, Uri,
};
use hyper::Body;
use snafu::ResultExt;
use tower::Service;
use vector_common::internal_event::BytesSent;
use vector_core::{
... |
/*
MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distrib... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct LegComplexEventRelativeDate {
/// LegComplexEventDateUnadjusted
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "41389")]
pub leg_complex_event_date_unadjusted: Option<fix_common:... |
use crate::make::match_points_to_lanes;
use crate::raw::{RawBusRoute, RawBusStop};
use crate::{
BusRoute, BusRouteID, BusStop, BusStopID, LaneType, Map, PathConstraints, PathRequest, Position,
};
use abstutil::Timer;
use geom::{Distance, HashablePt2D};
use std::collections::{BTreeMap, HashMap, HashSet};
struct Mat... |
// Copyright 2019. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use mi::logger::debugln;
use crate::gallery::GalleryImages;
use crate::gallery::Image;
use crate::gallery::Picture;
// use crate::mi::fs::clean_basename;
use crate::mi::img::Resolution;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use threadpool::ThreadPool;
#[derive(Debug)]
pub struct CollectionInput ... |
use std::fs::File;
use reqwest::blocking::Client;
use std::path::{PathBuf};
use std::fs;
use std::io;
use crate::dbang_utils;
pub fn get_deno_binary(version: &str) -> PathBuf {
let deno_bin_path = get_deno_home(version).join("deno");
if !deno_bin_path.exists() {
println!("{} not found and begin to inst... |
use std::{
collections::{BTreeMap, HashMap},
fs,
io::{stdout, BufRead, Write},
time::Duration,
};
use crossterm::style::Color;
use crossterm::{
cursor,
event::{poll, read, Event as CTEvent, KeyCode, KeyEvent, KeyModifiers},
execute, queue,
style::{self, Print},
terminal::{self, Clea... |
pub mod visit;
use std::ops::RangeInclusive;
use itertools::Itertools;
use rustc_hash::FxHashMap;
use crate::{
AstNode, Direction, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxNodePtr, TextRange, TextUnit,
};
/// Returns ancestors of the node at the offset, sorted by length. This should
/// do the right thing ... |
use arrayvec::ArrayVec;
use num_bigint::BigUint;
use num_traits::identities::Zero;
/// Type for indexing leaves of a sparse merkle tree
pub trait LeafIndex {
/// Path from root to leaf
// TODO: Return type can be arrayvec?
fn to_leaf_path(&self, arity: u8, tree_depth: usize) -> Vec<u8>;
}
/// When sparse ... |
use std::cmp::Reverse;
use std::io::BufRead;
use std::io::BufReader;
use std::io::Read;
use itertools::Itertools;
use regex::Regex;
use common::Solution;
#[derive(Default, Debug, Eq, PartialEq, Clone)]
struct Group {
power: u32,
count: u32,
hp: u32,
initiative: i32,
damage: String,
weaknesses... |
// 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 fidl::endpoints::Proxy;
use fidl_fuchsia_bluetooth_bredr as bredr;
use fuchsia_bluetooth::{profile::ValidScoConnectionParameters, types::PeerId};
use f... |
#![windows_subsystem = "windows"]
use atrofac_libgui::engine::Engine;
use atrofac_libgui::system::{
new_system_interface, MenuItem, MenuItemIdx, MenuItemState, StringMenuItem, SystemEvent,
SystemInterface,
};
use atrofac_library::AfErr;
use log::info;
use std::borrow::Cow;
use std::convert::TryFrom;
use std::t... |
use std::{env, path::PathBuf, io::ErrorKind, fmt::Debug};
use super::*;
/// Result type used by the module loader.
pub type ModuleResolveResult = Result<RantProgram, ModuleResolveError>;
/// Represents the features required for a module resolver.
///
/// A module resolver only resolves the `RantProgram` that the fin... |
// Copyright © 2020 <NAME>.
//
// 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 th... |
use std::ptr::NonNull;
use std::sync::Arc;
use crate::aliases::WinResult;
use crate::co;
use crate::enums::HwndPlace;
use crate::funcs::PostQuitMessage;
use crate::gui::traits::{baseref_from_parent, Child, hwndref_from_child, Parent};
use crate::gui::very_unsafe_cell::VeryUnsafeCell;
use crate::handles::{HDWP... |
use crate::api::context::{
HttpTextExtract, HttpTextFormat, HttpTextInject, ToHttpText, TryFromHttpText,
};
use crate::api::trace::span_context::{
Entry, SpanContext, SpanId, TraceId, TraceOption, TraceState,
};
use crate::api::trace::trace_context::TraceContext;
const TRACEPARENT: &str = "traceparent";
const ... |
// This file contains an implementation of Eq / PartialEq for OpLog. The implementation is quite
// complex because:
//
// - Operation logs don't have a canonical ordering (because of bubbles)
// - Internal agent IDs are arbitrary.
//
// This implementation of Eq is mostly designed to help fuzz testing. It is not optim... |
use crate::{Error, ast::Expr, message::{ErrorType, MessageDispatcher}};
use std::collections::HashMap;
use std::collections::HashSet;
use uuid::Uuid;
use self::builder::OperatorBuilder;
use self::builder::OperatorDef;
mod builder;
macro_rules! corrupt_layer {
($e:expr,$s:ident) => {{
match $e {
... |
use std::{
collections::{HashMap, HashSet},
fmt::Debug,
};
use common::prelude::*;
use log::{debug, trace};
use nom::{
branch::alt,
bytes::complete::tag,
character::complete::multispace0,
combinator::{all_consuming, map, value},
multi::{many1, separated_list1},
sequence::{separated_pair... |
use crate::render_buffer::RenderBuffer;
use rusttype::{point, Font, Scale};
use crate::pixel::Pixel;
use crate::axisalignedrectangle::AxisAlignedRectangle;
use std::fs::File;
use std::io::Read;
use std::collections::HashMap;
#[derive(Debug)]
pub struct RenderContext{
fonts: HashMap<String, Option< Font<'static> >>,
... |
use crate::{error::Error, SyncRobot};
use serde::{Deserialize, Serialize};
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
#[derive(Debug, Deserialize)]
pub enum Status {
#[serde(rename = "ready")]
Ready,
/// Server is being provisioned or otherwise unavailable
#[serde(rename = "in progress")]
InProgre... |
use anchor_lang::prelude::*;
use crate::error::*;
use crate::math::amm;
use crate::math::casting::{cast, cast_to_i128, cast_to_i64, cast_to_u128};
use crate::math_error;
use crate::MARK_PRICE_PRECISION;
use solana_program::msg;
#[account(zero_copy)]
pub struct Markets {
pub markets: [Market; 64],
}
impl Default ... |
pub fn readline() -> String {
let mut buf: String = String::new();
std::io::stdin().read_line(&mut buf).unwrap();
buf
}
pub fn read_int() -> i64 {
readline().trim().parse::<i64>().unwrap()
}
#[derive(Default)]
pub struct Scanner {
buffer: Vec<String>,
}
/// ```
/// let mut sc: S... |
use anyhow::ensure;
use bellperson::gadgets::boolean::{self, AllocatedBit, Boolean};
use bellperson::{ConstraintSystem, SynthesisError};
use paired::Engine;
use crate::error;
pub const NODE_SIZE: usize = 32;
/// Returns the start position of the data, 0-indexed.
pub fn data_at_node_offset(v: usize) -> usize {
v ... |
//! Decoder-based structs and traits.
mod decoder;
mod impl_core;
mod impl_tuples;
mod impls;
use self::read::{BorrowReader, Reader};
use crate::{
config::{Config, InternalLimitConfig},
error::DecodeError,
utils::Sealed,
};
pub mod read;
pub use self::decoder::DecoderImpl;
/// Trait that makes a type a... |
//! Pretty printing ASTs in Eucalypt syntax (i.e. writing Eucalypt)
use crate::syntax::ast::*;
use crate::syntax::lexer;
use pretty::RcDoc;
/// Express AST as eucalypt, pretty printing to string.
pub fn express<I>(expr: &I) -> String
where
I: ToSourceDoc,
{
let doc = expr.source_doc();
let mut w = Vec::new... |
// SPDX-License-Identifier: Apache-2.0
//! The `sev` crate provides an implementation of [AMD Secure Encrypted
//! Virtualization (SEV)](https://developer.amd.com/sev/) APIs.
//!
//! The Linux kernel exposes two technically distinct AMD SEV APIs:
//!
//! 1. An API for managing the SEV platform itself
//! 2. An API for... |
use bevy::app::{AppBuilder, EventWriter, Plugin};
use bevy::core::prelude::Time;
use bevy::ecs::entity::Entity;
use bevy::ecs::prelude::*;
use bevy::math::{Vec3, vec3};
use bevy::prelude::{DespawnRecursiveExt, Transform, Visible};
use crate::util::{Z_CARD, Z_CARD_DRAG, Z_CARD_SWITCH};
pub struct AnimationPlugin;
pub ... |
use core::time::Duration;
use std::collections::BTreeSet;
use tokio::sync::watch;
use tokio::time::Instant;
use crate::core::ServerState;
use crate::metrics::RaftMetrics;
use crate::raft::RaftTypeConfig;
use crate::LogId;
use crate::LogIdOptionExt;
use crate::MessageSummary;
// Error variants related to metrics.
#[d... |
use crate::{
constants::*,
traits::{Emitable, Parseable},
DecodeError, RouteMessageBuffer, ROUTE_HEADER_LEN,
};
bitflags! {
/// Flags that can be set in a `RTM_GETROUTE` ([`RtnlMessage::GetRoute`]) message.
pub struct RouteFlags: u32 {
/// If the route changes, notify the user via rtnetlink... |
#![deny(warnings)]
#![deny(unsafe_code)]
#![no_main]
#![no_std]
// pick a panicking behavior
#[cfg(not(debug_assertions))]
extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to catch panics
#[cfg(debug_assertions)]
extern crate panic_semihosting; // logs messages to the host stderr; requires a... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::cursor::Cursor;
use crate::file_format_common::*;
use proptest::prelude::*;
// verify all bytes in the vector have the high bit set except the last one
fn check_vector(buf: &[u8]) {
let mut last_byte: bool = false;
f... |
//! This program is a showcase to demonstrate how you can use grayscale textures to displace the
//! lookup location of a texture. This is commonly referred to as "displacement mapping." Here we
//! demonstrate using multiple displacement maps to offset the lookup in different directions. The
//! displacement also uses... |
//! The main application logic.
use std::path::{Path, PathBuf};
use std::process::Command;
use anyhow::{anyhow, Result};
use cargo::{
core::Workspace,
ops::CompileOptions,
util::{config::Config, important_paths, interning::InternedString},
};
use termcolor::Color;
use crate::instruments;
use crate::opt::... |
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[allow(dead_code)]
mod model;
#[allow(dead_code)]
mod my_strategy;
#[allow(dead_code)]
mod strategy;
#[allow(dead_code)]
mod examples;
use crate::my_strategy::world::World;
use crate::my_strategy::vec3::Vec3;
use crate::my_strategy::random::XorShiftRng;... |
use crate::component::{container::AncestorsScoreSortKey, entry::TxEntry, proposed::ProposedPool};
use ckb_types::{core::Cycle, packed::ProposalShortId};
use ckb_util::LinkedHashMap;
use std::collections::{BTreeSet, HashMap, HashSet};
// A template data struct used to store modified entries when package txs
pub struct ... |
use c8y_smartrest::{
smartrest_deserializer::{get_datetime_from_file_path, SmartRestLogRequest},
smartrest_serializer::{
CumulocitySupportedOperations, SmartRestSerializer, SmartRestSetOperationToExecuting,
SmartRestSetOperationToSuccessful,
},
topic::C8yTopic,
};
use mqtt_channel::Messa... |
use std::path::Path;
use anyhow::{
anyhow,
Result,
};
use sorted_iter::{
assume::*,
SortedPairIterator,
};
use itertools::Itertools;
pub mod accession;
pub mod basic;
pub mod crs;
pub mod entry;
pub mod feedback;
pub mod go_annotation;
pub mod interacting_protein;
pub mod interacting_rna;
pub mod pr... |
//! DSL for building a light client [`Instance`]
use tendermint::{block::Height, Hash};
use crate::builder::error::Error;
use crate::components::clock::Clock;
use crate::components::io::{AtHeight, Io};
use crate::components::scheduler::Scheduler;
use crate::components::verifier::Verifier;
use crate::light_client::{Li... |
use crate::{BinaryImage, PointI32};
/// Walks the boundary of a `BinaryImage` with straight run optimization
pub struct PathWalker<'a> {
image: &'a BinaryImage,
start: PointI32,
curr: PointI32,
prev: PointI32,
prev_prev: PointI32,
length: u32,
clockwise: bool,
first: bool,
}
/// Walks ... |
use crate::project::*;
use crate::*;
use log::*;
use serde::{Deserialize, Serialize};
use serde_json;
#[derive(Serialize, Deserialize, Clone)]
pub(crate) struct CDDService {
pub bin_path: String,
pub address: String,
pub template_path: String,
pub project_path: String,
pub component_file: String,
... |
//-
// Copyright 2018, 2020 <NAME>
//
// 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 accordin... |
//! Module for handling unresolved URLs returned by the scryfall api
//!
//! Some fields of the scryfall api have URLs refering to queries that can be run to obtain more
//! information. This module abstracts the work of fetching that data.
use crate::error::Error;
use std::marker::PhantomData;
use reqwest::Client;
u... |
//! Implements size inference for `For` loops.
use ast::BuilderKind::*;
use ast::ExprKind::*;
use ast::Type::*;
use ast::*;
use exprs::*;
use util::SymbolGenerator;
struct NewAppender<'a> {
elem_type: &'a Type,
}
impl<'a> NewAppender<'a> {
fn extract(expr: &'a TypedExpr) -> Option<NewAppender<'a>> {
... |
use std::borrow::BorrowMut;
use std::convert::TryFrom;
use bytes::{Buf, BufMut, BytesMut};
use tokio::net::tcp::{ReadHalf, WriteHalf};
use tokio_util::codec::{BytesCodec, FramedRead, FramedWrite, LengthDelimitedCodec};
use crate::core::element::{Element, Serde};
use crate::core::runtime::ChannelKey;
pub(crate) mod c... |
use crate::{ctx::Limit, DekuError, DekuRead, DekuWrite};
use alloc::{boxed::Box, vec::Vec};
use bitvec::prelude::*;
impl<'a, T, Ctx> DekuRead<'a, Ctx> for Box<T>
where
T: DekuRead<'a, Ctx>,
Ctx: Copy,
{
/// Read a T from input and store as Box<T>
fn read(
input: &'a BitSlice<Msb0, u8>,
... |
//! This module contains implementation of a mouse manager and related utilities.
use crate::prelude::*;
pub mod event;
use crate::control::callback;
use crate::system::web;
use std::cell::RefCell;
use std::rc::Rc;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen::prelude::Closure;
pub use eve... |
#![doc = include_str!("../README.md")]
use std::fs;
use std::fs::File;
use std::io::ErrorKind;
use std::io::{Error, Result};
use std::ops::Range;
use memmap::{Mmap, MmapOptions};
/// Four-character code
pub type FourCC = [u8; 4];
/// FourCC for 'RIFF'
const RIFF: FourCC = [0x52, 0x49, 0x46, 0x46];
/// FourCC for '... |
use std::marker::PhantomData;
use std::ffi::CString;
use std::mem;
use std::ptr;
use std::str;
use std::iter::repeat;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use gl;
use gl::types::*;
use resource::{GLPrimitive, GPUVec};
#[path = "../error.rs"]
mod error;
/// Structure encapsulating a shader progra... |
use abstutil::Tags;
use map_model::{Direction, EditRoad, LaneSpec, LaneType};
/// Returns the index where the new lane was inserted
pub fn add_new_lane(road: &mut EditRoad, lt: LaneType, osm_tags: &Tags) -> usize {
let mut dir = Direction::Fwd;
let mut idx = 0;
match lt {
LaneType::Driving => {
... |
use std::fmt::Debug;
/// Starts a new expectation chain for the supplied expression.
#[macro_export]
macro_rules! expect {
($tested:expr) => {
$crate::blank_chain!($tested)
};
}
// Originates from the assert_matches library https://github.com/murarth/assert_matches
// Licensed under the Apache 2.0 Sof... |
use crate::b2_body::*;
use crate::b2_joint::*;
use crate::b2_math::*;
use crate::b2_settings::*;
use crate::b2_time_step::*;
use crate::private::dynamics::joints::b2_distance_joint as private;
impl<D: UserDataType> Default for B2distanceJointDef<D> {
fn default() -> Self {
return Self {
base: B2jointDef {
j... |
extern crate codegen;
extern crate heck;
extern crate prost_build;
mod client;
mod server;
use std::io;
use std::path::Path;
use heck::CamelCase;
/// Code generation configuration
pub struct Config {
prost: prost_build::Config,
build_client: bool,
build_server: bool,
}
struct ServiceGenerator {
cli... |
use std::fmt;
use std::fs;
use std::io::prelude::*;
use std::path::Path;
use log::{info, trace};
use crate::config::AppConfig;
use crate::TeachResult;
pub struct MakeTarget<'a, T, P, R>
where
T: AsRef<str>,
P: AsRef<str>,
R: AsRef<str>,
{
targets: &'a [T],
prereqs: &'a [P],
recipe: &'a [R],
}... |
use std::{
collections::{BTreeMap, BTreeSet, HashMap},
path::PathBuf,
};
use serde::{Deserialize, Serialize};
use url::Url;
use crate::{
consolidator::{ConsolidatorConfig, ConsolidatorOverride},
parser::merge_cargo_tomls,
renderer::RenderConfig,
resolver::{Resolver, ResolverConfig},
};
#[deri... |
// Zinc, the bare metal stack for rust.
// Copyright 2014 Vladimir "farcaller" Pouzanov <<EMAIL>>
// Adapted from stm32f4/pin.rs for stm32f7 by <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 c... |
use crate::{
cmd::oui::*,
traits::{TxnEnvelope, TxnFee, TxnSign, TxnStakingFee, B64},
};
use helium_api::{models::transactions::PendingTxnStatus, ouis};
use serde_json::json;
use structopt::StructOpt;
/// Updates an organizational OUI. The transaction is not
/// submitted to the system unless the '--commit' op... |
use crate::commitment_tree::sidechain_tree_alive::SidechainTreeAlive;
use crate::commitment_tree::sidechain_tree_ceased::SidechainTreeCeased;
use crate::type_mapping::{FieldElement, GingerMHTPath};
use algebra::serialize::*;
//--------------------------------------------------------------------------------------------... |
/// Partial percent-decoding.
///
/// Performs percent-decoding on a slice but can selectively skip decoding certain sequences.
///
/// # Examples
/// ```
/// # use actix_router::Quoter;
/// // + is set as a protected character and will not be decoded...
/// let q = Quoter::new(&[], b"+");
///
/// // ...but the other e... |
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
use sabre_sdk::ApplyError;
use sabre_sdk::TransactionContext;
use protos::identity::{Policy, PolicyList, Role, RoleList};
} else {
use sawtooth_sdk::messages::identity::{Policy, PolicyList, Role, RoleList};
use sawtooth_sdk:... |
use std::{fs, mem};
fn main() {
let contents = fs::read_to_string(
"/mnt/c/Users/predrag/Dropbox/Documents/Code/advent-of-code-2020/day17/input.txt",
)
.unwrap();
let cubes: Vec<Vec<char>> = contents
.trim()
.split("\n")
.map(|x| x.chars().collect())
.collect();... |
//! Cipher defined with Ring
use std::{mem, ptr};
use ring::aead::{
open_in_place, seal_in_place, Aad, Nonce, OpeningKey, SealingKey, AES_128_GCM, AES_256_GCM, CHACHA20_POLY1305,
};
use crate::crypto::{
aead::{increase_nonce, make_skey},
cipher::Error,
AeadDecryptor, AeadEncryptor, CipherResult, Ciph... |
//! The security control header is described here
use crate::mac::DecodeError;
use byte::{BytesExt, TryRead, TryWrite, LE};
/// The Security Control header
///
/// Contains fields describing the security applied to the incoming frame
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct SecurityControl {
... |
use core::iter;
use core::mem;
use core::ops;
use amd64::PhysAddr;
use amd64::apic::{ApicId, Lint, Polarity, TriggerMode};
use amd64::ioapic::IoApicId;
/// Architectural limit for the number of CPUs in a system.
pub const MAX_CPU_COUNT: usize = 256;
/// Architectural limit for the number of IO APICs in a system.
pub... |
use std::fmt;
use std::cmp;
use crate::math::field::{ add, sub, mul, ONE };
use crate::stark::hash_acc::STATE_WIDTH as ACC_STATE_WIDTH;
use super::{ NUM_OP_BITS, NUM_LD_OPS, MIN_STACK_DEPTH };
// CONSTANTS
// ================================================================================================
const OP_CODE... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright 2018-2020 Airalab <<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
//
// ... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::ops::Deref;
use std::rc::Rc;
use wayland_server::protocol::wl_touch::WlTouch;
use wayland_server::{Filter, Main};
use crate::backend::input::TouchSlot;
use crate::utils::{Logical, Point};
use crate::wayland::seat::wl_surface::WlSurface;
use crate::waylan... |
//! # WorkerHandler
//!
//! ...
use crate::ClientList;
use chttp::HttpClient;
use log::{info, warn};
use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
/// `Order` struct ...
#[derive(Debug, Deserialize, Serialize)]
struct ... |
use readwrite_comp::{ExtWrite,ExtRead};
use std::io::Write;
use rand::thread_rng;
use rand::Rng;
use std::io::Cursor;
use keyval::{KeyVal};
use keyval::{Attachment,SettableAttachment};
//use utils;
use transport::LocalAdd;
use shadow::{
ShadowTest,
};
#[cfg(test)]
use shadow::{
shadower_test,
};
use shadow::{
... |
use std::process;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::collections::HashMap;
use std::collections::HashSet;
use std::time::Duration;
use std::thread;
use std::iter::FromIterator;
extern crate regex;
use regex::Regex;
extern crate may;
use may::sync::mpmc::{Sender, Receiver};
use std::sy... |
use crate::{BeatPair, DisplayBpm, Fraction, Measure, Note, NoteData, NoteRow, NoteType};
pub fn write_sm(data: &NoteData) -> String {
let mut output = String::new();
let mut string_tag = |tag_name: &str, from_location: &Option<String>| {
if let Some(tag) = from_location {
output.push_str(&w... |
extern crate x11;
extern crate fnv;
use x11::xlib;
use x11::xlib::{Display, Window, KeySym, XEvent};
use std::ptr;
use std::thread;
use std::os::raw::{c_int, c_uint};
use fnv::FnvHashMap;
/// X11 keysyms used as keycode for KeyBind
pub use x11::keysym;
/// Functoin to execute on KeyBind
pub type FunctionCall = fn()... |
mod wordlists;
use std::collections::HashSet;
use std::io::Write;
use std::{env, io};
use wordle_bot::WORD_LENGTH;
use wordle_bot::{Bot, Feedback};
use wordlists::{EXTRA_GUESSING_OPTIONS, POSSIBLE_SOLUTIONS};
fn main() {
let possible_solutions = POSSIBLE_SOLUTIONS.lines().collect::<HashSet<&str>>();
let ext... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.