text stringlengths 3.09k 13.9k |
|---|
use reqwest;
use scraper::{Html, Selector, ElementRef};
use crate::models::MangaChapter;
use std::error;
use crate::utils::ScraperError;
use reqwest::{Client, Error};
/// Downloads the HTML contents of the URL given in parameter.
/// Executes a GET request in async mode.
/// It is preferable to use the client to make ... |
use crate::renderer::SceneRenderer;
use crate::world::init_world;
use crate::config::get_media_href;
use crate::geometry::*;
use crate::components::*;
use shipyard_scenegraph::prelude::*;
use crate::systems::{self, TICK};
use crate::input;
use std::rc::{Rc};
use std::cell::{RefCell};
use gloo_events::{EventListener};
... |
// TODO
// Incorporate urm.rs
use super::urm::Instruction as Inst;
use std::cmp::min;
// #[derive(Debug, Clone, Copy, PartialEq, Eq)]
// pub enum Inst {
// S(usize),
// Z(usize),
// T(usize, usize),
// J(usize, usize, usize),
// }
pub type Program = Vec<Inst>;
pub fn pi(x: usize, y: usize) -> usize ... |
use crate::germanwhist::{self, Action, ActionError, PlayerState, Round, ScoringRules};
use crate::learning::model::{LearningModel, LearningModelError};
use ndarray::prelude::*;
use rand::{thread_rng, Rng};
pub struct SarsaLambdaParameters {
lambda: f32,
gamma: f32,
eps: f32,
}
impl Default for SarsaLambd... |
use std::cell::{
RefCell,
};
use std::rc;
use crate::{
Component,
Element,
};
use super::{
modelcomponent::{
ModelComponent,
ModelDimensions,
ModelDisplay,
},
screensize::ScreenSize,
};
#[cfg(test)]
use crate::{
dimension::{
Dimension,
Offset,
... |
use std::{
collections::HashMap,
fmt::{Display, Write},
};
use anyhow::anyhow;
use enum_as_inner::EnumAsInner;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
pub use super::*;
#[derive(Debug, EnumAsInner, PartialEq, Clone, Serialize, Deserialize)]
pub enum Item {
Ident(Ident),
String(... |
use itertools::Itertools;
use std::collections::{HashMap, HashSet};
fn count_valid(input: String, f: impl Fn(HashMap<&str, &str>) -> bool) -> usize {
input
.split("\n\n")
.filter(|passport| {
let batch: HashMap<_, _> = passport
.split_whitespace()
.map(|k... |
// TrueType format interpretation.
use super::parse::*;
use std::collections::{HashMap, HashSet};
/// The magic number that must be in the head table's `magic_number` field.
const HEAD_TABLE_MAGIC: u32 = 0x5F0F3CF5;
// Types defined by Apple, they are just for easier doc-reading.
type Fixed = i32;
type LongD... |
use std::vec::IntoIter;
use rustyline::line_buffer::LineBuffer;
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
pub fn align_text(text: &str, alignment: &str, maximum_length: u16) -> String {
if maximum_length < 1 {
panic!("Parameter of 'maximum_length' cannot be below 1... |
use crate::emulator::components::latch;
use crate::emulator::memory::Reader;
use crate::emulator::memory::Writer;
use crate::emulator::ppu::flags;
use crate::emulator::ppu::PPU;
impl PPU {
fn ppuaddr_increment(&self) -> u16 {
// Increment controlled by bit 2 of PPUCTRL.
// 0 -> increment by 1
... |
use console::{style, Term};
use std::fmt;
use std::fmt::Display;
use std::fs;
use std::time::{Duration, Instant};
mod grid;
pub use grid::*;
mod tree;
pub use tree::*;
pub fn run<T, U, V, FParse, F1, F2>(parse: FParse, part1: F1, part2: F2)
where
U: Display,
V: Display,
FParse: Fn(&str) -> T,
F1: Fn(... |
use entity::animalentity::AnimalEntity;
use infrastruct::context::dbcontext::{DBContext, IDbContext};
use model::PageModel;
use tool::custom_error::*;
use tool::stringtoObjectId;
use async_trait::async_trait;
use bson::doc;
use bson::{Bson, Document};
use futures::StreamExt;
use mongodb::options::FindOptions;
#[async... |
use deepmesa_collections::bitvec::bitvec::BitVector;
use deepmesa_collections::bitvec::BitOrder;
use crate::prefix::gamma;
use crate::prefix::unary;
impl_encoder!(
/// Encodes unsigned values using Gamma Encoding.
///
/// Each value is encoded in two parts - a length and an
/// offset. The length is e... |
//! Values.
use std::{convert, fmt};
use crate::basic::mem;
use crate::model::hir::*;
//
// Public Values
//
/// A built-in function.
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
pub enum BuiltinFunction {
/// An addition.
Add,
/// A boolean and.
And,
/// An non-equality... |
use winit::event::{Event, VirtualKeyCode};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::WindowBuilder;
use winit::dpi::PhysicalSize;
use winit_input_helper::WinitInputHelper;
use pixels::{Pixels, SurfaceTexture};
use rand::prelude::*;
use lakhesis::{ Model, ITERATIONS, MAX_DROPS };
// number of... |
// Copyright 2020-2021 bd_
//
// 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, distribu... |
use crate::{hint, Error, Parcel, Settings};
use std::io::prelude::*;
use std::{marker, mem};
/// A value that is aligned to a specified number of bytes.
///
/// When bytes are written, they are zero-padding at the end
/// until the total size is the smallest multiple of the
/// size of `ToSizeOfType`.
///
/// When an ... |
use std::io::{self, Read};
use std::cmp;
use std::mem;
use std::collections::HashSet;
use std::collections::HashMap;
fn find_gcd( mut a: i32, mut b: i32 ) -> i32 {
if b < a {
mem::swap( & mut a, & mut b );
}
let mut r = b % a;
while r != 0 {
b = r;
if b < a {
mem::... |
use crate::utils::ascii::{
is_close_brace, is_colon, is_double_quote, is_equals, is_identifier,
is_left_angle_bracket, is_open_brace, is_right_angle_bracket, is_slash,
is_whitespace,
};
use crate::console_log;
use crate::value::attr::{AKind, Attr, PropValue};
use crate::value::capsule::Capsule;
use crate::value:... |
//! UART driver, cc26x2 family
use core::cell::Cell;
use kernel;
use kernel::common::cells::{TakeCell, OptionalCell};
use kernel::common::regs::{ReadOnly, ReadWrite, WriteOnly};
use kernel::common::StaticRef;
use kernel::hil::uart;
use prcm;
const MCU_CLOCK: u32 = 48_000_000;
#[repr(C)]
struct UartRegisters {
dr:... |
use crate::elf::sym::Sym;
use crate::elf::sym::STB_GLOBAL;
use crate::elf::sym::STB_WEAK;
use crate::elf::section_header::SHN_UNDEF;
use crate::strtab::Strtab;
use crate::elf::sym::Symtab;
use crate::elf::Elf;
use core::fmt;
use core::mem;
use core::slice;
/// ELF hash function: accepts a symbol name and returns a v... |
use selectable::staged_columns::StagedColumns;
use command::{Command, Query};
use selectable::fragmentable::Fragmentable;
use command_query::CommandQuery;
use queryable::Queryable;
use commandable::Commandable;
use command_line::CommandLine;
use selectable::drilldown_type::DrilldownUsable;
pub struct StagedColumnsBuil... |
//! Utilities related to directions in the plane.
use crate::axis::Axis;
use std::{
ops::{Index, IndexMut, Not},
slice,
};
/// Basic direction in a plane.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(
feature = "impl-serde",
derive(serde::Serialize, serde::Deserialize... |
extern crate proc_macro as pm1;
use proc_macro2::{Ident, Literal, Punct, Spacing, TokenStream, TokenTree};
use quote::{quote, quote_spanned, ToTokens};
use std::collections::HashMap;
use std::iter::FromIterator;
use syn::spanned::Spanned;
use syn::{
parse_macro_input, parse_quote, Attribute, FnArg, ImplItem, ItemI... |
extern crate chrono;
extern crate hostname;
extern crate rand;
use chrono::Local;
use core_sdk::board_representation::game_state::*;
use core_sdk::move_generation::makemove::make_move;
pub struct PGNMetadata {
pub event_name: Option<String>,
pub site: Option<String>,
pub date: Option<String>,
pub round... |
use crate::compiler::CraneliftCompiler;
use cranelift_codegen::isa::{lookup, TargetIsa};
use cranelift_codegen::settings::{self, Configurable};
use loupe::MemoryUsage;
use std::sync::Arc;
use wasmer_compiler::{
Architecture, Compiler, CompilerConfig, CpuFeature, ModuleMiddleware, Target,
};
// Runtime Environment
... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Start Timer"]
pub tasks_start: crate::Reg<tasks_start::TASKS_START_SPEC>,
#[doc = "0x04 - Stop Timer"]
pub tasks_stop: crate::Reg<tasks_stop::TASKS_STOP_SPEC>,
#[doc = "0x08 - Increment Timer (Counter mode only)"]
p... |
//! Astar RPCs implementation.
use fc_rpc::{
EthApi, EthApiServer, EthBlockDataCacheTask, EthFilterApi, EthFilterApiServer, EthPubSubApi,
EthPubSubApiServer, HexEncodedIdProvider, NetApi, NetApiServer, OverrideHandle,
RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override, SchemaV3Override,
Stor... |
use std::io::Cursor;
use byteorder::{ByteOrder, LittleEndian, ReadBytesExt};
pub const POLY_KEY_BYTES: usize = 16;
#[derive(Debug)]
struct Key {
r0: u64,
r1: u64,
r2: u64,
}
#[derive(Debug, Default)]
struct State {
h0: u64,
h1: u64,
h2: u64,
}
impl Key {
pub fn new(key: [u8; 16]) -> Sel... |
use aoc::aoc_input::get_input;
use num_integer::lcm;
use regex::Regex;
use std::cmp::max;
use std::num::ParseIntError;
use std::ops::{Add, AddAssign};
use std::str::FromStr;
#[macro_use]
extern crate lazy_static;
const DIMENSIONS: usize = 3;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
struct Velocity {
dx: [isiz... |
use std::fmt;
use Command;
#[deriving(PartialEq, Eq, PartialOrd, Ord)]
pub struct Grid {
width: u32,
height: u32,
chars: Vec<char>,
}
impl fmt::Show for Grid {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
let s: String = String::from_chars(self.chars.as_slice());
write!(w, "G... |
//! * Driver for the HTS221 humidity sensor
//! See `http://www.st.com/content/st_com/en/products/mems-and-sensors/humidity-sensors/hts221.html`
use i2cdev::core::I2CDevice;
use byteorder::{ByteOrder, LittleEndian};
pub const REG_AV_CONF: u8 = 0x10;
pub const REG_CTRL1: u8 = 0x20;
pub const REG_STATUS: u8 = 0x27;
pub... |
use log::{
debug,
error,
trace,
};
use std::{
collections::HashMap,
marker::PhantomData,
};
use cqrs_es2::{
AggregateContext,
Error,
EventContext,
IAggregate,
ICommand,
IEvent,
};
use super::{
i_event_dispatcher::IEventDispatcher,
i_event_store::IEventStore,
};
///... |
// Copyright (c) 2021-present, Cruise LLC
//
// This source code is licensed under the Apache License, Version 2.0,
// found in the LICENSE-APACHE file in the root directory of this source tree.
// You may not use this file except in compliance with the License.
use std::sync::Arc;
use wrflib::*;
use wrflib_component... |
// Copyright 2020 AXIA Technologies (UK) Ltd.
// This file is part of AXIA Ethereum.
// AXIA Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) ... |
use std::{collections::HashMap, sync::Arc};
use cosmicverge_shared::{
protocol::{navigation, pilot},
solar_systems::SolarSystemId,
strum::EnumCount,
};
use once_cell::sync::OnceCell;
use redis::{aio::MultiplexedConnection, AsyncCommands};
use serde::Deserialize;
use tokio::sync::RwLock;
pub struct Locatio... |
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use jsonrpsee::core::RpcResult;
use jsonrpsee_core::server::rpc_module::RpcModule;
use jsonrpsee_proc_macros::rpc;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use sui_core::gateway_state::Gatew... |
use std::{error::Error as StdError, fmt::Display, str::FromStr};
use bytes::Bytes;
use crate::{response::BoxResponse, BoxError, Response};
crate::include_proto!("hrpc.v1");
/// Represents a hRPC error identifier.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum HrpcErrorIdentifier {
... |
// use std::process::exit;
use std::io;
use std::io::prelude::*;
use std::fs::File;
struct Machine {
buf: Vec<u8>,
stack: Vec<u16>,
pos: usize,
reg: [u16; 8],
input: Vec<char>
}
impl Machine {
fn load() -> Machine {
let mut m = Machine { pos: 0, buf: Vec::new(), reg: [0; 8], stack: Vec... |
//! Configures and runs the outbound proxy.
//!
//! The outbound proxy is responsible for routing traffic from the local application to other hosts.
#![deny(
warnings,
rust_2018_idioms,
clippy::disallowed_methods,
clippy::disallowed_types
)]
#![forbid(unsafe_code)]
mod discover;
pub mod endpoint;
pub ... |
use std::{env, fs, path::PathBuf};
use crate::language::LanguageType;
use crate::sort::Sort;
/// A configuration struct for how [`Languages::get_statistics`] searches and
/// counts languages.
///
/// ```
/// use tokei::Config;
///
/// let config = Config {
/// treat_doc_strings_as_comments: Some(true),
/// .... |
use bitcoins::{prelude::ByteFormat, types::{BitcoinTxIn, ScriptType, SpendScript, TxOut, Utxo}};
use coins_bip32::{path::DerivationPath, prelude::*};
use coins_core::ser;
use coins_ledger::common::{APDUAnswer, APDUCommand, APDUData};
use crate::LedgerBTCError;
#[repr(u8)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
... |
use crate::traits::query::outlives_bounds::InferCtxtExt as _;
use crate::traits::{self, TraitEngine, TraitEngineExt};
use rustc_hir as hir;
use rustc_hir::lang_items::LangItem;
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::traits::ObligationCause;
use rustc_middle::arena::ArenaAllocatabl... |
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use anyhow::Result;
use serde::Serialize;
use serde_json::Value;
use std::{
collections::HashMap,
env, fs,
process::{Command, Stdio},
};
use utils::root_path;
mod ut... |
use crate::file::from_paths;
use crate::file::SectionBody;
use crate::parser::{Key, ParsedSectionHeader};
use crate::{values, File};
use bstr::{BString, ByteSlice};
use git_ref::Category;
use std::borrow::Cow;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
const DOT: &[u8] = b".";
pub(crate) fn resolv... |
use std::cell::RefCell;
extern crate num;
extern crate primes;
#[macro_use]
extern crate itertools;
// Perform repeated iterations on a single dimension until all the moons are back to their
// original state in that dimension.
fn simulate(moons: &[RefCell<MoonDimension>]) -> u64 {
let moons = moons.to_owned();
... |
//! Iterator that allows escaping % and {
#[derive(PartialEq, Debug)]
pub enum Token<'a> {
Percent,
Str(&'a str),
Block(&'a str),
OpenBrace,
}
#[derive(Copy, Clone, PartialEq)]
pub enum Mode {
Block,
Brace,
}
pub struct EscapeIterator<'a> {
remainder: &'a str,
mode: Mode,
}
impl<'a> EscapeIterator<'a> {
pu... |
// Copyright 2020 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,... |
//! This is a simple test for reading the value of locals from a child process.
mod test_utils;
#[cfg(target_os = "linux")]
use headcrab::{
symbol::{LocalValue, RelocatedDwarf},
target::UnixTarget,
CrabResult,
};
static BIN_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/testees/hello");
// FIX... |
use byteorder::{ByteOrder, NativeEndian};
use failure::ResultExt;
use std::mem::size_of;
use crate::constants::*;
use crate::utils::parse_u32;
use crate::{DecodeError, DefaultNla, Nla, NlaBuffer, Parseable};
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum RouteMetricsNla {
Unspec(Vec<u8>),
Lock(u32),
Mtu(... |
// === Non-Standard Linter Configuration ===
#![allow(missing_docs)]
use crate::data::dirty::traits::*;
use crate::prelude::*;
use crate::control::callback;
use crate::data::dirty;
use crate::debug::stats::Stats;
use crate::display::symbol::material::Material;
use crate::display::symbol::material::VarDecl;
use crate:... |
// Copyright 2022 RisingLight Project Authors. Licensed under Apache-2.0.
//! Defines all plan nodes and provides tools to visit plan tree.
use std::fmt::{Debug, Display};
use std::sync::Arc;
use bit_set::BitSet;
use downcast_rs::{impl_downcast, Downcast};
use erased_serde::serialize_trait_object;
use paste::paste;
... |
// Copyright © 2018 <NAME>
// [This program is licensed under the "MIT License"]
// Please see the file LICENSE in the source
// distribution of this software for license terms.
//! Points types for finding canvex hull
///A basic representation of a point
///
///With x and y coordinate, a point2D
///is a point in 2D ... |
use self::runtime::Runtime;
use async_file::*;
use async_rt::task::JoinHandle;
use std::time::Instant;
const CACHE_SIZE: usize = 1024 * 50; // 1024 * 50: 4 MB * 50 (cache hit), or 10 (cache miss)
static mut SEED: u32 = 0;
fn get_random() -> u32 {
unsafe {
SEED = SEED * 1103515245 + 12345;
let hi =... |
//! The core of the implementation for the Language Protocol Server.
//!
//! todo: implement a custom rope for fun
//! todo: handle errors properly
use codespan_lsp::{byte_span_to_range, position_to_byte_index};
use codespan_reporting::{diagnostic::LabelStyle, files::Files};
use lsp_server::{Connection, Message};
use ... |
use crate::{
stream::{interval, DEFAULT_POLL_INTERVAL},
JsonRpcClient, Provider, ProviderError,
};
use ethers_core::types::{TransactionReceipt, TxHash, U64};
use futures_core::stream::Stream;
use futures_util::stream::StreamExt;
use pin_project::pin_project;
use std::{
fmt,
future::Future,
ops::Dere... |
// 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... |
use std::convert::TryFrom;
use crate::db::{C_M, C_R, D_M, D_R, D_T, InstanceDaoImpl, MetaCache, Mission, RawTask, RelationCache, TaskDao, TaskType};
use crate::db::flow_tool::{context_check, state_check};
use crate::domain::*;
use crate::nature_lib::dispatcher::*;
use crate::nature_lib::task::{TaskForConvert, TaskForS... |
use std::cmp::Ordering;
use std::ops::{BitAnd, Shl, Shr, Sub};
use num::{One, Zero};
use crate::error::Fallible;
pub trait CheckNull { fn is_null(&self) -> bool; }
/// TotalOrd is well-defined on types that are Ord on their non-null values.
/// The framework provides a way to ensure values are non-null at runtime.
... |
extern crate memmap;
mod reader;
mod segment;
use self::segment::Segment;
pub use reader::Reader;
use std::fs;
use std::io;
use std::path::PathBuf;
use derive_more::From;
#[derive(Debug, From)]
pub enum Error {
Io(io::Error),
Segment(segment::Error),
BufferSizeExceeded,
SegmentUnavailable,
}
pub en... |
use std::error::Error;
use std::io;
use serde::*;
use std::fmt;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
pub enum SocketErrorKind {
NotFound,
PermissionDenied,
ConnectionRefused,
ConnectionReset,
HostUnreachable,
NetworkUnreachable,
Connect... |
use crate::pattern::filter::Filter;
use crate::pattern::parser::{Item, ParsedItem, Parser};
mod char;
pub mod error;
mod escape;
pub mod eval;
mod explain;
mod field;
pub mod filter;
pub mod help;
mod index;
mod integer;
mod lexer;
mod number;
mod padding;
pub mod parse;
mod parser;
pub mod path;
mod range;
mod reader... |
/**
* [0707] Design Linked List
*
* Design your implementation of the linked list. You can choose to use a singly or doubly linked list.<br />
* A node in a singly linked list should have two attributes: val and next. val is the value of the current node, and next is a pointer/reference to the next node.<br />
* I... |
use crate::arch::x86_64::kernel::irq::IrqStatistics;
use crate::arch::x86_64::kernel::BOOT_INFO;
use crate::scheduler::{CoreId, PerCoreScheduler};
use crate::x86::bits64::task::TaskStateSegment;
use crate::x86::msr::*;
use core::mem;
use core::ptr;
use crossbeam_utils::CachePadded;
pub static mut PERCORE: PerCoreVaria... |
// 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 in the LICENSE-APACHE file or at:
// https://www.apache.org/licenses/LICENSE-2.0
//! Toolkit for KAS targeting winit + WebGPU
//!
//! This c... |
use crate::{
aead::{Aead, AeadCtx, AeadCtxR, AeadCtxS, AeadKey, AeadNonce},
kdf::Kdf as KdfTrait,
kem::Kem as KemTrait,
kex::{KeyExchange, Serializable},
op_mode::{OpModeR, OpModeS, PskBundle},
setup::ExporterSecret,
};
use generic_array::GenericArray;
use rand::{rngs::StdRng, CryptoRng, Rng, R... |
use candid::{CandidType, Deserialize};
use thiserror::Error;
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, CandidType, Deserialize, Error)]
pub enum DFTError {
#[error("DFT: call it anonymous is not allow")]
NotAllowAnonymous,
#[error("DFT: Caller is not the owner")]
OnlyOwnerAllowCallIt,
... |
use std::sync::mpsc::Receiver;
use std::mem;
use gl;
use glfw::{self, Glfw, Context, Key, Action, Window as GlfwWindow, WindowEvent};
use lang::{ObjectPar, RasterFloat, TimeSec};
use input::{MouseEvent, MouseButtonEvent, KeyEvent, InputEvent, InputControl};
use timing::Timing;
type Events = Receiver<(f64, WindowEven... |
//! This modules handles asynchronous interactions with the solver.
//!
//! The related function is [`Solver::async_check_sat_or_unk`].
//!
//! Presently, only asynchronous check-sat-s are supported. The idea is to wrap the whole solver in
//! a new thread, and yield a future of the check-sat result. The new thread sta... |
use serde::*;
use std::ops::*;
use web_sys::WebGlProgram;
use webgl_wrapper::uniforms::*;
use webgl_wrapper::*;
/// An RGBA color, stored in a linear color space.
///
/// This currently approximates sRGB by using a gamma of 2.2.
#[repr(C)]
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
pub struct Col... |
//! Contains definitions for low-level bindings.
//!
//! Most of this module is Rust versions of the systemd headers. The goal of
//! this crate is to make it unattractive to ever use the FFI directly, but
//! it's there if you need it.
//!
//! Items in this module corresponding to systemd functions are well-documented... |
use challenge::solve;
include!("../../helpers.rs");
fn main() {
let (stdin, time_reading) = time(|| read_stdin());
// let (input, time_parsing) = time(|| Input::parse(&stdin));
let (solution_1, time_solving_1) = time(|| {
stdin
.split('\n')
.map(|line| solve(line, false))
... |
//! Poor attempt to write the [ssloy's tinyraycaster](https://github.com/ssloy/tinyraycaster/wiki) in rust
//! to teach mysef both rust and raycasting
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::pixels::{Color, PixelFormatEnum};
use std::f64::consts::PI;
use std::time::Duration;
use framebuffer::Fra... |
/***********************************************************************************************************************
* Copyright (c) 2019 by the authors
*
* Author: <NAME>
* License: MIT / Appache License 2.0
******************************************************************************************************... |
use amethyst::{
prelude::*,
assets::{AssetStorage, Handle, Loader},
core::transform::Transform,
input::{is_close_requested, is_key_down, VirtualKeyCode},
renderer::{
Camera, ImageFormat, SpriteRender,
SpriteSheet, SpriteSheetFormat, Texture,
// palette::Srgba,
... |
use std::fmt::Display;
use std::str::FromStr;
use std::sync::Arc;
use std::sync::Mutex;
use enum_iterator::IntoEnumIterator;
use serde::{Deserialize, Deserializer};
use structopt::StructOpt;
pub const DEFAULT_CONFIG_FILE: &'static str = "config.json";
#[derive(Clone, Debug, Default, PartialEq, PartialOr... |
// Copyright 2021 Red Hat, 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... |
use std::path::PathBuf;
use anyhow::{Context, Result};
use futures::{try_join, FutureExt};
use nix::mount::MsFlags;
use reqwest::Url;
use slog::{info, o, Logger};
use structopt::clap::AppSettings;
use structopt::StructOpt;
use strum_macros::EnumIter;
use apply_disk_image::apply_disk_image;
use find_root_disk::{DiskPa... |
use super::{CoordPos, Direction, Edge, EdgeEnd, GeometryGraph, IntersectionMatrix, Label};
use crate::{Coordinate, GeoFloat};
/// A collection of [`EdgeEnds`](EdgeEnd) which obey the following invariant:
/// They originate at the same node and have the same direction.
///
/// This is based on [JTS's `EdgeEndBundle` as... |
use arrsac::{Arrsac, Config};
use nalgebra::{dimension::U2, Dynamic, Matrix, Matrix3x2, VecStorage, Vector2, Vector3};
use pcg_rand::Pcg64;
use rand::distributions::Uniform;
use rand::{distributions::Distribution, Rng};
use sample_consensus::{Consensus, Estimator, Model};
const RESIDUAL_SCALE: f32 = 0.1;
const LINES_T... |
use bit_vec::BitVec;
use ast::knormal::*;
use util::{id, Id, Spanned};
fn merge(p: (Option<BitVec>, bool), q: (Option<BitVec>, bool)) -> (Option<BitVec>, bool) {
let b = match (p.0, q.0) {
(None, None) => None,
(x, None) | (None, x) => x,
(Some(mut x), Some(y)) => {
x.and(&y);
... |
// Copyright (c) The nextest Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Filtering tests based on user-specified parameters.
//!
//! The main structure in this module is [`TestFilter`], which is created by a [`TestFilterBuilder`].
use crate::{
errors::RunIgnoredParseError,
partition::{Parti... |
//! This crate provides high level access to HaveIBeenPwned password check.
//!
//! It makes requests against the [Password](https://haveibeenpwned.com/Passwords) service of HaveIBeenPwned
//! and uses its [API](https://haveibeenpwned.com/API/v3#PwnedPasswords)
#[cfg(test)]
extern crate mockito;
extern crate regex;
... |
use crate::config::Committee;
use crate::context::Context;
use crate::timer::Timer;
use bft_lib::base_types::NodeTime;
use bft_lib::interfaces::{ConsensusNode, DataSyncNode, NodeUpdateActions};
use bft_lib::smr_context::SmrContext;
use bytes::Bytes;
use crypto::{PublicKey, SignatureService};
use futures::executor::bloc... |
//! Displays debug lines using an orthographic camera.
use amethyst::{
core::{
transform::{Transform, TransformBundle},
Time,
},
ecs::{Read, ReadExpect, Resources, System, SystemData, Write},
prelude::*,
renderer::{
camera::Camera,
debug_drawing::{DebugLines, DebugLi... |
//use async_trait::async_trait;
use mav::ma::{Dao, MWallet, MAddress};
use mav::{WalletType, NetType};
use crate::{BtcChain, ContextTrait, EeeChain, EthChain, WalletError};
use crate::deref_type;
#[derive(Debug, Default)]
pub struct Wallet {
pub m: MWallet,
pub eth_chain: EthChain,
pub eee_chain: EeeChain... |
// Distributed under the OSI-approved BSD 2-Clause License.
// See accompanying LICENSE file for details.
//! Video subsystem support
//!
//! This module contains all of the structures required to juggle the graphics resources for a
//! game. It includes bits for holding the view matrix as well as a context structure ... |
#[allow(unused_imports)]
use builtin::*;
#[allow(unused_imports)]
use builtin_macros::*;
#[allow(unused_imports)]
#[macro_use]
use crate::pervasive::*;
//pub mod page_table;
pub mod paging;
use paging::*;
#[macro_export]
macro_rules! bit {
($x:expr) => {
1 << $x
};
}
pub enum KError {
BadAddress... |
use crate::storage::PaneStorage;
use crate::*;
use wasm_bindgen::JsCast;
use web_sys::HtmlElement;
/// Internal representation of the state required to control a div in the browser.
///
/// The first name for the crate was pane and a PaneHandle was exposed to library users.
/// But a crate names pane already existed o... |
use crate::{
generic_public_key::{GenericPublicKey, TPublicKey},
Error, Hash256,
};
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_utils::hex::encode as hex_encode;
use ssz::{Decode, Encode};
use std::fmt;
use std::marker::PhantomData;
use tree_hash::TreeHash;
//... |
use crate::cartridge::Cartridge;
use crate::cartridge::Mapper;
use crate::cartridge::Mirror;
use std::fs::File;
use std::io::{Read, Write};
use std::path::Path;
pub struct MMC1 {
cart: Cartridge,
step: u8,
shift_register: u8,
control: u8,
prg_ram_bank: [u8; 0x2000],
prg_ram_enabled: bool,
... |
use cgmath::dot;
use cgmath::prelude::*;
use cgmath::vec3;
use cgmath::Vector3;
use rand::prelude::*;
use super::Textured;
pub struct Perlin {
pub ranvec: Vec<Vector3<f64>>,
pub perm_x: Vec<usize>,
pub perm_y: Vec<usize>,
pub perm_z: Vec<usize>,
}
impl Perlin {
pub fn new() -> Self {
Perl... |
use std::borrow::Cow;
use bindings::{
Microsoft::Graphics::Canvas::{
Text::CanvasHorizontalAlignment, Text::CanvasTextFormat, Text::CanvasTextLayout,
Text::CanvasVerticalAlignment, UI::Composition::CanvasComposition,
},
Windows::{
Foundation::Numerics::Vector2,
Foundation::S... |
use std::collections::HashMap;
use ::term::Term;
use eir::Clause;
use eir::pattern::PatternNode;
use eir::AtomicTerm;
use eir::SSAVariable;
#[derive(Debug, Copy, Clone)]
pub enum MatchState {
MatchClause(usize),
GuardWait(usize),
Finished,
}
impl MatchState {
fn clause_num(&self) -> usize {
... |
use std::path::PathBuf;
use crate::{
catalogue::Chapter,
config::GLOBAL_CONFIG,
db::{model, MangaDatabase},
guard::AdminGuard,
utils::{decode_cursor, encode_cursor},
worker::downloads::{Command as DownloadCommand, DownloadSender},
};
use async_graphql::{
connection::{query, Connection, Edg... |
use super::runtime_delegation::RuntimeDelegationState;
use super::transaction::{MethodType, RunningFunction, Transaction, TransactionDataProvider};
use crate::contract_data::{ContractData, ContractMethod};
use ethereum_types::U256;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
pub struct NetBuilder {
... |
extern crate configparser;
use configparser::ini::Ini;
use std::error::Error;
#[derive(Debug)]
pub struct InputParams {
pub lengths_t_max: Vec<(i32, i32)>,
pub k_neighbours: Vec<i32>,
pub seeds: Vec<i32>,
pub periodic_bc: bool,
pub init_seed: i32,
}
impl InputParams {
pub fn new(displ_params:... |
#![allow(dead_code)]
extern crate libnx_rs;
use libnx_rs::libnx::*;
use libnx_rs::{service, LibnxError};
use libnx_rs::ipc::{IpcCommandHeader, RawIpcArgs};
use libnx_rs::console::ConsoleHandle;
extern crate libc;
use std::result::Result;
use std::fs::File;
use std::fs::OpenOptions;
use std::io::Write;
use std::io;
... |
use common::prelude::*;
pub fn run() -> AdventOfCodeResult {
let input = include_str!("../input/day-13.txt");
let (timestamp, bus_schedule) = parse_bus_schedule(input);
let part_one = part_one(timestamp, &bus_schedule);
let part_two = part_two(&bus_schedule);
Ok((part_one, part_two))
}
fn part_o... |
// Copyright 2020 The Kythe Authors. All rights reserved.
//
// 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 appli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.