text stringlengths 8 4.13M |
|---|
#![allow(non_camel_case_types)]
use libloading::os::unix::Symbol as UnixSymbol;
use libloading::{Library, Symbol};
use crate::prelude::*;
use std::ffi::CStr;
use std::os::raw::c_char;
type gamemode_error_string = unsafe fn() -> *const c_char;
type gamemode_request_start = unsafe fn() -> i32;
type gamemode_request_e... |
use crate::{SMResult, AST};
pub fn range(expr: &AST) -> SMResult<AST> {
match expr {
_ => unimplemented!(),
}
}
pub fn power_range(expr: &AST) -> SMResult<AST> {
match expr {
_ => unimplemented!(),
}
}
|
use juniper::graphql_scalar;
#[graphql_scalar(specified_by_url = "not an url", transparent)]
struct ScalarSpecifiedByUrl(i32);
fn main() {}
|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// 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 ... |
#[macro_use]
mod foo {
macro_rules! my_macro {
($s: tt) => (concat!("Hello ", $s))
}
}
fn main() {
if my_macro!("world!") != "Hello world!" {
panic!("Oh no! Wrong output!");
}
}
|
use std::io::prelude::*;
use std::net::TcpStream;
fn main() {
if let Ok(mut stream) = TcpStream::connect("ecc.co.id:80") {
let mut res = String::new();
// stream.read(&mut [0; 128]).unwrap();
stream.read_to_string(&mut res).unwrap();
println!("{:?}", res);
} else {
println!("Tidak dapat terhubung... |
use proc_macro2::Ident;
use quote::format_ident;
pub fn format_action(ident: &Ident) -> Ident {
format_ident!("EosAction{}", ident)
}
pub fn format_table(ident: &Ident) -> Ident {
format_ident!("EosTable{}", ident)
}
|
/*
Simplest Ever Markov Chain Monte Carlo (MCMC) simulation
*/
extern crate color_eyre;
extern crate rand;
#[macro_use]
extern crate std;
extern crate textplots;
use color_eyre::{eyre, Result};
use rand::prelude::*;
use std::collections::HashMap;
use textplots::{Chart, Plot, Shape};
struct TransitionProb {
origin... |
use num_bigint::BigInt;
use liblumen_alloc::erts::time::Milliseconds;
use crate::time::{self, Unit};
pub fn time_in_unit(unit: Unit) -> BigInt {
let system = time();
time::convert_milliseconds(system.into(), unit)
}
#[cfg(not(all(target_arch = "wasm32", feature = "time_web_sys")))]
mod sys {
use std::ti... |
#[cfg(target_os = "macos")]
#[macro_use]
extern crate objc;
use vki::{glfw_surface_descriptor, winit_surface_descriptor};
use vki::{AdapterOptions, DeviceDescriptor, Instance};
pub mod support;
#[test]
fn winit_surface() {
let _ = pretty_env_logger::try_init();
vki::validate(|| {
let instance = Insta... |
use anyhow::*;
use liblumen_alloc::erts::exception;
use liblumen_alloc::erts::process::Process;
use liblumen_alloc::erts::term::prelude::*;
use crate::erlang;
#[native_implemented::function(erlang:binary_part/2)]
pub fn result(process: &Process, binary: Term, start_length: Term) -> exception::Result<Term> {
let ... |
use proconio::input;
use proconio::marker::Chars;
fn dist(n: usize, x: &[char], y: &[char]) -> usize {
let mut d = 0;
for i in 0..n {
if x[i] != y[i] {
d += 1;
}
}
d
}
fn main() {
input! {
n: usize,
s: Chars,
t: Chars,
};
let u: Vec<char... |
pub fn day01(_filename: &str){
println!("Day 01 - frequency");
} |
//! Arithmetic instructions
use bigint::{M256, U512};
use super::State;
use crate::{Memory, Patch};
pub fn addmod<M: Memory, P: Patch>(state: &mut State<M, P>) {
pop!(state, op1: U512, op2: U512, op3: U512);
if op3 == U512::zero() {
push!(state, M256::zero());
} else {
let v = (op1 + op2... |
pub mod alfred;
mod dictionary;
mod error;
pub mod plover_config;
pub use dictionary::{Dictionary, InvertedDictionary, Stroke, Translation};
pub use error::Error;
|
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn borrowed_proc<'a>(x: &'a isize) -> Box<dyn FnMut()->(isize) + 'a> {
// This is legal, because the region bound on `proc`
// states that it captures `x`.
Box::new(move|| { *x })
}
fn static_proc(x: &isize) -> Box<dy... |
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct NegTokenResp {
/// NegState (1 byte): Contains the state of the negotiation. (required in first reply)
pub state: Vec<u8>,
/// SupportedMech (10 byte): The negotiation mechanism offered by the initiator. OPTIONAL
/// (only in first reply)
pub support... |
use std::cell::{ RefCell, RefMut };
use std::rc::Rc;
use piston_window::G2d;
use graphics::Transformed;
use graphics::math::{ Scalar, Matrix2d };
use gfx_device_gl::{ Resources };
use gfx_texture::{ Texture };
use gfx;
use util::texture_register::TextureRegister;
use game::operation::*;
use game::world::World;
use gam... |
extern crate tokio_core;
extern crate futures;
use std::net::SocketAddr;
use tokio_core::net::UdpSocket;
use tokio_core::reactor::Core;
fn main() {
let mut core = Core::new().unwrap();
let handle = core.handle();
let addr: SocketAddr = "127.0.0.1:5515".parse().unwrap();
let socket = UdpSocket::bind(&... |
use std::f64::consts::PI;
use crate::{graphics::materials::Material, math::{Point, Vec3}};
use crate::graphics::{Aabb, HitRecord, Hittable, Ray};
pub struct Sphere {
pub center: Point,
pub radius: f64,
pub material: Box<dyn Material>,
}
impl Sphere {
pub fn new(center: Point, radius: f64, material: B... |
fn main() {
let serial_number = 3463;
let mut grid = vec![vec![0 as i32; 300]; 300];
for x in 0..grid.len() {
for y in 0..grid[x].len() {
let rack_id = x as i32 + 10;
let starting_power_level = rack_id * y as i32;
let increased_power_level = starting_power_level ... |
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// 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 ... |
use std::fs::File;
use std::io::{self, Read};
use std::path::PathBuf;
#[cfg(feature = "reqwest")]
use std::sync::Arc;
#[cfg(feature = "reqwest")]
use reqwest::{self, Client as HttpClient, Method, Request};
use quick_error::ResultExt;
use manifest::{FileData, Package, Packages, PackageData};
#[cfg(feature = "reqwest")... |
#[doc = "Reader of register SMPR1"]
pub type R = crate::R<u32, super::SMPR1>;
#[doc = "Writer for register SMPR1"]
pub type W = crate::W<u32, super::SMPR1>;
#[doc = "Register SMPR1 `reset()`'s with value 0"]
impl crate::ResetValue for super::SMPR1 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Sel... |
use std::io::Error;
use std::io::ErrorKind;
use trust_dns_resolver::config::*;
use trust_dns_resolver::Resolver;
pub use crate::network::ip_address_utility;
pub enum ObscurificationType {
DWORD,
OCTAL,
HEX,
}
const INVALID_URL_ERROR_MESSAGE: &str =
"The URL provided was invalid. The URL format accepted is \"... |
// Copyright 2022 Datafuse Labs.
//
// 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 ... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use anyhow::{ensure, Result};
use dirs;
use libp2p::core::Multiaddr;
use once_cell::sync::Lazy;
use rand::prelude::*;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use starcoin_crypto::{
ed25519::{Ed25519PrivateKey,... |
mod size_of;
use std::process::Command;
const BUILTIN_TYPES: &'static str =
include_str!("../../../../backend_resources/javascript/builtins.js");
fn nodejs_run(script: &str) -> Vec<u8> {
let res = Command::new("node")
.arg("-e")
.arg(script)
.output()
.expect("failed to execut... |
use std::vec::Vec ;
use pos::*;
use std::cmp::{max,min};
impl Position {
/// Positions from top-left are added first, to top-right, to finish by bottom-right
pub fn in_range(self,range:i32) -> Vec<Position> {
let range = range.abs() ;
let n : usize = range.abs() as usize + 1 ;
let mut ve... |
#[doc = "Reader of register MIMR"]
pub type R = crate::R<u32, super::MIMR>;
#[doc = "Writer for register MIMR"]
pub type W = crate::W<u32, super::MIMR>;
#[doc = "Register MIMR `reset()`'s with value 0"]
impl crate::ResetValue for super::MIMR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
use crate::challenges::Challenge;
use crate::ResultHashMap;
use crate::file_lines_to_string_vec;
use crate::n_ary_tree;
pub fn challenge() -> Challenge {
return Challenge::new(
product_of_sorted_value_differences,
count_valid_joltage_paths,
String::from("resources/joltage_ratings.txt"),
... |
pub mod parity;
pub fn is_even(n: i64) -> bool {
parity::bitwise_is_even(n)
}
pub fn is_odd(n: i64) -> bool {
parity::bitwise_is_odd(n)
}
#[cfg(test)]
mod tests {
use std::fmt::Display;
use super::*;
#[derive(Debug)]
pub(crate) struct UniqueCategorySample<N, C>(pub(crate) N, pub(crate) C);
... |
use std::env;
extern crate failure;
use linked_list::LinkedList;
use std::fs::File;
use std::io::prelude::*;
use std::io;
use std::io::SeekFrom;
use chrono::{NaiveDateTime, NaiveTime};
const QUOTE_SIZE: usize = 210;
#[derive(Debug)]
//The Global header
pub struct Header {
thiszone: u32, // timestamp second off... |
//! Totalistic Life-like rules.
use crate::{
cells::{CellRef, State, ALIVE, DEAD},
error::Error,
rules::Rule,
search::Reason,
world::World,
};
use bitflags::bitflags;
use ca_rules::{ParseLife, ParseLifeGen};
use std::str::FromStr;
bitflags! {
/// Flags to imply the state of a cell and its neig... |
use serde::Deserialize;
use super::helpers::deserealize_currency;
/// Информация о валюте
/// https://developers.xsolla.com/ru/api/v2/getting-started/#api_param_webhooks_payment_purchase_virtual_currency
#[derive(Debug, Deserialize)]
pub struct VirtualCurrency {
pub name: String,
pub sku: String,
pub quant... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::chain_state::StateStore;
use anyhow::Result;
use crypto::keygen::KeyGen;
use logger::prelude::*;
use once_cell::sync::Lazy;
use starcoin_state_api::ChainState;
use std::convert::TryInto;
use types::account_config::starcoi... |
mod get_all;
pub use self::get_all::*;
|
use serde::de;
pub fn is_array<T: ?Sized>(type_name: &str) -> bool
where
T: de::DeserializeOwned {
if type_name.starts_with("alloc::collections::linked_list")
|| type_name.starts_with("alloc::vec::Vec<")
|| type_name.starts_with("[")
|| type_name.starts_with("&[") {
retu... |
#[doc = "Reader of register CCIPR"]
pub type R = crate::R<u32, super::CCIPR>;
#[doc = "Writer for register CCIPR"]
pub type W = crate::W<u32, super::CCIPR>;
#[doc = "Register CCIPR `reset()`'s with value 0"]
impl crate::ResetValue for super::CCIPR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Sel... |
use ic_cdk::api::call::CallResult;
use ic_cdk::call;
use ic_cdk::export::candid::Principal;
use crate::types::{
GetControllersResponse, GetTotalMembersResponse, IsMemberRequest, IsMemberResponse,
IssueRevokeMembershipsRequest, UpdateControllerRequest, UpdateControllerResponse,
};
pub struct MembershipTokenCli... |
use crate::ds;
use crate::object::ObjType;
use crate::{ds::DataStore, key::Key, object::Object};
use std::io::prelude::*;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum PutDataError {
#[error("error putting object: {_0}")]
PutObjError(#[from] ds::PutObjError),
#[error("io error: {_0}")]
IOErro... |
use std::io;
use anyhow::Result;
use nexers::nexus::Event;
fn main() -> Result<()> {
use std::fs;
let from = io::BufReader::new(fs::File::open("sample-index")?);
let mut errors = 0;
nexers::nexus::read(from, |event| {
match event {
Event::Doc(d) => {
if d.id.group ... |
//! A general purpose library for HTTP request routing.
//!
//! This crate provides basic building blocks to implement
//! URI and method-based routing and middleware functionality
//! in web applications as well as frameworks.
//!
//! The library is general purpose in the sense that it is un-opinionated
//! with regar... |
use std::{
fs,
fs::File,
path::PathBuf,
io::{BufWriter,BufReader,BufRead,Write},
};
use regex::Regex;
use clap::{Arg, App};
use image::{
GenericImageView,
imageops::FilterType,
};
fn main() {
let matches = App::new("Album Builder")
.version("0.1")
... |
pub fn add_to_wait_list(){} |
//! Oasis WASM ABI implementation.
use crate::memory;
pub mod crypto;
pub mod dispatch;
pub mod env;
pub mod storage;
#[no_mangle]
pub extern "wasm" fn allocate(length: u32) -> u32 {
memory::allocate_host(length)
}
#[no_mangle]
pub extern "wasm" fn deallocate(offset: u32, length: u32) {
memory::deallocate_ho... |
use digest;
use digest::generic_array::GenericArray;
use digest::generic_array::typenum::{U28, U32, U64};
use block_buffer::BlockBuffer512;
use byte_tools::write_u32v_be;
use consts::{STATE_LEN, H224, H256};
#[cfg(not(feature = "asm"))]
use sha256_utils::compress256;
#[cfg(feature = "asm")]
use sha2_asm::compress256;... |
use crate::ast;
use crate::collections::HashMap;
use std::cell::RefCell;
use std::rc::Rc;
/// Storage for synthetic language items.
#[derive(Clone, Default)]
pub struct Storage {
inner: Rc<RefCell<Inner>>,
}
impl Storage {
/// Construct a new empty storage.
pub(crate) fn new() -> Self {
Self::defa... |
use crate::error::IntoPyResult;
use geo_types::Geometry;
use numpy::{IntoPyArray, PyArray1};
use py_geo_interface::Geometry as GiGeometry;
use pyo3::prelude::PyModule;
use pyo3::prelude::*;
use pyo3::{wrap_pyfunction, PyResult, Python};
use ukis_h3cellstore::export::h3ron::collections::HashSet;
use ukis_h3cellstore::ex... |
fn main() {
println!("Hello, world! ok fine!!!");
}ls
|
// RGB standard library
// Written in 2020 by
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warr... |
use crate::chunks::Chunks;
pub struct Limits {
max_sequences: Option<u64>,
max_nucleotides: Option<u64>,
max_file_size: Option<u64>,
}
impl Limits {
pub fn new(
max_sequences: Option<u64>,
max_nucleotides: Option<u64>,
max_file_size: Option<u64>,
) -> Self {
Self {
... |
#[cfg(test)]
mod tests;
use {
itertools::Itertools,
rand::{rngs::StdRng, Rng},
std::{cmp::Ordering, iter::repeat_with},
};
const DIFF2_MAX: i32 = 3;
pub fn brute_minplus_convolution(a: &[i32], b: &[i32]) -> Vec<i32> {
if a.is_empty() && b.is_empty() {
return Vec::new();
}
let mut c = v... |
use crate::models::{DeletedHabit, Habit, HabitDraft, HabitId, HabitLog, HabitPatch};
use chrono::NaiveDate;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Serialize, Deserialize)]
pub struct HabitStore {
current_id: u32,
data: HashMap<HabitId, Habit>,
}
#[derive(Serialize, Deseri... |
use async_graphql::Executor;
use poem::{async_trait, Endpoint, FromRequest, Request, Result};
use crate::{GraphQLBatchRequest, GraphQLBatchResponse};
/// A GraphQL query endpoint.
///
/// # Example
///
/// ```
/// use async_graphql::{EmptyMutation, EmptySubscription, Object, Schema};
/// use async_graphql_poem::Graph... |
mod opts;
pub use self::opts::*;
|
const BUILTIN_SPRITES: [u8; 80] = [
0xF0, 0x90, 0x90, 0x90, 0xF0, // 0x0
0x20, 0x60, 0x20, 0x20, 0x70, // 0x1
0xF0, 0x10, 0xF0, 0x80, 0xF0, // 0x2
0xF0, 0x10, 0xF0, 0x10, 0xF0, // 0x3
0x90, 0x90, 0xF0, 0x10, 0x10, // 0x4
0xF0, 0x80, 0xF0, 0x10, 0xF0, // 0x5
0xF0, 0x80, 0xF0, 0x90, 0xF0, // 0... |
#[doc = "Description cluster[n]: Channel n task end-point"]
pub struct TEP {
register: ::vcell::VolatileCell<u32>,
}
#[doc = "Description cluster[n]: Channel n task end-point"]
pub mod tep;
|
pub struct FunctionInstance;
pub struct TableInstance;
pub struct MemInstance;
pub struct GlobalInstance;
/// The store represent all global state that can be manipulated by Webassembly program.
pub struct Store {
pub funcs: Vec<FunctionInstance>,
pub tables: Vec<TableInstance>,
pub mems: Vec<MemInstance>,... |
#[doc = "Reader of register ADDR2H"]
pub type R = crate::R<u32, super::ADDR2H>;
#[doc = "Writer for register ADDR2H"]
pub type W = crate::W<u32, super::ADDR2H>;
#[doc = "Register ADDR2H `reset()`'s with value 0"]
impl crate::ResetValue for super::ADDR2H {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
use super::AddArgs;
use crate::v0::support::StringError;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use cid::Cid;
use futures::stream::{Stream, StreamExt, TryStreamExt};
use ipfs::unixfs::ll::{
dir::builder::{
BufferingTreeBuilder, TreeBuildingFailed, TreeConstructionFailed, TreeNode, TreeOptions,
},
... |
use piston_window::*;
pub trait Drawable {
fn draw<G:Graphics> (&self, Context, &mut G);
}
|
use shipyard::*;
use shipyard_hierarchy::*;
use std::collections::HashMap;
struct MyTree {}
#[test]
fn test_hierarchy() {
let world = World::new();
let mut storages = world.borrow::<(EntitiesViewMut, ViewMut<Parent<MyTree>>, ViewMut<Child<MyTree>>)>().unwrap();
let mut hierarchy = (&mut storages.0, &mut... |
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate uuid;
extern crate docopt;
extern crate time;
use uuid::{Uuid, UuidV1Context};
use docopt::Docopt;
const USAGE: &'static str = "\
Usage:
rsuuidgen [options]
Create a new UUID value.
Options:
-r, --random generate random-based uuid
-t, -... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type NamedResource = *mut ::core::ffi::c_void;
pub type ResourceCandidate = *mut ::core::ffi::c_void;
#[repr(transparent)]
pub struct ResourceCandidateKind(... |
// Copyright 2022 Datafuse Labs.
//
// 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 ... |
use std::cmp;
use std::fmt::{self, Debug, Formatter};
use std::mem;
use std::ptr::{self, NonNull};
use intrusive_collections::container_of;
use intrusive_collections::{LinkOps, RBTreeLink};
use liblumen_core::alloc::utils as alloc_utils;
use liblumen_core::alloc::{AllocError, Layout};
use crate::sorted::{Link, SortK... |
//! # Acteur Actor System
//!
//! An actor system written in Rust that just works. Simple, robust, fast, documented.
//!
//! ## Overall features of Acteur
//!
//! ## Example
//!
//! ```rust,no_run
//! use acteur::{Actor, Handle, Assistant, System};
//! use async_trait::async_trait;
//!
//! #[derive(Debug)]
//! struct E... |
#![feature(external_doc)]
use ta_common::traits::Indicator;
pub struct EMA {
ema: f64,
init: bool,
k: f64,
}
#[doc(include = "../README.md")]
impl EMA {
pub fn new(period: u32) -> EMA {
let k = 2.0 / (period as f64 + 1.0);
Self {
k,
init: false,
ema:... |
use fine_grained::Stopwatch;
use std::collections::HashMap;
/// A profiler that gathers average run times code sections.
pub struct Profiler {
main_watch: Stopwatch,
watches: HashMap<&'static str, (usize, Stopwatch)>,
current_section: Option<&'static str>,
}
/// Profiling data collected by the `Profiler`.... |
use std::env;
use std::path::PathBuf;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let out_path = PathBuf::from(&out_dir).join("bindings.rs");
cc::Build::new()
.cpp(true)
.warnings(false)
.flag("-std=c++17")
.include("ragemp-c-sdk/include")
.include("rage... |
const PI: f32 = 3.141592654;
fn get_circumference(r: f32) -> f32 {
return PI * 2.0 * r;
}
fn get_area(r: f32) -> f32 {
return PI * r * r;
}
fn main() {
let r: f32 = 5.0;
let c: f32 = get_circumference(r);
printf("Circumference (Perimeter) = %.2f\n", c); // ... |
#![cfg_attr(test, allow(dead_code))]
#![cfg_attr(test, allow(unused_imports))]
extern crate rustc_serialize;
extern crate docopt;
mod env;
mod error;
mod load;
mod run;
use docopt::Docopt;
use error::BenvError;
use load::load_file;
use run::run;
use std::path::Path;
use std::process::exit;
use std::result;
/// Gene... |
#[doc = "Writer for register C1IFCR"]
pub type W = crate::W<u32, super::C1IFCR>;
#[doc = "Register C1IFCR `reset()`'s with value 0"]
impl crate::ResetValue for super::C1IFCR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Write proxy for field `CTEIF1`"]
pub ... |
// SPDX-License-Identifier: MIT OR BlueOak-1.0.0
use crate::unicode;
use crate::value::Value;
use std::collections::HashMap;
use std::option::Option;
use std::str::Chars;
fn is_ws(c: char) -> bool {
c == ' ' || c == '\t' || c == '\n' || c == '\r'
}
fn peek(chars: &Chars) -> Option<char> {
chars.clone().next(... |
use std::io::Read;
fn read<T: std::str::FromStr>() -> T {
let token: String = std::io::stdin()
.bytes()
.map(|c| c.ok().unwrap() as char)
.skip_while(|c| c.is_whitespace())
.take_while(|c| !c.is_whitespace())
.collect();
token.parse().ok().unwrap()
}
fn main() {
let... |
use console::style;
use emoji;
use error::Error;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
pub struct ProgressOutput {
bar: MultiProgress,
}
impl ProgressOutput {
pub fn new() -> Self {
Self {
bar: MultiProgress::new(),
}
}
pub fn message(&self, message: ... |
use crate::intcode_compute::computer_1202;
use std::collections::VecDeque;
use std::fs;
pub fn program_1205_01() -> i64 {
let filename = "./src/aoc05/input.txt";
let contents = fs::read_to_string(filename).expect("Something went wrong reading the file");
let result = computer_1202(&contents, false, &mut VecDeque... |
#[doc = "Reader of register MPCBB2_VCTR18"]
pub type R = crate::R<u32, super::MPCBB2_VCTR18>;
#[doc = "Writer for register MPCBB2_VCTR18"]
pub type W = crate::W<u32, super::MPCBB2_VCTR18>;
#[doc = "Register MPCBB2_VCTR18 `reset()`'s with value 0xffff_ffff"]
impl crate::ResetValue for super::MPCBB2_VCTR18 {
type Typ... |
use crate::qrcode::model::QREncoder;
use crate::Config;
use actix_web::*;
use failure::Error;
use serde_derive::*;
#[derive(Deserialize)]
pub struct Info {
username: String,
}
#[derive(Serialize)]
struct ResponseData {
data: QRCodes,
}
#[derive(Serialize)]
struct QRCodes {
qrcodes: Vec<QRCode>,
}
#[deri... |
//! Asynchronous I/O.
//!
//! This module is the asynchronous version of `std::io`. Primarily, it
//! defines two traits, [`AsyncRead`] and [`AsyncWrite`], which extend the
//! `Read` and `Write` traits of the standard library.
//!
//! # AsyncRead and AsyncWrite
//!
//! [`AsyncRead`] and [`AsyncWrite`] must only be imp... |
use crate::compat::Transaction as DbTransaction;
use crate::rpc;
use crate::transaction_info::{parse_accesses, parse_tx_hash, TransactionInfo};
use rocksdb::{Error, Options, SliceTransform, DB};
use std::collections::HashMap;
use std::convert::TryInto;
use web3::types::{Transaction as Web3Transaction, TransactionReceip... |
#![feature(question_mark)]
#![feature(collections)]
#![no_std]
#[macro_use] extern crate collections;
mod util;
mod ops;
use collections::Vec;
pub use ops::Acorn128;
#[derive(Debug)]
pub enum DecryptFail {
TagLengthError,
AuthenticationFail
}
pub fn aead_encrypt(key: &[u8], iv: &[u8], message: &[u8], aad:... |
#![forbid(unsafe_code)]
#![deny(dead_code)]
#![deny(unused_must_use)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::panic)]
#![deny(clippy::perf)]
#![deny(clippy::nursery)]
#![deny(clippy::needless_update)]
#![deny(clippy::match_like_matches_macro)]
#![deny(clippy::from_... |
use input_i_scanner::InputIScanner;
use mod_int::ModInt998244353;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
_i_i.scan::<$... |
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
use rocket::response::content;
use rocket::request;
use rocket::Outcome;
use rocket::http::{RawStr, Status, ContentType};
#[macro_use]
extern crate curl;
use curl::easy;
use image::{DynamicImage, load_from_memory};
#[derive(Debug)]
enum ... |
/// :)
pub const FERROS_BANNER: &'static str = "== F3RR0S v0.1.0 by Dowland Zaldivar Aiello <3 ==";
/// The number of TTYs to open at startup
pub const N_TTYS: u8 = 7;
/// The scheduler will only use one thread by default
pub const N_SCHEDULER_THREADS: u16 = 1;
|
use crate::{
existing_whitespace::{ExistingWhitespace, TrailingWhitespace, TrailingWithIndentationConfig},
text_edits::TextEdits,
width::{Indentation, SinglelineWidth, Width},
};
use candy_frontend::cst::Cst;
pub struct UnformattedCst<'a> {
pub child: &'a Cst,
pub whitespace: ExistingWhitespace<'a>... |
use super::{Context, Time, TimerTask, Timer};
use std::collections::BinaryHeap;
use std::cmp::Ordering;
struct TimerEntry {
time: Time,
task: Box<TimerTask>,
}
impl TimerEntry {
fn new(time : Time, task: Box<TimerTask>) -> Self {
TimerEntry{ time: time, task: task}
}
}
impl Ord for TimerEntry... |
#[macro_use]
extern crate nom;
use nom::{be_u16, be_u64};
#[derive(Debug)]
enum OpCode {
Continue,
Text,
Binary,
Close,
Ping,
Pong,
Reserved,
}
impl From<u8> for OpCode {
fn from(opcode: u8) -> OpCode {
match opcode {
0 => OpCode::Continue,
1 => OpCode:... |
use config::Config;
use types::Domain;
use hyper::header::{Authorization, Basic, Header};
use rocket::{Outcome, State};
use rocket::http::Status;
use rocket::response::Failure;
use rocket::request::{self, FromRequest, Request};
use std::net::{Ipv4Addr, Ipv6Addr};
#[get("/dns/update?<update>")]
pub fn update(config: S... |
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub struct StudyScript {
pub title: String,
pub shorttitle: Option<String>,
pub overlay: Option<bool>,
pub format: Option<String>,
pub precision: Option<i64>,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(tag = "type"... |
use crate::auth;
use crate::handlers::types::*;
use crate::Pool;
use crate::controllers::mail_folder_controller::*;
use actix_web::{web, Error, HttpResponse};
use actix_web_httpauth::extractors::bearer::BearerAuth;
pub async fn add_mail_folder(
db: web::Data<Pool>,
auth: BearerAuth,
space_name: web::Path<... |
use std::fmt::{Debug, Display};
use compactor_scheduler::CompactionJob;
use futures::stream::BoxStream;
pub mod endless;
pub mod once;
/// Source for compaction jobs.
pub trait CompactionJobStream: Debug + Display + Send + Sync {
/// Create new source stream of compaction jobs.
///
/// This stream may be... |
use std::{
cmp::Ordering,
fmt,
ops::{Deref, DerefMut}
};
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Token<'src> {
Word(&'src str),
End,
}
impl<'src> fmt::Debug for Token<'src> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self {
Token::Word(w) => fmt:... |
use std::collections::hash_map::Entry;
use std::result;
use ::tokio_io::{AsyncRead, AsyncWrite};
use ::futures::{Poll, Async, Stream, Future};
use ::futures::sync::mpsc::{unbounded};
use ::futures::unsync::mpsc::UnboundedSender;
use ::futures_mutex::{FutMutex, FutMutexGuard};
use ::persistence::Persistence;
use ::pro... |
use crate::{
builtins::{PyDict, PyDictRef, PyListRef, PyStrRef, PyTuple, PyTupleRef, PyType, PyTypeRef},
convert::{IntoObject, TryFromObject},
types::PyComparisonOp,
AsObject, Context, Py, PyObjectRef, PyResult, VirtualMachine,
};
pub struct WarningsState {
filters: PyListRef,
_once_registry: P... |
#[allow(dead_code)]
#[cfg(test)]
use mockall::{automock, predicate::*};
#[cfg_attr(test, automock)]
trait MyTrait {
fn foo(&self, x: u32) -> u32;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn mytest() {
let mut mock = MockMyTrait::new();
mock.expect_foo().with(eq(4)).times(1).ret... |
pub struct Modulo<T> {
modulo: T,
inv: Vec<Option<u32>>
}
pub struct ModInt<'a, T> {
number: T,
modulo: &'a T,
inv: &'a Vec<Option<u32>>
}
mod modint_trait;
mod functions; |
use cranelift::prelude::*;
use num_traits::cast::ToPrimitive;
use rustpython_compiler_core::bytecode::{
self, BinaryOperator, BorrowedConstant, CodeObject, ComparisonOperator, Instruction, Label,
OpArg, OpArgState, UnaryOperator,
};
use std::collections::HashMap;
use super::{JitCompileError, JitSig, JitType};
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.