text
stringlengths
8
4.13M
use super::{pure_expr, ty, Parser, SyntaxKind::*, T}; pub(crate) fn annotations_opt(p: &mut Parser) { while p.at(T!['[']) { annotations(p); } } fn annotations(p: &mut Parser) { let m = p.start(); p.bump(T!['[']); annotation(p); while p.eat(T![,]) { annotation(p); } p.ex...
use js::back::compiler::JitCompiler; use js::back::executor::JitExecutor; use js::front::run::compiler::Compiler; use js::front::run::executor::Executor; use js::syntax::lexer::Lexer; use js::syntax::parser::Parser; use jit::Context; use std::default::Default; use std::io::{BufferedReader, File}; use std::path::Path; /...
#![allow(non_snake_case)] use std::fmt; use std::mem; use std::slice; use num; use approx; use angle::{Deg, Angle, FromAngle, IntoAngle, Turns, Rad}; use angle; use channel::{PosFreeChannel, FreeChannelScalar, AngularChannel, AngularChannelScalar, ChannelFormatCast, ChannelCast, ColorChannel}; use color:...
// StructOpt generated code triggers this lint. #![allow(clippy::option_unwrap_used)] #![allow(clippy::result_unwrap_used)] // I don't care. #![allow(clippy::needless_pass_by_value)] use snapcd::{ cache::SqliteCache, commit, diff, dir, display, ds::sqlite::SqliteDS, ds::GetReflogError, ds::Transactional, filte...
extern crate humansize; use humansize::{format_size, format_size_i, SizeFormatter, ISizeFormatter, BINARY, DECIMAL, WINDOWS}; fn main() { println!("{}", format_size(5456usize, BINARY)); println!("{}", format_size(1024usize, DECIMAL)); println!("{}", format_size(1000usize, WINDOWS)); println!("{}", fo...
pub mod layout; pub mod compression;
//! A decentralized twitter based on Substrate #![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; use codec::{Encode, Decode}; use sp_std::prelude::*; use sp_runtime::{RuntimeDebug, DispatchResult}; use frame_support::{decl_module, decl_storage, decl_event, decl_e...
#[link(wasm_import_module = "sample")] extern { fn count_up() -> i32; fn log(ptr: *const u8, len: usize); } fn main() { let n = 5; for i in 1..=n { unsafe { let s = format!("カウント {} : {}", i, count_up()); log(s.as_ptr(), s.len()); } } }
use crate::block::{Sender, Transaction}; use crate::chain::Chain; use crate::consensus; use crate::proof_of_work; use crate::viewmodel; use std::sync::RwLock; use actix_web::{get, post, web, HttpResponse, Responder}; #[post("/mine")] async fn mine(chain: web::Data<RwLock<Chain>>, node: web::Data<String>) -> impl Resp...
/* * Copyright 2021 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
#[doc = "Reader of register LDOSPCTL"] pub type R = crate::R<u32, super::LDOSPCTL>; #[doc = "Writer for register LDOSPCTL"] pub type W = crate::W<u32, super::LDOSPCTL>; #[doc = "Register LDOSPCTL `reset()`'s with value 0"] impl crate::ResetValue for super::LDOSPCTL { type Type = u32; #[inline(always)] fn re...
use std::sync::Arc; use datafusion::logical_expr::LogicalPlan; use crate::exec::field::FieldColumns; /// A plan that can be run to produce a logical stream of time series, /// as represented as sequence of SeriesSets from a single DataFusion /// plan, optionally grouped in some way. /// /// TODO: remove the tag/fiel...
// 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::sync::Arc; use futures_util::{stream::BoxStream, TryFutureExt}; use tracing_futures::Instrument; use tracinglib::{span, Level}; use crate::{ extensions::{ Extension, ExtensionContext, ExtensionFactory, NextExecute, NextParseQuery, NextRequest, NextResolve, NextSubscribe, NextValidation, R...
pub type IUIAnimationInterpolator = *mut ::core::ffi::c_void; pub type IUIAnimationInterpolator2 = *mut ::core::ffi::c_void; pub type IUIAnimationLoopIterationChangeHandler2 = *mut ::core::ffi::c_void; pub type IUIAnimationManager = *mut ::core::ffi::c_void; pub type IUIAnimationManager2 = *mut ::core::ffi::c_void; pub...
pub const MEGA_BYTE: usize = 1_000_000; pub const SCRATCH_PAD_SIZE: usize = MEGA_BYTE * 1;
use yew::prelude::*; use yew_functional::*; #[function_component(RiBookmark)] pub fn ri_bookmark() -> Html { html! { <svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" style="vertical-align: middle; transform: translateY(-5%);"><path d="...
use crate::request::contract::EntryPointType; use anyhow::{Context, Error, Result}; use pathfinder_common::{felt_bytes, ClassHash}; use serde::Serialize; use sha3::Digest; use stark_hash::{Felt, HashChain}; use stark_poseidon::PoseidonHasher; #[derive(Debug, PartialEq)] pub enum ComputedClassHash { Cairo(ClassHash...
//! Default Generic Type Parameters and Operator Overlaoding //! Rust doesn’t allow you to create your own operators or overload arbitrary operators. //! But you can overload the operations and corresponding traits listed in std::ops //! by implementing the traits associated with the operator. use std::ops::Add; #[d...
use phd; use std::process; const DEFAULT_BIND: &str = "[::]:7070"; const DEFAULT_HOST: &str = "127.0.0.1"; const DEFAULT_PORT: u16 = 7070; fn main() { let args = std::env::args().skip(1).collect::<Vec<_>>(); let mut args = args.iter(); let mut root = "."; let mut addr = DEFAULT_BIND; let mut host ...
use cgmath::{Vector3, Quaternion, Zero, One}; use glium::uniforms::{AsUniformValue, UniformValue}; use types::{Scalar, Mat4}; pub struct Transform { /// Object scale, default `1`. pub scale: Scalar, /// Object translation, default `(0, 0, 0)`. pub position: Vector3<Scalar>, /// Object rotation. ...
use crate::app_route::{AppAnchor, AppRoute}; use crate::components::shared::{form_container::FormContainer, input_field::InputField}; use yew::prelude::*; pub struct LoginForm {} impl Component for LoginForm { type Message = (); type Properties = (); fn create(_props: Self::Properties, _link: ComponentLi...
use bytes::{Bytes, BytesMut}; pub const HEADER_LEN_BYTES: usize = 24; #[repr(u8)] #[derive(FromPrimitive, Debug)] pub enum Opcode { Get = 0x00, Set = 0x01, Add = 0x02, Replace = 0x03, Delete = 0x04, Increment = 0x05, Decrement = 0x06, Quit = 0x07, Flush = 0x08, GetQ = 0x09, ...
// Copyright 2021 Tomba technology web service 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
#[derive(Copy, Clone, Debug)] pub enum Square { Empty, Tree, } impl Square { pub fn is_tree(&self) -> bool { match &self { Square::Tree => true, Square::Empty => false, } } } pub struct Topology<'t> { pub squares: &'t Vec<Vec<Square>>, pub height: usize,...
//! Types for dealing with errors in scanning, parsing, compiling, or executing Piccolo. use crate::runtime::{op::Opcode, Line}; use core::fmt; // TODO: impl Error for PiccoloError /// The main error-reporting struct. #[derive(Debug, Clone)] pub struct PiccoloError { kind: ErrorKind, line: Option<Line>, ...
// 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. //! TokenManagerFactory manages service provider credentials for a set of users. //! //! The interaction with each service provider is mediated by a compon...
use std::io::Read; use std::sync::mpsc::{sync_channel, Receiver, TryRecvError}; use std::thread; use std::time::{Duration, Instant}; const CHANNEL_BUFFER_SIZE_BYTES: usize = 1024; const SLEEP_DURATION_WHEN_AWAITING_DATA_MS: u64 = 1; pub struct ReadUntil { receiver: Receiver<u8>, timeout: Duration, } #[derive...
//! Describes the context for which a function must be optimized. use crate::codegen::{self, Function}; use crate::device::{ArrayArgument, Device, ScalarArgument}; use crate::explorer::Candidate; use crate::ir; use itertools::{process_results, Itertools}; use log::info; use num; use std::sync::Arc; use std::{cmp, fmt};...
use anyhow::Result; use crate::db::{DB, Manager}; use tracing::subscriber::set_global_default; use tracing_subscriber::FmtSubscriber; use server::Server; mod config; mod db; mod server; #[tokio::main] async fn main() -> Result<()> { let subscriber = FmtSubscriber::new(); set_global_default(subscriber)?; ...
//! Worlds store collections of entities. An entity is a collection of components, identified //! by a unique [`Entity`] ID. //! //! # Creating a world //! //! ``` //! # use legion::*; //! let mut world = World::default(); //! ``` //! //! `World::new()` can be used to construct a new world with custom options. //! //! ...
#[doc = "Reader of register CCIPR2"] pub type R = crate::R<u32, super::CCIPR2>; #[doc = "Writer for register CCIPR2"] pub type W = crate::W<u32, super::CCIPR2>; #[doc = "Register CCIPR2 `reset()`'s with value 0"] impl crate::ResetValue for super::CCIPR2 { type Type = u32; #[inline(always)] fn reset_value() ...
use super::CodeGeneratorContext; use quote::quote; use std::fmt::{Debug, Formatter, Result as FmtResult}; use syn::{ parenthesized, parse::{Parse, ParseStream}, punctuated::Punctuated, visit_mut::VisitMut, Expr, Ident, LitInt, Result, Token, }; pub(crate) enum Operator { Where(Expr), Map(Ex...
use std::{sync::Arc, thread::JoinHandle}; use data_types::{sequence_number_set::SequenceNumberSet, SequenceNumber}; use generated_types::influxdata::iox::wal::v1 as proto; use observability_deps::tracing::{debug, error}; use parking_lot::Mutex; use prost::Message; use tokio::sync::mpsc; use crate::{Segments, WalBuffe...
#[macro_use] mod common; use common::util::*; static UTIL_NAME: &'static str = "pwd"; #[test] fn test_default() { let (at, mut ucmd) = testing(UTIL_NAME); let out = ucmd.run().stdout; let expected = at.root_dir_resolved(); assert_eq!(out.trim_right(), expected); }
#![crate_name = "automata_survey"] pub mod automata;
use anyhow::Result; use super::ppu::Ppu; use super::memory::Ram; use super::sound::Sound; use super::timer::Timer; use super::cartridge::Cartridge; use super::input::Joypad; pub struct Bus{ pub ppu: Ppu, pub timer: Timer, pub cartridge: Box<dyn Cartridge>, pub enabled_interrupts: u8, pub requested...
use std::rc::Rc; use std::cell::RefCell; use std::ops::Deref; use std::fmt; #[derive(Clone)] pub enum Expr { Const(i64), Diff(Rc<Expr>, Rc<Expr>), IsZero(Rc<Expr>), If(Rc<Expr>, Rc<Expr>, Rc<Expr>), Var(u32), Let(Rc<Expr>, Rc<Expr>), Proc(Rc<Expr>), Call(Rc<Expr>, Rc<Expr>), Letrec(...
#[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { _reserved0: [u8; 264usize], #[doc = "0x108 - TXD byte sent and RXD byte received"] pub events_ready: EVENTS_READY, _reserved1: [u8; 504usize], #[doc = "0x304 - Enable interrupt"] pub intenset: INTENSET, #[doc = "0x308 - Disabl...
/* * Copyright 2020 Fluence Labs Limited * * 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 a...
use futures::stream::Stream; use futures::sync::mpsc::{Receiver, Sender}; use futures::task::Task; use futures::{Async, Future}; use serde::{Deserialize, Serialize}; use std::ffi::CString; use zugzug_sys::{callback::*, dns::*}; #[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Debug, Hash)] pub struct ClientConfig { ...
use types::{int_t}; #[no_mangle] pub static mut errno: int_t = 0;
use super::kc::KcVal; use super::sma::{declare_ma_var, wma_func}; use super::tr::tr_func; use super::VarResult; use crate::ast::stat_expr_types::VarIndex; use crate::ast::syntax_type::{FunctionType, FunctionTypes, SimpleSyntaxType, SyntaxType}; use crate::helper::err_msgs::*; use crate::helper::str_replace; use crate::...
use openaip::parse; #[test] fn it_works() { let str = include_str!("data/de_asp.aip"); let result = parse(str); assert!(result.is_ok()); let file = result.unwrap(); assert!(file.airspaces.is_some()); let airspaces = file.airspaces.unwrap(); assert_eq!(airspaces.len(), 621); assert!(a...
mod render_engine; mod shaders; mod models; mod textures; mod toolbox; mod entities; use cgmath::{vec3}; use render_engine::display_manager::DisplayManager; use render_engine::loader::Loader; use render_engine::renderer; use shaders::static_shader; use textures::model_texture::ModelTexture; use models::textured_model...
//! Types having to do with partitions. use super::{TableId, Timestamp}; use schema::sort::SortKey; use sha2::Digest; use std::{fmt::Display, sync::Arc}; use thiserror::Error; /// Unique ID for a `Partition` during the transition from catalog-assigned sequential /// `PartitionId`s to deterministic `PartitionHashId`s...
// 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::{ canvas::{measure_text, Canvas, FontDescription, FontFace, MappingPixelSink, Paint}, geometry::{Coord, IntSize, Point, Rect, Size}, }; ...
use portaudio; use std::sync::mpsc::*; fn main() { // Construct a portaudio instance that will connect to a native audio API let pa = portaudio::PortAudio::new().expect("Unable to init PortAudio"); // Collect information about the default microphone let mic_index = pa .default_input_device() .expect("U...
use rustviz_lib::data::{ExternalEvent, LifetimeTrait, ResourceAccessPoint, Owner, MutRef, StaticRef, Function, VisualizationData, Visualizable}; use rustviz_lib::svg_frontend::svg_generation; use std::collections::BTreeMap; fn main() { let x = ResourceAccessPoint::Owner(Owner { hash: 1, name: S...
/* 130. Surrounded Regions Medium Given an m x n matrix board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. Example 1: Input: board = [["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]] Output: [[...
use diesel::prelude::*; use super::Member; use crate::graphql_schema::Context; #[derive(Queryable)] pub struct Team { pub id: i32, pub name: String, } #[juniper::object(Context = Context, description = "A team of members")] impl Team { pub fn id(&self) -> i32 { self.id } pub fn name(&sel...
use super::ReqMgr; use failure::Error; use futures_03::prelude::*; use log::{error, info}; use nix::sys::socket::setsockopt; use nix::sys::socket::sockopt::IpTransparent; use std::cell::RefCell; use std::os::unix::io::AsRawFd; use std::rc::Rc; use std::result::Result; use stream_cancel::{Trigger, Tripwire}; use tokio; ...
use crate::cartridge::Cartridge; use crate::cpu::CPU; use crate::ram::{ IORegisters, MemoryError, MemoryErrorKind, MemoryRegion, UnusedRegion, HRAM, OAM, VRAM, WRAM, }; use crate::{register::Reg16, BitField, Dst, ReadWriteError, ReadWriteErrorKind, Src}; use std::fmt; /// A location in memory, indexed by a 16-bit...
// 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. //! Implementation of fuchsia.net.stack.Stack. use { crate::eventloop::Event, failure::Error, fidl::endpoints::{RequestStream, ServiceMarker},...
use crate::error::HandleError; use crate::filter::with_db; use mysql::MySqlPool; use repository::PublishedUsers; use warp::filters::BoxedFilter; use warp::path; use warp::{Filter, Rejection, Reply}; pub fn route(db_pool: &MySqlPool) -> BoxedFilter<(impl Reply,)> { warp::get() .and(path("users")) .a...
#![allow(non_snake_case)] extern crate log; extern crate toml; use std::fs; use std::collections::{HashMap, HashSet}; #[allow(unused_imports)] use log::{trace, debug, info, warn, error}; pub mod tcp_rule; use tcp_rule::TcpRule; pub fn parse_DNS_Hijack (DNS_HIJACK: &toml::Value) -> HashMap<String, String> { // pa...
use super::util::{Point, plane, find_left_n_right_xtreme}; use std::cmp::Ordering; use std::collections::VecDeque; /// Creates U and L from Polygon P, U the upper part of P and L is the lower part. /// This function assumes P has "positi v omløbsretnig" pub fn generate_u_l (p: &Vec<Point>) -> (Vec<Point>, Vec<Point>)...
extern mod std; extern mod zmq; extern mod mongrel2; fn main() { let ctx = match zmq::init(1) { Ok(ctx) => ctx, Err(e) => fail e.to_str(), }; let conn = mongrel2::connect(ctx, Some(~"F0D32575-2ABB-4957-BC8B-12DAC8AFF13A"), ~[~"tcp://127.0.0.1:9998"], ~[~"tcp://127.0...
use crate::ir::eval::prelude::*; impl IrEval for ir::IrCall { type Output = IrValue; fn eval( &self, interp: &mut IrInterpreter<'_>, used: Used, ) -> Result<Self::Output, IrEvalOutcome> { let mut args = Vec::new(); for arg in &self.args { args.push(arg....
//! The TachoMotor provides a uniform interface for using motors with positional //! and directional feedback such as the EV3 and NXT motors. //! This feedback allows for precise control of the motors. /// The TachoMotor provides a uniform interface for using motors with positional /// and directional feedback such as...
// 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 agre...
use super::suit::Suit; #[derive(Debug, Clone)] pub struct Card { suit: Suit, pub name: String, pub value: u32, order: usize, } impl Card { pub fn new(name: &str, suit: &Suit, value: &u32, order: &usize) -> Card { Card { name: String::from(name), suit: suit.clone(), ...
// lib.rs pub mod gameboard; pub mod actor;
extern crate phrases; //use phrases::english::{greetings,farewells}; use phrases::english; use phrases::japanese; fn main() { println!("Hello in english is {}", english::hello() ); println!("Goodbye in english is {}", english::goodbye() ); println!("Hello in japanese is {}", japanese::hello() );...
#[path = "bxor_2/with_big_integer_left.rs"] mod with_big_integer_left; #[path = "bxor_2/with_small_integer_left.rs"] mod with_small_integer_left; test_stdout!(without_integer_left_errors_badarith, "{caught, error, badarith}\n{caught, error, badarith}\n{caught, error, badarith}\n{caught, error, badarith}\n{caught, erro...
pub fn decompress_rl_elist(nums: Vec<i32>) -> Vec<i32> { let mut output: Vec<i32> = vec![]; for x in nums.chunks(2) { let freq = x[0] as usize; let val = x[1]; let mut insert_vec = vec![val; freq]; output.append(&mut insert_vec); } output } #[cfg(test)] mod decompres...
#[doc = "Reader of register MACPPSCR"] pub type R = crate::R<u32, super::MACPPSCR>; #[doc = "Writer for register MACPPSCR"] pub type W = crate::W<u32, super::MACPPSCR>; #[doc = "Register MACPPSCR `reset()`'s with value 0"] impl crate::ResetValue for super::MACPPSCR { type Type = u32; #[inline(always)] fn re...
use std::collections::HashSet; use std::io; use regex::Regex; fn valid_value(key: &str, value: &str) -> bool { match key { "byr" => match value.parse::<u16>() { Ok(n) => n >= 1920 && n <= 2002, Err(_) => false, }, "iyr" => match value.parse::<u16>() { Ok...
use crate::context::ContextSignature; use crate::{CompileMeta, Hash, Item, TypeInfo}; use thiserror::Error; /// An error raised when building the context. #[derive(Debug, Error)] pub enum ContextError { /// Conflicting `()` types. #[error("`()` types are already present")] UnitAlreadyPresent, /// Conf...
mod error_type; mod proof_manager; mod request_response; use crate::error_type::AppResult; use crate::proof_manager::ProofManager; use crate::request_response::{Request, Response}; use fluence::sdk::*; use log::info; use serde_json::Value; use std::cell::RefCell; fn init() { logger::WasmLogger::init_with_level(l...
// Copyright (c) 2019 Jason White // // 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, merge, publish, d...
use nativeshell_build::{AppBundleOptions, BuildResult, Flutter, FlutterOptions, MacOSBundle}; fn build_flutter() -> BuildResult<()> { Flutter::build(FlutterOptions { ..Default::default() })?; if cfg!(target_os = "macos") { let options = AppBundleOptions { bundle_name: "ADB TOOL...
use std::io; fn main() { let mut S = String::new(); io::stdin().read_line(&mut S).unwrap(); let mut letters: Vec<char> = S.trim().to_lowercase().chars().collect(); letters.sort(); letters.dedup(); match letters.len() { 26 => print!("YES"), _ => print!("NO") } }
pub use VkGeometryTypeNV::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkGeometryTypeNV { VK_GEOMETRY_TYPE_TRIANGLES_NV = 0, VK_GEOMETRY_TYPE_AABBS_NV = 1, }
use petgraph::graph::NodeIndex; #[derive(Clone)] pub struct Node { pub layer: usize, pub order: usize, pub width: usize, pub height: usize, pub orig_width: usize, pub orig_height: usize, pub x: i32, pub y: i32, pub dummy: bool, pub align: Option<NodeIndex>, pub root: Option<...
#[derive(Clone)] pub struct StepIO { pub steps: usize, } #[derive(Clone)] pub struct JumpIO { pub jumps: usize, } #[derive(Clone)] pub enum IO { Steps(StepIO), Jumps(JumpIO), } impl From<JumpIO> for IO { fn from(jump_io: JumpIO) -> Self { IO::Jumps(jump_io) } } impl From<StepIO> for ...
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#![feature(test)] extern crate hlife; extern crate test; use std::io::{self, Read}; use std::fs::File; use test::Bencher; use hlife::Hashlife; #[cfg(not(features = "4x4_leaf"))] use hlife::global::Pattern; fn read_file(path: &str) -> io::Result<Vec<u8>> { let mut buf = Vec::new(); let mut file = File::open...
use std::thread; use std::io; use std::time::Duration; use std::collections::HashMap; fn main(){ let rules = get_rules(); //print out all of the defined rules println!("The following elementary cellular automata rules are available:"); let mut count = 0; for i in rules.keys(){ if count%6 ==0 { println!("");...
#[macro_use] extern crate lazy_static; use std::io; use std::process; use std::time::Duration; mod network; mod repository; lazy_static! { static ref REPOSITORY_JSON: &'static str = "./repos.json"; static ref ADDR: &'static str = "www.github.com:80"; static ref TIMEOUT: Duration = Duration::from_secs(30)...
#[macro_use] extern crate log; #[macro_use] extern crate lazy_static; pub mod reporters; pub mod manager; pub mod publishers;
// Remove Palindromic Subsequences // https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/589/week-2-march-8th-march-14th/3665/ pub struct Solution; impl Solution { pub fn remove_palindrome_sub(s: String) -> i32 { if s.is_empty() { return 0; } let mid = ...
use std::str::Chars; use std::fmt; #[derive(Debug)] #[derive(PartialEq)] #[derive(Copy, Clone)] enum LexerStateDescriptor { START, IDENTIFIER, NUMERIC, NUMERIC_DOT, NUMERIC_FLOAT, GT, LT, EQ } #[derive(Debug)] #[derive(PartialEq)] #[derive(Copy, Clone)] pub enum TokenType { IDENTIF...
use futures01::{Future, Sink}; use snafu::Snafu; pub mod streaming_sink; #[cfg(feature = "sinks-aws_cloudwatch_logs")] pub mod aws_cloudwatch_logs; #[cfg(feature = "sinks-aws_cloudwatch_metrics")] pub mod aws_cloudwatch_metrics; #[cfg(feature = "sinks-aws_kinesis_firehose")] pub mod aws_kinesis_firehose; #[cfg(featur...
use std::collections::{hash_map::Entry, HashMap}; use scoped_tls_hkt::scoped_thread_local; use serde::{Deserialize, Serialize, Serializer}; use thiserror::Error; use uuid::Uuid; use crate::{internals::entity::EntityHasher, world::Allocate, Entity}; /// Describes how to serialize and deserialize a runtime `Entity` ID...
// Copyright 2018-2020 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at yo...
use crate::error::Result; /// The `Device` trait represents devices that are capable of /// performing basic device commands. pub trait Device { /// Turns on the device. fn turn_on(&mut self) -> Result<()>; /// Turns off the device. fn turn_off(&mut self) -> Result<()>; }
use std::collections::HashMap; use std::collections::linked_list::LinkedList; use std::sync::RwLock; use serde_json::Value; use crate::engine::node::Node; use crate::engine::parser::parser; lazy_static! { /// for engine: if cache not have expr value,it will be redo parser code.not wait cache return for no blockin...
#![allow(non_snake_case)] #![allow(non_camel_case_types)] #![allow(dead_code)] use winapi::ctypes::{c_char, c_void}; #[repr(C)] #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub enum EGCResults { k_EGCResultOK = 0, k_EGCResultNoMessage = 1, // There is no message in the queue k_EGCResultBufferTooSmall ...
use anyhow::Result; use rand::seq::SliceRandom; use rand::thread_rng; use std::path::PathBuf; use std::{collections::HashSet, env}; use structopt::StructOpt; use walkdir::WalkDir; #[derive(StructOpt, Debug)] struct Cli { #[structopt(parse(from_os_str))] location: Option<PathBuf>, #[structopt(default_value...
use std::fs::{self, File}; use std::io::{self, Write}; use std::path::Path; use std::{iter, mem, thread, time}; use tempfile::Builder; use tar::{GnuHeader, Header, HeaderMode}; #[test] fn default_gnu() { let mut h = Header::new_gnu(); assert!(h.as_gnu().is_some()); assert!(h.as_gnu_mut().is_some()); ...
use anchor_lang::prelude::*; declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); #[program] pub mod credentials { use super::*; pub fn initialize(ctx: Context<Initialize>) -> ProgramResult { Ok(()) } } #[derive(Accounts)] pub struct Initialize {}
use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let n: usize = rd.get(); let m: usize = rd.get(); let s: Vec<u8> = rd.get_vec(n); let t: Vec<u8> = rd.get_vec(m); if let Some(mut ans) = solve(n, m, &s, &t) { l...
//! Integration tests verifying that `MatchState` correctly updates its internal //! state as actions are performed in the game. use mahjong::{ match_state::{MatchId, MatchState}, tile::{self, Wind}, }; // Test that the match state stays consistent when players discard tiles from their // hands (i.e. not disc...
use std::fs::File; use std::io::prelude::*; use std::io::{self, BufReader}; fn main() { let result_part1: i32 = part1(); let result_part2: i128 = part2(); println!("Answer for part 1: {:?}", result_part1); println!("Answer for part 2: {:?}", result_part2); } fn read_file(file_name: &str) -> io::Resul...
mod with_function; use proptest::strategy::Just; use liblumen_alloc::atom; use liblumen_alloc::erts::term::prelude::*; use crate::erlang::spawn_opt_2::result; use crate::test::*; #[test] fn without_function_errors_badarg() { run!( |arc_process| { ( Just(arc_process.clone()), ...
use core::{digit, alpha}; /// `token = 1*tchar` pub fn token(s: &[u8]) -> bool { s.iter().all(tchar) && !s.is_empty() } /// `tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" /// / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" /// / DIGIT / ALPHA ; any VCHAR, except delimiters pub fn tchar(c: &u8) -> bool { c =...
fn main() -> anyhow::Result<()> { pkg_config::Config::new().statik(false).probe("alsa")?; Ok(()) }
use super::*; use hex::FromHex; use primitives::Balance; use frame_support::traits::GetPalletVersion; pub fn import_initial_claims<T: Config>(claims_data: &[(&'static str, Balance)]) -> frame_support::weights::Weight { let version = <Module<T> as GetPalletVersion>::storage_version(); if version == None { for (addr...
#[macro_use] extern crate nickel; use nickel::{Nickel, HttpRouter}; fn main() { let mut server = Nickel::new(); server.get("/txStat/:address", middleware! { |req| let address = req.param("address").unwrap(); println!("address: {}", address); format!("{{\"status\" : \"complete\", ...