text
stringlengths
8
4.13M
use actix_web::http::Method; use actix_web::{fs, server, App}; use failure::Error; use num_cpus::get as cpus; use std::sync::Arc; use crate::configuration::Configuration; use crate::store::Store; mod errors; mod middlewares; mod types; // !! Context holds important values for the server. #[derive(Clone)] pub struct ...
//! Core `yggy` service implementations. mod peer; mod router; mod switch; pub use peer::{Peer, PeerManager}; pub use router::Router; pub use switch::Switch;
//! Search your team's files and messages. use rtm::{File, Message, Paging}; #[derive(Clone, Debug, Serialize)] pub enum SortDirection { #[serde(rename = "asc")] Ascending, #[serde(rename = "desc")] Descending, } #[derive(Clone, Debug, Serialize)] #[serde(rename = "snake_case")] pub enum SortBy { ...
use crate::instruction::Instruction; #[derive(Default)] pub struct InterruptController { interrupt: Option<Instruction>, } impl InterruptController { pub fn generate_interrupt(&mut self, instruction: Instruction) { self.interrupt = Some(instruction); } pub fn consume_interrupt(&mut self) -> O...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// AwsTagFilterDeleteRequest : The objects used to delete an AWS tag filter entry. #[derive(Clone, D...
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use engine::rocks::util::get_cf_handle; use engine::*; use test_raftstore::*; use tikv_util::config::ReadableSize; #[test] fn test_turnoff_titan() { let mut cluster = new_node_cluster(0, 3); cluster.cfg.rocksdb.defaultcf.disable_auto_compactio...
use std::process::Command; use std::{thread, time}; pub struct PACMD { /// Mac Address e.g. AA:11:2B:3F:44:55 pub mac: String, /// Sink Card e.g. bluez_card.AA_11_2B_3F_44_55 pub sink: String, /// Is debug config enabled pub dbg: bool, } impl PACMD { /// Get all cards listed by pacmd pu...
//! A set of abstraction utilities used by the framework to simplify its code. //! //! Usable outside of the framework. pub mod id_map; pub mod segments; pub use id_map::*; pub use segments::*;
pub mod pc_usage; pub mod python_repo; use crate::{ error::WebsocketError, message::{ResultMessage, TaskMessage, WebsocketMessage}, }; use anyhow::Context; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use tokio::sync::mpsc; #[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_a...
pub mod moves; pub mod characters; pub mod boosters; pub mod outcomes; pub mod streaks; pub mod players; pub mod io; pub mod prfg; pub mod single_player_game; mod helpers;
fn count_diffs(data: &[u32], val: u32) -> u32 { data.windows(2) .map(|s| (s[1] - s[0])) .filter(|diff| *diff == val) .count() as u32 } fn count_permutations(data: &[u32]) -> u64 { let mut amount = 0; let mut ret: u64 = 1; for slice in data.windows(2) { if slice[1] - slic...
use std::collections::VecDeque; use crate::geometry::*; #[derive(Debug, Clone)] pub struct QuadTree<T: Clone> { boundary: Rect, points: Vec<Point>, data: Vec<T>, north_west: Option<Box<QuadTree<T>>>, north_east: Option<Box<QuadTree<T>>>, south_west: Option<Box<QuadTree<T>>>, south_east:...
use std::fmt::{self, Debug}; use line_drawing::{FloatNum, Midpoint, SignedNum}; use renderer::{Coord, Drawable}; use point::Point2; /// Euclidean + barycentric coordinate on a line. pub type Coordinate<T> = (Point2<T>, [T; 2]); impl<T: Copy> Coord<T> for Coordinate<T> { #[inline(always)] fn point(&self) -> ...
#![cfg_attr(test, allow(dead_code))] use ::scene::{Camera, Scene}; pub mod bunny; pub mod cornell; pub mod cow; pub mod easing; pub mod fresnel; pub mod heptoroid; pub mod lucy; pub mod sibenik; pub mod sierpinski; pub mod sphere; pub mod sponza; pub mod tachikoma; pub mod teapot; pub trait SceneConfig { fn get_c...
#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal, excessive_precision))] use std::cmp::{ min, max }; use physical_constants::{ PLANCK_CONSTANT as h, SPEED_OF_LIGHT_IN_VACUUM as c, BOLTZMANN_CONSTANT as kb, WIEN_WAVELENGTH_DISPLACEMENT_LAW_CONSTANT as b, }; use lazy_static::lazy_static; u...
extern crate rand; use rand::random; use std::slice; use std::os::args; use std::io::{print, println}; use std::slice::MutableCloneableVector; fn main() { // get arguments let args = args(); let mut args_iter = args.iter(); args_iter.next(); let size = from_str::<uint>(*args_iter.next().unwrap()).unwrap...
use message::*; use vecmath::*; use std::time::{Instant, Duration}; use config::{Config, ControllerMode, GimbalTrackingGain}; use std::collections::HashMap; use controller::velocity::RateLimitedVelocity; pub struct ManualControls { axes: HashMap<ManualControlAxis, f32>, velocity: RateLimitedVelocity, camer...
//! Tests auto-converted from "sass-spec/spec/values/maps" #[allow(unused)] use super::rsass; // From "sass-spec/spec/values/maps/duplicate-keys.hrx" // Ignoring "duplicate_keys", error tests are not supported yet. // From "sass-spec/spec/values/maps/errors.hrx" // Ignoring "errors", error tests are not supported y...
use crate::{error::VelociError, persistence::Persistence}; use doc_store::DocStoreWriter; use std::{io::Write, path::Path, str}; #[derive(Debug)] pub(crate) struct DocWriteRes { pub(crate) num_doc_ids: u32, #[allow(dead_code)] pub(crate) bytes_indexed: u64, } pub(crate) fn write_docs<K, S: AsRef<str>>(per...
// 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. //! A futures-rs executor design specifically for Fuchsia OS. #![deny(warnings)] #![deny(missing_docs)] extern crate bytes; extern crate crossbeam; #[mac...
mod fixtures; use assert_cmd::Command; use fixtures::{server, Error, TestServer, FILES}; use predicates::str::contains; use reqwest::blocking::ClientBuilder; use rstest::rstest; use select::{document::Document, node::Node}; /// Can start the server with TLS and receive encrypted responses. #[rstest] #[case(server(&[ ...
// Run with `rust run hello.rs` fn greeter(greeting_text: &str) { println(fmt!("Hello %s!", greeting_text)); } fn main() { greeter("World"); }
// GM/T 0004-2012 SM3密码杂凑算法标准 (中文版本) // https://sca.gov.cn/sca/xwdt/2010-12/17/1002389/files/302a3ada057c4a73830536d03e683110.pdf // // GM/T 0004-2012 SM3 Cryptographic Hash Algorithm (English Version) // http://www.gmbz.org.cn/upload/2018-07-24/1532401392982079739.pdf use core::convert::TryFrom; const INITIAL_STATE: ...
use std::process::{Command, Stdio, Child, ChildStdout}; use assert_cmd::prelude::*; use std::io::{Write}; use std::thread::sleep; use std::time::Duration; use nonblock::NonBlockingReader; use std::ops::{Deref, DerefMut}; use rzmq::{chat, socket}; fn test_push_pull_send_listen() { let test_message = "TEST MESSAGE ...
#[doc = "Register `ISR` reader"] pub type R = crate::R<ISR_SPEC>; #[doc = "Field `PE` reader - PE"] pub type PE_R = crate::BitReader; #[doc = "Field `FE` reader - FE"] pub type FE_R = crate::BitReader; #[doc = "Field `NF` reader - NF"] pub type NF_R = crate::BitReader; #[doc = "Field `ORE` reader - ORE"] pub type ORE_R...
#![allow(dead_code)] #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #[macro_use] extern crate arrayref; #[macro_use] extern crate bitflags; #[macro_use] extern crate derive_new; #[macro_use] extern crate downcast_rs; #[macro_use] extern crate enum_dispatch; #[macro_use] extern crate num_derive; #[ma...
use crate::{ component::{ containers::paper::{paper, PaperProps}, text_paper::{text_paper, TextPaperProps}, }, theme::ThemedWidgetProps, }; use raui_core::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct TextFieldPaperProps { #[...
use actix_web::{middleware, web, App, HttpServer}; use forum_rust::config::MyConfig as Config; use forum_rust::headers; #[actix_web::main] async fn main() -> std::io::Result<()> { std::env::set_var("RUST_LOG", "actix_web=info"); env_logger::init(); let config = Config::new(); let pool = r2d2::Pool::new(...
mod crypto_key; mod crypto_read; mod crypto_write; pub use self::crypto_key::*; pub use self::crypto_read::*; pub use self::crypto_write::*; // ex: et ts=2 filetype=rust
use std::fmt; pub struct UserInputLiteral { pub field_name: Option<String>, pub phrase: String, } impl fmt::Debug for UserInputLiteral { fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { match self.field_name { Some(ref field_name) => write!(formatter, "{}:\"{}\...
//! src/handlers.rs use axum::{ extract::{Extension, Json, UrlParams}, response::{self, IntoResponse}, }; use hyper::http::StatusCode; use serde_json::json; use sqlx::{postgres::PgPool, query_as}; use uuid::Uuid; use crate::models; pub async fn get_recipes( Extension(pool): Extension<PgPool>, ) -> response::Js...
use juice_sdk_rs::{client, transports, types, Result}; #[tokio::main] async fn main() -> Result<()> { let transport = transports::http::Http::new("http://10.1.1.40:7009")?; let client = client::Client::new(transport, true); let number = client.block_number(String::from("test")).await?; let block = cli...
#[doc = "Register `HYSCR2` reader"] pub type R = crate::R<HYSCR2_SPEC>; #[doc = "Register `HYSCR2` writer"] pub type W = crate::W<HYSCR2_SPEC>; #[doc = "Field `PC` reader - Port C hysteresis control on/off"] pub type PC_R = crate::FieldReader<u16>; #[doc = "Field `PC` writer - Port C hysteresis control on/off"] pub typ...
use criterion::{black_box, criterion_group, criterion_main, Criterion}; fn memory_copy( minitrace::TraceDetails { start_time_ns, elapsed_ns, cycles_per_second, spans, properties: minitrace::Properties { span_ids, property_lens, ...
#[doc = "Register `T0VALR1` reader"] pub type R = crate::R<T0VALR1_SPEC>; #[doc = "Field `TS1_FMT0` reader - Engineering value of the frequency measured at T0 for temperature sensor 1 This value is expressed in 0.1 kHz."] pub type TS1_FMT0_R = crate::FieldReader<u16>; #[doc = "Field `TS1_T0` reader - Engineering value ...
// /Users/josiah/github/rustOS/src/serial.rs use uart_16550::SerialPort; // SerialPort implements fmt::Write trait use spin::Mutex; use lazy_static::lazy_static; lazy_static! { // "use lazy_static and a spinlock to create a static writer instance" pub static ref SERIAL1: Mutex<SerialPort> = { // Mutex 'mut...
use kvs::*; use std::process; use structopt::StructOpt; const IO_ERR: i32 = 74; #[derive(Debug, StructOpt)] #[structopt(name = "kvs", about = "Key value storage")] struct Cli { #[structopt(subcommand)] cmd: Command, } #[derive(Debug, StructOpt)] pub enum Command { #[structopt(name = "set")] /// Set a...
//! control the interrupt processing use crate::registers::cp0; /// disable all interrupts pub fn disable() { cp0::status::disable_interrupt(); } /// enable all interrupts pub fn enable() { cp0::status::enable_interrupt(); } /// execute a closure in critical section, which means it will not be interrupted ...
use chapter2::basics_nlz; #[cfg(target_arch = "x86_64")] use std::borrow::BorrowMut; #[cfg(target_arch = "riscv64")] use core::borrow::BorrowMut; /// Integer Divisions /* q[0], r[0], u[0], and v[0] contain the LEAST significant halfwords. (The sequence is in little-endian order). This first version is a fairly preci...
use super::config; use crate::encoder; use crate::errors::{Error, ErrorKind, Result}; use crate::protos::{xchain, xendorser}; use num_bigint; use num_traits; use num_traits::cast::FromPrimitive; use serde_json; use std::ops::AddAssign; use std::ops::Sub; use std::prelude::v1::*; use std::slice; extern crate sgx_types; ...
use std::time::Duration; use std::{env, path::Path}; use std::{str::FromStr, thread}; use anyhow::{bail, Context}; use anyhow::{Ok, Result}; use chrono::prelude::*; use log::debug; use crate::cli::Appearance; use crate::config::Config; use crate::constants::UPDATE_INTERVAL_MINUTES; use crate::heif; use crate::info::I...
use english_numbers::{Formatting, convert}; // bit o cheating ;) fn main() { let mut form = Formatting::none(); form.conjunctions = true; let sum: u64 = (1..=1000) .map(|x| convert(x, form).len()) .fold(0, |a, b| a + b as u64); println!("{}", sum); }
use std::fs::File; use std::io::{BufRead, BufReader}; use crate::util::{lines_as_i32, time, vecs_i32}; pub fn day1() { println!("== Day 1 =="); let input = "src/day1/input.txt"; // let input = "src/day1/aoc_2022_day01_large_input.txt"; // println!("Part A: {}", part_a(&input)); // println!("Part B...
// 2019-07-08 // Un programme avec // un thread qui génère des valeurs et les envoie dans une channel // un thread qui les reçoit et les affiche // mpsc signigie Multiple Producer, Single Consumer // Une channel peut avoir plusieurs extrémités qui produisent des valeurs // mais UNE SEULE extrémité qui les con...
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #![allow(nonstandard_style)] #[cfg(feature = "std")] use std::io::{Error}; use core::fmt::{self, Display, Debug, Fo...
use super::geometry::{Ray, Vector}; use image::{DynamicImage, GenericImageView}; use std::sync::Arc; pub struct Scene { pub objects: Vec<Arc<dyn Traceable>>, pub lights: Vec<Light>, pub environment_color: Vector, pub environment_map: Option<DynamicImage>, } pub struct Light { pub position: Vector, pub intensity...
//! A description of a widget. use std::any::Any; use std::panic::Location; use druid::widget; use crate::any_widget::{Action, AnyWidget, DruidAppData}; use crate::cx::Cx; use crate::id::Id; pub trait View: AsAny + std::fmt::Debug { fn same(&self, other: &dyn View) -> bool; // This will yield Box<dyn Widget...
mod map_file; mod pp; use plotters::drawing::DrawingAreaErrorKind; use twilight_model::application::interaction::{ApplicationCommand, MessageComponentInteraction}; use twilight_validate::message::MessageValidationError; pub use self::{map_file::MapFileError, pp::PpError}; #[macro_export] macro_rules! bail { ($($...
#![deny(missing_docs)] //! Custom derive for GetCorresponding. See `relational_types` for the documentation. #![recursion_limit = "128"] extern crate proc_macro; use quote::*; use proc_macro::TokenStream; use std::collections::{HashMap, HashSet}; /// Generation of the `GetCorresponding` trait implementation. #[pr...
pub mod bmx055; pub mod madgwick; pub mod potentio; pub mod serial;
use actix_web::{get, web, HttpResponse, Responder}; use drogue_cloud_service_api::version::DrogueVersion; use drogue_cloud_service_common::endpoints::EndpointSourceType; use serde_json::json; #[get("/info")] pub async fn get_info(endpoint_source: web::Data<EndpointSourceType>) -> impl Responder { match endpoint_...
extern crate parenchyma; #[cfg(test)] mod backend_spec { mod native { use std::rc::Rc; use parenchyma::backend::Backend; use parenchyma::frameworks::Native; #[test] fn it_can_create_default_backend() { let backend: Result<Backend, _> = Backend::new::<Native>(); ...
use crate::{ gui::{BuildContext, Ui, UiMessage, UiNode}, load_image, send_sync_message, Message, }; use rg3d::{ core::{color::Color, pool::Handle, scope_profile}, gui::{ brush::Brush, button::ButtonBuilder, grid::{Column, GridBuilder, Row}, image::ImageBuilder, li...
use std::error::Error; use std::fmt; use tokio::io; #[derive(Debug)] pub enum CacheError { IOError { source: io::Error }, DeserializationError { source: serde_json::Error }, } impl Error for CacheError { fn source(&self) -> Option<&(dyn Error + 'static)> { match self { CacheError::IOEr...
#[doc = "Register `CMPCR` reader"] pub type R = crate::R<CMPCR_SPEC>; #[doc = "Field `CMP_PD` reader - Compensation cell power-down"] pub type CMP_PD_R = crate::BitReader; #[doc = "Field `READY` reader - READY"] pub type READY_R = crate::BitReader; impl R { #[doc = "Bit 0 - Compensation cell power-down"] #[inli...
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::SUPPLYSTATUS { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, ...
use std::vec; use std::unstable::atomics::{atomic_store, atomic_load, AtomicUint, fence, SeqCst, Acquire, Release, Relaxed}; use std::unstable::sync::{UnsafeArc, LittleLock}; use std::cast; struct Deque<T> { priv state: UnsafeArc<State<T>>, } impl<T: Send> Deque<T> { pub fn with_capacity(capacity: uint) -> De...
use crate::{ app::util::arg::formatter, repository::{Category, Repository}, util::{optfilter::OptFilter, repoobject::RepoObject}, }; use clap::{App, ArgMatches, Error, SubCommand}; use std::path::Path; pub(crate) const NAME: &str = "categories"; pub(crate) const ABOUT: &str = "Iterate all categories in a r...
use piston_window::{ellipse, rectangle, Context, G2d}; use crate::colors; use crate::player::Player; use crate::shapes::{Circle, Rectangle, Shape}; pub enum SceneryType { Tree { base_width: f64, base_height: f64, top_radius: f64, }, } pub struct Scenery { pub type_: SceneryType, ...
// #![allow(unused_variables, unused_mut)] pub mod proto; pub mod server;
use std::collections::HashMap; use std::fmt; use indexmap::map::{IndexMap, IntoIter, Iter, IterMut}; use serde::de::{Deserialize, Deserializer, MapAccess, Visitor}; use serde::ser::{Serialize, SerializeMap, Serializer}; use super::{de::ValueDeserializer, ser::ValueSerializer, Error, Key, Value}; #[derive(Clone, Debu...
use crate::{util::CowUtils, Context}; use chrono::FixedOffset; use hashbrown::HashMap; use serde::Deserialize; use smallstr::SmallString; use std::{borrow::Borrow, fmt, ops::Deref}; lazy_static! { static ref TIMEZONES: HashMap<&'static str, i32> = { const HOUR: i32 = 3600; const HALF_HOUR: i32 = 1...
use graphql_client::{GraphQLQuery, Response as GQLResponse}; mod shared; use seed::{prelude::*, *}; use serde::{Deserialize, Serialize}; // Allows sort_by use itertools::Itertools; use rasciigraph::{plot, Config}; // Global types and Constant values type Id = String; type Name = String; type Author = String; type Poin...
use anyhow::Error; use anyhow::Result; #[derive(PartialEq, Eq, Debug)] pub struct Stack { stack: [u16; 16], stack_ptr: usize, } impl Stack { pub fn new() -> Self { Self { stack: [0; 16], stack_ptr: 0, } } pub fn pop(&mut self) -> Result<u16> { if se...
use crate::client::API_VERSION_PARAM; use crate::Error; use crate::KeyClient; use azure_core::TokenCredential; use chrono::serde::{ts_seconds, ts_seconds_option}; use chrono::{DateTime, Utc}; use const_format::formatcp; use getset::Getters; use reqwest::Url; use serde::Deserialize; use serde_json::{Map, Value}; const...
// https://video-api.wsj.com/api-video/find_all_videos.asp #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] #[serde(rename_all = "camelCase")] pub struct WSJRoot { pub items: Vec<WSJVideos>, } impl crate::HasRecs for WSJRoot { fn to_recs(&self) -> Vec<Vec<String>>...
#[doc = "Register `DOUTR12` reader"] pub type R = crate::R<DOUTR12_SPEC>; #[doc = "Register `DOUTR12` writer"] pub type W = crate::W<DOUTR12_SPEC>; #[doc = "Field `DOUT12` reader - Output data sent to MDIO Master during read frames"] pub type DOUT12_R = crate::FieldReader<u16>; #[doc = "Field `DOUT12` writer - Output d...
// // Parser // #[macro_use] extern crate nom; pub mod parser; // // Main // extern crate flate2; use std::fs::File; use std::io::prelude::*; use std::path::Path; use std::error::Error; use std::fs::DirBuilder; use std::fs::OpenOptions; use flate2::read::ZlibDecoder; const VERSION: Option<&'static str> = option_env!...
use std::time::Duration; use crate::pbteddy; use crate::service::rpc; use etcd_rs::KeyRange; use futures::StreamExt; use prost::Message; use redis::Value as RV; use redis::{aio::MultiplexedConnection, AsyncCommands}; pub struct Client { nc: nats::Connection, rpc: rpc::Client, redis: redis::Client, } impl ...
use std::fs::File; use std::io; use std::io::{BufRead, BufReader}; fn read_input() -> Result<Vec<String>, io::Error> { let filename = "input"; let file = File::open(filename)?; let reader = BufReader::new(file); let input: Vec<String> = reader.lines().collect::<Result<_, _>>().unwrap(); ...
use dynamixel_driver::DynamixelDriver; use looprate::{ Rate, RateTimer }; use std::time::Instant; use clap::Clap; #[derive(Clap)] #[clap()] struct Args { #[clap( about = "Serial port to use" )] port: String, } fn main() -> Result<(), Box<dyn std::error::Error>> { let args: Args = Args::parse()...
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use crate::{power, u64_key, BytesKey, OptionalEpoch, HAMT_BIT_WIDTH}; use address::Address; use cid::Cid; use clock::ChainEpoch; use encoding::{BytesDe, BytesSer}; use ipld_amt::{Amt, Error as AmtError}; use ipld_blockstore::BlockStore; us...
fn main() { // セミコロンが文の区切りになる let a = 10 ; let b = 20 ; println!("a is {}, b is {}", a, b ); // これも3つの文 let a = 10 ; let b = 20 ; println!("a is {}, b is {}", a, b ); // 文の中に改行が入っても良い let a = 10 ; let b = 20 ; println!("a is {}, b is {}", a, b ); // 式は値を返...
use super::*; pick! { if #[cfg(target_feature="avx2")] { #[derive(Default, Clone, Copy, PartialEq, Eq)] #[repr(C, align(32))] pub struct i16x16 { avx2: m256i } } else if #[cfg(target_feature="sse2")] { #[derive(Default, Clone, Copy, PartialEq, Eq)] #[repr(C, align(32))] pub struct i16x16 { ...
#[allow(unused_variables)] use std:env; fn main(){ y :}
use std::ops::Neg; use sdl2::{pixels::Color, rect::Rect, mouse::SystemCursor, render::{Canvas, Texture}, video}; use sdl2::gfx::primitives::DrawRenderer; use crate::{TextBuffer, Scroller, Window, PaneManager, Cursor, color::STANDARD_TEXT_COLOR}; #[derive(Debug, Clone)] pub struct EditorBounds { pub editor_left...
use proc_macro::{self, *}; use lustre_lib::{object::{Object, RefObject}, reader::{Reader, tokenizer::Tokenizer}}; use std::io::prelude::*; use std::io::Cursor; fn ref_object_to_parsable(refobj: &RefObject) -> String { if let Some(obj) = refobj.as_ref() { format!("Arc::new(Some({}))", object_to_parsable(obj...
// (c) Dean McNamee <dean@gmail.com>, 2012. // (c) Rust port by Katkov Oleksandr <alexx.katkoff@gmail.com>, 2016. // // https://github.com/deanm/css-color-parser-js // https://github.com/7thSigil/css-color-parser-rs // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software a...
// This example just prints "Hello Tock World" to the terminal. // Run `tockloader listen`, or use any serial program of your choice // (e.g. `screen`, `minicom`) to view the message. #![no_std] #![feature(asm)] use libtock::println; use libtock::result::TockResult; libtock_core::stack_size! {0x400} #[libtock::mai...
extern crate bit_vec; pub mod genetic; pub mod algorithm; pub mod distributions; pub mod abstractions; mod samplefitness; pub type Chromosome = bit_vec::BitVec; pub use genetic::Genetic; pub use genetic::gen_custom::GeneticCustom; pub use crate::algorithm::algorithm::AlgorithmParams; pub use crate::algorithm::alg...
#[macro_use] extern crate log; mod worker; use kube::Client; use chrono::Local; use std::{io::Write, sync::Arc}; use tokio::signal::unix::{signal, SignalKind}; #[tokio::main] async fn main() -> anyhow::Result<()> { std::env::set_var("RUST_LOG", "info,kube=debug"); env_logger::Builder::from_env(env_logger::E...
use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn test_open_browser(url: String) { web_sys::console::log_1(&format!("checking in {}", &url).into()); webbrowser::open(&url).expect("failed to open browser"); web_sys::console::log_1(&"yolo".into()); }
/// An enum to represent all characters in the OldNorthArabian block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum OldNorthArabian { /// \u{10a80}: '𐪀' LetterHeh, /// \u{10a81}: '𐪁' LetterLam, /// \u{10a82}: '𐪂' LetterHah, /// \u{10a83}: '𐪃' LetterMeem, /// \u{10a...
use std::thread::spawn; use std::process::Command; use std::num::Wrapping; use std::cmp::max; use libc::{c_uchar,c_int, c_ulong}; use std::ffi::CString; use std::ptr::{ null, null_mut, }; use x11::xlib; use config; use config::KeyCmd; unsafe extern fn error_handler(_: *mut xlib::Display, _: *mut xlib::XErrorEvent...
#[doc = "Reader of register DDFT_CTRL"] pub type R = crate::R<u32, super::DDFT_CTRL>; #[doc = "Writer for register DDFT_CTRL"] pub type W = crate::W<u32, super::DDFT_CTRL>; #[doc = "Register DDFT_CTRL `reset()`'s with value 0"] impl crate::ResetValue for super::DDFT_CTRL { type Type = u32; #[inline(always)] ...
#![allow(clippy::use_self)] // Gives a false positive on the Logos proc-macro #![allow(clippy::non_ascii_literal)] use logos::Logos; pub type Lexer<'a> = logos::Lexer<'a, TokenKind>; #[derive(Debug, Copy, Clone, PartialEq, Eq, Logos)] #[rustfmt::skip] #[logos(subpattern DecDigit = r"[0-9]")] #[logos(subpattern DecD...
use specs::*; use types::*; use SystemInfo; use std::time::Duration; use component::channel::*; use component::event::*; use consts::timer::RESPAWN_TIME; use systems::missile::MissileHit; pub struct SetRespawnTimer { reader: Option<OnPlayerKilledReader>, } #[derive(SystemData)] pub struct SetRespawnTimerData<'a> ...
pub mod housing_parameters; pub use housing_parameters::HousingParameters;
use malvolio::prelude::*; use crate::prelude::*; #[test] fn diffing_regression_2021_06_06() { let mut before = H1::new("") .raw_attribute("¡", "") .wrap() .into_element(vec![0]); let expected_after = H1::new("").wrap().into_element(vec![0]); let diff_before = before.clone(); ...
use intrusive_collections::{intrusive_adapter, LinkedList, LinkedListLink}; const NUM_PLAYERS: usize = 455; const NUM_MARBLES: usize = 71223; struct Marble { value: usize, link: LinkedListLink, } impl Marble { fn new(value: usize) -> Box<Self> { Box::new(Marble { value, li...
use chrono::{NaiveDateTime}; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Comment { pub id: String, pub user_id: u16, pub username: String, pub avatar_url: String, pub topic_id: String, pub content: String, pub agree_count: u16, pub disagree_count: u16, pub status: u8,...
use auto_impl::auto_impl; #[auto_impl(Fn)] trait Greeter { fn greet<const N: usize>(&self, id: usize); } fn main() {}
//判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 // //示例 1: // //输入: 121 //输出: true //示例 2: // //输入: -121 //输出: false //解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。 //示例 3: // //输入: 10 //输出: false //解释: 从右向左读, 为 01 。因此它不是一个回文数。 //进阶: // //你能不将整数转为字符串来解决这个问题吗? fn pow(a: u32, b: i32) -> u32 { if b == 0 { ret...
//! Unit test macro collections. //! //! Contains macros for asserting approximate equivalence for floating-point numbers, and for //! comparing whether or not two floating-point vectors (or any iterable) are approximately //! equivalent. #![warn(missing_docs)] #[macro_export] macro_rules! assert_fp_eq { ($lhs:ex...
#[doc = "Register `BMCR` reader"] pub type R = crate::R<BMCR_SPEC>; #[doc = "Register `BMCR` writer"] pub type W = crate::W<BMCR_SPEC>; #[doc = "Field `BME` reader - Burst Mode enable"] pub type BME_R = crate::BitReader; #[doc = "Field `BME` writer - Burst Mode enable"] pub type BME_W<'a, REG, const O: u8> = crate::Bit...
pub const __AUDIT_ARCH_CONVENTION_MASK: u32 = 0x3000_0000; pub const __AUDIT_ARCH_CONVENTION_MIPS64_N32: u32 = 0x2000_0000; pub const __AUDIT_ARCH_64BIT: u32 = 0x0800_0000; pub const __AUDIT_ARCH_LE: u32 = 0x4000_0000; pub const AUDIT_ARCH_AARCH64: u32 = 0xC000_00B7; pub const AUDIT_ARCH_ALPHA: u32 = 0xC000_9026; pub c...
use anyhow::Result; use rusoto_credential::{AwsCredentials, ChainProvider, ProvideAwsCredentials}; use tokio; async fn find_credentials() -> Result<AwsCredentials> { let provider = ChainProvider::new(); let credentials = provider.credentials().await?; Ok(credentials) } #[tokio::main] async fn main() -> Re...
use super::*; use super::*; use crate::gui::*; use physics::*; use physics::*; #[derive(Default, Clone)] pub struct ControllingSystem; impl<'a> System<'a> for ControllingSystem { type SystemData = (WriteExpect<'a, Touches>, Write<'a, AppState>); fn run(&mut self, data: Self::SystemData) { let (touche...
#![ allow( unused_imports ) ] pub(crate) mod e_handler ; pub(crate) mod color ; pub(crate) mod user_list ; mod import { pub(crate) use { chat_format :: { ServerMsg, ClientMsg } , async_runtime :: { * ...
impl Solution { pub fn get_maximum_generated(n: i32) -> i32 { if n == 0{ return 0; } let mut res = vec![0;n as usize + 1]; res[1] = 1; for i in 2..=n as usize{ res[i] = res[i / 2] + (i & 1) * res[i / 2 + 1]; } res[0..=n as usize].iter(...