text stringlengths 8 4.13M |
|---|
#![deny(warnings)]
#![feature(abi_msp430_interrupt)]
#![feature(const_fn)]
#![feature(proc_macro)]
#![no_std]
extern crate msp430;
extern crate msp430g2553;
#[macro_use(task)]
extern crate msp430_rtfm as rtfm;
use rtfm::app;
app! {
device: msp430g2553,
resources: {
static SHARED: u32 = 0;
},
... |
use core_foundation_sys::base::*;
extern {
pub fn CFNetServiceGetTypeID() -> CFTypeID;
pub fn CFNetServiceMonitorGetTypeID() -> CFTypeID;
pub fn CFNetServiceBrowserGetTypeID() -> CFTypeID;
}
|
use crate::{material::Material, ray::Ray, Point3};
use std::sync::Arc;
pub struct HitRecord {
pub p: Point3,
pub normal: Point3,
pub t: f64,
pub front_face: bool,
pub material: Option<Arc<dyn Material + Send + Sync>>,
}
impl Clone for HitRecord {
fn clone(&self) -> Self {
HitRecord {
... |
use binary_search_range::BinarySearchRange;
use proconio::input;
fn main() {
input! {
t: usize,
};
for _ in 0..t {
input! {
n: usize,
a: [u32; n],
};
solve(n, a);
}
}
fn solve(n: usize, a: Vec<u32>) {
let mut b = a.clone();
b.sort();
... |
use super::interfaces::player::{Angle, PlayerState, Position};
use super::packet::Packet;
use uuid::Uuid;
pub fn route_packet<P: PlayerState>(p: Packet, conn_id: Uuid, player_state: P) {
match p {
Packet::PlayerPosition(player_position) => {
player_state.move_and_look(
conn_id,
... |
//! VM Runtime
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
#[cfg(not(feature = "std"))]
use alloc::rc::Rc;
#[cfg(feature = "std")]
use std::rc::Rc;
#[cfg(not(feature = "std"))]
use core::ops::AddAssign;
#[cfg(feature = "std")]
use std::ops::AddAssign;
use su... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]... |
use h2;
use http;
use indexmap::IndexMap;
use std::time::Instant;
use proxy::Source;
use transport::connect;
// TODO this should be replaced with a string name.
#[derive(Copy, Clone, Debug)]
pub enum Direction { In, Out }
#[derive(Clone, Debug)]
pub struct Endpoint {
pub direction: Direction,
pub target: con... |
use regex::Regex;
use std::collections::{HashMap, HashSet};
use std::fs::read_to_string;
use std::path::Path;
fn count_outer_bags_for(
input: HashMap<String, HashMap<String, usize>>,
input_color: String,
containers: &mut HashSet<String>,
) {
let mut additional_color_containers = Vec::new();
for (c... |
use std::collections::vec_deque::VecDeque;
use std::result as result;
pub trait TimeMachineState {
type Forward;
type Reverse;
fn apply_forward(&mut self, delta: &Self::Forward) -> Self::Reverse;
fn apply_reverse(&mut self, delta: &Self::Reverse);
}
#[derive(Debug, PartialEq)]
pub enum Error<T> {
... |
// Port of https://www.rabbitmq.com/tutorials/tutorial-six-python.html. Start this
// example in one shell, then the rpc_client example in another.
use amiquip::{
AmqpProperties, Connection, ConsumerMessage, ConsumerOptions, Exchange, Publish,
QueueDeclareOptions, Result,
};
use serde_json::Value;
fn fib(inpu... |
use crate::{
commands::{
BasicCommand, BasicRetVal, CommandTrait, CommandUnion, CommandUnion as CU, ReturnValUnion,
ReturnValUnion as RVU, WhichVariant,
},
error::Unsupported,
ApplicationMut, Error, Plugin, PluginType, WhichCommandRet,
};
use abi_stable::std_types::{RBoxError, RResult, ... |
/// Aborts processing of this action and unwinds all pending changes if the test condition is true
#[inline]
pub fn check(pred: bool, msg: &str) {
if !pred {
let msg_ptr = msg.as_ptr();
#[allow(clippy::cast_possible_truncation)]
let msg_len = msg.len() as u32;
unsafe { eosio_cdt_sys:... |
use super::{Array, Index, Length, Slice};
use crate::htab;
use std::borrow::Borrow;
use std::collections::hash_map::RandomState;
use std::hash;
use std::marker::PhantomData;
struct Field<Q: ?Sized>(PhantomData<fn(&Q) -> &Q>);
impl<K: Borrow<Q>, V, Q: ?Sized + Eq + hash::Hash> htab::Field<(K, V)> for Field<Q> {
ty... |
#![allow(unused_imports)]
#![allow(dead_code)]
use std::env;
use std::fs;
use std::thread;
use std::path::Path;
use std::str::from_utf8;
use common::SOCKET_PATH;
use sodiumoxide::crypto::box_;
use std::collections::HashMap;
use serde::{Serialize, Deserialize};
use std::io::{Read, Write, Error};
use std::sync::{Arc, Mut... |
mod serde_types {
pub mod registration {
#[derive(Serialize,Deserialize,Clone,PartialEq,Debug)]
pub struct ClientData {
pub challenge: String,
pub origin: String,
pub typ: String,
}
}
}
|
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Management_Core")]
pub mod Core;
#[cfg(feature = "Management_Deployment")]
pub mod Deployment;
#[cfg(feature = "Management_Policies")]
pub mod Policies;
#[cfg(feature = "Management_Update"... |
use crate::{Error, Module, Trait};
use frame_support::debug;
use num_bigint::BigUint;
use num_traits::{One, Zero};
use rand::distributions::{Distribution, Uniform};
use rand_chacha::{
rand_core::{RngCore, SeedableRng},
ChaChaRng,
};
use sp_std::{vec, vec::Vec};
/// all functions related to random value generat... |
use {Bathroom, BathroomLocation};
macro_rules! b_room {
( $num:expr, $loc:ident, [$($served:expr),*] ) => {
Bathroom {
number: $num,
rooms: vec![$($served,)*],
location: BathroomLocation::$loc,
}
}
}
lazy_static! {
/// A list of all the bathrooms in Sim... |
use std::io::{self, BufRead, BufReader, Read};
use bytes::buf::ext::BufExt;
use bytes::Bytes;
use flate2::bufread::ZlibDecoder;
use crate::object::parse::ParseObjectError;
use crate::object::{ObjectData, ObjectHeader};
use crate::parse;
pub struct ObjectReader {
header: Option<ObjectHeader>,
reader: ZlibDeco... |
//! The module containing the connection pool task and related code.
//!
//! The connection pool task maintains the current pool of active client
//! connections, allowing responses to be broadcast to all active connections.
#![experimental]
use std::collections::hash_map::{ HashMap, IterMut };
use std::io::stderr;
us... |
use glutin_window::GlutinWindow;
use opengl_graphics::{GlGraphics, OpenGL};
use piston::event_loop::{EventSettings, Events};
use piston::RenderEvent;
use crate::scene::Scene;
pub struct Program {
window: GlutinWindow,
scene: Scene,
events: Events
// gl: GlGraphics
}
impl Program {
pub fn new(w : GlutinWindow) ->... |
/* A struct containing syntax errors */
pub struct errors{
missingCaret: "error: expected '^' at the end of the line",
misplacedCaret: "error: move '^' to the end of the line",
missingVariable: "error: expected variable name after identifier (Ashari,Harf,Sahih)",
missingValue: "error: expected a value ... |
use coffee::{graphics::*, load::Task, Game, Result, Timer};
fn main() -> Result<()> {
MainGame::run(WindowSettings {
title: String::from("coffee_issue"),
size: (1280, 1024),
resizable: true,
fullscreen: false,
})
}
struct MainGame;
impl Game for MainGame {
type Input = ();... |
// 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 gl::types::*;
pub enum Primitive {
Byte,
Short,
UShort,
Int,
UInt,
Float,
Double,
Nothing
}
impl Primitive {
pub fn value(&self) -> GLenum {
match self {
Primitive::Byte => gl::BYTE,
Primitive::Short => gl::SHORT,
Primitive::UShort =>... |
/// Contains constants that the user might want to modify.
/// The prompt that appears at the beginning of the insert box when in insert mode.
pub const ADD_PROMPT: &str = "Add: >";
/// Keep ADD_PROMPT_LEN up to date to ensure proper cursor positioning in insert mode.
pub const ADD_PROMPT_LEN: u16 = 6;
/// Column widt... |
use lazy_static::lazy_static;
lazy_static! {
static ref PAGE_SIZE: usize = unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize };
}
lazy_static! {
static ref NUM_CPUS: usize = get_num_cpus();
}
#[inline]
pub fn page_size() -> usize {
*PAGE_SIZE
}
#[inline]
pub fn num_cpus() -> usize {
*NUM_CPUS
}
#... |
use table;
mod lib;
use std::io;
fn main() {
println!("Enter number");
let mut input=String::new();
io::stdin().read_line(&mut input).expect("Fail to read");
let data:u32=input.trim().parse().expect("Fail to read");
print_table::sub_mod::table(data);
lib::lib_table::lib_sub_mod::table(... |
//! How to load new cache entries.
use async_trait::async_trait;
use std::{fmt::Debug, future::Future, hash::Hash, marker::PhantomData, sync::Arc};
pub mod batch;
pub mod metrics;
#[cfg(test)]
pub(crate) mod test_util;
/// Loader for missing [`Cache`](crate::cache::Cache) entries.
#[async_trait]
pub trait Loader: st... |
use super::*;
use crate::mock::*;
use ark_ff::prelude::*;
use arkworks_gadgets::{
poseidon::PoseidonParameters,
utils::{get_mds_poseidon_circom_bn254_x5_3, get_rounds_poseidon_circom_bn254_x5_3},
};
use frame_support::{assert_err, assert_ok, instances::Instance1};
use sp_core::bytes;
#[test]
fn should_fail_with_para... |
// The device which renders the objects and draws them to the screen. They are all contained in
// this one device struct which is why I'm giving it its own file.
use crate::render_objects::*;
use crate::structures::*;
use std::cmp;
pub struct Device {
// The width and height of the screen. This will of course be... |
// Copyright 2021 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 agre... |
/*
http://rosalind.info/problems/ba1b/
Find all the most frequent k-mers
Sample:
ACGTTGCATGTCGCATGATGCATGAGAGCT
4
CATG GCAT
*/
extern crate rosalind_rust;
use rosalind_rust::Cli;
use std::collections::HashMap;
use std::io::{prelude::*, BufReader};
use structopt::StructOpt;
// https://github.com/dib-lab/bioinf_al... |
extern crate failure;
extern crate luster;
use std::env;
use std::fs::File;
use std::io::Read;
use failure::{err_msg, Error};
use luster::state::Lua;
fn main() -> Result<(), Error> {
let mut args = env::args();
args.next();
let mut file = File::open(args.next()
.ok_or_else(|| err_msg("no file ar... |
#[doc = "Reader of register CTR"]
pub type R = crate::R<u32, super::CTR>;
#[doc = "Reader of field `_IminLine`"]
pub type _IMINLINE_R = crate::R<u8, u8>;
#[doc = "Reader of field `DMinLine`"]
pub type DMINLINE_R = crate::R<u8, u8>;
#[doc = "Reader of field `ERG`"]
pub type ERG_R = crate::R<u8, u8>;
#[doc = "Reader of f... |
use input::Input;
use input::evaluator::InputEvaluatorRef;
use parser::{ Evaluator, Node };
use util;
// Smoother
pub struct Smooth {
input : Box<Input>,
values : Vec<f64>,
samples : usize,
index : usize,
curr_val : f64,
curr_sum : f64,
}
impl Smooth {
pub fn create(samples_v: usize, ... |
use crate::topology::{config::DataType, Config};
use std::collections::HashMap;
pub fn typecheck(config: &Config) -> Result<(), Vec<String>> {
Graph::from(config).typecheck()
}
#[derive(Debug, Clone)]
enum Node {
Source {
ty: DataType,
},
Transform {
in_ty: DataType,
out_ty: Da... |
extern crate specs;
use rltk::Point;
use specs::prelude::*;
use crate::{GlobalTurnTimeScore, MEDIUM_LIFETIME, ParticleBuilder, Position, TakesTurn, WaitCause, WantsToWait};
pub struct WaitSystem;
impl<'a> System<'a> for WaitSystem {
type SystemData = (
Entities<'a>,
WriteStorage<'a, WantsToWait>... |
use super::vec2;
pub struct Ray2d {
range: f32,
dir: vec2::Vec2
}
// todo |
use ndarray::{Array, Array2};
pub fn fusion<T, U>(mu1: T, mu2: T, var1: U, var2: U) -> (T, U)
where
T: num::Float + From<U>,
U: num::Float {
let v: U = var1 + var2;
let mu = (mu1 * From::from(var2) + mu2 * From::from(var1)) / From::from(v);
let var = (var1 * var2) / v;
(mu, var)
}
pub fn fusio... |
use crate::BLOCK_384_512_LEN as BLOCK_LEN;
use crate::PAD_AND_LENGTH_384_512_LEN as PAD_AND_LENGTH_LEN;
use crate::STATE_384_512_LEN as STATE_LEN;
use crate::WORD_384_512_LEN as WORD_LEN;
use crate::{inner_full_pad, inner_pad, process_block_384_512, zero_block};
use crate::{Error, Hash, Sha2};
/// Digest length in byt... |
pub mod account;
pub mod account_utils;
pub mod bpf_loader;
pub mod client;
pub mod fee_calculator;
pub mod genesis_block;
pub mod hash;
pub mod instruction;
pub mod instruction_processor_utils;
pub mod loader_instruction;
pub mod message;
pub mod native_loader;
pub mod packet;
pub mod poh_config;
pub mod pubkey;
pub m... |
//! Thread-safe, asynchronous counting semaphore.
//!
//! A `Semaphore` instance holds a set of permits. Permits are used to
//! synchronize access to a shared resource.
//!
//! Before accessing the shared resource, callers acquire a permit from the
//! semaphore. Once the permit is acquired, the caller then enters the... |
use std::collections::HashMap;
use std::io;
use std::io::Read;
use regex::Regex;
fn main() {
let mut input = String::new();
io::stdin().read_to_string(&mut input).unwrap();
let re = Regex::new(r"(?m)(?:^mask = ([01X]+)$)|(?:^mem\[(\d+)\] = (\d+)$)").unwrap();
let mut mem = HashMap::new();
let mut... |
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_structure_associate_file_system_aliases_input(
object: &mut smithy_json::serialize::JsonObjectWriter,
input: &crate::input::AssociateFileSystemAliasesInput,
) {
if let Some(var_1) = &input.client_request_token ... |
use crate::errors::ServiceError;
use crate::models::msg::Msg;
use crate::schema::option_group;
use crate::utils::validator::{re_test_name, Validate};
use actix::Message;
use actix_web::error;
use actix_web::Error;
use diesel;
use uuid::Uuid;
#[derive(Deserialize, Serialize, Debug, Message, Insertable)]
#[rtype(result ... |
mod is_unique;
pub use self::is_unique::*;
|
#[inline]
pub unsafe fn outb(port: u16, value: u8)
{
asm!("outb %al, %dx" :: "{dx}" (port), "{al}" (value) :: "volatile" );
}
static VIDEO_MEM: u64 = 0xB8000;
static mut cursor_x: u64 = 0;
static mut cursor_y: u64 = 0;
#[inline]
unsafe fn update_cursor()
{
let offset: u64 = cursor_y * 80 + cursor_x;
let ... |
include_generated!();
impl ::application::Application {
pub fn create_and_exit<F: FnOnce(&mut ::application::Application) -> i32>(f: F) -> ! {
let exit_code = {
let mut args = ::qt_core::core_application::CoreApplicationArgs::from_real();
let mut app = unsafe { ::application::Application::new(args.ge... |
use rand::prelude::{RngCore, SeedableRng, StdRng};
use solana_remote_wallet::ledger::LedgerWallet;
use solana_remote_wallet::remote_wallet::{
initialize_wallet_manager, DerivationPath, RemoteWallet,
};
use solana_sdk::{
instruction::{AccountMeta, Instruction},
message::Message,
pubkey::Pubkey,
syste... |
pub fn invert_result<T, E>(res: Result<Option<T>, E>) -> Option<Result<T, E>> {
match res {
Ok(Some(batch)) => Some(Ok(batch)),
Err(err) => Some(Err(err)),
Ok(None) => None,
}
}
|
use crate::prelude::*;
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
#[derive(Debug)]
pub struct VkPipelineTessellationStateCreateInfo {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub flags: VkPipelineTessellationStateCreateFlagBits,
pub patchControlPoints: u32,
}
impl VkPipelineTesse... |
// memory access - uses values in mem_map to check what address being passed actually is before
// returning value
use crate::mem_map::*;
const RAM_SIZE: usize = 2 * 1024;
const VRAM_SIZE: usize = 2 * 1024;
const ROM_BLOCK_SIZE: usize = 16 * 1024;
const CHR_BLOCK_SIZE: usize = 8 * 1024;
pub struct RAM {
ram: [u8;... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Services_Maps_Guidance")]
pub mod Guidance;
#[cfg(feature = "Services_Maps_LocalSearch")]
pub mod LocalSearch;
#[cfg(feature = "Services_Maps_OfflineMaps")]
pub mod OfflineMa... |
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::PINASSIGN7 {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'... |
//! Linux LibOS
//! - run process and manage trap/interrupt/syscall
#![no_std]
#![feature(asm)]
#![deny(warnings, unused_must_use, missing_docs)]
extern crate alloc;
#[macro_use]
extern crate log;
use {
alloc::{boxed::Box, string::String, sync::Arc, vec::Vec},
core::{future::Future, pin::Pin},
kernel_hal:... |
use bevy::{
input::mouse::{MouseButtonInput, MouseMotion, MouseWheel},
prelude::*,
window::CursorMoved,
sprite::collide_aabb::{collide, Collision}
};
use bevy::{core::FixedTimestep, prelude::*};
use std::convert::TryInto;
use std::collections::HashMap;
use bevy_ggrs::{GGRSApp, GGRSPlugin, RollbackIdP... |
use crate::{AsObject, PyObject, VirtualMachine};
pub struct ReprGuard<'vm> {
vm: &'vm VirtualMachine,
id: usize,
}
/// A guard to protect repr methods from recursion into itself,
impl<'vm> ReprGuard<'vm> {
/// Returns None if the guard against 'obj' is still held otherwise returns the guard. The guard
... |
use std::{collections::{HashMap, HashSet}, ops::{Deref, Mul, DerefMut}};
use itertools::Itertools;
use ndarray::{arr1, arr2, Array1, Array2};
// FrameIndependentDisplacement is a tuple of 3 values, indcating the difference in positions of 2 coordinates,
// the order is not by axes and there are no nergatives to make ... |
use std::collections::HashMap;
use shader::{Shader, ShaderSource};
use asset_mgr::AssetMgr;
use gl;
pub struct ShaderMgr {
shaders: HashMap<&'static str, Shader>
}
impl ShaderMgr {
pub fn new() -> ShaderMgr {
ShaderMgr {
shaders: HashMap::new()
}
}
pub fn load_default_shaders(&mut self, asset_mgr: &mut As... |
use std::fs;
use std::sync::Arc;
use urlencoding::decode;
use crate::path_utils::{get_path, is_filepath};
use crate::request::{Request, RequestHandler, ResponseResult};
use crate::{multipart, Opts, Response};
use std::path::PathBuf;
pub struct Patch;
impl RequestHandler for Patch {
fn get_response<'a>(req: &'a ... |
use crate::types::{HitRecord, Hitable, Ray};
pub struct HitableList {
pub list: Vec<Box<dyn Hitable>>,
}
impl Hitable for HitableList {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
let mut closest_so_far = t_max;
let mut hit_rec: Option<HitRecord> = None;
for... |
extern crate pest;
#[macro_use]
extern crate pest_derive;
extern crate serde;
pub use parser::parse;
pub mod ast;
pub mod validator;
pub mod parser;
pub mod errors;
pub mod support;
|
use hitable::HitRecord;
use rand::random;
use ray::Ray;
use sphere;
use vec3::{dot, unit_vector, Vec3};
pub trait Material: MaterialClone {
fn scatter(
&self,
r_in: &Ray,
rec: &HitRecord,
attenuation: &mut Vec3,
scattered: &mut Ray,
) -> bool;
}
// this is coming from t... |
use anyhow::{bail, Result};
use jsonwebtoken::{decode, decode_header, Algorithm, DecodingKey, Validation};
use serde::Deserialize;
use tracing::info;
use crate::authoriser::jwk;
#[derive(Debug, Deserialize)]
pub struct Claims {
#[serde(rename = "cognito:username")]
pub username: String,
}
pub async fn verify... |
#[cfg(target_os = "linux")]
static DRIVERFILELOCATION: &str = "/dev/input/by-path/platform-i8042-serio-0-event-kbd";
use std::fs::File;
use std::io::{Read};
use libc::time_t;
use libc::suseconds_t;
// Representation of the kbd event struct in C on linux
#[derive(Debug)]
#[repr(C)]
struct InputEvent {
tv_sec: tim... |
use std::time::Duration;
use crate::{
RotatorEvent,
RotatorResult,
};
use crate::value::get_secret_value;
pub fn set_secret(e: RotatorEvent) -> RotatorResult<()> {
let timeout = Duration::from_secs(2);
let _value = match get_secret_value(&e.secret_id, Some("AWSPENDING"), Some(&e.client_request_token),... |
use decisionengine::datasource::DecisionDataset;
use decisionengine::modules::PassAllModule;
use decisionengine::results::ModuleResult;
use decisionengine::results::RuleResult;
use decisionengine::results::SubmoduleResult;
use decisionengine::rules::Condition;
use decisionengine::rules::Rule;
use decisionengine::EvalRe... |
mod de;
mod ser;
pub use self::de::Deserializer;
pub use self::ser::Serializer;
use serde_base::de::{Deserialize, DeserializeOwned};
use serde_base::ser::Serialize;
use std::io::{Read, Seek, Write};
use Result;
use EventReader;
use xml;
pub fn deserialize<R: Read + Seek, T: DeserializeOwned>(reader: R) -> Result<T>... |
// 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 ... |
#[macro_use]
extern crate mysql;
extern crate time;
// ...
use museus::mysql::MyDatabase;
use museus::LladreDAO;
use museus::Visitant;
use std::collections::HashSet;
use std::iter::FromIterator;
mod museus;
fn main() {
let db = MyDatabase::connecta(
String::from("172.99.0.2"),
"lladres".to_string(... |
use crate::context::UpstreamContext;
use crate::fifo::{AsyncConsumer, AsyncFifo, AsyncProducer};
use crate::handler::{Handler, Sink};
use crate::interrupt::Interruptable;
use core::cell::{RefCell, UnsafeCell};
use heapless::consts::*;
pub use drogue_async::task::spawn;
/// A non-root, but possibly leaf (or middle) por... |
extern crate reactive_net;
mod __authentic_execution;
pub mod __run;
#[allow(unused_imports)] use __authentic_execution::authentic_execution;
#[allow(unused_imports)] use __authentic_execution::authentic_execution::{MODULE_NAME, success, failure, handle_output, handle_request, Error};
#[allow(unused_imports)] use rea... |
// Copyright 2021 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 reqwest;
use std::env;
async fn get(symbols: &str) -> Result<String, reqwest::Error> {
let mut url = String::from("http://sqt.gtimg.cn/utf8/q=");
url.push_str(symbols);
url.push_str("&offset=3,2,4,33,39,60,40,46,1");
Ok(reqwest::get(url.as_str()).await?.text().await?)
}
#[tokio::main]
async fn mai... |
use openexr_sys as sys;
pub use crate::core::{
error::Error,
frame_buffer::{Frame, Slice, SliceRef},
refptr::{OpaquePtr, Ref, RefMut},
PixelType,
};
pub use imath_traits::{Bound2, Vec2};
use std::marker::PhantomData;
use std::ffi::{CStr, CString};
type Result<T, E = Error> = std::result::Result<T, E>... |
use std::iter::Peekable;
use std::str::Chars;
use super::keyword::Keyword;
use super::Token;
pub fn consume_while<F>(it: &mut Peekable<Chars>, pred: F) -> Vec<char>
where F: Fn(char) -> bool {
let mut chars: Vec<char> = vec![];
while let Some(&ch) = it.peek() {
if pred(ch) {
it.next().unwrap();
... |
pub use macroquad::prelude::KeyCode as Key;
use crate::Context;
#[allow(unused_variables)]
pub fn pressed(ctx: &Context, key: Key) -> bool {
macroquad::prelude::is_key_pressed(key)
}
#[allow(unused_variables)]
pub fn down(ctx: &Context, key: Key) -> bool {
macroquad::prelude::is_key_down(key)
}
#[allow(unus... |
use super::check;
#[test]
fn t01_inline() {
check(
".result {\n output: \"dquoted\";\n output: #{\"dquoted\"};\n \
output: \"[#{\"dquoted\"}]\";\n output: \"#{\"dquoted\"}\";\n \
output: '#{\"dquoted\"}';\n output: \"['#{\"dquoted\"}']\";\n}\n",
".result {\n output: \"dquot... |
use crate::mmu::MMU;
use std::time::Instant;
pub const VRAM_SIZE: usize = 0x2000;
pub const IO_REG: usize = 0xFF7F - 0xFF00 + 1;
pub const VOAM_SIZE: usize = 0xFE9F - 0xFE00 + 1;
pub const SCREEN_W: usize = 160;
pub const SCREEN_H: usize = 144;
pub const BACK_W: usize = 256;
pub const BACK_H: usize = 256;
pub const ... |
fn main() {
let equation = |x: f64| -> f64 { 3.0 * x.powi(2) + 2.0 };
let value = quadrature(0.01, equation);
println!("{:?}", value);
}
fn quadrature(x_delta: f64, equation: fn(f64) -> f64) -> f64 {
let mut x: f64 = 0.0;
let mut s: f64 = 0.0;
while x <= 1.0 {
s += equation(x) * x_delt... |
#![no_main]
#![no_std]
#![deny(unsafe_code)]
extern crate stm32f4xx_hal as hal;
#[allow(unused_imports)]
use panic_semihosting;
use crate::hal::{prelude::*, spi::Spi, stm32};
use cortex_m_rt::ExceptionFrame;
use cortex_m_rt::{entry, exception};
use embedded_hal::digital::v1_compat::OldOutputPin;
use mcp49xx::{Comman... |
// Copyright 2018 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::cmp::{max, min, Reverse};
use crate::parse::boolean_matrix::BooleanMatrix;
use crate::parse::image::{Image, Color};
use crate::parse::target::Target;
use ordered_float::OrderedFloat;
#[derive(Debug)]
pub struct TargetMesh {
pub targets: Vec<Target>, // coordinates stored are between 0 and 1 as height p... |
//! The following is derived from Rust's
//! library/std/src/os/windows/io/raw.rs
//! at revision
//! 4f9b394c8a24803e57ba892fa00e539742ebafc0.
//!
//! All code in this file is licensed MIT or Apache 2.0 at your option.
use super::super::raw;
/// Raw SOCKETs.
#[cfg_attr(staged_api, stable(feature = "rust1", since = "... |
// Copyright 2019 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 failure::Error;
use serde_derive::{Deserialize, Serialize};
use serde_json::Value;
use std::sync::Arc;
use crate::test::facade::TestFacade;
use crate:... |
mod client;
mod config;
mod server;
use config::Config;
use server::Server;
fn main() {
let config = Config::init();
Server::new(&config.get_address())
.max_clients(config.get_max_clients())
.max_acceptable_buffer(config.get_acceptable_buffer())
.run();
}
|
#![allow(dead_code)]
use crate::{regex, utils};
use lazy_static::lazy_static;
use regex::Regex;
use std::collections::{HashMap, HashSet};
use utils::AOCResult;
lazy_static! {
static ref BAG_REGEX: Regex = regex!(r"([0-9])* ?([a-z]+ [a-z]+) bags?");
}
pub type BagID = usize;
#[derive(Debug)]
pub struct BagRules ... |
extern crate criterion;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
#[path = "../src/ecoz2_lib/lpca_c.rs"]
mod lpca_c;
#[path = "../src/lpc/lpca_rs.rs"]
mod lpca_rs;
fn criterion_benchmark(c: &mut Criterion) {
let input = lpca_rs::lpca_load_input("signal_frame.inputs").unwrap();
... |
pub struct Solution;
impl Solution {
pub fn find_words(board: Vec<Vec<char>>, words: Vec<String>) -> Vec<String> {
let solver = Solver::from_board(board);
solver.find_words(words)
}
}
struct Solver {
m: usize,
n: usize,
board: Vec<Vec<char>>,
visited: Vec<Vec<bool>>,
result... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::AES_DMAIC {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R... |
mod common;
use std::str::FromStr;
use common::run_test_in_repo;
use rusty_git::object::Id;
use rusty_git::repository::Repository;
#[test]
fn test_pack_file() {
run_test_in_repo("tests/resources/repo.git", |path| {
let repo = Repository::open(path).unwrap();
repo.object_database()
.p... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qundoview.h
// dst-file: /src/widgets/qundoview.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin ... |
use super::*;
#[test]
fn with_atom_right_returns_true() {
with_right_returns_true(|mut _process| Atom::str_to_term("right"));
}
#[test]
fn with_false_right_returns_true() {
with_right_returns_true(|_| false.into());
}
#[test]
fn with_true_right_returns_true() {
with_right_returns_true(|_| true.into());
}... |
macro_rules! force_trailing_comma {
[$($x:expr,)*] => (vec![$($x),*])
}
macro_rules! forbid_trailing_comma {
[$($x:expr),*] => (vec![$($x),*])
}
macro_rules! allow_both {
[$($x:expr,)*] => { force_trailing_comma![$($x,)*] };
[$($x:expr),*] => { forbid_trailing_comma![$($x),*] };
}
fn main() {
for... |
pub mod api;
pub mod tls_mitm;
pub mod tls_check;
pub mod plaintext;
pub mod tcp_hijack;
pub mod dns_hijack;
pub mod packet_logger;
|
use std::{num::ParseIntError, ops::RangeInclusive};
pub const INPUT: &str = include_str!("../input.txt");
type ParseResult = Result<Vec<(RangeInclusive<u8>, RangeInclusive<u8>)>, ParseIntError>;
pub fn parse_input(input: &str) -> ParseResult {
let parts = input.trim().split(['\n', ',', '-']);
let numbers = pa... |
// xfail-stage1
// xfail-stage2
// xfail-stage3
// Create a task that is supervised by another task,
// join the supervised task from the supervising task,
// then fail the supervised task. The supervised task
// will kill the supervising task, waking it up. The
// supervising task no longer needs to be wakened when
/... |
/*
* @lc app=leetcode id=3 lang=rust
*
* [3] Longest Substring Without Repeating Characters
*/
impl Solution {
pub fn length_of_longest_substring(s: String) -> i32 {
let mut counts = [0; 256];
let mut bad = 0;
let mut i = 0;
let mut j = 0;
let s = s.as_bytes();
w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.