text
stringlengths
8
4.13M
use crate::{DocBase, VarType}; const DESCRIPTION: &'static str = r#" The function sets a number of study properties. "#; const EXAMPLE: &'static str = r#" ```pine study(title='MyScriptStudy') study(title="MyScriptStudy", shorttitle="MSS", overlay=true) ``` "#; const ARGUMENT: &'static str = r#" **title (string)** st...
use crate::estimate::Statistic; use crate::plot::plotters_backend::{Colors, DEFAULT_FONT, SIZE}; use crate::plot::{FilledCurve, Line, LineCurve, Rectangle as RectangleArea, Size}; use crate::report::BenchmarkId; use crate::stats::univariate::Sample; use plotters::data::float::pretty_print_float; use plotters::pre...
use std::io::prelude::*; use std::str::FromStr; fn main() { let stdin = std::io::stdin(); let l = stdin.lock().lines().next().unwrap().unwrap(); let mut d : Vec<i32> = l.split_whitespace().map(|x| i32::from_str(x).unwrap()).collect(); d.sort_by(|a,b| b.cmp(a)); let s : String = d.iter().m...
use crate::errors::*; use crate::version::Version; use bytes::*; use std::cell::RefCell; use std::convert::From; use std::fmt::Display; use std::mem; use std::rc::Rc; pub const TINY: u8 = 0x80; pub const SMALL: u8 = 0xD0; pub const MEDIUM: u8 = 0xD1; pub const LARGE: u8 = 0xD2; #[derive(Debug, PartialEq, Eq, Hash, Cl...
//! ```elixir //! # label 1 //! # pushed to stack: () //! # returned form call: {:ok, document} //! # full stack: ({:ok, document}) //! # returns: {:ok parent} //! {:ok, old_child} = Lumen.Web.Document.create_element(document, "table") //! {:ok, parent} = Lumen.Web.Document.create_element(parent_document, "div") //! :o...
use amethyst::{ prelude::*, core::{Transform}, ecs::{Component, NullStorage, Join, ParJoin, Read, Write, ReadStorage, System, WriteStorage, Entities}, }; use crate::physics::Physics; use crate::charactermove::CharacterMove; #[derive(Default)] pub struct SimpleEnemy; impl Component for SimpleEnemy { typ...
use criterion::measurement::WallTime; use criterion::{ criterion_group, criterion_main, Bencher, BenchmarkGroup, BenchmarkId, Criterion, Throughput, }; use rustpython_compiler::Mode; use rustpython_parser::parse_program; use rustpython_vm::{Interpreter, PyResult}; use std::collections::HashMap; use std::path::Path;...
use hashbrown::{HashMap, HashSet}; use log::*; use morgan_interface::pubkey::Pubkey; pub type Fork = u64; #[derive(Default)] pub struct AccountsIndex<T> { account_maps: HashMap<Pubkey, Vec<(Fork, T)>>, roots: HashSet<Fork>, //This value that needs to be stored to recover the index from AppendVec pub l...
extern crate ted_interface; extern crate byteorder; use std::sync::mpsc; use std::net; use std::io; use std::thread; use std::sync::{Mutex, Arc}; use ted_interface as tint; use ted_interface::Command; use ted_interface::Frame; pub struct Client{ pub frame_stream: mpsc::Sender<Frame>, pub command_stream: mpsc::Receiv...
//! Code generation for OpenAPI v2. #[cfg(feature = "cli")] mod author; mod emitter; mod impls; pub mod object; mod state; include!(concat!(env!("OUT_DIR"), "/template.rs")); pub use self::{ emitter::{EmittedUnit, Emitter}, state::EmitterState, }; use super::Schema; use std::{fmt::Debug, marker::PhantomData...
// 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 according to those terms. use bitflags::bitflags; u...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type LocalLocation = *mut ::core::ffi::c_void; pub type LocalLocationFinderResult = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct LocalLocationF...
use gary_zmq::cluster_api::*; use chrono::{DateTime, Utc}; use std::collections::HashMap; use std::sync::{Arc, Mutex}; pub fn start(m: Arc<Mutex<HashMap<String, DateTime<Utc>>>>) { let m = ZmqClusterApi::new(m); m.run(); println!("Cluster Api Running"); }
use crate::prelude::*; use std::os::raw::c_void; use std::ptr; #[repr(C)] #[derive(Debug, Clone)] pub struct VkDeviceQueueCreateInfo { pub sType: VkStructureType, pub pNext: *const c_void, pub flags: VkDeviceQueueCreateFlagBits, pub queueFamilyIndex: u32, pub queueCount: u32, pub pQueuePriorit...
// 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 agreed to ...
use std::io; pub mod bcm2835; pub mod epd; use epd::doodle; use epd::doodle::Color; pub fn interactive() { epd::epd_init(); let mut buff = epd::Frame::new(); println!("Welcome to doodle interactive!"); loop { let mut command = String::new(); io::stdin().read_line(&mut command).expect(...
#![allow(dead_code)] extern crate cgmath; extern crate embree; extern crate rand; extern crate rayon; extern crate support; extern crate tobj; use std::path::Path; use cgmath::{InnerSpace, Matrix3, Point2, Vector2, Vector3, Vector4}; use embree::{Device, Geometry, IntersectContext, Ray, RayHit, Scene, TriangleMesh}; ...
use super::character::*; use components::*; pub fn new_guard() -> CharacterBuilder { // add the resource let render = EntityRender { sprite_id: "/dungeon/walk_cycle.png".to_owned(), width: 16, height: 24, start_frame: 88, frame: 88, }; let mut builder = Charac...
pub mod get_field_offset; pub mod get_field_scale; pub mod get_field_string_value; pub mod get_field_type;
use super::*; #[test] fn with_number_atom_reference_function_or_port_returns_false() { run!( |arc_process| { ( strategy::term::pid::local(), strategy::term::number_atom_reference_function_or_port(arc_process), ) }, |(left, right)| { ...
// 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...
//! Contains items related to the [`#[sabi_trait]`](macro@crate::sabi_trait) attribute. #[doc(hidden)] pub mod reexports { pub use std::ops::{Deref as __DerefTrait, DerefMut as __DerefMutTrait}; pub use crate::{ marker_type::ErasedObject as __ErasedObject, pointer_trait::GetPointerKind as __G...
pub mod codec; pub mod naming;
use std::num::Float; use vec::{ Vec3, dot }; use ray::{ Ray, Inter }; use scene::Scene; pub trait Light { fn bright(&self, ray: &Ray, inter: &Inter, scene: &Scene) -> (f64, f64); } pub struct Lights<'a> { all: Vec<Box<Light + 'a>>, } impl<'a> Lights<'a> { pub fn new(all: Vec<Box<Light + 'a>>) -> Lights<'...
use game::game::Game; use player::player::Player; use std::collections::HashMap; use team::team::Team; pub type Id = String; // TODO: World can only have one game at a time in this configuration, which is // to see if we can have game have mutable references to the two teams (that are // owned by world). Is there a w...
use ::amethyst::assets::*; use ::amethyst::ecs::*; use std::collections::HashMap; use std::fs; use std::path::Path; /// Loads asset from the so-called asset packs /// It caches assets which you can manually load or unload on demand. /// /// Example: /// If the folder structure looks like this /// /assets/base/sprit...
pub mod user_controller; pub mod user_service; use crate::cache::users::update_cache; use crate::context::{generate_context, Ctx}; use crate::users::user_controller::{create_user, delete_user, get_user, get_users, update_user}; use futures::future::lazy; use futures::{future, Future}; use std::boxed::Box; use thruster...
// 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...
// revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir struct Foo { field: i32 } impl Foo { fn foo<'a>(&self, x: &i32) -> &i32 { x //[base]~^ ERROR lifetime mismatch //[nll]~^^ ERROR lifetime may not live long enough } } fn main() { }
use rune::{Diagnostics, Options, Sources}; use runestick::{Any, AnyObj, Context, Module, Shared, Source, Vm, VmError}; use std::sync::Arc; #[test] fn test_reference_error() { #[derive(Debug, Default, Any)] struct Foo { value: i64, } fn take_it(this: Shared<AnyObj>) -> Result<(), VmError> { ...
// 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. #![allow(missing_docs)] use { failure::{format_err, Error}, fdio::{fdio_sys, ioctl, make_ioctl}, fidl_fuchsia_device::ControllerSynchronousPro...
use proptest::prop_assert_eq; use proptest::strategy::Just; use crate::erlang::tuple_to_list_1::result; use crate::test::strategy; #[test] fn without_tuple_errors_badarg() { run!( |arc_process| { ( Just(arc_process.clone()), strategy::term::is_not_tuple(arc_proc...
use std::sync::{Arc, Mutex}; use log::{Level, Log, Metadata, Record}; use serde::Deserialize; use alacritty_config::SerdeReplace as _; use alacritty_config_derive::{ConfigDeserialize, SerdeReplace}; #[derive(ConfigDeserialize, Debug, PartialEq, Eq)] enum TestEnum { One, Two, Three, #[config(skip)] ...
use rustc_serialize::json::{ToJson, Json}; use chrono::*; use bill::{Bill, BillItem, ItemList, Tax}; use ordered_float::OrderedFloat; use std::process; use std::error::Error; use super::Project; use super::product::Product; use util::currency_to_string; fn opt_to_json<T: ::std::fmt::Display>(opt:Option<T>) -> Json{ ...
#![doc = include_str!("../README.md")] use macaddr::MacAddr6; #[derive(Debug)] pub struct SensorData { pub relative_humidity_percent: f32, pub radon_short_term: Option<u32>, pub radon_long_term: Option<u32>, pub temperature_celsius: f32, pub relative_atmospheric_pressure: f32, pub co2: f32, ...
extern crate curl; mod rhyme; use curl::http; use rhyme::*; use std::env; fn main() { let word = env::args().nth(1).unwrap_or("heart".to_string()); let url = format!("http://rhymebrain.com/talk?function=getRhymes&word={}", word); let resp = http::handle().get(url).exec().unwrap(); println!("{}", resp...
extern crate reqwest; extern crate serde; extern crate serde_json; extern crate console; extern crate dialoguer; use serde_json::Value; use dialoguer::{Input, Select}; use std::process::{Command, Stdio}; use std::env; const PROMPT: &str = "[search]"; fn req(ctx: &Context, q: &str) -> reqwest::Response { let mut...
// 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 ...
#[doc = "Reader of register ITLINE23"] pub type R = crate::R<u32, super::ITLINE23>; #[doc = "Reader of field `I2C1`"] pub type I2C1_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - I2C1"] #[inline(always)] pub fn i2c1(&self) -> I2C1_R { I2C1_R::new((self.bits & 0x01) != 0) } }
#![cfg(any(target_arch="x86", target_arch="x86_64"))] #![feature(const_fn)] #![feature(asm)] #![no_std] #![cfg_attr(test, allow(unused_features))] #[macro_use] extern crate bitflags; extern crate raw_cpuid; #[cfg(feature = "performance-counter")] #[macro_use] extern crate phf; #[cfg(target_arch="x86")] pub mod bit...
use arkworks_gadgets::{ poseidon::PoseidonParameters, prelude::ark_bn254::Bn254, setup::{ common::Curve, mixer::{setup_groth16_circuit_circomx5, setup_groth16_random_circuit_circomx5, setup_random_circuit_circomx5}, }, utils::{ get_mds_poseidon_bls381_x3_5, get_mds_poseidon_bls381_x5_5, get_mds_poseidon_bn25...
mod options; use std::sync::atomic::{AtomicU64, Ordering}; use lazy_static::lazy_static; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; use crate::runtime::scheduler; pub use options::*; /// There are two types of unique integers both created using the erlang:unique_intege...
use std::io; pub struct Operator {} impl Operator { pub fn add(x: i128, y: i128) -> i128 { x + y } pub fn multiply(x: i128, y: i128) -> i128 { x * y } pub fn input() -> i128 { println!("Provide input: "); let mut input = String::new(); io::stdin().read_lin...
//! Reverse unit propagation redundancy checks. use std::ops::Range; use partial_ref::{partial, PartialRef}; use varisat_formula::{lit::LitIdx, Lit}; use varisat_internal_proof::ClauseHash; use crate::{ clauses::{UnitClause, UnitId}, context::{parts::*, Context}, hash::rehash, variables::ensure_var, ...
use proconio::input; fn main() { input! { y: usize, }; let ans = if y % 4 <= 2 { y + (2 - y % 4) } else { y + 3 }; println!("{}", ans); }
use num::traits::{AsPrimitive, FromPrimitive, PrimInt}; //returns the digits of the number pub fn digits<Int>(mut n: Int) -> Vec<u8> where Int: PrimInt + AsPrimitive<u8> + FromPrimitive, { let mut digits = vec![]; let ten = Int::from_usize(10usize).unwrap(); while n != Int::zero() { digits.push...
#[doc = "Reader of register OPTCR"] pub type R = crate::R<u32, super::OPTCR>; #[doc = "Writer for register OPTCR"] pub type W = crate::W<u32, super::OPTCR>; #[doc = "Register OPTCR `reset()`'s with value 0"] impl crate::ResetValue for super::OPTCR { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
//= { //= "output": { //= "2": [ //= "", //= true //= ], //= "1": [ //= "Resources \\{ mem: 20971520, cpu: 0\\.05 \\}\n", //= true //= ] //= }, //= "children": [ //= { //= "output": { //= "2": [ //= "", //= true //= ], //= ...
//! Ready //! //! Check readiness of an InfluxDB instance at startup use reqwest::{Method, StatusCode}; use snafu::ResultExt; use crate::{Client, Http, RequestError, ReqwestProcessing}; impl Client { /// Get the readiness of an instance at startup pub async fn ready(&self) -> Result<bool, RequestError> { ...
// 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::ops::{Add, Mul, Sub}; use num::traits::{Float, ToPrimitive}; use super::{Channel, Colorspace, clamp}; pub use self::imp::ColorARGB; #[cfg(target_endian = "little")] mod imp { #[repr(C)] #[derive(Debug, Copy)] pub struct ColorARGB<T> { pub b: T, pub g: T, pub r: T, ...
#[doc = "Reader of register PRGPIO"] pub type R = crate::R<u32, super::PRGPIO>; #[doc = "Reader of field `R0`"] pub type R0_R = crate::R<bool, bool>; #[doc = "Reader of field `R1`"] pub type R1_R = crate::R<bool, bool>; #[doc = "Reader of field `R2`"] pub type R2_R = crate::R<bool, bool>; #[doc = "Reader of field `R3`"...
#[ blah= "abc ] " , blah2= "abc ] \n \\ " " \" \" " end of string ]
use utopia_core::{ math::{Size, Vector2}, widgets::{pod::WidgetPod, TypedWidget, Widget}, Backend, }; pub struct Scale<T, B: Backend> { pub scale_x: f32, pub scale_y: f32, widget: WidgetPod<T, B>, } impl<T, B: Backend> Scale<T, B> { pub fn new<TW: TypedWidget<T, B> + 'static>(widget: TW) -...
// Celsius to Farenheit fn main() { println!("Enter the Celsius value"); loop { let mut celsius = String::new(); io::stdin() .read_line(&mut celsius) .expect("Failed to read line"); let celsius: i32 = match celsius.trim().parse() { Ok(n) => n, ...
use core::cmp; use core::convert::TryFrom; use core::fmt; use core::marker::PhantomData; use core::ptr::NonNull; use typenum::{IsGreaterOrEqual, True, Unsigned}; use crate::internal::Internal; use crate::pointer::{ self, InvalidNullError, Marked::{self, Null, Value}, MarkedNonNull, MarkedNonNullable, Mark...
use { alloc::sync::Arc, core::mem::size_of, zircon_object::{object::KernelObject, util::kcounter::*, vm::*}, }; /// Create kcounter VMOs from kernel memory. /// Return (KCOUNTER_NAMES_VMO, KCOUNTER_VMO). #[cfg(target_os = "none")] pub fn create_kcounter_vmo() -> (Arc<VmObject>, Arc<VmObject>) { const H...
#[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::ICR { #[doc = r"Writes to the register"] #[inline(always)] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { self.register.set( f(&mut W { bits: Self::re...
extern crate clipboard2; use clipboard2::{Clipboard, SystemClipboard}; fn main() { let clipboard = SystemClipboard::new().unwrap(); clipboard .set_string_contents(String::from("Hello")) .unwrap(); println!("{}", clipboard.get_string_contents().unwrap()); }
// 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 agreed to ...
#![allow(unused_variables)] use std::{ fmt, sync::{Arc, Mutex}, collections::BTreeMap, }; use euclid::{TypedRect, TypedSize2D}; use webrender::api::{ LayoutPixel, DisplayListBuilder, PrimitiveInfo, GradientStop, ColorF, PipelineId, Epoch, ImageData, ImageDescriptor, ResourceUpdate, AddImage, Bo...
use rand::Rng; use std::cmp::Ordering; fn main() { let number = rand::thread_rng().gen_range(0, 11); println!("number: {}", number); // if else if else if number < 5 { println!("The number is lower than 5"); } else if number == 5 { println!("The number is 5"); } else { ...
// 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::{ formatting::{format_parts, get_child_listing, get_locations, Formatter}, options::PathFormat, result::IqueryResu...
use pyo3::prelude::*; use ukis_h3cellstore::clickhouse::compacted_tables::TableSet; /// A Tableset describes the available database tables of a schema created from a `CompactedTableSchema` #[pyclass] pub struct PyTableSet { tableset: TableSet, } #[pymethods] impl PyTableSet { /// The name of the TableSet. ...
pub mod equipment; pub mod fermentable; pub mod hop; pub mod mash; pub mod misc; pub mod recipe; pub mod style; mod utils; pub mod water; pub mod yeast; pub use equipment::Equipment; pub use fermentable::Fermentable; pub use hop::Hop; pub use misc::Misc; pub use recipe::Recipe; pub use recipe::Type; pub use style::Sty...
use futures::{SinkExt, StreamExt, TryFutureExt}; use std::collections::HashMap; use tokio::sync::mpsc::{self, UnboundedSender}; use tokio_stream::wrappers::UnboundedReceiverStream; use uuid::Uuid; use warp::ws::WebSocket; use warp::Filter; use xtra::prelude::*; use xtra::spawn::Tokio; // User struct User { id: Uui...
//! A lot of macros for hiding ugly unsafe blocks by changing most useful global static variables. #[macro_export] macro_rules! get_ref_curmap { () => ({ use map; unsafe { &map::GAME_MAP[map::CUR_MAP] } }) } #[macro_export] macro_rules! get_ref_curmap_wo_unsafe { () => ({ use map; ...
use std::f64::consts::PI; use super::model::Boid; use super::model::velocity::Velocity; const AVERAGE_WEIGHT: f64 = 2.0; const AVOIDANCE_WEIGHT: f64 = 3.0; const SEEK_WEIGHT: f64 = 2.0; const TOTAL_WEIGHT: f64 = AVERAGE_WEIGHT + AVOIDANCE_WEIGHT + SEEK_WEIGHT; pub fn brain(boid: &Boid, clique: &Vec<Boid>) -> Option<V...
pub fn count_paranthesis(line: &str) -> i64 { let mut count = 0; for bracket in line.chars() { let change = match bracket { '(' => 1, ')' => -1, _ => 0, }; count += change; } count } pub fn count_newlines(s: &str) -> usize { bytecount::...
extern crate rand; use rand::Rng; use rand::distributions::{IndependentSample, Range}; use find_folder::Search; use find_folder::Error; use std::path::PathBuf; pub fn select_random<T>(x: T, y: T) -> T { if rand::thread_rng().gen() { x } else { y } } pub fn select_random_3<T>(x: T, y: T, z: T) -> T { let mut rng ...
//! Code to filter a trace down to queries. //! //! We are looking for symbols like this: //! //! rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::force //! //! which we want to transform to just the name of the query `borrowck`. const QUERY_PREFIX_0: &str = "rustc::ty::maps::<impl rustc::ty::maps...
//use super::field::{One, Zero}; //use std::ops::{Add, BitAnd, Shl, Shr, Sub}; pub trait DivRem<RHS = Self>: Sized { type Output; fn divrem(self, rhs: RHS) -> (Self::Output, Self::Output); } pub trait Egcd<RHS = Self> { type Output; fn egcd(self, rhs: RHS) -> (Self::Output, Self::Output); } pub trait...
use ffi; use error; use device::Device; use MantleObject; use DeviceExt; use std::ops::{Deref, DerefMut}; use std::sync::Arc; use std::slice; use std::mem; pub struct Buffer { memory: ffi::GR_GPU_MEMORY, size: usize, default_state: ffi::GR_ENUM, } pub struct Mapping<'a, T> { buffer: &'a Buffer, ...
//! Commands available to use on the HD44780 device. use crate::instructions::*; /// Commands every driver must support /// /// Commands that only require a write capable bus pub trait Driver { type Error; /// Clears entire display and sets DDRAM address 0 in address counter. fn clear_display(&mut self) ...
use survey_manager_core::dtos::{SurveyDTO, SurveyDTOs, ListViewSurveyDTO}; use survey_manager_core::app_services::repository_contracts::SurveyDTOReadRepository; pub struct MysqlSurveyDTOsRepository { // A single connection to Mysql. Handed down from a pool likely. conn: mysql::PooledConn, } impl MysqlSurveyD...
#[doc = "Reader of register CCVR"] pub type R = crate::R<u32, super::CCVR>; #[doc = "Reader of field `NCV`"] pub type NCV_R = crate::R<u8, u8>; #[doc = "Reader of field `PCV`"] pub type PCV_R = crate::R<u8, u8>; impl R { #[doc = "Bits 0:3 - NMOS compensation value"] #[inline(always)] pub fn ncv(&self) -> NC...
use std::fmt; use std::path::PathBuf; pub type Result<T> = std::result::Result<T, Error>; /// The various kinds of errors that can happen while reading input. #[derive(Debug)] pub enum Error { /// An I/O error (such as not being able to read the input file) Io(std::io::Error), /// An error while reading o...
extern crate reqwest; extern crate twitter_rs; use twitter_rs::*; fn main() { twitter_rs::ClientContext::new_with_oauth(ANDROID_CK, ANDROID_CS); }
pub mod configuration; pub mod minecraft_related; pub mod server_interactions; pub mod shared_data; pub mod web_server;
//! # Pretty Assertions //! //! When writing tests in Rust, you'll probably use `assert_eq!(a, b)` _a lot_. //! //! If such a test fails, it will present all the details of `a` and `b`. //! But you have to spot the differences yourself, which is not always straightforward, //! like here: //! //! ![standard ass...
//! Helper functions and macros for use in the rest of PICL. // use std::collections::HashMap; /// A helper for making a HashMap literal. /// /// # Examples /// ``` /// let my_map = map!{ "this" => "that", "foo" => "bar" }; /// ``` #[macro_export] macro_rules! map( { $($key:expr => $value:expr),+ } => { {...
use crate::report::Styled; pub fn write_diff( writer: &mut dyn std::fmt::Write, expected: &crate::Data, actual: &crate::Data, expected_name: Option<&dyn std::fmt::Display>, actual_name: Option<&dyn std::fmt::Display>, palette: crate::report::Palette, ) -> Result<(), std::fmt::Error> { #[all...
use std::collections::{HashMap, VecDeque}; use std::io::{Write, ErrorKind}; use std::net::{SocketAddr, ToSocketAddrs}; use std::time::{Duration, Instant}; use std::thread; use netopt::{NetworkOptions, NetworkStream}; use rand::{self, Rng}; use mqtt3::{MqttRead, MqttWrite, Message, QoS, SubscribeReturnCodes, SubscribeTo...
use crate::crawler::photo_crawler::craw_photo_splider; use rocket::http::Status; use rocket::Route; use rocket_contrib::json::JsonValue; #[get("/photo/entries?<count>", format = "json")] fn get_photo_entries(count: usize) -> Result<JsonValue, Status> { if count > 15 { return Err(Status::BadRequest); } ...
use { crate::switchboard::base::*, crate::switchboard::hanging_get_handler::{HangingGetHandler, Sender}, crate::switchboard::switchboard_impl::SwitchboardImpl, fidl::endpoints::ServiceMarker, fidl_fuchsia_settings::{ DoNotDisturbMarker, DoNotDisturbRequest, DoNotDisturbRequestStream, DoNotDi...
use rune::ast::{CopySource, Delimiter, Kind, NumberSource, StrSource, StringSource, Token}; use rune::macros::{with_context, MacroContext}; use rune::quote; use runestick::Span; use Kind::*; macro_rules! assert_quote { ([$($expected:expr),* $(,)?], $quote:expr) => { assert_eq!(vec![$(token($expected),)*],...
use super::*; pub fn parse_new(s :&String)->Result<String, &str> { #[derive(Debug)] enum InitType { Constructor, RefType, CopyType, _None } #[derive(Debug)] enum DeclareType { Make, Have, Let } use DeclareType::*; use InitType::*; let keyword = &keyw...
mod amt_test; mod cbor_test; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use std::result; use serde::{de::DeserializeOwned, Serialize}; use serde_cbor::Value; use blockstore::BlockstoreError; use cid::{Cid, Codec, Prefix, Version}; use crate::node::{create_root, Item, Node, PartAmt}; us...
// 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...
// Copyright 2020, The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
//! The vast majority of the code is taken from https://github.com/markschl/seq_io/blob/master/src/fasta.rs use crate::errors::{ErrorPosition, ParseError}; use crate::parser::record::SequenceRecord; use crate::parser::utils::{ fill_buf, find_line_ending, grow_to, trim_cr, FastxReader, Format, LineEnding, Position,...
use rand::Rng; use std::io; use std::io::Write; // keeps track of number of tries struct Tries { init: u8, left: u8, } impl Tries { fn init(x: u8) -> Tries { Tries { init: x, left: x } } // decrement number of tries left fn dec(&mut self) { self.left = self.left - 1u8; } ...
use parser::ArgumentParser; use super::{Store, List}; use test_parser::{check_ok}; fn parse_pos(args: &[&str]) -> isize { let mut val = 0; { let mut ap = ArgumentParser::new(); ap.refer(&mut val) .add_argument("value", Store, "The value"); check_ok(&ap, args); } retu...
use std::fmt; use std::sync::RwLock; lazy_static! { pub static ref MUTEX_ID_COUNTER:RwLock<u32>= RwLock::new(0); } #[derive(Debug, Serialize, Deserialize)] pub struct LinkTreeNode { id: u32, link: String, node_list: Vec<LinkTreeNode>, parent_id: u32, depth: u32, } impl fmt::Display for LinkTr...
use std::fs::File; use std::io::{self, Read}; use std::path::Path; use std::fmt; mod cpu; mod ppu; #[derive(Debug)] pub enum NESError { Io(io::Error) } impl From<io::Error> for NESError { fn from(err: io::Error) -> NESError { NESError::Io(err) } } impl fmt::Display for NESError { fn fmt(&sel...
// 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::{format_err, Error, ResultExt}, fidl_fidl_test_compatibility::{ EchoEvent, EchoMarker, EchoProxy, EchoRequest, EchoRequestSt...
// we can do this since the file `front_of_house.rs` // exists in the same directory mod front_of_house; mod back_of_house { fn fix_incorrect_order() { cook_order(); super::front_of_house::serving::serve_order(); } fn cook_order() {} pub struct Breakfast { pub toast: String, ...
use serde_json::{from_str, Error, Value}; use serial::{PortSettings, SerialPort}; #[allow(unused_imports)] use std::cell::RefCell; use std::sync::{Arc, Mutex}; use std::time::Duration; #[allow(unused_imports)] use std::*; use std::io::{self}; /// Состояние программы static mut PROGRAM_STATE: ProgramState = ...
//! Tries to unify the two traits via templating on the error type and using //! the never type (still experimental). Tests have shown no performance //! overhead. //! //! Rng exists as a separate trait only so that users don't have to unwrap //! the `Result<T, !>` type themselves. //! //! Note: this *only* considers...
use proconio::input; use proconio::marker::Chars; fn main() { input! { h: usize, w: usize, s: [Chars; h], }; let mut si = 0; let mut sj = 0; for i in 0..h { for j in 0.. w { if s[i][j] == 'o' { si = i; sj = j; ...