text
stringlengths
8
4.13M
use bindings::{ Windows::UI::Notifications::*, Windows::Data::Xml::Dom::XmlDocument }; use windows::Result; #[allow(dead_code)] pub enum ToastDuration { Short, Long } #[allow(dead_code)] pub enum ToastAudio { Default, IM, Mail, Reminder, SMS, LoopingAlarm, LoopingAlarm2, LoopingAlarm3, LoopingAlarm4, Loo...
use std::env; use std::fs::File; use std::io::Read; mod interpreter; fn get_prog() -> String { let filename = match env::args().nth(1) { Some(n) => n, _ => panic!("Please provide a file to load from"), }; let mut file = match File::open(filename) { Ok(f) => f, _ => panic!("That file doesn't exis...
use P80::graph_converters::labeled; use P84::*; pub fn main() { let g = labeled::from_term_form( &vec!['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'], &vec![ ('a', 'b', 5), ('a', 'd', 3), ('b', 'c', 2), ('b', 'e', 4), ('c', 'e', 6), (...
#[doc(hidden)] #[macro_use] pub mod test_utils; pub mod const_utils; #[doc(hidden)] pub mod type_layout { pub mod small_types; pub mod tl_field_accessor_macro; pub mod tl_field_macro; pub mod tl_lifetimes_macro; pub mod tl_multi_tl_macro; pub mod tl_type_layout_index; } use core_extensions::S...
// FIXME: Make me pass! Diff budget: 25 lines. use Duration::{MilliSeconds, Seconds, Minutes}; #[derive(Debug)] enum Duration { MilliSeconds(u64), Seconds(u32), Minutes(u16) } impl PartialEq for Duration { fn eq(&self, other: &Duration) -> bool { match (self, other) { (&Seconds(s),...
// ========= use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use std::process::exit; const MOD: usize = 1000000007; macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s...
pub fn run() -> Result<(), anyhow::Error> { anyhow::bail!("not yet implemented") }
#![feature( allocator_api, anonymous_lifetime_in_impl_trait, core_intrinsics, fmt_internals, iterator_try_collect, let_chains, nonzero_ops, slice_ptr_get, step_trait, strict_provenance, try_blocks )] use crate::heap::{DisplayWithSymbolTable, Struct, SymbolId, Tag}; use execu...
extern crate oncemutex as om; use std::sync::mpsc::{SyncSender, Receiver}; use std::io::Read; pub mod core0; #[derive(Default)] pub struct Permission { privilege: u8, address: u32, } pub struct Com<T> { pub permission: Permission, pub bus: usize, pub data: T, } impl<T> Com<T> { fn new(permis...
use once_cell::sync::Lazy; use prometheus::{IntCounterVec, IntGauge}; /// Counter of txn status in tx_pool pub static TXN_STATUS_COUNTERS: Lazy<IntCounterVec> = Lazy::new(|| { register_int_counter_vec!( "txpool_txn_stats", "Counters of how many txn's stats in tx pool", &["status"] ) ...
use input_i_scanner::InputIScanner; use union_find::UnionFind; 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::<$t>() as $t ...
use std::collections::HashMap; use std::hash::Hash; fn main() { let map: HashMap<(i16, i16), usize> = include_str!("input").lines().enumerate().flat_map(|(i, x)| { x.split("").filter(|x| !x.is_empty()).map(str::parse).enumerate().map(|(j, d)| ((i as i16, j as i16),d.unwrap())).collect::<Vec<_>>() }).co...
use ggez::graphics; use ggez::{Context, GameResult}; use nalgebra as na; use specs::{Join, World}; use assets::Assets; use gamestate::BaseSprite; use gamestate::Position; pub const TILE_SIZE_PX: (f32, f32) = (10.0, 10.0); pub fn render(ctx: &mut Context, world: &World, assets: &Assets) -> GameResult { let pos_s ...
//! SSE4.2 (pcmpestri) accelerated substring search //! //! Using the two way substring search algorithm. // wssm word size string matching<br> // wslm word size lexicographical maximum suffix // #![allow(dead_code)] extern crate unchecked_index; extern crate memchr; use std::cmp; use std::iter::Zip; use std::ptr; ...
use crate::prelude::*; use std::os::raw::c_void; use std::ptr; pub struct VkPhysicalDeviceMaintenance3PropertiesKHR { pub sType: VkStructureType, pub pNext: *const c_void, pub maxPerSetDescriptors: u32, pub maxMemoryAllocationSize: VkDeviceSize, } impl VkPhysicalDeviceMaintenance3PropertiesKHR { ...
use { super::{ChunkMaterial, ChunkRenderMesherData, ChunkRenderMesherWorker, WorldViewer}, rough::{ amethyst::{ assets::{AssetStorage, Handle, Loader}, core::Transform, derive::SystemDesc, ecs::prelude::*, renderer::Mesh, }, ter...
extern crate tokio; use std::error::Error; use std::sync::Arc; use tokio::net::TcpListener; use tokio::sync::Mutex; #[tokio::main] async fn main() -> Result<(), Box<dyn Error>> { let listener = TcpListener::bind("localhost:6969").await?; let state = Arc::new(Mutex::new(String::new())); loop { let...
#![allow(non_snake_case)] use super::mix; use bulletproofs::r1cs::ConstraintSystem; use error::SpacesuitError; use std::iter::once; use value::AllocatedValue; /// Enforces that the outputs are either a merge of the inputs: `D = A + B && C = 0`, /// or the outputs are equal to the inputs `C = A && D = B`. See spec for...
use composer::*; fn assert_float_eq(a: f32, b: f32) { if (a - b).abs() > 1e-5 { panic!( "assertion failed: `(left == right)`\n left: `{}`,\n right: `{}`", a, b ); } } #[test] fn test_note_length_to_float() { use generate::note_length_to_float; use parse::NoteLe...
use lightning::chain::chaininterface::{ConfirmationTarget, FeeEstimator}; use tokio::runtime::Handle; use crate::p2p::router::RemoteSenseiInfo; pub struct RemoteFeeEstimator { remote_sensei: RemoteSenseiInfo, tokio_handle: Handle, } impl RemoteFeeEstimator { pub fn new(host: String, token: String, tokio_...
#[doc = "Reader of register DCISC"] pub type R = crate::R<u32, super::DCISC>; #[doc = "Writer for register DCISC"] pub type W = crate::W<u32, super::DCISC>; #[doc = "Register DCISC `reset()`'s with value 0"] impl crate::ResetValue for super::DCISC { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
/// Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn]. /// /// Return the array in the form [x1,y1,x2,y2,...,xn,yn]. /// /// /// Example 1: /// /// Input: nums = [2,5,1,3,4,7], n = 3 /// Output: [2,3,5,4,1,7] /// Explanation: Since x1=2, x2=5, x3=1, y1=3, y2=4, y3=7 then the answer ...
use regex::{escape, Regex}; use errors::BuildError; pub fn parse(mut route: &str) -> Result<Regex, BuildError> { let mut pattern = "^/?".to_string(); if route.len() != 0 && route.as_bytes()[0] == b'/' { route = &route[1..]; } for (i, segment) in route.split('/').enumerate() { if i > ...
use std::collections::HashMap; use std::fs; use serde::{de::DeserializeOwned, Deserialize}; use serde_json; use tokio::sync::RwLock; use super::character_data::CharacterData; use super::map_data::MapData; struct ResourceToLoad { pub name: String, pub resource_type: ResourceType, } impl ResourceToLoad { ...
//! https://github.com/lumen/otp/tree/lumen/lib/eunit/src use super::*; test_compiles_lumen_otp!(eunit); test_compiles_lumen_otp!(eunit_autoexport); test_compiles_lumen_otp!(eunit_data); test_compiles_lumen_otp!(eunit_lib); test_compiles_lumen_otp!(eunit_listener); test_compiles_lumen_otp!(eunit_proc); test_compiles_...
use glam::{vec2, Vec2}; use rand::prelude::*; use super::Config; #[derive(Clone, Copy)] pub struct RigidCircle { pub pos: Vec2, pub vel: Vec2, pub radius: f32, pub to_pos: Vec2, pub to_vel: Vec2, } #[derive(Clone, Copy)] pub struct Color { pub val: [f32; 4], } impl RigidCircle { pub fn n...
// Copyright 2020-2021, The Tremor Team // // 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 agr...
#![cfg(feature = "runtime-benchmarks")] use crate::{BalanceOf, Call, Pallet, WRAPPED_BYTES_PREFIX, WRAPPED_BYTES_POSTFIX}; use cumulus_pallet_parachain_system::Pallet as RelayPallet; use cumulus_primitives_core::{ relay_chain::{v1::HeadData, BlockNumber as RelayChainBlockNumber}, PersistedValidationData, }; use cumu...
mod bao; use bao::{RandomAgent, HumanAgent, TrainingAgent, Direction, Game, Mode, Player}; use rustneat::{Environment, Organism, Population}; fn random_ai_game() { let mut results = [0; 2]; for _ in 0..100000 { let winner_tag = Game::new( Direction::CW, Mode::Easy, ...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct CompositorController(pub ::windows::core::IIns...
use amethyst::core::Transform; use amethyst::derive::SystemDesc; use amethyst::ecs::{Join, Read, System, SystemData, WriteStorage}; use amethyst::input::{InputHandler, StringBindings}; use crate::components::{Direction, Player, PlayerState}; #[derive(SystemDesc)] pub struct PlayerSystem; impl<'s> System<'s> for Play...
pub mod asset; pub mod grpc_stub; pub mod prelude;
#[doc(hidden)] #[macro_export] macro_rules! declare_tl_lifetime_types {( repr=$repr:ty, attrs=[ $($extra_attrs:meta),* $(,)* ] ) => ( /// Which lifetime is being referenced by a field. /// Allows lifetimes to be renamed,so long as the "same" lifetime is being referenced. #[repr(transparent)] #[...
#![crate_name = "js"] #![comment = "Javascript parsing, compilation and execution using LibJIT"] #![license = "MIT"] #![crate_type = "lib"] #![doc( html_favicon_url = "http://tombebbington.github.io/favicon.png" )] #![experimental] #![feature(phase, macro_rules, globs)] #![deny(non_uppercase_statics, missing_doc,...
// TODO: flat::tree::Libraries needs DuplicateLibraryError, but maybe that should // go somewhere else pub mod errors; mod visitor; use super::*; use crate::flatten::{lookup, ResolverContext, UnresolvedScope}; use crate::lexer::Span; use crate::raw; use crate::raw::Spanned; use crate::span; use errors::{Error, RawName...
fn main() { // `n` will take the values: 1, 2, ..., 100 in each iteration for n in 1..101 { if n % 15 == 0 { println!("fizzbuzz"); } else if n % 3 == 0 { println!("fizz"); } else if n % 5 == 0 { println!("buzz"); } else if n % 1 == 0 { ...
use std::{fs, io}; use anyhow::Error; use clap::{App, ArgMatches, SubCommand}; use varisat::checker::{Checker, CheckerError}; use varisat_lrat::WriteLrat; use super::{banner, init_logging}; mod transcript; pub fn check_args() -> App<'static, 'static> { SubCommand::with_name("--check") .arg_from_usage("...
#[doc = "Reader of register FTSR2"] pub type R = crate::R<u32, super::FTSR2>; #[doc = "Writer for register FTSR2"] pub type W = crate::W<u32, super::FTSR2>; #[doc = "Register FTSR2 `reset()`'s with value 0"] impl crate::ResetValue for super::FTSR2 { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
use crate::rustc_lint::LintContext; use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::source::snippet_with_macro_callsite; use clippy_utils::sugg; use if_chain::if_chain; use rustc_errors::Applicability; use rustc_hir::{Block, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session:...
use super::Part; use crate::codec::{Decode, Encode}; use crate::{remote_type, RemoteObject, Vector3}; remote_type!( /// An reaction wheel. Obtained by calling `Part::reaction_wheel().` object SpaceCenter.ReactionWheel { properties: { { Part { /// Returns the part object for this...
pub mod image; pub(crate) mod bitmap;
#[macro_export] macro_rules! derive_Component { ($type_name: ty) => { impl $crate::ecs::Component for $type_name { type Manager = $crate::component::DefaultManager<$type_name>; type Message = $crate::component::DefaultMessage<$type_name>; } } } #[macro_export] macro_rule...
//! `intialize` subcommand use crate::application::app_config; use crate::config::LightClientConfig; use std::collections::HashMap; use abscissa_core::status_err; use abscissa_core::status_warn; use abscissa_core::Command; use abscissa_core::Options; use abscissa_core::Runnable; use tendermint::hash; use tendermint...
//! UnixFS symlink support. UnixFS symlinks are UnixFS messages similar to single block files, but //! the link name or target path is encoded in the UnixFS::Data field. This means that the target //! path could be in any encoding, however it is always treated as an utf8 Unix path. Could be that //! this is wrong. use...
fn main() { println!("Hello, world!"); } #[derive(Debug)] struct Trie<K: Ord + Eq + Copy, V> { root: Node<K, V> } #[derive(Debug)] struct Node<K: Ord + Eq + Copy, V> { key : Option<K>, value: Option<V>, next : Vec<Node<K, V>>, } impl<K: Ord + Eq + Copy, V> Trie<K, V> { fn new() -> Self { ...
use std::error::Error; use std::thread; use std::time::Duration; use rainbow_hat_rs::alphanum4::Alphanum4; fn main() -> Result<(), Box<dyn Error>> { let sleep_time = 500; let msg = "HELLO WORLD "; let mut alphanum = Alphanum4::new()?; let mut start_index = 0; let mut msg2 = msg.to_string(); ...
use crate::lws::WMessage; use std::fmt; use stream_cancel::Trigger; use tokio::sync::mpsc::UnboundedSender; pub struct Request { pub index: u16, pub tag: u16, pub request_tx: Option<UnboundedSender<WMessage>>, pub trigger: Option<Trigger>, pub write_out: u16, } impl Request { pub fn new(idx:...
use std::collections::HashMap; use chrono::Local; use crate::{HTTP_VERSION}; use std::path::PathBuf; pub struct Response<'a> { pub http_version: &'a str, pub status_code: u16, pub reason_phrase: &'a str, pub headers: HashMap<&'a str, String>, pub body: Option<Vec<u8>>, } impl Response<'_> { ...
use lexical_core::Number; use crate::database as db; use deadpool_postgres::Pool; use serde::{Serialize, Deserialize}; pub async fn accept_invite(invite_id: db::InviteID, session_id: db::SessionID, pool: Pool) -> Result<Box<dyn warp::Reply>, warp::Rejection> { let user_id = match db::session_user_id(pool.clone...
use crate::parse::image::Image; use crate::parse::boolean_matrix::BooleanMatrix; use crate::parse::target_mesh::TargetMesh; mod boolean_matrix; pub mod image; mod target; mod target_mesh; use crate::make::scan_sheet_elements::{ALIGNER_OUTER_RADIUS}; use crate::make::scan_sheet_layout::ALIGNER_DISTANCE_FROM_CORNER; c...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_operation_create_batch_inference_job( input: &crate::input::CreateBatchInferenceJobInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json...
use sat::formula::{Lit, Var, LitMap}; use sat::formula::assignment::Assignment; use sat::formula::clause::*; #[derive(Clone, Copy, Debug)] struct Watcher { pub cref : ClauseRef, pub blocker : Lit } #[derive(Debug)] struct WatchesLine { watchers : Vec<Watcher>, dirty : bool } pub struct Watch...
// 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 std::io::{ Cursor, Read, }; use std::marker::PhantomData; use std::path::PathBuf; use regex::Regex; use sourcerenderer_core::platform::IO; use sourcerenderer_core::Platform; use crate::asset::asset_manager::{ AssetContainer, AssetFile, }; use crate::asset::loaders::csgo_loader::CSGOMapLoaderError:...
use nodes::prelude::*; pub struct Definition { name: String, args: NodeListP, // body of the macro declaration body: Ptr<NodeList<NodeP>>, // referencing macro invocations references: RefCell<Vec<Weak<Node>>>, env: LocalEnv } impl Node for Definition...
use crate::LED_COUNT; use nrf51822::GPIO; /// A color represented in 24-bit GRB format (the same at the strip). #[derive(Copy, Clone)] #[repr(packed)] pub struct Color { pub g: u8, pub r: u8, pub b: u8, } impl Color { pub const fn black() -> Color { Color { g: 0, r: 0, b: 0 } } pub co...
use utilities::prelude::*; use crate::impl_vk_handle; use crate::prelude::*; use std::sync::Arc; pub struct DescriptorPoolBuilder { layout: Option<Arc<DescriptorSetLayout>>, descriptor_count: u32, flags: VkDescriptorPoolCreateFlagBits, } impl DescriptorPoolBuilder { pub fn set_flags(mut self, flags:...
use dlal_component_base::{component, err, serde_json, Body, CmdResult, View}; use multiqueue2::{MPMCSender, MPMCUniReceiver}; #[derive(Debug)] enum QueuedItem { Command { view: View, body: Box<serde_json::Value>, detach: bool, }, Wait(usize), } struct Queues { to_audio_send: M...
use std::path::Path; use actix_files::NamedFile; use actix_web::{ middleware::Logger, web::{self, Data}, App, HttpRequest, HttpServer, Responder, }; use env_logger::Env; use fintrack::utils::AuthProvider; use fintrack::{services, Config, Db}; use true_layer::Client as TrueLayerClient; #[actix_web::main] ...
use super::*; #[derive(Clone)] pub struct TypeRef(pub Row); impl TypeRef { pub fn name(&self) -> &'static str { self.0.str(1) } pub fn namespace(&self) -> &'static str { self.0.str(2) } pub fn type_name(&self) -> TypeName { TypeName::new(self.0.str(2), self.0.str(1)) ...
use std::any::type_name; #[cfg(feature = "use_serde")] use serde::{Deserialize, Serialize}; use crate::clickhouse::compacted_tables::schema::ValidateSchema; use crate::Error; #[cfg_attr(feature = "use_serde", derive(Serialize, Deserialize))] #[derive(Debug, PartialEq, Eq, Clone)] pub enum TableEngine { Replacing...
#[doc = "Reader of register MACPOCR"] pub type R = crate::R<u32, super::MACPOCR>; #[doc = "Writer for register MACPOCR"] pub type W = crate::W<u32, super::MACPOCR>; #[doc = "Register MACPOCR `reset()`'s with value 0"] impl crate::ResetValue for super::MACPOCR { type Type = u32; #[inline(always)] fn reset_va...
use super::ChunkId; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use crate::beam::reader::{ReadError, Result}; pub struct Header { pub chunk_id: ChunkId, pub data_size: u32, } impl Header { pub fn new(chunk_id: &ChunkId, data_size: u32) -> Self { Header { chunk_id: *chunk_...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_operation_add_attributes_to_findings( input: &crate::input::AddAttributesToFindingsInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json...
use { amethyst::input::BindingTypes, serde::{Deserialize, Serialize}, std::fmt, }; #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)] pub enum AxisBinding { Vertical, Sideways, Forward, } impl fmt::Display for AxisBinding { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt...
// 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. // This module contains the bulk of the logic for connecting user applications to a // vsock driver. // // Handling user requests is complicated as there a...
use super::RuntimeErr; use crate::runtime::Ctx; pub trait Runnable<'a> { fn back(&mut self, _ctx: &mut dyn Ctx<'a>) -> Result<(), RuntimeErr> { Ok(()) } fn run(&mut self, _ctx: &mut dyn Ctx<'a>) -> Result<(), RuntimeErr> { Ok(()) } }
// Copyright 2017 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 flexi_logger::{style, DeferredNow, LogSpecBuilder, LogTarget, Logger, ReconfigurationHandle}; use log::{LevelFilter, Record}; use std::error::Error; use super::debug_view::DebugView; use super::Conf; pub fn setup(conf: &Conf, debug_view: &mut DebugView) -> Result<(), Box<dyn Error>> { let mut builder = LogSpe...
#[cfg(not(feature = "high-dpi"))] #[deprecated(note = "Specifying the default process DPI awareness via API is not recommended. Use the '<dpiAware>true</dpiAware>' setting in the application manifest. https://docs.microsoft.com/ru-ru/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process")] pub unsafe fn s...
pub(crate) mod body_generators { use crate::tetromino::GRID_SIZE; pub(crate) fn generate_i() -> Vec<(i16, i16)> { vec![ (GRID_SIZE.0 / 2, -2), (GRID_SIZE.0 / 2, -1), (GRID_SIZE.0 / 2, -0), (GRID_SIZE.0 / 2, 1), ] } pub(crate) fn generate_l(...
use cgmath::{Vector3, Matrix4, vec3, Deg}; use crate::entities::camera::Camera; pub fn create_transformation_matrix(translation: &Vector3<f32>, rx: f32, ry: f32, rz: f32, scale: f32) -> Matrix4<f32> { let mut matrix = Matrix4::<f32>::from_translation(*translation); matrix = matrix * Matrix4::<f32>...
use cosmwasm_std::StdError; use cw721_base::ContractError as CW721ContractError; use thiserror::Error; /// This overrides the ContractError enum defined in cw721-base #[derive(Error, Debug, PartialEq)] pub enum ContractError { #[error("{0}")] Std(#[from] StdError), #[error("Unauthorized")] Unauthorize...
use aoc2019::aoc_input::get_input; use aoc2019::intcode::*; fn main() { let input = get_input(19); let tape = parse_intcode_program(&input); let mut pulled_locations = 0; for y in 0..50 { for x in 0..50 { let mut machine = IntcodeMachine::new(tape.clone()); machine.inp...
// misc_instructions.rs for BIT instruction, NOP and more use super::flags::*; use crate::mem_map; use crate::memory::{RAM, *}; pub fn bittest_zero_page( pc_reg: &mut u16, accumulator: u8, operand: u8, mem: &mut RAM, status_flags: &mut u8, cycles: &mut u8, ) { let value = mem.read_mem_value...
struct Solution {} impl Solution { pub fn reverse_words(s: String) -> String { let mut xs = s .split(" ") .map(|word| word.trim()) .filter(|word| !word.is_empty()) .collect::<Vec<_>>(); xs.reverse(); xs.join(" ") } } fn main() { print...
extern crate bindgen; use std::env; use std::path::PathBuf; fn main() { println!("cargo:rustc-link-lib=glpk"); println!("cargo:rebuild-if-changed=wrapper.h"); let bindings = bindgen::Builder::default() .header("wrapper.h") .parse_callbacks(Box::new(bindgen::CargoCallbacks)) // We e...
//! Router server entrypoint. use self::{grpc::RpcWriteGrpcDelegate, http::HttpDelegate}; use std::sync::Arc; use trace::TraceCollector; pub mod grpc; pub mod http; /// The [`RpcWriteRouterServer`] manages the lifecycle and contains all state for a /// `router-rpc-write` server instance. #[derive(Debug)] pub struct ...
// 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. create_net_enum! { MessageType, MembershipQuery: MEMBERSHIP_QUERY = 0x11, MembershipReportV1: MEMBERSHIP_REPORT_V1 = 0x12, MembershipReport...
#[derive(Debug, Clone)] pub struct WildcardMatcher { chars: Vec<char>, } impl WildcardMatcher { pub fn new(s: &str) -> Self { Self { chars: s.chars().collect::<Vec<char>>(), } } pub fn is_match(&self, s: &str) -> bool { let mut chars = s.chars(); let mut dot...
use bitvec::prelude::Msb0; use bitvec::vec::BitVec; use stark_hash::Felt; use crate::hash::FeltHash; /// A node in a Starknet patricia-merkle trie. /// /// See pathfinders merkle-tree crate for more information. #[derive(Debug, Clone, PartialEq)] pub enum TrieNode { Binary { left: Felt, right: Felt }, Edge { ...
use crate::params::named_params; use pathfinder_common::{ BlockHash, BlockNumber, ClassCommitment, StateCommitment, StorageCommitment, }; use rusqlite::{OptionalExtension, Transaction}; use crate::params::RowExt; pub(crate) fn migrate(tx: &Transaction<'_>) -> anyhow::Result<()> { tx.execute("DROP TABLE l1_sta...
use std::sync::mpsc::{channel, Receiver, Sender}; use anyhow::{Context, Result, bail}; use cpal::{ traits::{DeviceTrait, HostTrait, StreamTrait}, BufferSize, Sample, Stream, StreamConfig, SupportedBufferSize, SizedSample, FromSample, }; use super::bus::Busable; pub struct Sound { _stream: Stream, sta...
extern crate serde; #[macro_use] extern crate serde_json; #[macro_use] extern crate serde_derive; #[macro_use] extern crate nom; extern crate regex; extern crate xrl; extern crate futures; mod client; mod disambiguation_map; mod insert_mode; mod key; mod maps; mod mode; mod mode_map; mod normal_mode; mod op; mod o...
use crate::ast::syntax_type::{SimpleSyntaxType, SyntaxType}; use crate::types::{Bool, Color, Float, Int, PineFrom, PineRef, RefData, Series, Tuple, NA}; use std::mem; pub fn convert<'a>(val: PineRef<'a>, dest_type: &SyntaxType<'a>) -> PineRef<'a> { match dest_type { SyntaxType::Series(SimpleSyntaxType::Boo...
// 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 { crate::{ cloud_action_provider::get_cloud_actions, mod_manager::ModManager, story_context_store::StoryContextStore, ...
pub mod utilities; use proffer::{Attribute, SrcCode}; #[test] fn test_attribute_attr() { let ann = "#[attr]"; let attribute = Attribute::from(ann); match &attribute { &Attribute::ItemAttr(ref s) => assert_eq!(&s, &ann), _ => panic!("Expected to match to Attribute::ItemAttr, got {:?}", ann),...
//! https://github.com/lumen/otp/tree/lumen/lib/inets/src/http_lib use super::*; test_compiles_lumen_otp!(http_chunk); test_compiles_lumen_otp!(http_request); test_compiles_lumen_otp!(http_response); test_compiles_lumen_otp!(http_transport); test_compiles_lumen_otp!(http_uri); test_compiles_lumen_otp!(http_util); fn...
//! Плиты перекрытия use crate::sig::rab_e::sec::BoxSec; use crate::sig::HasWrite; use nom::{ bytes::complete::take, number::complete::{le_f32, le_u16, le_u8}, IResult, }; use std::borrow::Borrow; use std::fmt; #[derive(Debug)] pub struct Slab { //1b bf: u8, //Флаг bF. 0=нет, 1=есть b: f32, ...
import option::none; import option::some; import util::orb; type vbuf = rustrt::vbuf; type operator2[T, U, V] = fn(&T, &U) -> V ; type array[T] = vec[mutable? T]; native "rust" mod rustrt { type vbuf; fn vec_buf[T](v: vec[T], offset: uint) -> vbuf; fn vec_len[T](v: vec[T]) -> uint; /** * Some...
use iface::iface::example_one::ExampleOne; use iface::iface::example_one::SearchQuery; use iface::iface::example_one::SearchResult; use apilib::apilib::request::TRequest; use apilib::apilib::response::TResponse; #[derive(new, Debug)] pub struct ExampleOneService {} impl ExampleOne for ExampleOneService { fn searc...
mod bam; fn main() { let path = std::env::current_dir() .unwrap() .join("data") .join("htsnexus_test_NA12878.bam"); let ref_seqs = bam::bam_blocks(path).unwrap(); println!("{}", serde_yaml::to_string(&ref_seqs).unwrap()); }
use super::*; use crate::errors::{span_to_snippet, spans_to_snippet, two_spans_to_snippet, ErrText}; use crate::flat::Sort; use crate::lexer::Span; use crate::source_file::FileMap; use annotate_snippets::snippet::{Annotation, AnnotationType, Snippet}; use std::fmt; #[derive(Debug, Clone)] pub enum Error { SortErro...
use std::cell::RefCell; use std::error::Error; use std::ptr; use std::slice; thread_local! { static LAST_ERROR: RefCell<Option<Box<dyn Error>>> = RefCell::new(None); } pub fn set_last_error<E: Error + 'static>(err: E) { LAST_ERROR.with(|prev| { *prev.borrow_mut() = Some(Box::new(err)); }); } pub ...
//! Core Paillier encryption scheme supporting ciphertext addition and plaintext multiplication. use traits::*; use std::ops::{Add, Sub, Mul, Div, Rem}; use num_traits::{One}; use arithimpl::traits::*; /// Representation of a keypair from which encryption and decryption keys can be derived. pub struct Keypair<I> {...
#[doc = "Reader of register DAC_STMODR"] pub type R = crate::R<u32, super::DAC_STMODR>; #[doc = "Writer for register DAC_STMODR"] pub type W = crate::W<u32, super::DAC_STMODR>; #[doc = "Register DAC_STMODR `reset()`'s with value 0"] impl crate::ResetValue for super::DAC_STMODR { type Type = u32; #[inline(always...
pub use crate::table::{chart::Chart, charts::Charts, table::*};
pub mod domain; pub mod gateway; pub mod port; pub mod usecase; #[macro_use] extern crate mockall;
//! read contains the Reader struct and its associated helpers and data //! structures. //! //! Initial master regex is taken from MAL: //! [\s,]*(~@|[\[\]{}()'`~^@]|"(?:\\.|[^\\"])*"|;.*|[^\s\[\]{}('"`,;)]*) //! //! https://doc.rust-lang.org/regex/regex/index.html extern crate regex; use self::regex::{Captures, Reg...
use crate::prelude::*; #[repr(C)] #[derive(Debug, Clone)] pub struct VkStencilOpState { pub failOp: VkStencilOp, pub passOp: VkStencilOp, pub depthFailOp: VkStencilOp, pub compareOp: VkCompareOp, pub compareMask: u32, pub writeMask: u32, pub reference: u32, }