text
stringlengths
8
4.13M
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - FLASH access control register"] pub acr: ACR, _reserved_1_acr_: [u8; 0x0200], } impl RegisterBlock { #[doc = "0x04..0x204 - Cluster BANK%s, containing KEYR?, CR?, SR?, CCR?, PRAR_CUR?, PRAR_PRG?, SCAR_CUR?, SCAR_PRG?, WPSN_...
pub mod server; pub fn connect() { }
use schemars::JsonSchema; use stainless_ffmpeg::order::{Filter, ParameterValue}; use std::collections::HashMap; use std::convert::TryInto; #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] // #[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))] pub struct GenericFilter { pub name:...
// the `std::print` macros panic on any IO error. these are non-panicking alternatives macro_rules! println_ignore_io_error { ($($tt:tt)*) => {{ use std::io::Write; let _ = writeln!(std::io::stdout(), $($tt)*); }} } macro_rules! eprintln_ignore_io_error { ($($tt:tt)*) => {{ use std:...
use super::super::super::failpoints::failpoint; use super::super::commit_log::Commit; use super::super::data::{self, DataWriter}; use super::super::entry::Entry; use super::super::env::SeriesEnv; use super::super::error::Error; use super::super::file_system::{FileKind, OpenMode}; use super::super::Compression; use crat...
/* 3 [8, 12, 40]; 6 [382253568, 723152896, 37802240, 379425024, 404894720, 471526144] */ fn main() { let n = read(); let mut vec = read_line(); let mut cnt = std::u32::MAX; for i in 0..n as usize { let mut t_cnt = 0; while vec[i] % 2 == 0 && vec[i] != 0 { vec[i] /= 2; ...
use crate::config::{Named, Project, Test}; use crate::docker::Verification; use crate::io::Logger; use curl::easy::{Handler, WriteError}; use serde::Deserialize; #[derive(Clone, Debug)] pub struct Verifier { pub verification: Verification, logger: Logger, } impl Verifier { pub fn new( project: &Pro...
//! wordcountは単語を数える機能を提供します。オプションで文字、行もカウントできます。 //! 詳しくは[`count`]のドキュメント(fm.count.html)を参照してください。 #![warn(missing_docs)] use regex::Regex; use std::collections::HashMap; use std::io::BufRead; /// inputから1行ずつUTF8文字列を読み込み、頻度を数える /// /// 頻度を数える対象はオプションにより制御される /// * [`CountOption::Char`](enum.CountOption.html#variant....
use azure_core::AddAsHeader; use http::request::Builder; use crate::headers::{CONTENT_CRC64, CONTENT_MD5}; #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord)] pub enum Hash { MD5([u8; 16]), CRC64(u64), } impl AddAsHeader for Hash { fn add_as_header(&self, builder: Builder) -> Builder { match ...
use lines; use marker; use marker::Marker; use board::Board; pub fn find_current_player(board: &Board) -> Marker { if board.get_spaces().len() % 2 == 0 { Marker::X } else { Marker::O } } pub fn is_game_over(board: &Board) -> bool { is_game_tied(board) || is_game_won(board) } pub fn is...
use byteorder::{LittleEndian, WriteBytesExt}; use failure::Error; use crate::{chunks::TOKEN_RESOURCE, model::owned::OwnedBuf}; #[derive(Default, Debug)] pub struct ResourcesBuf { resources: Vec<u32>, } impl ResourcesBuf { pub fn push_resource(&mut self, resource: u32) { self.resources.push(resource);...
// Copyright 2018 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 clap::arg_enum; use fidl_fuchsia_net_stack::{self as netstack}; use structopt::StructOpt; // Same as https://docs.rs/log/0.4.8/log/enum.Level.html // ...
use crate::model::{Change, Changeable, Revertable, Watcher, SubWatcher, apply_pipe_to_mut_ref}; use std::fmt; #[derive(Clone, PartialEq)] struct ChangeSet<C> { name: String, changes: Vec<C>, } impl<C> ChangeSet<C> { fn new(name: String) -> ChangeSet<C> { ChangeSet { name, changes: vec![], } } } /// Al...
use svm_types::{ReceiptLog, RuntimeError}; #[derive(Debug, PartialEq, Clone)] pub struct Failure { err: RuntimeError, logs: Vec<ReceiptLog>, } impl Failure { pub fn new(err: RuntimeError, logs: Vec<ReceiptLog>) -> Self { Self { err, logs } } pub fn take_logs(&mut self) -> Vec<ReceiptLog> ...
use std::any::Any; use std::any::TypeId; use std::collections::HashMap; pub struct SharedResources { resources: HashMap<TypeId, Box<Any>>, } impl SharedResources { pub fn new() -> SharedResources { SharedResources { resources: HashMap::new(), } } pub fn add<R: 'static>(&mu...
/// An enum to represent all characters in the IdeographicSymbolsandPunctuation block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum IdeographicSymbolsandPunctuation { /// \u{16fe0}: '𖿠' TangutIterationMark, /// \u{16fe1}: '𖿡' NushuIterationMark, /// \u{16fe2}: '𖿢' OldChineseHo...
use clap::Clap; use euler::*; #[derive(Clap)] #[clap(version = "1.0", author = "Brian McCallister <brianm@skife.org>")] struct Args { #[clap(subcommand)] subcmd: Command, } #[derive(Clap)] enum Command { #[clap(name = "1")] One(p0001::Solution), #[clap(name = "2")] Two(p0002::Solution), ...
use crate::domain::admin::AdminId; #[derive(Debug, Clone)] pub enum Status { Requested, Approved { admin_id: AdminId }, Rejected { admin_id: AdminId }, Cancelled, } impl ToString for Status { fn to_string(&self) -> String { match self { Status::Requested => "requested".to_owned...
//! Reset and Clock Control peripheral //! //! This module contains a partial abstraction over the RCC peripheral, as well as types and traits //! related to the various clocks on the chip. The usual pattern here is to mutate clock settings //! as you wish them to be, freeze the clocks, and then pass references to the ...
use hasami_shogi_engine::ShogiGame; use hasami_shogi_engine::Cell; // 0 2 0 // 0 1 0 // 0 0 2 #[test] fn it_makes_the_best_move_as_cpu() { let board_state = vec![0, 2, 0, 0, 1, 0, 0, 0, 2]; let mut sg = ShogiGame::import(3,3, board_state); sg.computer_move(1); assert_eq!(sg.cell(7), Cell::Player2); } #[test...
use crate::lexer::Lexer; use crate::lexer::LexerError; use crate::lexer::Loc; use crate::lexer::ParserLanguage; use crate::lexer::StrLit; use crate::lexer::StrLitDecodeError; use crate::lexer::Token; use crate::lexer::TokenWithLocation; use std::fmt; #[derive(Debug)] pub enum TokenizerError { LexerError(LexerError...
#![feature(box_syntax, box_patterns, or_patterns)] #![allow(dead_code)] pub mod ast; pub mod lexer; pub mod parser; mod tests; use crate::{ ast::{Expression, FloatSize, IntSize, PrimitiveType, TypeKind, AST}, lexer::{ token, token::{Keyword, Symbol, Type}, }, parser::{ParseError, Pars...
use rand::prelude::*; struct Solution { nums: Vec<i32>, rng: ThreadRng, } impl Solution { fn new(nums: Vec<i32>) -> Self { Self { nums, rng: thread_rng(), } } /** Resets the array to its original configuration and return it. */ fn reset(&self) -> Vec<i3...
use crate::actix::{ Actor, SyncContext, Message, Handler }; use crate::model::Msg; use crate::schema; use actix_web::error::Error; use diesel::r2d2::{ ConnectionManager, Pool }; use diesel::PgConnection; use diesel::prelude::*; use serde_derive::Deserialize; use uuid::Uuid; use chrono::Local; pub struct DbActor(pub P...
use crate::basictables::fill_tables; use crate::glyph::glifs_to_glyph; use fonttools::font; use fonttools::font::Table; use fonttools::glyf; use fonttools::gvar::GlyphVariationData; use fonttools::hmtx; use fonttools::otvar::VariationModel; use kurbo::{Affine, Point}; use norad::{Component, Contour, ContourPoint, Glyph...
use std::{env, path::PathBuf}; use anyhow::{Context, Result}; use config::{Config, File, FileFormat}; use serde::Deserialize; #[derive(Deserialize)] pub struct CliConfig { pub db_path: String, pub data_path: PathBuf, } pub fn read_config() -> Result<CliConfig> { let home = env::var("HOME") .contex...
extern crate clap; extern crate futures; #[macro_use] extern crate log; extern crate rand; extern crate rdkafka; extern crate tokio; use clap::{App, Arg}; use futures::{lazy, Stream}; use rdkafka::config::ClientConfig; use rdkafka::consumer::Consumer; use rdkafka::consumer::stream_consumer::StreamConsumer; use rdkafka...
// Copyright 2020 Shift Cryptosecurity AG // // 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 ...
use crate::tcp::opaque_transport; use linkerd_app_core::{ metrics, profiles::{self, LogicalAddr}, proxy::{ api_resolve::{ConcreteAddr, Metadata}, http, resolve::map_endpoint::MapEndpoint, }, svc::{self, Param}, tls, transport::{self, OrigDstAddr, Remote, ServerAddr}, ...
//! 2x2 Matrix use super::common::{Mat2, Vec2, hypot, EPSILON}; /// Creates a new identity mat2. /// /// [glMatrix Documentation](http://glmatrix.net/docs/module-mat2.html) pub fn create() -> Mat2 { let mut out: Mat2 = [0_f32; 4]; out[0] = 1_f32; out[3] = 1_f32; out } /// Creates a new ...
use mongodb::bson::{document::Document, oid::ObjectId}; use serde::Serialize; use std::iter::Iterator; use super::Product; #[derive(Serialize, Clone)] pub struct Wishlist { #[serde(skip)] id: Option<ObjectId>, timestamp: Option<i32>, #[serde(skip)] product_ids: Option<Vec<ObjectId>>, products:...
use crate::format::problem::*; use crate::format::solution::*; use crate::helpers::*; #[test] fn can_use_vehicle_with_open_end() { let problem = Problem { plan: Plan { jobs: vec![create_delivery_job("job1", vec![1., 0.])], relations: Option::None }, fleet: Fleet { vehicles: vec![create_default_vehi...
pub mod dtos; pub mod role; pub mod user;
use super::super::super::repository::design::{find_designs}; #[test] fn test_find_designs() { let domain_designs = find_designs(1, 1); assert_eq!(1, domain_designs[0].id); }
use crate::{ fragment::{Bounds, Rect}, Fragment, }; /// Result of endorsing processes #[derive(Debug)] pub struct Endorse<T, E> { /// The result that passed the endorsed pub accepted: Vec<T>, /// The objects that didn't pass the endorsement pub rejects: Vec<E>, } impl<T, E> Endorse<T, E> { ...
#[macro_use] extern crate log; use bot::{commands, data, handler}; use std::{collections::HashSet, env, sync::Arc}; use dotenv::dotenv; use redis::Client as RedisClient; use serenity::{ client::bridge::gateway::GatewayIntents, framework::StandardFramework, http::Http, prelude::Mutex, Client, }; use songbi...
#[macro_use] extern crate ndarray; use ndarray::{arr2, ArrayBase}; use ndarray::{Array1, Array2, Axis}; fn projection_space(space: ArrayBase<ndarray::ViewRepr<&f64>, ndarray::Dim<[usize; 2]>>, projection: Array1<f64>) -> Array1<f64> { let space_shape = space.shape(); let mut sum = Array1::<f64>::zeros(space_s...
use reqwest::Client; use reqwest::StatusCode; use serde::{Deserialize, Serialize}; use std::env; use std::process; use std::time::SystemTime; #[derive(Serialize, Deserialize)] struct RequestBody { time: u128, time_end: u128, is_region: bool, tags: Vec<String>, text: String, } fn main() { let a...
extern crate byteorder; #[macro_use] extern crate lazy_static; extern crate regex; use std::borrow::Cow; use std::cmp::min; use std::fmt; use std::io::{self, Read, Write}; use std::num::ParseIntError; mod game; pub use game::Game; pub use game::ROM_SIZE; pub mod sections; mod rom_rebuilder; pub use rom_rebuilder::R...
//! Named Window //! //! A widget represent a named window use std::fmt::Debug; use druid::{ widget::{Label, LabelText, LineBreaking, WidgetExt}, LifeCycle, LifeCycleCtx, }; use druid::{ BoxConstraints, Color, Data, Env, Event, EventCtx, LayoutCtx, PaintCtx, Point, Rect, RenderContext, Size, UpdateCtx...
#[doc = "Register `HASH_CSR52` reader"] pub type R = crate::R<HASH_CSR52_SPEC>; #[doc = "Register `HASH_CSR52` writer"] pub type W = crate::W<HASH_CSR52_SPEC>; #[doc = "Field `CS52` reader - CS52"] pub type CS52_R = crate::FieldReader<u32>; #[doc = "Field `CS52` writer - CS52"] pub type CS52_W<'a, REG, const O: u8> = c...
use serde::{Deserialize, Serialize}; /// The system parameters type returned from contract calls. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct SysParams { /// Block gas limit #[serde(rename = "BlockGasLimit")] pub block_gas_limit: u64, /// Transaction gas limit #[serde(rena...
use { ply_generator_lib::{ V3, print_ply, merge_meshes, negate_z_coord, flip_normals }, simple_tiled_wfc::grid_generation::{WfcModule, WfcContext, WfcContextBuilder}, ron::de::from_reader, crate::{ types::{ControlPoints}, wang_info::{ ...
//! Version Output use libwgetj; include!(concat!(env!("OUT_DIR"), "/version.rs")); #[cfg(unix)] /// Generate the verbose version string. fn verbose_ver() -> String { format!("\x1b[32;1mlibwgetj {}\x1b[0m ({} {}) (built {})\ncommit-hash: {}\ncommit-date: \ {}\nbuild-date: {}\nhost: {}\nrelease: {}\n\...
// Pasts // // Copyright (c) 2019-2020 Jeron Aldaron Lau // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // https://apache.org/licenses/LICENSE-2.0>, or the Zlib License, <LICENSE-ZLIB // or http://opensource.org/licenses/Zlib>, at your option. This file may not be // copied, modified, or distr...
#[cfg(unix)] use cluFlock::{ExclusiveFlock, FlockLock}; use reqwest::Client; use reqwest::header::{USER_AGENT, CONTENT_DISPOSITION}; use reqwest::Url; use std::fs::File; use std::io; use std::path::Path; #[cfg(windows)] use std::path::{Component, Prefix, PathBuf}; #[cfg(unix)] pub fn lock_process_or_wait<'a>(lock_file...
use core::slice; use std::{collections::HashMap, time::Duration}; use futures::Future; use http::{header::AUTHORIZATION, Method, Request, StatusCode, Uri}; use hyper::{client::HttpConnector, Body, Client}; use metrics::counter; use serde::Deserialize; use tokio::{ sync::mpsc::{self, Receiver, Sender}, time::ti...
#![deny(unsafe_code)] #![type_length_limit = "1664759"] #![feature( trait_alias, option_flattening, // Converts Option<Option<Item>> into Option<Item> TODO: Remove this once this feature becomes stable )] #[macro_use] extern crate serde_derive; #[macro_use] extern crate log; pub mod assets; pub mod clock; pub...
use std::{fs, hash::Hasher, io::Read, path::Path}; use anyhow::Result; use crate::wallpaper::Wallpaper; use crate::{cache::Cache, wallpaper::unpack}; /// Unpacks HEIF files and loads them into `Wallpaper` structs, while transparently caching them. #[derive(Debug)] pub struct WallpaperLoader { cache: Cache, } im...
use std::env; use sidekiq::{Client, ClientOpts, JobOpts, Job}; use bson::ordered::{ OrderedDocument }; use r2d2_redis::{redis, RedisConnectionManager}; use r2d2_redis::r2d2::{Pool}; use std::error::Error; pub struct Notifier { client: Client } impl Notifier { pub fn new() -> Self { let client_opts = ClientOpt...
use lspower::jsonrpc::{Error, ErrorCode}; #[derive(Debug)] pub enum LspError { InternalError(String), LockNotAcquired, FileNotFound(String), InvalidArguments(Vec<serde_json::value::Value>), InvalidCommand(String), CompositionNotFound(lspower::lsp::Url), } impl From<LspError> for Error { f...
//! # Logistic regression //! //! `logistic_regression` provides tools to build and run //! logistic regression models. extern crate ndarray; extern crate ndarray_linalg; use ndarray::{ Array, Array1, Array2, ArrayBase, Data, Ix1, Ix2, NdFloat, s, }; use ndarray_...
use std::{cell::RefCell, rc::Rc}; use apllodb_storage_engine_interface::StorageEngine; use crate::{ access_methods::{ with_db_methods_impl::WithDbMethodsImpl, with_tx_methods_impl::WithTxMethodsImpl, without_db_methods_impl::WithoutDbMethodsImpl, }, sqlite::sqlite_resource_pool::{db_pool::...
use math; pub fn runner() { let a: [u64; 2] = [13195, 600851475143]; for element in a.iter() { println!( "lpf of {} is {}", *element, calculate_lpf(*element) ); } } pub fn calculate_lpf(n: u64) -> u64 { let root = (n as f64).sqrt(); let root = m...
#[macro_use] extern crate actix_web; use std::{thread, time}; use std::{env, io}; use std::borrow::Borrow; use std::sync::mpsc; use actix_rt::System; use actix_web::{ App, error, Error, guard, HttpRequest, HttpResponse, HttpServer, middleware, Result, web, }; use actix_web::dev::Server; use actix_web::http::{...
use std::collections::{HashMap}; use super::hash::{H256}; use super::block::{Block, Header}; use super::blockchain::{BlockChain}; use std::sync::{Arc, Mutex}; use std::sync::mpsc::{self}; use std::collections::{HashSet, VecDeque}; use super::contract::interface::{Message, Handle, Answer}; use web3::types::{TransactionR...
use crate::component_store::ComponentStore; use crate::entity_store::EntityStore; use crate::{Component, Entity}; use std::any::{Any, TypeId}; use std::collections::HashMap; const UNDEFINED: usize = 1; pub struct System { components: HashMap<TypeId, Box<Any>>, entity_store: EntityStore, } impl System { ...
use crate::base::{ID, Element, ListResult, BareList}; use crate::dbbase::ConnectionProvider; use crate::rocketeer::db::listdao; use crate::rocketeer::service::list_service::{ListService}; /** * Database implementation of the list service interface. * * Note. Deceptively pretends to be database-agnostic! But * Con...
/*! Some helper functions. */ /// Used to coerce `&[T;N]` to `&[T]`. pub const fn coerce_slice<'a,T>(slic:&'a [T])->&'a [T]{ slic }
use crate::{check_uniq, field_indices, index_number, is_cow, is_option, variant_indices}; use crate::{Idx, lifetimes_to_constrain, is_str, is_byte_slice, encoding, Encoding}; use crate::{collect_type_params, CustomCodec, custom_codec}; use crate::find_cbor_attr; use quote::quote; use std::collections::HashSet; use syn:...
/// Won't you be my neighbor? /// /// A simple CRM, starting as a JSON API user management system. mod sitter; use std::env; use actix_web::{middleware, App, HttpServer}; use anyhow::Result; use dotenv::dotenv; use log::info; use sqlx::PgPool; #[actix_web::main] async fn main() -> Result<()> { dotenv().ok(); ...
// Copyright (c) 2016, <daggerbot@gmail.com> // This software is available under the terms of the zlib license. // See COPYING.md for more information. use device::{Device, DeviceBridge}; use error::Result; use imp::PixelFormatProvider; use util::GetProvider; /// Implementation trait for `PixelFormat`. pub ...
use crate::commands::*; use std::collections::HashSet; use serenity::framework::standard::macros::group; use serenity::framework::StandardFramework; use serenity::model::event::ResumedEvent; use serenity::model::gateway::Ready; use serenity::prelude::*; struct Handler; impl EventHandler for Handler { fn ready(&...
// Copyright 2020 Shift Cryptosecurity AG // // 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 ...
mod task; use fumio_utils::park::Park; use futures_core::future::{Future, FutureObj, LocalFutureObj}; use futures_core::task::{Spawn, LocalSpawn, SpawnError}; use futures_executor::Enter; use futures_util::pin_mut; use std::rc::{Rc, Weak}; use std::task::{Context, Poll}; // Set up and run a basic single-threaded spa...
use glfw::{Action, CursorMode, Key, WindowEvent}; use luminance::{ context::GraphicsContext, face_culling::FaceCulling, framebuffer::Framebuffer, linear::M44, pipeline::BoundTexture, pixel::Floating, render_state::RenderState, shader::program::{Program, Uniform}, texture::{Dim2, Flat...
// Copyright 2017 rust-ipfs-api Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except accord...
use std::{ net::SocketAddr, time::{Duration, Instant}, }; use crate::protocol::handshake::Handshake; use crate::{SeqNumber, SocketID}; #[derive(Clone, Debug)] pub struct Connection { pub settings: ConnectionSettings, pub handshake: Handshake, } #[derive(Debug, Clone, Copy)] pub struct ConnectionSetti...
use List::*; enum List { Cons(u32, Box<List>), Nil, } // Here we attach methods to an enum impl List { // creates an empty list fn new() -> List { Nil } // prepends values to list fn prepend(self, elem: u32) -> List { Cons(elem, Box::new(self)) } // returns length...
extern crate rand; use std::collections::HashMap; use self::rand::{thread_rng, Rng}; #[derive(Debug)] pub struct Chain { pub map: HashMap<String, Vec<String>>, pub gramcount: usize, } impl Chain { pub fn new(count: usize) -> Chain { Chain { map: HashMap::with_capacity(8_000_000), ...
#[no_mangle] pub extern fn physics_single_chain_ufjc_morse_thermodynamics_isotensional_legendre_helmholtz_free_energy(number_of_links: u8, link_length: f64, hinge_mass: f64, link_stiffness: f64, link_energy: f64, force: f64, temperature: f64) -> f64 { super::helmholtz_free_energy(&number_of_links, &link_length, ...
pub mod sys; pub mod error; use core::iter::FusedIterator; use std::io; /// Get an `Iterator` over all USB devices identified by your operating system. /// /// Note that the return value for this iterator is a `Result`. /// You may need to use a try operator `?` after the function call `devices()` /// if you want t...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00..0x100 - DFSDM channel configuration cluster"] pub ch: [CH; 8], #[doc = "0x100..0x300 - DFSDM cluster: CR1, CR2, ISR, ICR, JCHGR, FCR, JDATAR, RDATAR, AWHTR, AWLTR, AWSR, AWCFR, EXMAX, EXMIN, CNVTIMR registers"] pub flt: [FLT...
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub enum Explain { Boost(f32), MaxTokenToTextId(f32), TermToAnchor { term_score: f32, anchor_score: f32, final_score: f32, term_id: u32, }, LevenshteinScore { score: f32, text_or_token_id: Stri...
use exonum::{ blockchain::{ExecutionError, ExecutionResult, Transaction, TransactionContext}, crypto::{PublicKey, SecretKey}, messages::{Message, RawTransaction, Signed}, }; use crate::currency::schema::Schema as CurrencySchema; use crate::lvm::{proto, runner::Runner, schema::Schema as LvmSchema, service:...
use super::*; #[test] fn test_header_marshalling() -> Result<(), Box<Error>> { let internal_header: InternalHeader = InternalHeader { typ: Typ::BWTv0, iat: 1, exp: 2, kid: [0u8; 16], nonce: [0u8; 12], base64_kid: "AAAAAAAAAAAAAAAAAAAAAA==".to_string(), }; le...
use std::convert::TryInto; fn contains_forbidden_letters(input: &str) -> bool { let vowels = ['i', 'u', 'l']; input .chars() .fold(0, |count, c| count + vowels.contains(&c) as u32) > 0 } fn contains_increasing_three_letters(input: &str) -> bool { input .as_bytes() ....
mod startup; mod stop; use super::RunnableCmd; pub use startup::StartupCmd; pub use stop::StopCmd; pub fn create_server_cmd(name: Option<String>, port: u16) -> Box<dyn RunnableCmd> { match name.as_ref().map(|s| s.as_ref()) { Some("start") => Box::new(StartupCmd::new("".to_owned(), port)), Some("st...
mod handler; use handler::promote_handler; mod server; pub use server::Server; mod auth; pub use auth::AuthTokenExtractor; mod response; use response::Response;
extern crate petgraph; #[macro_use] extern crate lazy_static; pub mod trie; pub mod powerset; pub mod score_word; pub use self::trie::Trie; pub use self::powerset::powerset; pub use self::score_word::score_word;
use image::{DynamicImage, LumaA}; use once_cell::sync::Lazy; use rusttype::{point, Font, Scale, ScaledGlyph}; use std::io::Cursor; static DEJA_VU_MONO: Lazy<Font<'static>> = Lazy::new(|| { Font::try_from_bytes(include_bytes!("../fonts/dejavu/DejaVuSansMono.ttf") as &[u8]).unwrap() }); static OPEN_SANS_ITALIC: Lazy...
mod mappers; mod maps; mod mapsets; mod mods; use std::sync::Arc; use twilight_model::application::{ command::CommandOptionChoice, interaction::{application_command::CommandOptionValue, ApplicationCommand}, }; use crate::{ commands::{MyCommand, MyCommandOption}, core::Context, error::Error, B...
use std::cmp::{max, min, Ordering}; use std::ops::Range; use std::ops::RangeInclusive; use crate::extended_time::ExtendedTime; pub fn wrapping_range_contains<T: PartialOrd>(range: &RangeInclusive<T>, elt: &T) -> bool { if range.start() <= range.end() { range.contains(elt) } else { range.start(...
pub mod math_library; // mod premutations { // fn count() { } // } // mod really_big_int { // fn addition() { } // } pub mod utilities { pub fn format_milliseconds(total_milliseconds: i64) -> String { let milliseconds = total_milliseconds % 1000; let totalseconds = total_milliseconds / 10...
use std::cmp::max; use std::any::Any; use Cursive; use align::*; use event::*; use theme::ColorStyle; use view::{Selector, TextView, View}; use view::{Button, SizedView}; use vec::{ToVec4, Vec2, Vec4}; use printer::Printer; use unicode_width::UnicodeWidthStr; #[derive(PartialEq)] enum Focus { Content, Button...
use byteorder::*; use std::error::Error; use std::io::Cursor; use serde_derive::{Serialize, Deserialize}; use super::CallLoopRef; #[cfg(test)] mod tests { use super::*; #[test] fn test_sustain_not_note() { let mut first = ParameterizedCommand::new(Some(1), None, None, Command::Rest); let s...
#[doc = "Register `GICV_BPR` reader"] pub type R = crate::R<GICV_BPR_SPEC>; #[doc = "Register `GICV_BPR` writer"] pub type W = crate::W<GICV_BPR_SPEC>; #[doc = "Field `BINARY_POINT` reader - BINARY_POINT"] pub type BINARY_POINT_R = crate::FieldReader; #[doc = "Field `BINARY_POINT` writer - BINARY_POINT"] pub type BINAR...
#[doc = "Register `BCCR` reader"] pub type R = crate::R<BCCR_SPEC>; #[doc = "Register `BCCR` writer"] pub type W = crate::W<BCCR_SPEC>; #[doc = "Field `BCBLUE` reader - Background color blue value"] pub type BCBLUE_R = crate::FieldReader; #[doc = "Field `BCBLUE` writer - Background color blue value"] pub type BCBLUE_W<...
use parity_scale_codec::{Encode, MaxEncodedLen}; #[derive(Encode, MaxEncodedLen)] union Union { a: u8, b: u16, } fn main() {}
use std::borrow::Cow; use serde_json; use request::DoRequest; use request::RequestBuilder; use response; impl response::NamedResponse for String { fn name<'a>() -> Cow<'a, str> { "".into() } } impl<'t> DoRequest<response::ResponseStringArray> for RequestBuilder<'t, ...
use ark_ec::{twisted_edwards_extended::GroupProjective as TEProjective, TEModelParameters}; use ark_ff::PrimeField; use ark_r1cs_std::{ alloc::AllocVar, groups::curves::twisted_edwards::AffineVar, prelude::*, uint8::UInt8, }; use ark_relations::r1cs::{Namespace, SynthesisError}; use ark_std::{borrow::Borrow, marker...
mod intcode; use std::collections::BTreeMap; use std::fs; use std::sync::mpsc; use std::{thread, time}; fn main() { let input = fs::read_to_string("input.txt").expect("Something went wrong reading the file"); let mut program: Vec<i64> = input.trim_end().split(",").map(|n| n.parse().unwrap()).collect(); ...
mod expression; mod instruction; mod lexer; mod section; mod symbol; use crate::lexer::{Lexer, Location, LocationSpan, TokType}; use crate::parser::AsmParser; use crate::symbol::Symbol; use lalrpop_util::lalrpop_mod; use std::cell::{Ref, RefCell}; use std::collections::HashMap; use std::fmt::{self, Display, Formatter};...
pub mod rng;
macro_rules! impl_from { ($to:ident :: $constructor:ident ($from:ty)) => { impl ::std::convert::From<$from> for $to { fn from(x: $from) -> Self { $to::$constructor(::std::convert::From::from(x)) } } }; } macro_rules! impl_node { ($x:ident <$a:ident, $...
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::{convert::TryInto, fmt::{self, Display, Formatter}}; use std::io::{self, Cursor, Read, Write}; pub trait Packable { type Error; fn pack_into(&self, stream: &mut impl Write) -> Result<(), Self::Error>; fn pack(&self) -> Result<Vec<u8>, Self:...
use std::fmt::Debug; use tokio::sync::{broadcast, mpsc}; use tokio::sync::{Mutex, RwLock}; // Notifier lets other tasks know that we're shutting down. #[derive(Debug)] pub struct Notifier { shutdown_tx: RwLock<Option<broadcast::Sender<()>>>, shutdown_complete_tx: RwLock<Option<mpsc::Sender<()>>>, shutdown_...
use { num_traits::{AsPrimitive, One, PrimInt, Signed, Unsigned}, std::mem::size_of, }; pub trait ZigZag: Signed + PrimInt where Self: AsPrimitive<<Self as ZigZag>::UInt>, { type UInt: Unsigned + PrimInt + AsPrimitive<Self>; #[inline] fn encode(value: Self) -> Self::UInt { let s = (value...
unsafe fn guessNumber(n: i32) -> i32 { let mut l = 1; let mut r = n as i64 + 1; while r - l > 1 { let mut mid = (l + r) / 2; match guess(mid as i32) { -1 => r = mid, 1 => l = mid, _ => return mid as i32 } } l as i32 }
use actix_cors::Cors; use actix_web::{middleware::Condition, web, App, HttpServer}; use anyhow::Context; use dotenv::dotenv; use drogue_cloud_admin_service::apps; use drogue_cloud_device_management_service::{ app, endpoints, service::{self, PostgresManagementServiceConfig}, Config, WebData, }; use drogue_cl...