text stringlengths 3.09k 13.9k |
|---|
// Copyright (C) 2018, Cloudflare, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list... |
#[doc = "Reader of register PEEK"]
pub type R = crate::R<u32, super::PEEK>;
#[doc = "Reader of field `CH0VAL`"]
pub type CH0VAL_R = crate::R<bool, bool>;
#[doc = "Reader of field `CH1VAL`"]
pub type CH1VAL_R = crate::R<bool, bool>;
#[doc = "Reader of field `CH2VAL`"]
pub type CH2VAL_R = crate::R<bool, bool>;
#[doc = "R... |
#![cfg_attr(test, allow(unused_imports))]
use crate::{
aggregator::service::{Aggregator, ServiceError, ServiceHandle},
common::client::Credentials,
};
use futures::future::{self, TryFutureExt};
use std::{
error::Error,
fmt::{Debug, Display},
future::Future,
io, iter,
pin::Pin,
time::Dura... |
use controls::{Button, Control, Label, Orientation, Root, Sizer, Slider, XY};
use serde_json::value::Value;
use failure::err_msg;
use failure::Error as FError;
use std::collections::BTreeMap;
use std::convert::TryInto;
pub enum Color {
Controls,
Labels,
Text,
Pressed,
Unpressed,
Background,
}
pub struct G... |
#![crate_name = "unsafe_ls"]
#![feature(rustc_private, slice_patterns)]
extern crate arena;
extern crate getopts;
extern crate syntax;
extern crate rustc;
extern crate rustc_back;
extern crate rustc_driver;
extern crate rustc_trans;
extern crate rustc_typeck;
use rustc::session::{self, config};
use rustc_driver::drive... |
use tonic::{Request, Response, Status};
use crate::models::{CredentialModel, UserModel};
use crate::proto::users::users_server::Users as UsersServiceTrait;
use crate::proto::users::{
find_users_request, ChangePasswordReply, ChangePasswordRequest, FindUsersReply,
FindUsersRequest, GetAllUsersReply, GetAllUsersR... |
//! Example dense net classifier with MNIST.
extern crate byteorder;
extern crate drug;
extern crate ndarray;
extern crate ron;
mod input;
use std::f32;
use std::fs::{create_dir_all, File};
use std::io::Write;
use std::path::Path;
use drug::*;
use input::{images, labels};
use ndarray::prelude::*;
static MODEL_DIR: &... |
#[doc = "Register `P2IV` reader"]
pub struct R(crate::R<P2IV_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<P2IV_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::convert::From<crate::R<P2IV_SPEC>> for R {
fn from(reader: crate::R<P2IV_SPEC>) ->... |
use std::fs::read_to_string;
use std::path::{Path, PathBuf};
use walkdir::DirEntry;
use crate::error::*;
struct PathAndStem {
path: PathBuf,
stem: String,
relative_path: String,
}
/// Looks for LICENSE and NOTICE files in `source_dir`, does some rudimentary
/// analysis, and compiles them together in a ... |
#[cfg(test)]
#[path = "../../../tests/unit/solver/population/elitism_test.rs"]
mod elitism_test;
use super::*;
use crate::algorithms::nsga2::{select_and_rank, Objective};
use crate::models::problem::ObjectiveCost;
use crate::solver::{Population, RefinementSpeed, Statistics, SOLUTION_ORDER_KEY};
use crate::utils::Rando... |
use ggez;
use ggez::conf::WindowMode;
use ggez::event::{quit, KeyCode};
use ggez::graphics::set_window_title;
use ggez::{event, graphics, input, Context, ContextBuilder, GameResult};
use std::fs;
use std::path::Path;
mod cli;
mod keypad;
mod random;
mod screen;
use chip8vm::{chip::Chip, PROGRAM_SIZE};
use keypad::*;
... |
/*
* Copyright (c) 2018 <NAME> <<EMAIL>>
* 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 std::any::type_name;
use cauchy::Scalar;
use ndarray::{Array1, ArrayBase, Axis, Data, Ix1, Ix2, OwnedRepr, RawData};
use num_traits::FromPrimitive;
use crate::{
array_ext::{RemoveAxisExt, ShapeExt},
error::LinalgError,
};
#[derive(Debug)]
pub struct LU<A, S>
where
S: Data<Elem = A>,
A: Scalar,
{
... |
//! Implementation for the reference types
// A lot is copied from <https://github.com/uuid-rs/uuid/blob/master/src/adapter/mod.rs>
use crate::{
std::{fmt, str},
Yyid,
};
/// The segments of a UUID's [u8; 16] corresponding to each group.
/// Marks indices and needs to be read as pairs.
const BYTE_POSITIONS: [... |
#![allow(unused)]
// This program is licensed under the "MIT License".
// Please see the file LICENSE in this distribution
// for license terms.
//! Advent of Code Day 12.
//! <NAME> 2019
use lazy_static::lazy_static;
use regex::Regex;
use aoc::sgn;
lazy_static! {
/// Regular expression used for parsing the i... |
mod box_context;
pub use box_context::BoxContext;
use std::sync::Arc;
use std::time::Instant;
use std::{collections::HashMap, str::FromStr};
use datafusion::prelude::*;
use async_trait::async_trait;
use serde::Serialize;
use serde_json::value::to_value;
use serde_json::Value;
use crate::extract::{DelimitedExtract,... |
use std::convert::TryFrom;
use anyhow::Result;
use crate::game::error::GameError;
use crate::game::InputCode;
const ALPHABET_0: &[char; 26] = &[
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z',
];
const ALPHABET_1: &[char; 26] =... |
use crate::error::CommonError;
use chrono::{SecondsFormat, Utc};
use crypto::hmac::Hmac;
use crypto::mac::Mac;
use crypto::sha1::Sha1;
use fehler::throws;
use nanoid::nanoid;
use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS, NON_ALPHANUMERIC};
use serde::de::DeserializeOwned;
use serde::{Deserialize, Seri... |
use std::env;
use std::error::Error;
pub mod scoop;
use self::scoop::Scoop;
mod bucket;
use self::bucket::Bucket;
mod app;
use self::app::App;
#[derive(Debug, std::cmp::PartialEq)]
pub struct Args {
pub query: String,
pub exclude_bin: bool,
}
pub fn parse_args(args: env::Args) -> Result<Args, &'static str>... |
use game_lib::{GameContext, GameInput};
use libloading::Library;
use std;
use log::*;
// TODO(JaSc): Use std::path::Paths instead of Strings for better readability
/// This helper struct provides convenience methods to load and hot-reload the game's
/// [`game_interface_glue`] shared library as well as calling the l... |
use druid::kurbo::BezPath;
use druid::{
BoxConstraints, Color, ContextMenu, Data, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx, LocalizedString,
MenuDesc, MenuItem, MouseEvent, PaintCtx, Point, Rect, RenderContext, Size, UpdateCtx, Widget,
};
use std::cell::RefMut;
use crate::commands;
use crate::data::l... |
use crate::ray::Ray4D;
use crate::tuple::Tuple4D;
use crate::matrix::Matrix4D;
use crate::world::World;
use crate::canvas::Canvas;
use crate::consts::REFLECTION_RECURSION_DEPTH;
/// A camera record for generating a canvas.
///
/// This record gives a "frame" of the world. Based on camera parameters,
/// different pers... |
//! Representations of the mumdrc configuration file.
use crate::error::ConfigError;
use crate::DEFAULT_PORT;
use log::*;
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
use std::fs;
use std::net::{SocketAddr, ToSocketAddrs};
use std::path::{Path, PathBuf};
use toml::value::Array;
use toml::Value;
//... |
//! This is the Javascript interpreter and REPL binary:
//!
//! ```sh
//! $ echo "2 + 2" | cargo run -q --bin sljs-node
//! 4
//!
//! // REPL mode (rlwrap is recommended):
//! $ $(which rlwrap) cargo run -q
//! sljs> var a = {one: 1}
//! sljs> a.one + 2
//! 3
//! ```
//!
//! It bundles Esrpima for parsing and relies on... |
//! # Summary
//!
//! This module defines external connections to other servers.
//! Responsible for forwarding messages to and from connected servers.
use serde_derive::{Serialize, Deserialize};
use tokio::prelude::*;
use tokio::net;
use crate::external;
use crate::internal;
use crate::message;
use crate::shared::Sh... |
extern crate cgmath;
extern crate clap;
extern crate game_of_life;
extern crate gl;
extern crate glutin;
mod config;
mod graphics_context;
mod render;
mod view;
use config::Config;
use game_of_life::GameOfLife;
use glutin::dpi::*;
use glutin::GlContext;
use render::Renderer;
use std::time::{Duration, Instant};
use vi... |
use crate::input::Input;
const MAX_POSITION: u64 = 10;
const SCORE_REQUIRED_PART_2: u8 = 21;
pub fn solve(input: &mut Input) -> Result<u64, String> {
let mut game = Game::parse(input.text)?;
if input.is_part_one() {
let mut die_roll_count = 0_u64;
let mut p1_score_saved = 0;
let mut p2... |
use std::env;
use std::fs;
use std::process;
use itertools::iproduct;
struct Point(isize, isize, isize, isize);
#[derive(Clone, Copy, Eq, PartialEq)]
enum State {
Active,
Inactive,
}
fn cartesian_product(hypercube: bool) -> Vec<Point> {
let wrange = if hypercube { -1..2 } else { 0..1 };
iproduct!(-1... |
#![allow(dead_code)]
use rt::Register;
use arch::page::PageTable;
use super::super::PERIPHERAL_BASE;
use core::mem;
const PIC_BASE: Register<u32> = PERIPHERAL_BASE.offset(0xB200);
const IRQ_BASIC_PENDING: Register<u32> = PIC_BASE.offset(0x00);
const IRQ_PENDING_1: Register<u32> = PIC_BASE.offset(0x04);
const I... |
mod args;
mod error;
mod interpreter;
mod parser;
mod position;
mod repl;
mod scanner;
#[cfg(test)]
mod test;
#[cfg(test)]
mod test_parser;
#[cfg(test)]
mod test_scanner;
use crate::error::{CResult, Error, ErrorKind};
use crate::interpreter::FunctionList;
use crate::position::{Pos, Span, Spanned};
use parser::{Expr, P... |
use std::io::Read;
use encoding::DecoderTrap::Replace;
use encoding::Encoding;
use encoding::all::WINDOWS_31J;
use if_let_return::if_let_some;
use crate::dictionary::DictionaryWriter;
use crate::errors::{AppError, AppResultU};
use crate::loader::Loader;
use crate::parser::eijiro::parse_line;
use crate::str_utils::{s... |
use super::SignatureScheme;
use ark_crypto_primitives::Error;
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::{
bytes::ToBytes,
fields::{Field, PrimeField},
to_bytes, ToConstraintField, UniformRand,
};
use ark_std::io::{Result as IoResult, Write};
use ark_std::rand::Rng;
use ark_std::{hash::Hash, ma... |
use std::time::Duration;
use tokio_retry::strategy::{jitter, ExponentialBackoff};
use tokio_timer::{wheel, Timer};
use client::KafkaVersion;
/// The default milliseconds after which we close the idle connections.
///
/// Defaults to 5 seconds, see
/// [`ClientConfig::max_connection_idle`](struct.ClientConfig.html#ma... |
// Copyright (c) 2018 <NAME>, RWTH Aachen University
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed exc... |
use super::lightning_address::LightningAddress;
use super::network_graph;
use std::io::Error as IoError;
use std::sync::Arc;
use std::fmt;
use dependencies::grpc::Error as GrpcError;
use dependencies::grpc::{Client, ClientStub};
use dependencies::futures::future::Future;
use structopt::StructOpt;
#[derive(Debug)]
pu... |
//! The Threads module.
//!
//! **NOTE** A Drone platform crate may re-export this module with its own
//! additions under the same name, in which case it should be used instead.
//!
//! Drone is a hard real-time operating system. It uses interrupt-based
//! preemptive priority scheduling, where tasks with same priori... |
// go to /code [DONE]
// install all deps there [DONE]
// run clippy there [DONE]
// get the output in a file [DONE]
// serialize that to json [DONE]
// write it to results.json file [DONE]
// calculate doc coverage https://crates.io/crates/cargo-doc-coverage
// count no. of deps by reading Cargo.toml? or any other way... |
use crate::config::Config;
use anyhow::{Context, Error};
use chrono::{DateTime, FixedOffset};
use reqwest::header::HeaderValue;
use reqwest::Client;
use serde::Deserialize;
#[derive(Copy, Clone, Debug)]
pub enum UserId<'a> {
Id(&'a str),
Login(&'a str),
}
#[derive(Copy, Clone, Debug)]
pub enum GameId<'a> {
... |
use std::{f64::consts::PI, sync::Arc};
use library::{
math::{Matrix, Tuple},
properties::*,
space::Plane,
space::{Camera, PointLight, Shape, Sphere, World},
Axis,
};
use sdl2_interface::Sdl2Interface;
use rand::Rng;
const SCREEN_WIDTH: u16 = 300; // height is half
const PATTERN_INDEX: Option<u32... |
use crate::{
at::{proto::client::AtSaveReq, service::Service as AtService},
auth::{
auth_claims::AuthClaims,
config::Config,
proto::server::{
AuthLoginReq, AuthLoginRes, AuthLogoutReq, AuthLogoutRes, AuthTokenReq, AuthTokenRes,
},
},
jwks::{proto::client::Jwks... |
use{
crate::*,
std::{cmp::*, convert::*}
};
#[derive(Debug)]
/// Possible errors that can occur during gluing together
/// WangLandau intervals or Entropic Sampling intervals
pub enum GlueErrors{
/// `original_hist.borders_clone()` failed
BorderCreation(HistErrors),
/// Nothing to be glued, glue in... |
// the html! macro failed to build without this
#![recursion_limit = "256"]
use anyhow;
use choosy_protocol as proto;
use std::collections::BTreeMap;
use wasm_bindgen::prelude::*;
use websocket::WebSocketStatus;
use yew::callback::Callback;
use yew::format::Json;
use yew::prelude::*;
use yew::services::websocket;
mod... |
// Copyright 2018 The Starlark in 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable la... |
use sanskrit_common::model::*;
use sanskrit_common::encoding::*;
use sanskrit_common::errors::*;
//A Block
#[derive(Copy, Clone, Debug, Parsable, Serializable, VirtualSize)]
pub struct Exp<#[AllocLifetime] 'b>(pub SlicePtr<'b, OpCode<'b>>);
//Description for a literal type
#[derive(Copy, Clone, Eq, PartialEq... |
// rpc-perf - RPC Performance Testing
// Copyright 2015 Twitter, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unle... |
//! Helper functions for using conrod with the `piston_window` crate.
//!
//! the `piston_window` crate attempts to provide a simple API over the gfx graphics backend and
//! the glutin window context and events.
extern crate piston_window;
use event;
use image;
use self::piston_window::{G2dTexture, PistonWindow};
us... |
//
//
// This file is a part of Aleph
//
// https://github.com/nathanvoglsam/aleph
//
// MIT License
//
// Copyright (c) 2020 Aleph Engine
//
// 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 Softwar... |
use super::id_generation::TicketId;
use super::recap::Status;
use chrono::{DateTime, Utc};
use std::collections::HashMap;
use std::error::Error;
/// Let's turn our attention again to our `TicketStore`.
/// We can create a ticket, we can retrieve a ticket.
///
/// Let's implement a `list` method to retrieve all tickets... |
// Copyright 2019 Twitter, Inc.
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
use crate::Ordering;
use core::fmt::Debug;
mod atomic_bool;
mod atomic_f32;
mod atomic_f64;
mod atomic_i16;
mod atomic_i32;
mod atomic_i64;
mod atomic_i8;
mod atomic_isize;
mod atomic_ptr;
... |
use heck::SnakeCase;
use proc_macro::TokenStream;
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{Ident, ItemStruct, Path, Token};
type PunctuatedQueryGroups = Punctuated<QueryGroup, Token![,]>;
pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
let arg... |
// Copyright 2014-2016 <NAME>.
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
// This file may not be copied, modified, or distributed
// except according to those terms.
//! Bounded version of Ukkonens DP algorithm for approximate pattern matching.
//! Complexity: O(n * k) on random texts.
//!... |
use std::borrow::Cow;
use super::test_text_format_pb::*;
// use protobuf::text_format::print_to_string;
fn t<F: FnMut(&mut TestTypes)>(_: &str, mut setter: F) {
let mut m = TestTypes::default();
setter(&mut m);
// validates that it compiles properly only
// assert_eq!(&*print_to_string(&m), ex... |
use super::*;
use crate::{
query_ast::*,
query_graph::{Node, NodeRef, QueryGraph, QueryGraphDependency},
ParsedInputMap, ParsedInputValue,
};
use connector::{Filter, RecordFilter};
use prisma_models::{ModelRef, PrismaValue, RelationFieldRef};
use std::{convert::TryInto, sync::Arc};
/// Adds a delete (singl... |
use web_sys::HtmlInputElement;
use yew::prelude::*;
use yew_hooks::prelude::*;
use yew_router::prelude::*;
use crate::components::list_errors::ListErrors;
use crate::routes::AppRoute;
use crate::services::articles::*;
use crate::types::{ArticleCreateUpdateInfo, ArticleCreateUpdateInfoWrapper};
#[derive(Properties, C... |
use crate::{self as fiat_ramps, crypto::Public};
use frame_support::{
parameter_types,
};
use sp_core::{
sr25519::Signature, H256, ByteArray
};
use sp_runtime::{
testing::{Header, TestXt},
traits::{BlakeTwo256, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify}
};
pub fn get_test_accounts() ->... |
use std::path::Path;
use std::sync::{Arc, Mutex};
use std::{fs::create_dir_all, path::PathBuf};
use anyhow::{bail, Result};
use crossbeam_channel::{unbounded, Sender};
use log::warn;
use pueue_lib::network::certificate::create_certificates;
use pueue_lib::network::message::{Message, Shutdown};
use pueue_lib::network:... |
#![deny(clippy::all, clippy::nursery, clippy::unwrap_used)]
mod argparse;
mod config;
mod execute;
mod subcommands;
mod util;
const APP_NAME: &str = "Multi Repo Tool";
const APP_SHORT_NAME: &str = "mrt";
const APP_VERSION: &str = "0.0.3";
use crate::subcommands::subcommand;
use crate::subcommands::subcommand::MrtSubc... |
// Copyright 2021 <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 writ... |
//! Detect if Ruby code parses successfully.
//!
//! The REPL needs to check if code is valid to determine whether it should
//! enter multiline editing mode.
use std::convert::TryFrom;
use std::ffi::CStr;
use std::ptr::NonNull;
use crate::backend::sys;
use crate::backend::Artichoke;
/// State shows whether artichok... |
use std::fmt;
use std::io;
use std::io::prelude::*;
use std::fs::File;
use crate::backtracker::Config;
/// Default cell char which designates an empty cell
static DEFAULT_CELL: char = '-';
/// This struct holds the configuration of a step in solving the Trunks problem
#[derive(Debug, Clone)]
pub struct Trunk {
wi... |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
//! Assume credentials for a role through the AWS Security Token Service (STS).
use aws_hyper::AwsMiddleware;
use aws_sdk_sts::error::AssumeRoleErrorKind;
use aws_sdk_sts::operation::AssumeRole;
use aw... |
use std::borrow::Cow;
use std::io::Write;
use chrono::prelude::*;
use chrono_humanize::HumanTime;
use termion::raw::RawTerminal;
use crate::{
app::State,
error::Error,
text::Fancy,
theme::{Colour, Theme},
util,
};
use lobsters::url::Url;
type Line = Vec<Fancy>;
type Lines = Vec<Line>;
pub fn ren... |
use crate::helpers::cis::CisFakeClient;
use crate::helpers::db::get_pool;
use crate::helpers::users::basic_user;
use actix_web::dev::*;
use actix_web::http::header::HeaderMap;
use actix_web::test;
use actix_web::web;
use actix_web::HttpMessage;
use base64::decode;
use base64::encode;
use cis_client::AsyncCisClientTrait... |
/// Checkpoint manager initiates and controls checkpoints.
/// Checkpoint procedure is the following:
///
/// 1. Checkpoint sequence number is incremented.
/// 2. Checkpointer thread writes record in the log about start of new checkpoint.
/// 3. Checkpointer thread calls storage driver to process checkpoint with the ne... |
//! General purpose ontology based on rustling.
//!
//! Contains detectors for various entities, like numbers, temperatures, dates
//! in french, english, ...
//!
//! ```
//! extern crate rustling;
//! extern crate rustling_ontology;
//!
//! fn main() {
//! use rustling_ontology::*;
//!
//! let ctx = ResolverCo... |
// Copyright 2017 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
// Copyright 2020 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or d... |
use std::any::Any;
use super::Shape;
use crate::{Intersection, Material, Matrix, Point, Ray, Vector, IDENTITY};
use uuid::Uuid;
#[derive(Debug)]
pub struct Group {
id: Uuid,
parent_id: Option<Uuid>,
pub transform: Matrix,
pub material: Material,
pub objects: Vec<Box<dyn Shape>>,
pub inherit_ma... |
extern crate edid;
extern crate getopts;
#[macro_use]
extern crate nom;
mod backend;
mod store;
mod frontend;
mod notifier;
use std::io::Write;
use std::env;
use getopts::Options;
use backend::{ConnectedOutput, Backend, SysFsBackend};
use store::{SavedOutput, SavedConfiguration, Store, GnomeStore, KanshiStore};
use... |
// Copyright 2017 <NAME>
//
// This file is part of the PulseAudio Rust language binding.
//
// Licensed under the MIT license or the Apache license (version 2.0), at your option. You may not
// copy, modify, or distribute this file except in compliance with said license. You can find copies
// of these licenses either... |
//! # Day 08: Memory Maneuver
//!
//! [Benchmarking report](../../../day08/target/criterion/report/index.html):
//!
//! * [Part 1](../../../day08/target/criterion/day08_part1/report/index.html)
//! * [Part 2](../../../day08/target/criterion/day08_part2/report/index.html)
//!
//!
//! ## Part One
//!
//! The sleigh is mu... |
use multimap::MultiMap;
use std::collections::HashMap;
fn process_signal(signal: &str) -> u8 {
let mut retval = 0;
signal.bytes().for_each(|l| match l {
b'a' => retval |= 0b0000001,
b'b' => retval |= 0b0000010,
b'c' => retval |= 0b0000100,
b'd' => retval |= 0b0001000,
b'... |
// 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... |
// Copyright 2020-present, the HuggingFace Inc. team.
// 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 req... |
use std::io;
use std::net::TcpStream;
use std::time::{Duration, Instant};
pub trait Timeout {
fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()>;
fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()>;
}
impl Timeout for TcpStream {
fn set_read_timeout(&self, dur: Option<Dur... |
use std::collections::HashMap;
use chrono::DateTime;
use drive3;
use failure::{err_msg, Error};
use fuse::{FileAttr, FileType};
use id_tree::NodeId;
use time::Timespec;
type Inode = u64;
type DriveId = String;
/// The representation of a local file used by GCSF.
///
/// `name`: the file name
/// `attr`: the file att... |
use std::alloc::Layout;
use std::mem;
use std::ptr::{self, NonNull};
use std::sync::Arc;
use crate::borrow::CloneToProcess;
use crate::erts::fragment::HeapFragment;
use crate::erts::process::alloc::TermAlloc;
use crate::erts::process::trace::Trace;
use crate::erts::term::prelude::*;
use super::AllocResult;
/// The r... |
/*
* 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... |
//! [`brainfucklib::code::brackets`]
//!
//! This module helps to identify pairs of brackets and their locations.
use std::{
collections::HashMap,
cmp::Ordering
};
use crate::{
debug::{BfErrorKind},
someorreturn
};
/// This categorizes a bracket into [`Left`] or [`Right`] hand size.
#... |
use std::{
borrow::Cow,
fmt,
};
use clang::{
Entity,
EntityKind,
EvaluationResult,
token::{Token, TokenKind},
};
use crate::{
DefaultElement,
Element,
EntityElement,
settings,
};
pub fn render_constant_rust<'f>(tokens: impl IntoIterator<Item=Token<'f>>) -> Option<Value> {
let mut out = Value {
kind: Val... |
//! This crate provides the [`open`] function, which opens a file or link with the default program
//! configured on the system.
//!
//! ```no_run
//! # fn main() -> Result<(), ::opener::OpenError> {
//! // open a website
//! opener::open("https://www.rust-lang.org")?;
//!
//! // open a file
//! opener::open("../Cargo.... |
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::string_lit_as_bytes)]
use codec::Encode;
use frame_support::{decl_error, decl_event, decl_module, decl_storage, traits::Randomness};
use frame_system::ensure_signed;
use randomness;
use sp_core::H256;
use sp_io::hashing::blake2_256;
use sp_std::{
cmp::{Eq, P... |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![cfg_attr(feature... |
// Copyright (c) 2019, The rav1e contributors. All rights reserved
//
// This source code is subject to the terms of the BSD 2 Clause License and
// the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
// was not distributed with this source code in the LICENSE file, you can
// obtain it at www.a... |
use std::collections::HashMap;
use std::cell::RefCell;
use std::io;
use std::io::{stdout, Stdout, Write};
use std::{thread, time};
use termion::{clear, color, cursor, style, terminal_size};
use termion::raw::{IntoRawMode, RawTerminal};
use nalgebra::{Vector2};
use palette::{Srgb, LinSrgb, Lch, Gradient, Shade};
pub s... |
use crate::boards::BitBoard;
use crate::pieces::*;
/// Describing the moves that can be done in a chessboard.
use crate::positions::*;
use std::fmt;
/// Move from ... to ...
pub struct PlayerMove(pub Position, pub Position);
impl From<Move> for PlayerMove {
fn from(mv: Move) -> Self {
PlayerMove(mv.start,... |
use std::ops::Range;
use crate::fastfield::{DynamicFastFieldReader, FastFieldReader, FastValue, MultiValueLength};
use crate::DocId;
/// Reader for a multivalued `u64` fast field.
///
/// The reader is implemented as two `u64` fast field.
///
/// The `vals_reader` will access the concatenated list of all
/// values f... |
use std::{
collections::HashMap,
error::Error,
fs::{read_dir, read_to_string, File},
path::PathBuf,
};
use colored::Colorize;
use sbbw_widget_conf::{validate_config_toml, get_widgets_path};
use serde::{Deserialize, Serialize};
use sha1::{Digest, Sha1};
#[derive(Debug, Clone, Serialize, Deserialize)]
p... |
use std::{env, ops::Deref, path::Path, thread, time::Duration};
use anyhow::{Context, Result};
use log::{debug, info, trace, LevelFilter};
use penguin::{Config, Controller, Mount, ProxyTarget, Server};
use crate::args::{Args, DEFAULT_PORT, ServeOptions};
pub(crate) async fn run(
proxy: Option<&ProxyTarget>,
... |
use crate::composite::FmtComposite;
use crate::line::FmtLine;
use minimad::{Composite, CompositeStyle};
/// build a composite which can be a new line after wrapping.
fn follow_up_composite<'s>(fc: &FmtComposite<'s>) -> FmtComposite<'s> {
FmtComposite {
composite: Composite {
style: match fc.com... |
use crate::util::*;
use arrayvec::{self, ArrayVec};
use std::{fmt, ops::Index, slice, str::FromStr};
use serde_repr::Serialize_repr;
plain_enum_mod!(modepi, derive(Serialize_repr,), map_derive(), EPlayerIndex {
EPI0, EPI1, EPI2, EPI3,
});
define_static_value!(pub SStaticEPI0, EPlayerIndex, EPlayerIndex::EPI0);
def... |
//! `relic` provides Arch Linux build and package automation
//!
//! ## About
//!
//! `relic` provides Arch Linux build and package automation
mod logger;
use clap::{App, AppSettings, Arg, SubCommand};
use librelic::prelude::*;
use std::{env, ffi::OsString};
use witcher::prelude::*;
/// CLI providers a command line in... |
//! This library can be used to get tax rates for addresses in WA state! Meant to be super simple.
//!
//! It gets data from DOR using its [XML URL interface defined here](https://dor.wa.gov/find-taxes-rates/retail-sales-tax/destination-based-sales-tax-and-streamlined-sales-tax/wa-sales-tax-rate-lookup-url-interface).... |
pub mod fronend;
pub mod model;
pub mod opt;
pub mod ui;
pub mod util;
pub mod view;
use std::sync::Arc;
use chrono::Local;
use clap::Clap;
use cursive::{
event::Event,
theme::{BaseColor::*, Color::*, ColorStyle, Palette, PaletteColor::*},
traits::Nameable,
view::{Margins, Selector, SizeConstraint},
... |
/// Ciphertext V2: XChaCha20Poly1305
use super::{PrivateKey, PublicKey};
use super::Error;
use super::Header;
use super::Result;
use super::Ciphertext;
use std::convert::TryFrom;
use chacha20poly1305::aead::{Aead, NewAead, Payload};
use chacha20poly1305::{Key, XChaCha20Poly1305, XNonce};
use rand::{rngs::OsRng, Rn... |
//! Cells in the cellular automaton.
use crate::rules::Rule;
use educe::Educe;
use std::{
cell::Cell,
fmt::{Debug, Error, Formatter},
ops::{Deref, Not},
ptr::NonNull,
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Possible states of a known cell.
///
/// During the search, the ... |
use std::collections::BTreeMap;
use aws_sdk_s3::error::PutObjectError;
use aws_sdk_s3::model::{ObjectCannedAcl, ServerSideEncryption, StorageClass};
use aws_sdk_s3::Client as S3Client;
use aws_smithy_client::SdkError;
use futures::FutureExt;
use http::StatusCode;
use serde::{Deserialize, Serialize};
use snafu::Snafu;
... |
//! Utilities for processing the ASTs provided by `tree_sitter`
use crate::diff::DiffEngine;
use crate::diff::Hunks;
use crate::diff::Myers;
use logging_timer::time;
use std::{cell::RefCell, ops::Index, path::PathBuf};
use tree_sitter::Node as TSNode;
use tree_sitter::Tree as TSTree;
/// A mapping between a tree-sitt... |
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//! Cerberus protocol messages.
//!
//! A Cerberus protocol message (also called a "command") consists of three
//! parts:
//! - A *command type*, representing the type ... |
use std::sync::mpsc;
use shred;
use slog;
#[cfg(not(target_os = "emscripten"))]
use slog_async;
#[cfg(not(target_os = "emscripten"))]
use slog_term;
use specs;
use crate::app::App;
use crate::cell_dweller;
use crate::net::{GameMessage, ServerResource};
use crate::window;
/// Builder for [`App`].
///
/// Will eventua... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.