text
stringlengths
8
4.13M
pub(crate) mod event; mod file; mod integration; use std::{collections::HashMap, ops::Deref, sync::Arc, time::Duration}; use tokio::sync::{Mutex, RwLock}; use self::{ event::EventHandler, file::{Operation, TestFile, ThreadedOperation}, }; use crate::{ cmap::{ establish::{ConnectionEstablisher, E...
mod language; use chord_composer::{ performance::performance_engine::PerformanceState, theory::{ composition::{Composition, Pattern, PatternEvent}, notes, }, FailResult, SuccessResult, }; use clap::{App, Arg, SubCommand}; use language::strings; use music_timer::music_time::MusicTime; /...
use crate::base::Rewrite; use crate::pos::{AgdaRange, InteractionId, Pos}; use std::fmt::{Display, Error, Formatter}; /// Text in the goal. #[derive(Debug, Clone)] pub struct GoalInput { id: InteractionId, range: AgdaRange, code: String, } impl GoalInput { pub fn new(id: InteractionId, range: AgdaRang...
pub fn min_path_sum(grid: Vec<Vec<i32>>) -> i32 { use std::cmp::min; let m = grid.len(); let n = grid[0].len(); let mut min_sum = vec![vec![None; n]; m]; min_sum[m-1][n-1] = Some(grid[m-1][n-1]); fn sum(min_sum: &mut Vec<Vec<Option<i32>>>, grid: &Vec<Vec<i32>>, i: usize, j: usize, m: usize, n: ...
use register::{mmio::*, register_bitfields, register_structs}; register_bitfields! { u32, /// wdog Configuration WDOGCFG [ /// Counter scale value WDOGSCALE OFFSET(0) NUMBITS(4) [], /// Controls whether the comparator output can set the wdogrst bit and hence cause a full reset. ...
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ use std::time::Duration; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use diskann::model::{Neighbor, NeighborPriorityQueue}; use rand::distributions::{Distribution, Uniform}; use rand::rng...
use crate::source::filters::{AudioFilter, GenericFilter}; use crate::Result; use stainless_ffmpeg::{audio_decoder::AudioDecoder, filter_graph::FilterGraph, order::Filter}; use std::convert::TryInto; pub fn build_audio_filter_graph( audio_filters: &[AudioFilter], audio_decoder: &AudioDecoder, ) -> Result<Option<Fil...
#![allow(dead_code)] #[cfg(test)] mod tests { use crate::*; use crate::days::day05::*; #[test] fn test1() -> AocResult<()> { let data: Data = parse_file(FileType::Example, 2, 1)?; let mut ctx = Context::from_data(data, &[]); ctx.resume()?; assert_eq!(30, ctx.read(0)); ...
use chunk::{Chunk, OpCode}; use disassembler::disassemble_chunk; mod chunk; mod disassembler; fn main() { let mut c = Chunk::new(); c.code.push(OpCode::OpReturn); disassemble_chunk(&c, "test chunk".to_owned()); }
use crate::view::Cursor; #[derive(Clone, Debug)] pub struct Window { cursor: Cursor, start: u64, size: u16, } impl Window { pub fn new() -> Self { Window { cursor: Cursor { column: 0, line: 0 }, start: 0, size: 0, } } pub fn set_cursor(&mut ...
#[doc = "Register `CLRFR` reader"] pub type R = crate::R<CLRFR_SPEC>; #[doc = "Register `CLRFR` writer"] pub type W = crate::W<CLRFR_SPEC>; #[doc = "Field `PROCENDFC` reader - Clear PKA End of Operation flag"] pub type PROCENDFC_R = crate::BitReader; #[doc = "Field `PROCENDFC` writer - Clear PKA End of Operation flag"]...
mod common; mod dimensions; mod layout_hacks; mod menu; mod polymorphic; use std::{cell::{Ref, RefCell, RefMut}, rc::Rc}; use chiropterm::*; pub use self::common::WidgetCommon; pub use self::dimensions::{InternalWidgetDimensions, WidgetDimensions}; pub use self::layout_hacks::LayoutHacks; pub use self::menu::WidgetM...
fn main() { let x = 3.0; let y = 2.0; let result: Option<f64> = if y != 0.0 { Some(x/y) } else { None }; // As expression. let with_default = match result { Some(v) => v, _ => 0.0, }; println!("{}", with_default); // {:?} marker prints the debug output. ...
/** Topic: Generics **/ /** Example: Generic Function **/ fn largest<T: PartialOrd + Copy>(list: &[T]) -> T { let mut largest = list[0]; for &item in list.iter() { if item > largest { largest = item; } } largest } struct Point<T> { x: T, y: T, } /** Example: Impl...
//! A lattice for tracking `il::Constant` values. use error::*; use executor; use il; use il::Expression; use std::collections::{BTreeMap, BTreeSet}; use std::cmp::{Ord, Ordering, PartialOrd}; use std::fmt; use std::ops::BitOr; /// A lattice of `il::Constant` values #[derive(Debug, Clone, Eq, PartialEq)] pub enum La...
use crate::camera::camera::Camera; use crate::objects::hittable::{Hittable, HittableList}; use crate::utils::util::{random_double, write_color, write_pixels_to_file, random_double_in_range}; use crate::vec::vec3::{Color, Point3, Ray, Vec3}; use std::f64::INFINITY; use std::sync::{Arc, Mutex}; use std::time::Instant; us...
/// Get the value of a variable. /// /// ``` /// use arc_runtime::prelude::*; /// let a = 5; /// let b = val!(a); /// ``` #[macro_export] macro_rules! val { ($arg:expr) => { $arg }; } macro_rules! inline { ($($tt:tt)*) => { $($tt)* }; } /// Access a struct's field. /// /// ``` /// use arc_runtime:...
use futures::prelude::*; use futures03::{compat::Compat, TryFutureExt as _}; use futures_timer::Delay; use libp2p::kad::record::{self, store::MemoryStore}; use libp2p::kad::{GetClosestPeersError, KademliaConfig}; use libp2p::kad::{Kademlia, KademliaEvent, Quorum, Record}; use libp2p::{ core::{either::EitherOutput, Co...
use std::collections::BTreeSet; use crate::kind::Kind; use crate::structure::Structure; pub struct Cluster { pub name: String, pub structures: Vec<Structure>, } impl Cluster { pub fn print(&self) { let kinds = Cluster::unique_kinds(&self); print!(" {:>23} |", ""); for kind in k...
use crate::CosmosError; use serde::ser::Serialize; use std::borrow::Cow; #[derive(Debug, Clone, PartialEq, PartialOrd)] pub struct ToJsonVector { last_serialized_string: Option<String>, serialized_string: String, } impl ToJsonVector { pub fn new() -> Self { Self { last_serialized_strin...
use std::fs; fn run_program(mut program: Vec<u32>, arg1: u32, arg2: u32) -> u32 { program[1] = arg1; program[2] = arg2; let mut i: usize = 0; while i < program.len() { let opcode = program[i]; i+= 1; if opcode == 99 { break; } if opcode == 1 || op...
fn main() { let start = std::time::Instant::now(); let data = std::fs::read_to_string("/Users/regan/MyRepos/aoc/2021-03/input.txt").expect("Unable to create String from input.txt"); let time1 = start.elapsed(); println!("Read file in {:?}", time1); let codes = parse_input(&data); println!("Parse...
//! Back-end agnostic joystick events. use std::any::Any; use { GenericEvent, JOYSTICK_AXIS }; /// Components of a joystick button event. Not guaranteed consistent across /// backends. #[derive(Copy, Clone, RustcDecodable, RustcEncodable, PartialEq, Eq, Debug, Hash)] pub struct JoystickButton { /// Which joysti...
use frame_system::offchain::{SendSignedTransaction, Signer}; use futures::compat::Future01CompatExt; use pallet_balances::Call as BalancesCall; use node_runtime::{Runtime, RuntimeApi}; use sp_core::crypto::Pair; use sp_keyring::Sr25519Keyring; use sp_runtime::{traits::IdentifyAccount, MultiSigner, MultiSignature}; use ...
#[doc = "Reader of register TX_RX_SYNTH_DELAY"] pub type R = crate::R<u32, super::TX_RX_SYNTH_DELAY>; #[doc = "Writer for register TX_RX_SYNTH_DELAY"] pub type W = crate::W<u32, super::TX_RX_SYNTH_DELAY>; #[doc = "Register TX_RX_SYNTH_DELAY `reset()`'s with value 0"] impl crate::ResetValue for super::TX_RX_SYNTH_DELAY ...
#[macro_use] extern crate log; extern crate libc; extern crate pretty_env_logger; extern crate rte; mod ethapp; mod ethtool; use std::env; use rte::ethdev::EthDevice; use rte::*; use ethtool::*; const PORT_RX_QUEUE_SIZE: u16 = 128; const PORT_TX_QUEUE_SIZE: u16 = 256; const PKTPOOL_EXTRA_SIZE: u16 = 512; const PK...
use super::super::{components, resources}; use specs::{Read, ReadStorage, System}; #[derive(Clone, Debug)] pub struct Color { pub r: u8, pub g: u8, pub b: u8, } impl PartialEq for Color { fn eq(&self, other: &Self) -> bool { self.r == other.r && self.g == other.g && self.b == other.b } } ...
#![allow(dead_code)] #![allow(unused_variables)] #[macro_use] extern crate hex_literal; #[macro_use] extern crate serde; #[macro_use] extern crate serde_json; pub mod env; pub mod errors; mod nfc; mod nfc_module; mod qr_module; pub mod utils; mod web; pub use crate::errors::*; use crate::utils::CheckedSender; use se...
#![deny(clippy::all)] //! Riddle crate dealing with user input (keyboard, mouse, gamepad). //! //! Built largely on the back of `gilrs` and its dependencies for controller support, //! and consumes system events from a `riddle-platform` compatible system (`winit`). //! //! The primary functions of this crate is to con...
use crate::message_handling::command_handler::command::Command; use crate::message_handling::command_handler::parameter_matcher::RequestParameter; use crate::message_handling::permission::PermissionLevel; use regex::Regex; use serenity::client::Context; use serenity::model::channel::Message; use unicase::UniCase; lazy...
use bevy::prelude::*; use super::{Piece, PieceColor, PieceType}; pub fn spawn_knight( commands: &mut Commands, material: Handle<StandardMaterial>, piece_color: PieceColor, position: (u8, u8), asset_server: &AssetServer, ) { let mesh_1: Handle<Mesh> = asset_server.load("models/chess_kit/pieces....
use std::any::Any; use std::fmt; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread::Result; use crate::coroutine_impl::Coroutine; use crate::sync::{AtomicOption, Blocker}; use generator::Error; pub struct Join { // the coroutine that waiting for this join handler to_wake: Atom...
use std::time::Instant; fn main() { let start = Instant::now(); // do stuff let elapsed = start.elapsed(); // debug format: println!("{:?}", elapsed); // or format as milliseconds: println!("Elapsed: {} ms", (elapsed.as_secs() * 1_000) + (elapsed.subsec_nanos() / 1_000_000) a...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ //! Serialization support for poll-related enums and structs. use core::fmt; use serde::Deseriali...
use apllodb_immutable_schema_engine_infra::test_support::sqlite_database_cleaner::SqliteDatabaseCleaner; use apllodb_server::ApllodbServer; use apllodb_shared_components::{DatabaseName, Session}; use futures::FutureExt; use super::{session_with_db, Step, Steps}; #[allow(dead_code)] #[derive(Clone, Debug)] pub enum Se...
extern crate k8s_openapi; extern crate kube; #[macro_use] extern crate log; extern crate serde_derive; extern crate serde_json; extern crate serde_yaml; extern crate tokio; use clap::{App, Arg}; use env_logger::Env; use kube::client::APIClient; use kube::config; use k8s_gcr_auth_helper::{Runner, Setup, Targets, Watch...
#![allow(dead_code)] #![feature(optin_builtin_traits)] #![feature(specialization)] // Crates with macros #[macro_use] extern crate log; #[macro_use] extern crate dimensioned; #[macro_use] extern crate specs_derive; #[macro_use] extern crate shred_derive; #[macro_use] extern crate lazy_static; #[cfg_attr(feature = "ser...
mod generation_animator; mod solution_animator; mod maze_animator; pub use maze_animator::*; mod waiting_animator; pub use waiting_animator::*; use nannou::prelude::*; pub trait Animator { fn update(&mut self); fn draw(&self, draw: &Draw, window: &Rect); fn done(&self) -> bool; }
/// An inline babe call. /// /// # Semantics /// /// Same as [`elements::BabelCall`] but inline. /// /// # Syntax /// /// ```text /// call_NAME[HEADER](ARGUEMTNS)[HEADER] /// ``` /// /// `NAME` can contain any character besides `(`, `[`, whitespace and newline. /// /// `HEADER` can contain any characer besides `]` and ...
use std::fs::File; use std::io::{BufRead, BufReader}; use std::collections::{HashSet, HashMap}; use std::iter::FromIterator; const D : [(i32, i32); 4] = [(-1, 0), (1, 0), (0, -1), (0, 1)]; fn insert_vpoint(visit_points : &mut HashMap<(usize, usize), HashSet<usize>>, pos : &(usize, usize), ...
// This file is part of Basilisk-node. // Copyright (C) 2020-2021 Intergalactic, Limited (GIB). // SPDX-License-Identifier: Apache-2.0 // 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 // /...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use super::{models, API_VERSION}; #[non_exhaustive] #[derive(Debug, thiserror :: Error)] #[allow(non_camel_case_types)] pub enum Error { #[error(transparent)] Operations_List(#[from] operations::l...
//! This library provides an interface to Rust Crypto([1]) for encrypting and decrypting files. //! It provides the following features: //! //! 1. A high-level configuration interface to specify various options //! //! 2. Generation and verification of HMACs([2]) for the encrypted data. //! //! In the future, this libr...
mod article; mod comment; mod errors; mod models; mod user; // mod middlewares; use errors::CustomError; use ntex::web::{self, middleware, service, App, HttpServer}; use sqlx::{postgres::PgPoolOptions, Pool, Postgres}; use std::{env, sync::Arc}; #[derive(Debug, Clone)] pub struct AppState { pub db_pool: Pool<Post...
use libc::{c_int, c_uint, c_void, FILE}; use MtrNode; /// Default flag value in `Mtr_MakeGroup`. pub const MTR_DEFAULT: c_uint = 0; /// See `Mtr_MakeGroup`. pub const MTR_TERMINAL: c_uint = 1; /// See `Mtr_MakeGroup`. pub const MTR_SOFT: c_uint = 2; /// See `Mtr_MakeGroup`. pub const MTR_FIXED: c_uint = 4; /// See `Mt...
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ #[allow(clippy::module_inception)] mod disk_index; pub use disk_index::DiskIndex; pub mod ann_disk_index;
// use rodio::{Decoder, OutputStream, Sink}; // use std::env; // use std::fs::File; use app::App; use std::io; // use std::io::BufReader; use tui::backend::CrosstermBackend; use tui::Terminal; use utils::draw_ui; mod app; mod utils; fn main() -> Result<(), io::Error> { let stdout = io::stdout(); let backend =...
extern crate chrono; use chrono::*; pub fn after(date: DateTime<UTC>) -> DateTime<UTC> { match date.checked_add(Duration::seconds(1000000000)){ Some(date) => date, None => date } }
use std::path::Path; use swc_common::{ FileName, comments::SingleThreadedComments, SourceFile, BytePos, Spanned }; use swc_ecmascript::parser::{Parser, StringInput, Syntax, error::{SyntaxError, Error as SwcError}, lexer::Lexer, Capturing, JscTarget, token::{TokenAndSpan}}; use dprint_core::types::{ErrBox, Error}; ...
#[doc = "Reader of register TZENR1"] pub type R = crate::R<u32, super::TZENR1>; #[doc = "Writer for register TZENR1"] pub type W = crate::W<u32, super::TZENR1>; #[doc = "Register TZENR1 `reset()`'s with value 0"] impl crate::ResetValue for super::TZENR1 { type Type = u32; #[inline(always)] fn reset_value() ...
use serde_json::value::*; use tide::prelude::*; use tide::{Body, Response, StatusCode}; use uuid::Uuid; #[derive(Debug)] pub struct NewGame { pub uuid: Uuid, pub width: usize, pub height: usize, } pub fn new_game_created(new_game: &NewGame) -> tide::Result { Ok(Response::builder(StatusCode::Created) ...
use std::io::{self, BufRead}; //use std::collections::BTreeSet; fn solve(n: usize, p: &[usize], dict: &[u8]) { let l = dict.len(); let m = (l as f64 / n as f64).ceil() as usize; // println!("line={} n={} perm={:?}", line, n , p); // println!("len={} mod={} id={:?}", l, m, id); let mut res = String...
use crate::global::mark_new_run; ///! Reader is used for reading items from datasource (e.g. stdin or command output) ///! ///! After reading in a line, reader will save an item into the pool(items) use crate::options::SkimOptions; use crate::spinlock::SpinLock; use crate::{SkimItem, SkimItemReceiver}; use crossbeam::c...
use yew::prelude::*; pub struct Model { link: ComponentLink<Self>, } pub enum Msg {} impl Component for Model { type Message = Msg; type Properties = (); fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self { Self { link } } fn update(&mut self, _msg: Self::Message) -> S...
#[allow(unused_imports)] use super::prelude::*; use super::intcode::IntcodeDevice; type Input = IntcodeDevice; pub fn input_generator(input: &str) -> Input { input.parse().expect("Error parsing the IntcodeDevice") } pub fn part1(input: &Input) -> i64 { let mut device = input.clone(); device.memory[1] = 12...
use std::collections::HashMap; fn main() { let mut a = HashMap::new(); a.insert("Hello, world!".to_string(), 1i32); a.insert("Hi".to_string(), 10); }
// A collection of useful utilities for bork use clap::{Values, ArgMatches}; use std::collections::HashSet; use constants; // Merge several arg and subcommand results into a single structure pub fn merge_package_vecs<'a>(package_lists: &[Option<Values<'a>>]) -> HashSet<&'a str> { package_lists.iter().fold(HashSe...
// Copyright (c) Facebook, Inc. and its affiliates. use crossbeam::channel::{self, select, tick, Receiver, Sender}; use linreg::linear_regression_of; use log::{debug, info, warn}; use num::Integer; use pid::Pid; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; use std::thread::{sleep, spawn, JoinHandle}; us...
use super::*; use crate::helpers::algorithms::p; use crate::helpers::models::domain::create_empty_problem; use crate::helpers::models::problem::test_single_with_id_and_location; use crate::helpers::solver::*; use crate::helpers::utils::random::FakeRandom; use crate::models::common::Location; use crate::utils::{Environm...
use bytes::Buf; use rand::{thread_rng, Rng}; use std::collections::VecDeque; use std::io::Cursor; use std::mem; use hex; use super::{QuicError, QuicResult, QUIC_VERSION}; use codec::Codec; use crypto::Secret; use frame::{Ack, AckFrame, CloseFrame, Frame, PaddingFrame, PathFrame, CryptoFrame}; use packet::{Header, L...
// Copyright 2022 The Tari Project // SPDX-License-Identifier: BSD-3-Clause //! A deterministic randomizer with utility functions for operating on numbers and arrays in a reproducible and //! platform-indepdent way. use alloc::vec::Vec; use core::convert::TryFrom; use rand_core::{CryptoRng, RngCore, SeedableRng}; /...
#[doc = "Reader of register VMCR"] pub type R = crate::R<u32, super::VMCR>; #[doc = "Writer for register VMCR"] pub type W = crate::W<u32, super::VMCR>; #[doc = "Register VMCR `reset()`'s with value 0x004f_0000"] impl crate::ResetValue for super::VMCR { type Type = u32; #[inline(always)] fn reset_value() ->...
#![cfg_attr(feature = "unstable", allow(unstable_features))] #![cfg_attr(feature = "unstable", feature(plugin))] #![cfg_attr(feature = "unstable", plugin(clippy))] // _ _ // | |_| |__ ___ ___ __ _ // | __| '_ \ / _ \/ __/ _` | // | |_| | | | __/ (_| (_| | // \__|_| |_|\___|\___\__,_| // // licensed under the MI...
extern crate clap; extern crate failure; extern crate barcode_assign; use std::io; use std::io::Write; use std::process; use clap::{App, Arg}; use barcode_assign::bc_frag::*; fn main() { match wrapper() { Err(e) => { io::stderr().write(format!("{}\n", e).as_bytes()).unwrap(); pr...
use pulldown_cmark::{Event, Tag}; pub fn md<'a, I>(events: I) -> String where I: Iterator<Item = Event<'a>>, { let mut res = String::new(); for event in events { match event { Event::Text(t) => { res.push_str(&t); } Event::SoftBreak => { ...
#[derive(Debug)] enum Direction { Right, Left, Up(String), Down(u8) } impl Direction { fn impl_ppt(&self) { // &Direction Readable // Direction Move // &mut Direction writeable println!("We are in impl_ppt Method"); println!("...
use anyhow::Context; use rusqlite::Transaction; /// Adds `starknet_state_updates` table. pub(crate) fn migrate(transaction: &Transaction<'_>) -> anyhow::Result<()> { transaction .execute_batch( r" -- Re-create block hash index as unique so that it can be used as a foreign key ...
use derivative::Derivative; use k8s_openapi::{api::core::v1::ObjectReference, apimachinery::pkg::apis::meta::v1::OwnerReference}; use kube_client::{ api::{DynamicObject, Resource}, core::ObjectMeta, ResourceExt, }; use std::{ fmt::{Debug, Display}, hash::Hash, }; #[derive(Derivative)] #[derivative(...
extern crate daemon_runner; extern crate fern; use std::{time, thread}; use daemon_runner::bitcoincore_rpc::RpcApi; use daemon_runner::bitcoin; use daemon_runner::{DaemonRunner, bitcoind}; fn setup_logger() { fern::Dispatch::new() .format(|out, message, rec| { out.finish(format_args!("[{}][{}] {}", rec...
use libc; use std::net::Ipv4Addr; pub const IFNAMSIZ: usize = 16; pub const SIOCGIFNAME: libc::c_ulong = 0x8910; /* get iface name */ pub const SIOCGIFADDR: libc::c_ulong = 0x8915; /* get PA address */ pub const SIOCSIFADDR: libc::c_ulong = 0x8916; /* set PA address ...
/**/ use std::collections::HashMap; use pyo3::prelude::*; use pyo3::types::{PyTuple, PyBytes}; use pyo3::exceptions; use pyo3::class::iter::{PyIterProtocol, IterNextOutput}; use osm_xml as osm; use crate::map; use crate::queries; use crate::queries::QueryBuilder; use crate::network; #[pyclass] #[derive(Clone)] /// ...
#[doc = "Register `CTRL` reader"] pub type R = crate::R<CTRL_SPEC>; #[doc = "Register `CTRL` writer"] pub type W = crate::W<CTRL_SPEC>; #[doc = "Field `ENABLE` reader - Counter enable"] pub type ENABLE_R = crate::BitReader; #[doc = "Field `ENABLE` writer - Counter enable"] pub type ENABLE_W<'a, REG, const O: u8> = crat...
use std::io::{Write, BufWriter, ErrorKind}; use std::fs::{File, hard_link}; use std::path::PathBuf; use source::Source; use storage::StorageBackend; use storage::error::{StorageError, StorageResult}; use storage::util::*; use storage::record::StorageRecord; pub struct FsStorage { path: PathBuf } impl FsStorage { ...
use solana_sdk::pubkey::{ Pubkey, read_pubkey_file, write_pubkey_file }; use solana_sdk::instruction::{ Instruction }; use solana_sdk::transaction::{ Transaction }; use solana_sdk::signer::{ Signer }; use solana_sdk::signer::keypair::{ Keypair, read_keypair_file }; use solana_sdk::program_pack::{ Pack }; use spl_token:...
//! This crate provides simple bindings for Rust to the Sightglass API. The primary intent is to //! make it easy to instrument Rust code that will be compiled to Wasm and measured with Sightglass. //! //! For example: //! ```compile_fail //! use sightglass_api as bench; //! bench::start(); //! let work = 42 * 42; //! ...
use specs::{Entities, Read, ReadStorage, System, WriteStorage}; use components::*; use systems::CollisionEvent; pub struct PickupSystem { } impl PickupSystem { pub fn new() -> Self { Self { } } } impl<'a> System<'a> for PickupSystem { type SystemData = ( Read<'a, Vec<CollisionEve...
use swc_common::DUMMY_SP; use swc_ecmascript::{ ast::*, visit::{Node, Visit, VisitWith}, }; pub(crate) fn contains_cjs(m: &Module) -> bool { let mut v = CjsFinder::default(); m.visit_with(&Invalid { span: DUMMY_SP }, &mut v); v.found } #[derive(Copy, Clone, Default)] struct CjsFinder { found: ...
use std::default::Default; use swgl::camera2d::interface::CameraType; use swgl::gl_wrapper::vertex_array_object::PrimitiveType; use swgl::global_tools::helpers::random_numbers::get_random; use swgl::global_tools::vector2::Vector2; use swgl::graphics_2d::color::Color; use swgl::graphics_2d::renderer::geometry_renderer:...
mod command; mod downstream; mod telemetry; mod ttn; mod x509; #[cfg(feature = "rustls")] use actix_tls::accept::rustls::Session; use actix_web::{ get, middleware, web::{self, Data}, App, HttpResponse, HttpServer, Responder, }; use dotenv::dotenv; use drogue_cloud_endpoint_common::command::{ Commands, ...
// This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 // // ht...
//! How to use environment variable fallback an how it //! interacts with `default_value`. //! //! Running this example with --help prints this message: //! ----------------------------------------------------- //! env 0.3.25 //! Example for allowing to specify options via environment variables //! //! USAGE: //! e...
extern crate std; use super::super::prelude::{ Application , Text , DialogBoxCommand , MessageBoxStyle , DllService , DialogBoxService }; pub fn Application() -> Application { DllService::GetModuleHandle(None) } pub fn MessageBox( text : Option<Text> , title : Option<Text> , style...
use common::event::EventPublisher; use common::result::Result; use crate::domain::collection::{CollectionId, CollectionRepository}; use crate::domain::publication::PublicationId; pub struct RemovePublication<'a> { event_pub: &'a dyn EventPublisher, collection_repo: &'a dyn CollectionRepository, } impl<'a> R...
// This file is part of Substrate. // Copyright (C) 2018-2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 // // ht...
use parity_scale_codec::{Encode, MaxEncodedLen}; #[derive(Encode)] struct NotMel; #[derive(Encode, MaxEncodedLen)] enum UnsupportedVariant { NotMel(NotMel), } fn main() {}
extern crate ws; extern crate env_logger; extern crate libc; extern crate tty; use std::process::Command; use tty::FileDesc; use tty::TtyServer; use ws::listen; fn main() { env_logger::init().unwrap(); if let Err(error) = listen("127.0.0.1:4444", |out| { move |msg| { println!("Server s...
#![no_std] #![feature(start)] #![no_main] use ferr_os_librust::io; extern crate alloc; use alloc::string::String; use alloc::vec::Vec; #[no_mangle] pub extern "C" fn _start(heap_address: u64, heap_size: u64, args: u64, args_number: u64) { ferr_os_librust::allocator::init(heap_address, heap_size); let argume...
pub use self::engine::{Engine, EngineData, EngineTransition, SimpleEngine}; pub mod basic; pub mod engine;
/// This function implements a simple for loop. fn for_loop() { let range = 0..10; for _x in range { print!("."); } println!(""); } /// This function uses an iterator to go over the range. fn iter_loop() { let mut range = 0..10; loop { match range.next() { Some(x) =...
use amethyst::core::{SystemDesc, Transform}; use amethyst::derive::SystemDesc; use amethyst::ecs::{Join, ReadStorage, System, SystemData, World, WriteStorage}; // You'll have to mark PADDLE_HEIGHT as public in pong.rs use crate::state::Krab; #[derive(SystemDesc)] pub struct KrabSystem; impl<'s> System<'s> for KrabSy...
use crate::arena::{block, component, ArenaMut, ArenaRef, BlockKind, BlockMut, BlockRef}; use crate::libs::random_id::U128Id; use nusa::v_node::v_element::VEvent; use std::cell::RefCell; use std::collections::HashSet; use std::rc::Rc; use wasm_bindgen::{prelude::*, JsCast}; pub mod table_tool; mod table_tool_state; mod...
use std::time::{Duration, Instant}; use spin_sleep::SpinSleeper; /// Helper struct for video/audio timing pub struct Timer { start: Instant, sleeper: SpinSleeper, } impl Timer { pub fn new() -> Self { Self { start: Instant::now(), sleeper: SpinSleeper::default(), }...
pub static TOPIC: &'static str = "bank_account";
use specs::Join; pub struct BouncerControlSystem; impl<'a> ::specs::System<'a> for BouncerControlSystem { type SystemData = ( ::specs::ReadStorage<'a, ::component::Contactor>, ::specs::ReadStorage<'a, ::component::Bouncer>, ::specs::WriteStorage<'a, ::component::Momentum>, ::specs:...
#[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; use num::{Zero, One}; use rand::{Rng, Rand}; use alga::general::ClosedAdd; use core::{ColumnVector, Scalar}; use core::dimension::{DimName, U1, U2, U3, U4, U5, U6}; use core::storage::OwnedStorage; use core::allocator::OwnedAllocator; use geometry::Tra...
use std::error; use std::path::{Path, PathBuf}; /// Validate and return a directory path. pub fn get_valid_dirpath<P: AsRef<Path>>(path: P) -> Result<PathBuf, Box<dyn error::Error>> where PathBuf: From<P>, { match PathBuf::from(path) { v if !v.exists() => Result::Err(From::from(format!("path \"{:?}\" w...
use std::io; use satellite_numeric::pddl_parser::make_satellite_problem_from; use anyhop::{process_expr_cmd_line, CmdArgs}; fn main() -> io::Result<()> { let cmd_args = CmdArgs::new()?; let verbosity:u32 = match cmd_args.num_from("v") { Some(n) => n, None => 0, }; let _logger = setup_lo...
// Disable dead code macros in "build" mode but keep them on in "test" builds so that we don't // get spurious warnings for functions that are currently only used in tests. This is useful for // development but can be removed later. #![cfg_attr(not(test), allow(dead_code))] #[macro_use] extern crate lazy_static; exter...
use crate::config::Configuration; use crate::error::Error; use std::fmt; use std::path::PathBuf; const SYSTEMD_USER_DIR: &str = "systemd/user"; #[derive(Debug, Clone)] pub struct SystemdStorage { basedir: PathBuf, storage: DirectoryStorageHandler, } impl Default for SystemdStorage { fn default() -> Self ...
use crate::model; pub async fn fetch_servers() -> model::ReadableServersMessage { let client = reqwest::Client::new(); let res = client .get("https://tanklar.glitch.me/tanklar_api/readableServers") .header("user-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chr...