text
stringlengths
8
4.13M
use crate::api; use crate::component::{Panel, PanelBlock, PanelHeading}; use serde::{Deserialize, Serialize}; use yew::format::Json; use yew::prelude::*; use yew::services::fetch::FetchTask; use yew_router::prelude::*; const ANSWER_SUGGESTIONS: [&str; 7] = [ "Sunday", "Monday", "Tuesday", "Wednesday", ...
#[doc = "Reader of register PP"] pub type R = crate::R<u32, super::PP>; #[doc = "Count Size\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum SIZE_A { #[doc = "0: Timer A and Timer B counters are 16 bits each with an 8-bit prescale counter"] _16 = 0, #[doc = "1: Timer A an...
// 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 ...
pub mod convert_libc_char_test; pub mod convert_i32_test; pub mod convert_string_test; pub mod convert_str_test;
#[path = "with_empty_list_options/with_arity_zero.rs"] mod with_arity_zero; test_stdout!( without_arity_zero_returns_pid_to_parent_and_child_process_exits_badarity, "badarity\n" );
//! Information about frame timing. //! //! By default the engine will run at 60 fps (giving a delta of 16.667 ms), but it will change //! its fixed framerate if necessary. For example, if the game fails to meet 60 fps, the engine //! will throttle down to 30 fps (with a delta of 33.333 ms) until it can return to 60 fp...
pub struct {{ AppName }}Config { } #[cfg(test)] mod tests { use super::*; #[test] fn test_{{ app_name }}_config() { } }
use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; const ten97: usize = 1000000007; fn alphabet2idx(c: char) -> usize { if c.is_ascii_lowercase() { c as u8 as usize - 'a' as u8 as usize } else if c.is_ascii_uppercase() { c a...
use ethers::prelude::ContractError; use std::result::Result; pub mod escalator; pub mod liquidations; pub mod sentinel; pub mod vaults; pub type EthersResult<T, M> = Result<T, ContractError<M>>;
//! This is an implementation of Single Decree Paxos, an algorithm that ensures a cluster of //! servers never disagrees on a value. //! //! # The Algorithm //! //! The Paxos algorithm is comprised of two phases. These are best understood in reverse order. //! //! ## Phase 2 //! //! Phase 2 involves broadcasting a prop...
use std::collections::HashMap; use std::fmt; use crate::ast::{Script, Expr}; #[derive(Debug)] pub enum CombineError { DuplicateDecl(String), NoSuchDecl(String), Recursion(String), } #[derive(Clone, Debug)] pub struct Program { pub order: Vec<String>, pub funcs: HashMap<String, Func>, } #[derive(...
//! Based on 'Go concurrency is not parallelism' //! www.soroushjp.com/2015/02/07/go-concurrency-is-not-parallelism-real-world-lessons-with-monte-carlo-simulations/ #![feature(test)] extern crate test; extern crate num_cpus; extern crate rand; use std::thread; use rand::distributions::{IndependentSample, Range}; // ...
use std::boxed::Box; use std::rc::Rc; pub mod graphics; use graphics::{Graphic, GraphicContext}; mod pdf; use pdf::{Dict, Name, ObjRef, Object, PDFData}; pub struct PDF { pages: Vec<Page>, writer: pdf::PDFWrite, catalog: Rc<ObjRef<Dict>>, outlines: Rc<ObjRef<Dict>>, pages_obj: Rc<ObjRef<Dict>>, } ...
// some convenience macros #[macro_export] macro_rules! clone_all { ($($i:ident),+) => { $(let $i = $i.clone();)+ } } #[macro_export] macro_rules! clone_mut { ($($i:ident),+) => { $(let mut $i = $i.clone();)+ } }
#[allow(unused_imports)] use proconio::{ input, fastout, }; fn solve(n: usize, p: Vec<Vec<f64>>) -> String { for i in 0..(n - 2) { for j in (i + 1)..(n - 1) { for k in (j + 1)..n { if check_straight(&p[i], &p[j], &p[k]) { return "Yes".to_string(); ...
//! //! Traits for generics //! use crate::internal::Generics; use crate::Generic; /// Provides methods to add generics to elements. pub trait GenericExt { /// Add a single generic. fn add_generic(&mut self, generic: Generic) -> &mut Self; /// Add multiple generics at once. fn add_generics<'a>(&mut s...
use std::collections::HashMap; // External uses use futures::{FutureExt, TryFutureExt}; use jsonrpc_core::Error; use jsonrpc_derive::rpc; // Workspace uses use models::node::{ tx::{TxEthSignature, TxHash}, Address, FranklinTx, Token, TokenLike, TxFeeTypes, }; // use storage::{ // chain::{ // block::...
use ptgui::prelude::*; use raylib::prelude::*; fn main() { let (mut rl_handler, rl_thread) = raylib::init() .size(1280, 720) .title("Dropdown Test") .build(); rl_handler.set_target_fps(60); let mut g_handler = GuiHandler::<()>::new(Colour::WHITE); g_handler .add_slider(...
//! Quadrature encoder interface /// Quadrature encoder interface /// /// # Examples /// /// You can use this interface to measure the speed of a motor /// /// ``` /// extern crate embedded_hal as hal; /// #[macro_use(block)] /// extern crate nb; /// /// use hal::prelude::*; /// /// fn main() { /// let mut qei: Qe...
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn nextafterf(x: f32, y: f32) -> f32 { if x.is_nan() || y.is_nan() { return x + y; } let mut ux_i = x.to_bits(); let uy_i = y.to_bits(); if ux_i == uy_i { return y; } let ax = ux_i & 0x7fff_ffff_u32; let ay...
use std::{io, fs}; use std::fs::File; use std::collections::HashMap; use std::path::{Path, PathBuf}; use std::default::Default; use std::io::Write; use liquid::{Renderable, LiquidOptions, Context, Value}; use markdown; use liquid; #[derive(Debug)] pub struct Document { pub name: String, pub attributes: HashM...
use std::io; use std::path::Path; use std::process::{Command, Stdio}; use rayon::prelude::*; #[derive(Debug, Deserialize, Eq, Hash)] pub struct Repo { pub name: String, pub html_url: String, pub ssh_url: String, pub namespace: String, pub branch: String, } impl Repo { pub fn get_url(&self) -> ...
use crate::entry::context_switch::CURRENT_CONTEXT; use crate::prelude::*; pub fn do_arch_prctl(code: ArchPrctlCode, addr: *mut usize) -> Result<()> { debug!("do_arch_prctl: code: {:?}, addr: {:?}", code, addr); match code { ArchPrctlCode::ARCH_SET_FS => { CURRENT_CONTEXT.with(|context| { ...
//! Default runtime //! //! By default, hyper includes the [tokio](https://tokio.rs) runtime. To ease //! using it, several types are re-exported here. //! //! The inclusion of a default runtime can be disabled by turning off hyper's //! `runtime` Cargo feature. pub use futures::{Future, Stream}; pub use futures::futu...
#[doc = "Reader of register MAPR2"] pub type R = crate::R<u32, super::MAPR2>; #[doc = "Writer for register MAPR2"] pub type W = crate::W<u32, super::MAPR2>; #[doc = "Register MAPR2 `reset()`'s with value 0"] impl crate::ResetValue for super::MAPR2 { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
extern crate imap; extern crate mailparse; extern crate native_tls; extern crate notify_rust; extern crate rayon; extern crate systray; extern crate toml; extern crate xdg; extern crate openssl; use native_tls::{TlsConnector, TlsConnectorBuilder, TlsStream}; use native_tls::backend::openssl::TlsConnectorBuilderExt; us...
#[cfg(feature = "ssl")] extern crate openssl; #[cfg(feature = "ssl")] mod ssl; mod tcp; pub mod mock; pub use tcp::{ NetworkOptions, NetworkListener, NetworkStream, NetworkWriter, NetworkReader }; #[cfg(feature = "ssl")] pub use ssl::{ SslContext, SslStream, SslError }; #[cfg(not(fea...
use int::{Int, LargeInt}; macro_rules! ashl { ($intrinsic:ident: $ty:ty) => { /// Returns `a << b`, requires `b < $ty::bits()` #[cfg_attr(not(test), no_mangle)] #[cfg_attr(all(not(test), not(target_arch = "arm")), no_mangle)] #[cfg_attr(all(not(test), target_arch = "arm"), inline(al...
use rayon::prelude::*; fn main() { let starting_number = 0; let until = 99_999_999; run_single_threaded(starting_number, until); run_multi_threaded(starting_number, until); } fn run_single_threaded(starting_number: u128, until: u128) { let instant = std::time::Instant::now(); let max = (star...
#![feature(test)] use benchtest::benchtest; use itertools::Itertools; use std::collections::HashMap; const INPUT: &str = include_str!("data/day3.txt"); #[derive(Hash, Eq, PartialEq, Copy, Clone, Debug, Default)] struct Position { x: i32, y: i32, } fn puzzle_a(input: &str) -> i32 { let (first, second) = ...
use rocket::Route; use rocket_contrib::json::Json; use crate::api::model::Client; use crate::api::service::client_service; use crate::common::http::ResponseWrapper; #[get("/")] fn list() -> ResponseWrapper<Vec<Client>> { client_service::list() } #[get("/<id>")] fn get(id: i32) -> ResponseWrapper<Client> { cl...
mod cli; use {{ artifact_id }}::{get_greeting}; use log::{debug, info}; fn main() { let matches = cli::app().get_matches(); cli::configure(&matches); debug!("Initializing..."); if let Some(_) = matches.subcommand_matches("greet") { info!("{}", get_greeting()); } }
use nix::sys::epoll::{epoll_create1, epoll_ctl, epoll_wait, EpollCreateFlags, EpollOp, EpollEvent, EpollFlags}; use std::mem::MaybeUninit; use nix::unistd::read; use nix::Error; fn main() { real_main().unwrap(); } fn real_main() -> Result<usize, Error>{ let efd = epoll_create1(EpollCreateFlags::EPOL...
#[macro_use] extern crate log; extern crate env_logger; pub mod lexical; pub mod syntax; pub mod semantic; pub mod codegen;
use std::thread; use rand::Rng; fn get_two_nums() { // there is an a/sync version of this function example at // https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html // but it is not 'real' let thread_one = thread::spawn(|| { let mut rng = rand::thread_rng(); prin...
use std::collections::HashSet; use std::io::BufRead; fn main() { let args: Vec<_> = std::env::args().collect(); let file = std::fs::File::open(&args[1]).unwrap(); let mut lines = std::io::BufReader::new(file) .lines() .map(|line| line.unwrap()); let mut groups = Vec::new(); loop { ...
pub const PIECE_SIZE_IN_BYTES: u64 = 8; pub const PIECE_SIZE_IN_BITS: u64 = 64;
use crate::context::RpcContext; use crate::websocket::types::{BlockHeader, SubscriptionBroadcaster}; use jsonrpsee::core::error::SubscriptionClosed; use jsonrpsee::types::error::SubscriptionEmptyError; use jsonrpsee::SubscriptionSink; use tokio_stream::wrappers::BroadcastStream; pub fn subscribe_new_heads( _contex...
//! Type wrappers and convenience functions for 3D collision detection pub use collision::algorithm::minkowski::GJK3; pub use collision::primitive::{ConvexPolyhedron, Cuboid, Particle3, Sphere}; pub use core::collide3d::*; pub use core::{CollisionMode, CollisionStrategy}; use cgmath::Point3; use collision::dbvt::{Dy...
use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; fn main() { let (a, b, k): (u64, u64, u64) = parse_line().unwrap(); let n = (a + b) as usize; let mut ans = "".to_string(); let mut left_a = a; let mut left_b = b; let mut...
extern crate capnp; #[macro_use] extern crate capnp_rpc; extern crate native_tls; extern crate tokio; extern crate tokio_tls; extern crate helloworld; use std::env; use std::fs::read; use std::io::{BufWriter, Error as IOError, ErrorKind as IOErrorKind}; use std::net::SocketAddr; use capnp::capability::Promise; use c...
/* A simple example testing full search. */ use max_tree::prelude::*; type Map = Vec<Vec<u8>>; type Pos = [usize; 2]; fn main() { let ref mut map: Map = vec![ vec![0, 0, 1], vec![0, 0, 0], vec![0, 0, 0] ]; let start: Pos = [0, 2]; let max_depth = 4; let eps_depth = 0.0000...
use super::{TMessage, WMessage}; use futures_03::prelude::*; use futures_03::ready; use futures_03::stream::FusedStream; use futures_03::task::{Context, Poll}; use std::io::Error; use std::pin::Pin; use tokio::io::{AsyncRead, AsyncWrite}; pub struct TcpFramed<T> { io: T, reading: Option<TMessage>, writing:...
// 顶点坐标 #[derive(Copy, Clone)] pub struct Position{ pub position: [f32; 3] } implement_vertex!(Position, position); // 法线向量 #[derive(Copy, Clone)] pub struct Normal{ pub normal: [f32; 3] } implement_vertex!(Normal, normal); // 矩阵乘法 pub fn matrix_multi(first: &[[f32; 4]; 4], second: &[[f32; 4]; 4]) -> [[f32; 4...
// 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 super::*; pub struct DarkSkyComponentRegistry; impl Plugin for DarkSkyComponentRegistry { fn build(&self, app: &mut bevy::prelude::AppBuilder) { app.register_component::<Player>(); } } #[derive(Properties, Default)] struct Player { pub health: f32, }
use std::path::{ Path, PathBuf }; use std::cell::RefCell; use std::rc::Rc; use parser::{ Evaluator, Node }; use sensor::Sensor; use util; // Hwmon sensor // // An arbitrary (temperature) input of a hwmon device. // While this can be used to monitor pretty much anything, // it should only be used for temperature inpu...
use rand::{thread_rng, Rng}; const SYMBOLS: [char; 62] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E'...
use crate::prelude::*; #[repr(C)] #[derive(Debug)] pub struct VkImageBlit { pub srcSubresource: VkImageSubresourceLayers, pub srcOffsets: [VkOffset3D; 2], pub dstSubresource: VkImageSubresourceLayers, pub dstOffsets: [VkOffset3D; 2], }
use super::{Cache, LongLiveC, UStub, UdpServer}; use crate::config::TunCfg; use crate::config::{LOCAL_SERVER, LOCAL_TPROXY_SERVER_PORT}; use crate::service::{SubServiceCtlCmd, TunMgrStub}; use bytes::BytesMut; use failure::Error; use log::{error, info}; use std::cell::RefCell; use std::hash::{Hash, Hasher}; use std::ne...
/*! ```cargo [dependencies] slow-build = { version = "0.1.0", path = "slow-build" } ``` */ fn main() { println!("--output--"); println!("Ok"); }
#![cfg_attr(not(feature = "std"), no_std)] use ink_env::Environment; pub enum MintEngineEnvironment {} impl Environment for MintEngineEnvironment { const MAX_EVENT_TOPICS: usize = <ink_env::DefaultEnvironment as Environment>::MAX_EVENT_TOPICS; type AccountId = <ink_env::DefaultEnvironment as Environment>::A...
use serde::de::IntoDeserializer as _; use crate::de::DatetimeDeserializer; use crate::de::Error; /// Deserialization implementation for TOML [values][crate::Value]. /// /// Can be creater either directly from TOML strings, using [`std::str::FromStr`], /// or from parsed [values][crate::Value] using [`serde::de::IntoD...
extern crate nalgebra; extern crate jacobi; extern crate pbr; use std::io::Write; use std::fs::File; use std::f32; use std::thread; use pbr::ProgressBar; use jacobi::{jacobi_iter, StencilElement}; use nalgebra::{DVector, Vector2}; pub fn write_ppm<W: Write>(w: &mut W, c: &DVector<f32>, ...
#[doc = "Reader of register MIS"] pub type R = crate::R<u32, super::MIS>; #[doc = "Reader of field `CTSMIS`"] pub type CTSMIS_R = crate::R<bool, bool>; #[doc = "Reader of field `RXMIS`"] pub type RXMIS_R = crate::R<bool, bool>; #[doc = "Reader of field `TXMIS`"] pub type TXMIS_R = crate::R<bool, bool>; #[doc = "Reader ...
//! Assign a unique and immutable ID. //! //! Some types do not have a natural implementation for `PartialEq` or `Hash`. //! In such cases, it can be convenient to assign an unique ID for each instance //! of such types and use the ID to implement `PartialEq` or `Hash`. //! //! An ID have a length of 64-bit. #![cfg_at...
//! TLS utilities. //! //! # Safety //! //! This file contains code that reads the raw phdr array pointed to by the //! kernel-provided AUXV values. #![allow(unsafe_code)] use crate::backend::c; use crate::backend::elf::*; use crate::backend::param::auxv::exe_phdrs_slice; use core::ptr::null; /// For use with [`set_t...
use core::cell::RefMut; use hdk::{ self, entry_definition::ValidatingEntryType, error::ZomeApiResult, holochain_core_types::{ cas::content::Address, dna::entry_types::Sharing, error::HolochainError, json::JsonString, entry::Entry, }, }; use crate::cache::{self...
#![deny(warnings)] #[macro_use] extern crate stdweb; extern crate gif; use gif::{Repeat, SetParameter}; use std::cell::RefCell; use stdweb::web::ArrayBuffer; thread_local!{ static IMAGES: RefCell<Vec<Vec<u8>>> = RefCell::new(vec![]); } //添加一张图像数据rgba fn add(data: Vec<u8>) -> i32 { let mut count = -1; IMA...
use core::convert::TryInto; use core::fmt; use core::hash; use core::str; use anyhow::*; use crate::erts::term::prelude::Boxed; use super::prelude::{Binary, BinaryLiteral, HeapBin, IndexByte, MaybePartialByte, ProcBin}; /// A `BitString` that is guaranteed to always be a binary of aligned bytes pub trait AlignedBin...
#[doc = "Reader of register C1PR3"] pub type R = crate::R<u32, super::C1PR3>; #[doc = "Writer for register C1PR3"] pub type W = crate::W<u32, super::C1PR3>; #[doc = "Register C1PR3 `reset()`'s with value 0"] impl crate::ResetValue for super::C1PR3 { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
use std::pin::Pin; use juniper::graphql_subscription; type Stream<'a, I> = Pin<Box<dyn futures::Stream<Item = I> + Send + 'a>>; struct Obj; #[graphql_subscription] impl Obj { async fn id(&self, __num: i32) -> Stream<'static, &'static str> { Box::pin(stream::once(future::ready("funA"))) } } fn main(...
#[doc = "Reader of register SWIER2"] pub type R = crate::R<u32, super::SWIER2>; #[doc = "Writer for register SWIER2"] pub type W = crate::W<u32, super::SWIER2>; #[doc = "Register SWIER2 `reset()`'s with value 0"] impl crate::ResetValue for super::SWIER2 { type Type = u32; #[inline(always)] fn reset_value() ...
pub fn static_kv() { println!("static_kv") }
extern crate failure; extern crate log; extern crate packt_core; #[macro_use] extern crate quicli; use packt_core::problem; use quicli::prelude::*; use std::{fs::OpenOptions, io, path::PathBuf}; #[derive(Debug, StructOpt)] struct Cli { /// Amount of rectangles to generate #[structopt(long = "count", short = "...
use gotham::state::State; use gotham::prelude::FromState; use gotham::hyper::Uri; use std::env; fn sample(state: State) -> (State, String) { let uri = Uri::borrow_from(&state); println!("path={}", uri); let res = format!("ok:{}", uri); (state, res) } fn main() { let port = env::var("APP_PORT")....
use std::error::Error; use regex_automata::{ hybrid::{ dfa::{self, DFA}, regex::Regex, OverlappingState, }, nfa::thompson, HalfMatch, MatchError, MatchKind, MultiMatch, }; use crate::util::{BunkPrefilter, SubstringPrefilter}; // Tests that too many cache resets cause the lazy ...
//! This module defines utilities for working with the `Result` type. /// Adds utilities to the `Result` type. pub trait ResultOps { type Item; type Error; /// Call the given handler if this is an error and promote `Result` to `Option`. fn handle_err<F>(self, f:F) -> Option<Self::Item> where F : FnOnc...
extern crate chrono; use self::chrono::prelude::{DateTime, Utc}; use portfolio::Portfolio; use strategy::{StrategyCollection, StrategyType}; use order::{Order, OrderStatus}; #[derive(PartialEq, Debug)] pub struct OrderPair<'a> { pub entry_order: &'a Order, pub exit_order: &'a Order } fn get_execution_datetim...
use shrev::EventChannel; use crate::event::*; use std::collections::HashMap; use std::collections::HashSet; pub mod system; #[derive(Default)] pub struct InputHandler { keyset: HashSet<String>, } impl InputHandler { pub fn new() -> Self { Default::default() } pub fn press(&mut self, key: &Str...
use juniper::graphql_interface; #[graphql_interface] trait Character { fn __id(&self) -> &str; } fn main() {}
use salvo::prelude::*; use tracing_subscriber; use tracing_subscriber::fmt::format::FmtSpan; #[fn_handler] async fn index(req: &mut Request, res: &mut Response) { res.render_plain_text(&format!("remote address: {:?}", req.remote_addr())); } #[tokio::main] async fn main() { let filter = std::env::var("RUST_LOG...
use std::{fmt, result}; use crate::lexer::State::*; #[derive(Clone, Debug, PartialEq)] pub enum Token { Charset(Vec<u8>), Encoding(Vec<u8>), EncodedText(Vec<u8>), ClearText(Vec<u8>), } pub type Tokens = Vec<Token>; enum State { Charset, Encoding, EncodedText, ClearText, } #[derive(D...
use super::Entry; use anyhow::Error; use nom::character::complete::{alpha1, anychar, char as ch, digit1, space1}; use nom::combinator::{map, map_opt}; use nom::sequence::{separated_pair, tuple}; use nom::{Finish, IResult}; impl Entry { pub fn parse(input: &str) -> IResult<&str, Self> { let range = map_opt(...
use regex::Regex; use std::fs; fn main() { let result = solve_puzzle("input"); println!("And the result is {}", result); } fn solve_puzzle(file_name: &str) -> u64 { let data = read_data(file_name); data.lines().fold(0, |sum, line| sum + compute(line)) } fn read_data(file_name: &str) -> String { f...
// 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 { failure::{bail, Error}, fidl_fuchsia_wlan_device as fidl_wlan_dev, fidl_fuchsia_wlan_mlme::{self as fidl_mlme, DeviceInfo}, fuchsia_c...
/* Simple enum with two variants. */ use abomonation_derive::Abomonation; #[derive(Debug, PartialEq, Copy, Clone, Abomonation)] pub enum Either<D1, D2> { Left(D1), Right(D2), }
pub struct Register { pub v: [u8; 16], pub I: u16, pub pc: u16, pub sp: u16, } impl Register { pub fn new() -> Self { Register { v: [0; 16], I: 0, pc: 0x200, sp: 0, } } } pub struct Cpu { pub register: Register, pub stack: ...
#![allow(dead_code)] use std::mem; use std::collections::{HashMap}; use parse::lexer::*; use parse::tokens::*; use ast::{Stmt, Expr, Block, TType, Local, Decl, OptionalTypeExprTupleList, OptionalParamInfoList, OptionalIdTypePairs}; use ast::Stmt::*; use ast::Expr::*; use ast::TType::*; use ast::Decl::*; //use ast::*; ...
//! A single-producer, multi-consumer channel that only retains the *last* sent //! value. //! //! This channel is useful for watching for changes to a value from multiple //! points in the code base, for example, changes to configuration values. //! //! # Usage //! //! [`channel`] returns a [`Sender`] / [`Receiver`] p...
#[macro_use] pub mod macros; pub mod ast; pub mod class; pub mod expr; pub mod op; pub mod statement; pub mod stream; pub mod subroutine; pub mod term; pub mod types; pub mod writer; use crate::token::Tokens; pub use ast::*; use stream::Stream; use anyhow::Result; pub fn parse(tokens: Tokens) -> Result<ASTs> { ...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use anyhow::*; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; use crate::runtime::registry::pid_to_process; macro_rules! is_not_alive { ($name:ident) => { is_not_alive(s...
#![no_std] #![no_main] extern crate pine64_hal as hal; use crate::hal::dma::{Descriptor, Transfer, TransferResources}; use crate::hal::pac::dma::DMA; use core::fmt::Write; use core::pin::Pin; use hal::ccu::Clocks; use hal::console_writeln; use hal::display::hdmi::HdmiDisplay; use hal::pac::{ ccu::CCU, de::DE, de_...
//! GraphQL support for [bson](https://github.com/mongodb/bson-rust) types. use crate::{graphql_scalar, InputValue, ScalarValue, Value}; #[graphql_scalar(with = object_id, parse_token(String))] type ObjectId = bson::oid::ObjectId; mod object_id { use super::*; pub(super) fn to_output<S: ScalarValue>(v: &Obj...
use std::fs::File; use std::io::{BufRead, BufReader}; fn main() { let f = File::open("/etc/hosts") .expect("Unable to open file"); let f = BufReader::new(f); for line in f.lines() { let line = line.expect("Unable to read line"); println!("Line: {}", line); } }
use btknmle_keydb::Store; use btmgmt::client::Client; use btmgmt::packet::ControllerIndex; use btmgmt::packet::{ command as cmd, AdvDataScanResp, AdvertisingFlag, IoCapability, Privacy, SecureConnections, Settings, SystemConfigurationParameter, }; pub(crate) async fn setup( devid: u16, store: &Store, ...
// This file is part of linux-epoll. 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/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
/// Generic types. pub mod generic { use crypto::HashValue; use serde::{Deserialize, Serialize}; use types::peer_info::PeerInfo; /// Consensus is mostly opaque to us #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] pub struct ConsensusMessage { /// Message payload. ...
#[macro_use] extern crate gb_io; extern crate regex; use std::cmp; use std::collections::HashMap; use std::env; use std::fs::File; use std::io; use std::io::Write; use std::process; use gb_io::reader::SeqReader; use regex::Regex; // Translation table 11 from https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi. ...
// Demonstrating a weird syntax for match default cases. fn main() { let x = 3; match x { 1 => println!("1"), 2 => println!("2"), a => println!("{}!!!!", a), } }
extern crate content_inspector; use std::env; use std::fs::File; use std::io::{Error, Read}; use std::path::Path; use std::process::exit; const MAX_PEEK_SIZE: usize = 1024; fn main() -> Result<(), Error> { let mut args = env::args(); if args.len() < 2 { eprintln!("USAGE: inspect FILE [FILE...]"); ...
use image::{ imageops::{self, FilterType::Triangle}, ImageError, }; use std::fmt::{self, Display}; pub struct Hash { backing: Vec<u64>, size: usize, } impl Display for Hash { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut nibbles = self.size as i64 / 4; ...
use std::{fmt, io}; use async_std::fs::File; use async_std::prelude::*; use failure_derive::Fail; use futures::io::{AsyncBufReadExt, BufReader}; use futures::join; use serde::de::DeserializeOwned; use surf::Client; mod photos; pub use crate::photos::{Posts, TotalPosts}; mod better_photos; pub use crate::better_p...
pub mod news_crawler; pub mod photo_crawler; pub mod video_crawler;
use crate::helpers::ID; use crate::render::DrawMap; use crate::ui::PerMapUI; use crate::ui::UI; use ezgui::{Color, EventCtx, GfxCtx, Key, Line, Text}; use map_model::raw_data::StableRoadID; use map_model::Map; use sim::{CarID, Sim}; use std::collections::BTreeMap; pub struct ObjectDebugger { tooltip_key_held: bool...
#[derive(Default)] #[derive(Debug)] #[derive(PartialEq)] #[derive(Clone)] pub struct NodeVersion { pub path: String, pub name: String }
use std::cell::RefCell; use std::collections::HashMap; use std::hash::Hash; use std::rc::{Rc, Weak}; //edgelist pub struct EdgeListGraph<E, ID> { v: Vec<(E, ID, ID)>, } type Rcc<T> = Rc<RefCell<T>>; pub fn rcc<T>(t: T) -> Rcc<T> { Rc::new(RefCell::new(t)) } // Pointer based pub struct RccGraph<T> { nodes...
use crate::quic_tunnel::tlv; use crate::Shutdown; use anyhow::Result; use quinn::{RecvStream, SendStream, VarInt}; use std::net::SocketAddr; use tokio::net::{tcp, TcpStream}; use tokio::prelude::*; use tokio::sync::{broadcast, mpsc}; use tracing::{debug, error, instrument}; // tcp payload size based on 1500 MTU const ...
extern crate reqwest; use std::io::Read; //use reqwest::get; /// returns a list of coin prices from coinmarketcap /// /// # Arguments /// /// * `limit` - the number of results to return /// /// # Example /// /// ``` /// use getcointicker::coinprices; /// /// let cp = match coinprices(4) { /// Result::Ok(val) => {...
#[doc = "Reader of register CFG3"] pub type R = crate::R<u32, super::CFG3>; #[doc = "Writer for register CFG3"] pub type W = crate::W<u32, super::CFG3>; #[doc = "Register CFG3 `reset()`'s with value 0"] impl crate::ResetValue for super::CFG3 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...