text
stringlengths
8
4.13M
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - power control register"] pub power: POWER, #[doc = "0x04 - SDI clock control register"] pub clkcr: CLKCR, #[doc = "0x08 - argument register"] pub arg: ARG, #[doc = "0x0c - command register"] pub cmd: CMD, ...
use crate::{ auth::UserDetail, server::{ chancomms::ControlChanMsg, controlchan::{ error::ControlChanError, handler::{CommandContext, CommandHandler}, Reply, ReplyCode, }, }, storage::{Metadata, StorageBackend}, }; use async_trait::async_trait;...
#![allow( clippy::too_many_arguments, clippy::new_without_default, clippy::type_complexity )] use crate::ffi::*; use crate::os::{HRESULT, LPCWSTR, LPWSTR, WCHAR}; use crate::utils::{from_wide, to_wide, HassleError}; use com_rs::ComPtr; use libloading::{Library, Symbol}; use std::ffi::c_void; use std::path:...
// Copyright 2019, 2020 Wingchain // // 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 alloc::fmt; use alloc::string::String; /// Errors for [`WritableAsset`] #[derive(Clone, Debug)] pub enum WritableAssetError { /// Raised when failed to close an asset CloseFailed(String), /// Raised when failed to write to an asset WriteFailed(String), } impl fmt::Display for WritableAssetError {...
// Copyright 2018-2019 Mozilla // // 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, sof...
// use futures::stream::TryStreamExt; // use futures::Stream; // use parity_tokio_ipc::Endpoint as IpcEndpoint; // use std::convert::TryFrom; // use std::{ // pin::Pin, // task::{Context, Poll}, // time::Duration, // }; // use tokio::io::{AsyncRead, AsyncWrite}; // use tokio::sync::mpsc; // use tonic::trans...
use crate::utils::lines_from_file; use lazy_static::lazy_static; use regex::{Error, Regex}; use std::{str::FromStr, time::Instant}; pub fn main() { let start = Instant::now(); let entries = lines_from_file("src/day_02/input.txt"); println!("valid_count {:?}", part_2(entries)); let duration = start.e...
extern crate hyphenated_name; fn main() { println!("Hyphenated: {}", hyphenated_name::NAME); }
//! An example of generating constant valued noise extern crate noise; use noise::Checkerboard; use noise::utils::*; fn main() { let checker = Checkerboard::new(); PlaneMapBuilder::new(&checker) .build() .write_to_file("checkerboard.png"); }
use super::parser::LvarCollector; use crate::util::{Annot, IdentId, Loc}; #[derive(Debug, Clone, PartialEq)] pub enum NodeKind { SelfValue, Nil, Integer(i64), Float(f64), Bool(bool), String(String), InterporatedString(Vec<Node>), Symbol(IdentId), Range { start: Box<Node>, ...
#![allow(dead_code)] use crate::*; use num::Integer; use std::collections::HashSet; use std::str::FromStr; use ndarray::Array2; use itertools::Itertools; const DAY: usize = 10; #[derive(Clone, PartialEq, Debug)] pub enum GridField { Asteroid, Empty, } impl FromStr for Grid<GridField> { type Err = AocErr...
use std::collections::HashMap; use std::sync::Arc; use std::sync::mpsc::Receiver; use std::time::{Duration, Instant}; use libdeflater::{CompressionLvl, Compressor, Decompressor}; use mio::{Events, Poll}; use packet_transformation::handling::{HandlingContext, UnparsedPacket}; use packet_transformation::TransformationR...
use std::env; use std::fs::File; use std::io::Read; use std::io::Write; use std::path::Path; use std::path::PathBuf; use std::process::Command; fn main() { // Get the current githash match Command::new("git") .args(&["rev-parse", "--short", "HEAD"]) .output() { Ok(output) => match S...
#![allow(dead_code)] use pwasm_abi::eth::EndpointInterface; use pwasm_abi_derive::eth_abi; #[eth_abi(StringsEndpoint, StringsClient)] pub trait StringsContract { fn string(&mut self, v: String); } const PAYLOAD_SAMPLE_1: &[u8] = &[ 0x3F, 0xCF, 0x74, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. use super::super::utils::build_proof_options; #[test] fn fib8_test_basic_proof_verification() { let fib = Box::new(super::Fib8Example...
//! Music file tagging for an artist and song approch, favouring em dashes use crate::utils::{cap_filename_ext, format_name, ResponseModel}; use serde::Serialize; /// A single song that is pretty printed for tagging, used in the [song] path #[derive(Debug, PartialEq, Clone, Serialize)] pub struct SingleSong { //...
use pest_derive::*; #[derive(Parser)] #[grammar = "zeroconf.pest"] pub struct ZeroConfParser;
/*! ```rudra-poc [target] crate = "cassandra-proto" version = "0.1.2" [report] issue_url = "https://github.com/AlexPikalov/cassandra-proto/issues/3" issue_date = 2021-01-05 [[bugs]] analyzer = "UnsafeDataflow" bug_class = "UninitExposure" rudra_report_locations = ["src/frame/parser_async.rs:19:1: 97:2"] ``` !*/ #![fo...
use actix_web::{ web::{self, HttpRequest, HttpResponse}, Error, Result, ResponseError }; use crate::AppData; use mysql_utils::{Db, MyLibError}; use serde::{Serialize, Deserialize}; #[derive(Serialize)] pub struct DbError { msg: String } impl DbError { pub fn msg<M: Into<String>>(msg: M) -> Self { ...
use std::mem::replace; use std::fmt::Debug; fn main() { // let mut ll: LinkedList<i32> = LinkedList::new(); //// ll.add(10); //// ll.add(20); //// ll.add(30); //// ll.add(40); //// ll.add(50); // //// println!("{:?}", ll.get_data_from_position(0)); //// println!("{:?}", ll.get_data_from_positio...
#[derive(Debug, PartialEq, Copy, Clone)] pub enum TokenType<'a> { LeftParen, RightParen, LeftBrace, RightBrace, LeftBracket, RightBracket, Comma, Dot, Colon, Semicolon, Slash, Backslash, Star, Mod, Hashtag, PlusEquals, MinusEquals, StarEquals, ...
use crate::features::syntax::StatementFeature; use crate::parse::visitor::tests::assert_no_stmt_feature; use crate::parse::visitor::tests::assert_stmt_feature; mod rest_args; #[test] fn func_decl() { assert_stmt_feature( "function foo() { }", StatementFeature::FunctionDeclaration, ) } ...
use crate::apps::{data::TransferOwnership, service::AdminService, Members}; use actix_web::{web, HttpResponse}; use drogue_cloud_service_api::auth::user::UserInformation; use std::ops::Deref; pub struct WebData<S: AdminService> { pub service: S, } impl<S: AdminService> Deref for WebData<S> { type Target = S; ...
/*! ```rudra-poc [target] crate = "arr" version = "0.6.0" [[target.peer]] crate = "crossbeam-utils" version = "0.7.2" [test] cargo_flags = ["--release"] cargo_toolchain = "nightly" [report] issue_url = "https://github.com/sjep/array/issues/1" issue_date = 2020-08-25 rustsec_url = "https://github.com/RustSec/advisory...
pub use itertools::Itertools as _; use unzip_n::unzip_n; unzip_n!(pub 4);
use std::io::File; use std::io::BufferedReader; fn main() { let mut source = BufferedReader::new( File::open(&Path::new("file.rs")) ); let mut c:int = 0; for line in source.lines() { c+=1; print!("{}: {}", c, line.unwrap()); } }
use crate::yield_now::yield_now; use std::sync::atomic::{AtomicUsize, Ordering}; pub struct DropGuard<'a>(&'a DelayDrop); pub struct DelayDrop { // can_drop & 0x1 is the flag that when kernel is done // can_drop & 0x2 is the flag that when kernel is started can_drop: AtomicUsize, } impl DelayDrop { pu...
use crate::name_resolution::TopLevelContext; use crate::rustspec::*; use crate::rustspec_to_coq_base::*; use crate::rustspec_to_coq_ssprove_pure; use crate::rustspec_to_coq_ssprove_state; use crate::rustspec_to_coq_ssprove_state::translate_base_typ; use core::slice::Iter; use itertools::Itertools; use pretty::RcDoc; us...
extern crate cc; fn main() { cc::Build::new() .file("src/question1.s") .file("src/question2a.s") .file("src/question2b.s") .file("src/question2c.s") .compile("task1-lib"); }
// This file is part of rdma-core. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/rdma-core/master/COPYRIGHT. No part of rdma-core, including this file, may be copied, modified, propagated, or distributed ...
pub fn greet() { println!("Hello world!"); }
use std::{ iter::FromIterator, ops::{Index, IndexMut}, }; pub use num_traits::{One, Zero}; pub mod dim; use dim::{Dim, Fixed}; pub mod view; pub mod iter; pub mod prelude { pub use crate::{ dim, dim::Dim, mat, ops::ViewOps, view::{col::ColumnView, row::RowView, V...
use util::{ bitfields, bits::Bits, fixedpoint::{FixedPoint16, FixedPoint32}, mem::read_u16, primitive_enum, }; use super::line::LineBuffer; use crate::{ memory::{ io::{IoRegisters, ObjCharVramMapping}, OAM_SIZE, VRAM_SIZE, }, video::line::{PixelAttrs, OBJ}, }; pub fn re...
use std::{ collections::{HashMap, VecDeque}, sync::Arc, }; use anyhow::Result; use crossbeam::atomic::AtomicCell; use handlegraph::{ handle::{Handle, NodeId}, pathhandlegraph::*, }; use handlegraph::packedgraph::paths::StepPtr; use bstr::ByteSlice; use parking_lot::Mutex; use rustc_hash::{FxHashMap...
#![cfg(test)] use std::path::PathBuf; #[test] #[ignore] fn get_main() { use std::io::prelude::*; use log::*; use regex::Regex; use socks::*; let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); println!("root: {}", root.display()); let exp = std::fs::read_to_string(root.join("src/main.r...
use crate::errors::PcapError; use byteorder::ByteOrder; use std::borrow::Cow; use derive_into_owned::IntoOwned; /// The systemd Journal Export Block is a lightweight containter for systemd Journal Export Format entry data. #[derive(Clone, Debug, IntoOwned)] pub struct SystemdJournalExportBlock<'a> { /// A journa...
pub fn has_cycle() { rs_not_supported!() }
//! FBX node attribute. use std::io; use fbxcel::pull_parser::{self as fbxbin, Result}; /// FBX node attribute. #[derive(Debug, Clone)] pub enum Attribute { /// `bool`. SingleBool(bool), /// `i16`. SingleI16(i16), /// `i32`. SingleI32(i32), /// `i64`. SingleI64(i64), /// `f32`. ...
#[macro_use] extern crate dotenv_codegen; mod common; mod test{ use actix_http_test::TestServer; use actix_web::http::header; use actix_web::http; use chrono::Duration; use actix_http::httpmessage::HttpMessage; use http::header::HeaderValue; use actix_http::cookie::Cookie; use serde_j...
use tokio::process::Command; use anyhow::{Result, Context}; use async_trait::async_trait; use crate::{ services::model::{Nameable, Ensurable, is_binary_present}, helpers::ExitStatusIntoUnit }; static NAME: &str = "curl"; #[derive(Default)] pub struct Curl {} impl Nameable for Curl { fn na...
// Copyright (C) 2020 Sebastian Dröge <sebastian@centricular.com> // // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use super::*; /// `Session` header ([RFC 7826 section 18.49](https://tools.ietf.org/html/rfc7826#section-18.49)). #[derive(Debug, Clone, PartialEq, Eq, P...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 //! This file defines ledger store APIs that are related to the main ledger accumulator, from the //! root(LedgerInfo) to leaf(TransactionInfo). u...
use super::ty::{IntoIri, IriRanges}; use locate::InputLocate; use locate::WithPos; use nom::{ branch::alt, bytes::complete::tag, character::complete::{alpha1, char, digit0, digit1, hex_digit1}, combinator::{map, opt}, error::{convert_error, ErrorKind, ParseError, VerboseError}, multi::{count, many0, many1, ...
pub mod strlen; pub mod environ;
use winit::event_loop::{ControlFlow, EventLoop}; use winit::window::Window; use winit::event::Event; use winit_input_helper::WinitInputHelper; use crate::high_level_fighter::{HighLevelFighter, HighLevelSubaction}; use crate::renderer::wgpu_state::WgpuState; use crate::renderer::draw::draw_frame; use crate::renderer::c...
use super::{arguments::_parse_args, io::_writeOutput, platforms::_platforms}; use ansi_term::Colour; use futures::{stream::iter, StreamExt}; use reqwest::Client; use tokio; #[tokio::main] pub async fn _takeover(hosts: Vec<String>, threads: usize) -> std::io::Result<()> { let client = &Client::builder() .da...
use mpi::topology::Communicator; use crate::prelude::*; pub unsafe trait ProtocolPart { unsafe fn build_part() -> Self; } pub struct Eps; unsafe impl ProtocolPart for Eps { unsafe fn build_part() -> Self { Self } } impl<C: Communicator> Session<Eps, C> { pub fn done(self) -...
extern crate structopt; use structopt::StructOpt; #[derive(StructOpt)] #[structopt(name = "kvs", about = "Key value storage")] struct Cli { #[structopt(subcommand)] cmd: Command, } #[derive(StructOpt)] enum Command { #[structopt(name = "set")] /// Set and modify key:value pairings Set { key: Strin...
use std::fs::File; use std::io::prelude::*; use std::io::{Result, SeekFrom}; use std::mem::size_of; use std::path::Path; fn cast<T, U>(r: &T) -> &U { assert_eq!(size_of::<T>(), size_of::<U>()); unsafe { &*(r as *const T as *const U) } } fn cast_mut<T, U>(r: &mut T) -> &mut U { assert_eq!(size_of::<T>(), si...
//! Decode a JSON stream to a Rust data structure. use std::collections::HashSet; use std::fmt; use std::str::FromStr; use async_trait::async_trait; use bytes::{BufMut, Bytes}; use destream::{de, FromStream, Visitor}; use futures::stream::{Fuse, FusedStream, Stream, StreamExt, TryStreamExt}; #[cfg(feature = "tokio-i...
use std::fs; use sg_syntax::{determine_language, SourcegraphQuery}; use syntect::{ html::{ClassStyle, ClassedHTMLGenerator}, parsing::SyntaxSet, }; fn main() -> Result<(), std::io::Error> { println!("scip-syntect tester"); let (path, contents) = if let Some(path) = std::env::args().nth(1) { ma...
#[doc = "Register `CR` reader"] pub type R = crate::R<CR_SPEC>; #[doc = "Register `CR` writer"] pub type W = crate::W<CR_SPEC>; #[doc = "Field `HSION` reader - HSI clock enable Set and cleared by software. Set by hardware to force the HSI to ON when the product leaves Stop mode, if STOPWUCK = 0 or STOPKERWUCK = 0. Set ...
// MIT License // Copyright (c) 2020 Andrew Plaza // 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, me...
use super::error::Error; use std::fs::{self, File, OpenOptions}; use std::path::{Path, PathBuf}; use std::sync::Arc; pub enum FileKind { Data, Index, Log(u64), } pub enum OpenMode { Read, Write, } pub struct SeriesDir { base_path: PathBuf, } impl SeriesDir { fn file_path(&self, kind: Fil...
use std::{net::SocketAddr}; use msg_types::{AnnouncePublic, AnnounceSecret, CallResponse}; use mio::Token; use crate::common::{encryption::SymmetricEncryption, lib::read_exact, message_type::{MsgType, msg_types::{self, Call}, Peer}}; use super::{CallRequest, RendezvousServer}; impl RendezvousServer { pub fn rea...
use alloc::{vec, vec::Vec}; use crate::Renderer; pub enum TextureFormat { Rgba8Unorm, Bgra8Unorm, Rgba16Float, Depth32, } impl TextureFormat { pub(crate) fn wgpu_type(&self) -> wgpu::TextureFormat { match self { TextureFormat::Rgba8Unorm => wgpu::TextureFormat::Rgba8Unorm, ...
use crate::config::cache::{Cache, DiskBasedCache}; use crate::config::dfinity::Config; use crate::config::{cache, dfx_version}; use crate::lib::error::DfxResult; use crate::lib::identity::identity_manager::IdentityManager; use crate::lib::network::network_descriptor::NetworkDescriptor; use crate::lib::progress_bar::Pro...
#[derive(Debug, Clone)] pub struct ClickEvent { pub x: i32, pub y: i32, } #[derive(Debug, Clone)] pub enum Event { MouseDown(ClickEvent), MouseUp(ClickEvent), } pub type EventTypes = u32; pub const QUIT: u32 = 1; pub const CLICK: u32 = 2; pub const MOUSE_MOVE: u32 = 4;
extern crate ares; #[macro_use] mod util; #[test] fn basic_types() { // TODO: test 1-arg and 2-arg eval_ok!("(= 1 1)", true); eval_ok!("(= 2 2 2 2)", true); eval_ok!("(= 1 2)", false); eval_ok!("(= 1 1 2)", false); }
use super::prelude::*; // Register the actual session middleware that is used to maintain session state. // `CookieSession` is an actual session processing backend // that does the initialization of the state of the `Session` instance inside the application (ServiceRequest::get_session) // when the request is received...
use std::marker::PhantomData; use std::any::{Any}; use std::rc::Rc; use std::sync::atomic::AtomicIsize; use observable::*; use subscriber::*; use unsub_ref::UnsubRef; use std::sync::Arc; use std::sync::atomic::Ordering; use scheduler::Scheduler; pub struct SubOnOp<Src, V, Sch> where Src : Observable<V>+Send+Sync, Sch...
mod lv2_raw; mod lv2; mod synth; use std::ptr; use std::mem; use std::f32; use std::ffi; use std::os::raw; use std::collections::BTreeMap; use lv2_raw::core::*; use lv2_raw::urid::*; use lv2_raw::atom::*; use lv2_raw::midi::*; use lv2::atom::*; use lv2::urid::*; use lv2::core::*; use lv2::midi::*; const CONTROL_INP...
//! The line primitive use crate::{ drawable::{Drawable, Pixel}, geometry::{Dimensions, Point, Size}, pixelcolor::PixelColor, primitives::Primitive, style::{PrimitiveStyle, Styled}, transform::Transform, DrawTarget, }; /// Line primitive /// /// # Examples /// /// The [macro examples](../....
use common::error::Error; use common::result::Result; #[derive(Debug, Clone, PartialEq)] pub struct Stars { stars: u8, } impl Stars { pub fn new(stars: u8) -> Result<Self> { if stars > 5 { return Err(Error::new("stars", "invalid_range")); } Ok(Stars { stars }) } p...
use core::time; use std::thread; fn main() { let numbers: Vec<usize> = vec![1, 2, 3, 4, 5, 6, 7]; /* let th = thread::spawn(move || numbers.iter().sum::<usize>() / numbers.len()); match th.join() { Ok(res) => println!("Result : {}", res), Err(err) => println!("Error : {:?}", err), ...
use libc::c_ulong; use x11::xlib; use std::ffi::CString; // For convenience pub const MODKEY1: u32 = xlib::Mod1Mask; pub const MODKEY2: u32 = xlib::Mod4Mask; pub const SHIFT: u32 = xlib::ShiftMask; // Key combos. We add our bindings here for wm actions pub const EXIT_KEY: KeyCmd<'static> = KeyCmd{ key: "F1", modifier...
use crate::{Dir, DirEntry}; use glob::{Pattern, PatternError}; impl<'a> Dir<'a> { /// Search for a file or directory with a glob pattern. pub fn find(&self, glob: &str) -> Result<impl Iterator<Item = &'a DirEntry<'a>>, PatternError> { let pattern = Pattern::new(glob)?; Ok(Globs::new(pattern, s...
use gstreamer::{ event::{FlushStart, FlushStop}, prelude::*, State, }; use gstreamer as gst; use gstreamer_app as gst_app; use gstreamer_audio as gst_audio; use parking_lot::Mutex; use std::sync::Arc; use super::{Open, Sink, SinkAsBytes, SinkError, SinkResult}; use crate::{ config::AudioFormat, conv...
#[macro_use] extern crate clap; use clap::{AppSettings, Arg, SubCommand}; use opfs::block::sblock; use opfs::file::*; use opfs::subcommand; use std::process::exit; fn main() { let matches = app_from_crate!() .setting(AppSettings::SubcommandRequiredElseHelp) .arg( Arg::with_name("img_fi...
use shrev::*; use component::event::*; use protocol::client::*; use types::event::{ConnectionClose, ConnectionOpen, Message}; use types::ConnectionId; // Connection Events pub type OnOpen = EventChannel<ConnectionOpen>; pub type OnClose = EventChannel<ConnectionClose>; // Timer Event pub type OnTimerEvent = EventCha...
//temporary Lighthouse SSZ and hashing implementation use bls::PublicKeyBytes; use ethereum_types::H256 as Hash256; use serde::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; use ssz_types::{BitList, FixedVector, VariableList}; use tree_hash::TreeHash; use tree_hash_derive::{SignedRoot, TreeHash}; use typen...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. use crate::{ utils::rescue::{Hash, Rescue128}, Example, ExampleOptions, }; use log::debug; use std::time::Instant; use winterfell:...
pub mod benchtemplate; pub mod filterbench; pub mod joinbench; pub mod test;
fn main() { let my_var = 7; println!("my_var = {:?}", my_var); { let my_var = 8; // shadow println!("inner scope my_var = {:?}", my_var); } let my_var = "foo"; // another shadow println!("shadowed my_var = {:?}", my_var); }
use std::path::{Path, PathBuf}; use anyhow::{anyhow, Result}; /// Returns a canonical absolute file path for the `filepath` argument. /// This function will return an error in (at least) the following situations: /// /// - The path does not exist. /// - A non-final component in path is not a directory. pub(crate) fn ...
pub mod color_control; pub mod switch; pub mod switch_level; pub use self::color_control::ColorControl; pub use self::switch::Switch; pub use self::switch_level::SwitchLevel;
use model::*; use errors::*; use url::Url; use serde_json::from_str; use tungstenite::connect; use tungstenite::protocol::WebSocket; use tungstenite::client::AutoStream; use tungstenite::handshake::client::Response; static WEBSOCKET_URL: &'static str = "wss://stream.binance.com:9443/ws/"; static OUTBOUND_ACCOUNT_INF...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. #[non_exhaustive] #[derive(std::fmt::Debug)] pub enum Error { BadRequestError(crate::error::BadRequestError), CapacityExceededError(crate::error::CapacityExceededError), InvalidSessionError(crate::error::InvalidSessionError), ...
use crate::common::*; #[derive(Debug, PartialEq)] pub(crate) enum Warning { // Remove this on 2021-07-01. #[allow(dead_code)] DotenvLoad, } impl Warning { fn context(&self) -> Option<&Token> { match self { Self::DotenvLoad => None, } } } impl Display for Warning { fn fmt(&self, f: &mut Form...
use crate::error::{Error, Result}; use std::env; #[derive(PartialEq, Debug)] pub enum Update { Wip, Overwrite, } impl Default for Update { fn default() -> Self { Update::Wip } } impl Update { pub fn env() -> Result<Self> { let var = match env::var_os("TRYBUILD") { Some...
pub mod user; pub mod pool_handler;
#![deny(warnings, rust_2018_idioms)] use linkerd2_stack::NewService; use parking_lot::RwLock; use std::{ collections::{hash_map::Entry, HashMap}, hash::Hash, sync::{Arc, Weak}, }; use tracing::{debug, trace}; pub mod layer; pub use self::layer::CacheLayer; #[derive(Clone)] pub struct Cache<T, N> where ...
mod join_handle; mod stream; use std::{future::Future, time::Duration}; use futures::future::{self, Either}; use futures_timer::Delay; pub(crate) use self::{join_handle::AsyncJoinHandle, stream::AsyncStream}; use crate::error::{ErrorKind, Result}; /// An abstract handle to the async runtime. #[derive(Clone, Copy, D...
fn main() { let data = std::fs::read_to_string("../input.txt").unwrap(); let count = data .split("\n\n") .filter(|passport| { let mut valid_count = 0; let mut has_cid = false; for field in passport.split_whitespace() { let mut parts: Vec<&str> ...
use std::collections::VecDeque; use std::iter::FromIterator; use aoc2019::io::slurp_stdin; extern crate regex; enum Technique { DealIntoNew, Cut(i64), DealWithIncrement(i64), } struct Deck { // Front is top cards: VecDeque<i64>, } impl Deck { fn new(n: i64) -> Self { let mut cards = ...
extern crate cairo; extern crate pango; extern crate pangocairo; extern crate gtk; extern crate gdk; extern crate gdk_sys; use config::{Color, Config}; use gtk::prelude::*; use status::StatusItem; use std::cell::{Cell, RefCell}; use std::rc::Rc; use std::sync::mpsc; use std::thread; pub struct StatusComponent { p...
use std::{ collections::HashMap, fmt::{self, Display}, io::Read, num::NonZeroU32, path::PathBuf, str::FromStr, }; use clap::{ArgGroup, Parser, Subcommand}; use lading::{ blackhole, captures::CaptureManager, config::{Config, Telemetry}, generator::{ self, process_...
extern crate itertools; use itertools::Itertools; use std::collections::HashMap; #[derive(Debug, PartialEq, Eq, Clone)] pub struct Palindrome { factors_tuple: Vec<(u64, u64)>, value: u64, } impl Palindrome { pub fn new(a: u64, b: u64) -> Palindrome { let mut ft = Vec::new(); ft.push((a, b...
#![allow(dead_code)] use std::mem; use std::result::Result; use crate::errors::*; const DOS_HEADER_FIELD_LEN_RES1: usize = 4 * 2; const DOS_HEADER_FIELD_LEN_RES2: usize = 10 * 2; #[derive(Debug, Default)] pub struct DosHeader { e_magic: u16, /* magic number */ e_cblp: u16, ...
#[doc = "Register `TXDR` writer"] pub type W = crate::W<TXDR_SPEC>; #[doc = "Field `TXDR` writer - transmit data register The register serves as an interface with TxFIFO. A write to it accesses TxFIFO. Note: In SPI mode, data is always right-aligned. Alignment of data at I2S mode depends on DATLEN and DATFMT setting. U...
//Kata: https://www.codewars.com/kata/5511b2f550906349a70004e1/train/rust pub fn last_digit(str1: &str, str2: &str) -> i32 { if str2 == "0" { return 1; } let divisibility_criterion = |module: u32| -> Option<u32> { if module == 2 { return Some(str2[&str2.len() - 1..str2.len()].p...
extern crate libc; pub struct Player { id: i32 } impl Player { pub fn new() -> Player { Player{ id: 0 } } }
//! # Firestore document access and Firebase Auth //! //! This crate allows you to easily access Google Firestore documents //! and handles all the finicky authentication details for you. extern crate regex; extern crate ring; extern crate untrusted; #[cfg(feature = "faststart")] extern crate bincode; pub mod creden...
#![warn(clippy::all)] //! Core data structures for working with point cloud data //! //! Pasture provides data structures for reading, writing and in-memory handling of arbitrary point cloud data. //! The best way to get started with Pasture is to look at the [example code](https://github.com/Mortano/pasture/tree/main...
use std::{cell::UnsafeCell, ffi::CString, marker::PhantomData, ops::Deref}; use anyhow::Result; use necsim_core::{ cogs::{ CoalescenceSampler, DispersalSampler, EmigrationExit, Habitat, ImmigrationEntry, LineageReference, LineageStore, MinSpeciationTrackingEventSampler, PrimeableRng, Singu...
// Copyright 2019 Google LLC // // 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 law or agreed to in ...
use crate::instructions; use crate::instructions::{ InstrThumb16 }; use crate::memory::{ Register, RegisterBank, Memory }; use crate::loader::ProgramImage; /// ARMv7-M virtual processor /// /// Registers: /// [ R0 ]: General purpose Thumb16 addressable /// [ R1 ]: General purpose Thumb16 addressable /// [ R2 ]: Ge...
//! Sky properties. use crate::input::Sky; use arctk::{err::Error, file::Build, img::GradientBuilder, math::Pos3}; use arctk_attr::input; use std::path::Path; /// Scene properties. #[input] pub struct SkyBuilder { /// Sky brightness fraction. brightness: f64, /// Sun position when calculating sun shadows ...
use std::fmt; use std::net::TcpStream; use std::io::{Read, Write}; pub struct HttpHeader { pub method: String, pub path: String, pub version: String, } impl HttpHeader { pub fn new(stream: &mut TcpStream) -> Option<HttpHeader> { let mut st = String::new(); loop { let mut tem...