text
stringlengths
8
4.13M
//! This project is used for creating two different digital sinusoidal signals //! with certain frequencies. //! //! Runs entirely locally without hardware. Rounding might be different than on //! device. Except for when printing you must be vigilent to not become reliant //! on any std tools that can't otherwise port ...
// Import hacspec and all needed definitions. use hacspec_lib::*; // WARNING: // This spec does not provide secret independence, and treats all keys as public. // Consequently, it should only be used as a FORMAL SPEC, NOT as a reference implementation. // Type definitions for use in poly1305. bytes!(PolyKey, 32); co...
use std::thread; use std::sync::{mpsc, Arc, Mutex}; struct Worker { thread: Option<thread::JoinHandle<()>>, id: usize, } impl Worker { fn new(id: usize, receiver: Arc<Mutex<mpsc::Receiver<Message>>>) -> Self { Self{ id, thread: Some(thread::spawn(move || loop { let message = receiver.lock().unwrap().rec...
use failure::Error; use client::Jenkins; use helpers::Class; use super::Job; use action::CommonAction; use build::ShortBuild; use property::CommonProperty; use queue::ShortQueueItem; use super::{BallColor, HealthReport, JobBuilder}; job_build_with_common_fields_and_impl!(/// A pipeline project #[derive(Deserialize,...
// Import hacspec and all needed definitions. use hacspec_lib::*; const ROUNDS: usize = 24; pub const SHA3224_RATE: usize = 144; pub const SHA3256_RATE: usize = 136; pub const SHA3384_RATE: usize = 104; pub const SHA3512_RATE: usize = 72; pub const SHAKE128_RATE: usize = 168; pub const SHAKE256_RATE: usize = 136; arr...
//! Provide helpers for making ioctl system calls //! //! Currently supports Linux on all architectures. Other platforms welcome! //! //! This library is pretty low-level and messy. `ioctl` is not fun. //! //! What is an `ioctl`? //! =================== //! //! The `ioctl` syscall is the grab-bag syscall on POSIX syste...
fn main() { let x = 5; let x = "something"; { let x = 5; let y = 10; } let y = "new"; }
use sudo_test::{Command, Env}; use crate::{Result, HOSTNAME}; macro_rules! assert_snapshot { ($($tt:tt)*) => { insta::with_settings!({ prepend_module_to_snapshot => false, }, { insta::assert_snapshot!($($tt)*) }) }; } // NOTE all the input sudoers files have e...
extern crate rusqlite; use std::result::Result; use std::string::String; // TODO: use rusqlite::Connection pub struct Database { conn: rusqlite::Connection, } #[derive(Debug)] pub struct Artist { pub id: i32, pub name: String, pub musicbrainz_id: String, pub last_checked: i64 } impl Database { ...
use shorthand::ShortHand; #[derive(ShortHand, Default, PartialEq, Debug)] #[shorthand(enable(try_into))] struct Example { value: String, other: Option<String>, } #[test] fn test_try_into() { let _: Result<&mut Example, ::core::convert::Infallible> = Example::default().try_value("s"); assert_eq!( ...
use std::collections::vec_deque::*; type Book = (usize, usize); #[derive(Debug,PartialEq)] pub enum LibraryState { SignUpNotStarted, SignUpStarted(usize), SignedUp, Empty } #[derive(Debug)] pub struct Library { pub state: LibraryState, pub books: VecDeque<Book>, signup_days: usize, bo...
mod inner_decoder; use crate::frame_data::FrameData; use inner_decoder::InnerDecoder; use stainless_ffmpeg::prelude::*; pub struct Decoder { inner_decoder: InnerDecoder, graph: Option<FilterGraph>, } impl Decoder { pub fn new_audio_decoder(decoder: AudioDecoder, graph: Option<FilterGraph>) -> Self { let in...
use mio::unix::SourceFd; use mio::{Events, Interest, Poll, Token}; use nix::errno::Errno; // vim: shiftwidth=2 use nix::fcntl::{open, OFlag}; use nix::sys::stat::Mode; use nix::unistd::{read, write}; use nix::Error; use libc::input_event; use std::mem::size_of; use uinput_sys::{ui_set_evbit, EV_SYN, EV_KEY, EV_MSC, ...
use serde::{Deserialize, Serialize}; use futures::FutureExt; use rstreams::{events::Event, BotInvocationEvent, LeoCheckpointOptions, LeoReadOptions, LeoSdk, AllProviders, Error}; use rstreams::aws::AWSProvider; use rusoto_signature::Region; use lambda::{run, handler_fn}; use anyhow::{anyhow}; pub struct ExampleSdkConf...
use Entity; pub struct World { regions: Map<Vector2<u64>, Region>, } pub struct Region { chunks: Map<Vector2<u64>, Chunk>, } pub struct Chunk { blocks: [[[Block;32];32];32], } pub struct Block { material: Material, } pub struct Material { resistance: f32, opacity: f32, }
use crate::SizeComparison; use structopt::StructOpt; #[derive(Debug, StructOpt)] #[structopt( name = "fnd", about = "A tiny command line tool to find file paths based on substring matching or regular expressions", setting = structopt::clap::AppSettings::ColoredHelp )] pub struct Flags { pub query: Opti...
extern crate pnet_datalink; extern crate actix_web; use actix_web::{http, server, App, Path, Responder}; fn index(info: Path<(u32, String)>) -> impl Responder { format!("Hello {}! id:{}", info.1, info.0) } fn main() { for interface in pnet_datalink::interfaces() { println!("{:?}", interface.ips); ...
use git2::Repository; use git2::DiffFormat; use std::path::PathBuf; struct Arguments { path: PathBuf, } fn main() { let args = Arguments { path: ".".into() }; let repo = match Repository::open(args.path) { Ok(repo) => repo, Err(e) => panic!("failed to open: {}", e), }; let mut revwa...
//! Top-level lib.rs for `cretonne_simplejit`. #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces, unstable_features)] #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(feature = "cargo-clippy", allow(new_without_defa...
use::std::ops;
#[derive(Debug, Deserialize, PartialEq, Eq, Clone)] pub struct ValveSettings { pub name: String, pub socket: String, pub gpio: u8 }
//! Components that are useful for all types of entities pub mod npc; pub mod map;
use actix_web::{ web, web::{post, resource, ServiceConfig}, HttpResponse, Result, }; use reqwest::{self, Error, Response}; use serde::{Deserialize, Serialize}; use serde_json::json; #[derive(Debug, Deserialize, Serialize)] pub struct UserNotificationForm { token: String, from: String, to: Stri...
use crate::utils::Ops; use erased_serde::serialize_trait_object; use std::any::Any; /* * This is the base for every AST type */ pub trait AstBase: dyn_clone::DynClone + erased_serde::Serialize + std::fmt::Debug { fn get_type(&self) -> Ops; fn as_self(&self) -> &dyn Any; } dyn_clone::clone_trait_object!(AstB...
#![doc(html_root_url = "https://docs.rs/rustfm-scrobble/1.0.0")] #![deny(clippy::all)] #![deny(clippy::pedantic)] //! # rustfm-scrobble //! //! Client for the Last.fm Scrobble API v2.0. Allows easy access to the most-commonly used Scrobble/Now Playing //! endpoints in the Last.fm API, as well as robust support for mult...
impl Solution { pub fn maximum_element_after_decrementing_and_rearranging(mut arr: Vec<i32>) -> i32 { let n = arr.len(); arr.sort_unstable(); arr[0] = 1; for i in 1..n{ arr[i] = arr[i].min(arr[i - 1] + 1); } arr[n - 1] } }
use totsu::prelude::*; use totsu::MatBuild; use totsu::totsu_core::{MatOp, solver::{Operator, LinAlg}}; use super::La; // pub struct ProbOpB<'a> { x_sz: usize, t_sz: usize, target_lx_norm1: f64, one: MatBuild<La>, xh: MatOp<'a, La>, } impl<'a> ProbOpB<'a> { pub fn new(widt...
use crate::cli::login::Login; use crate::cli::news::News; use crate::cli::query::Query; use crate::cli::thread::Thread; use crate::cli::tree::Tree; use crate::cli::HnCommand; use crate::error::HnError; use clap::App; use clap::ArgMatches; /// Top level parser/cmd for the cli pub struct HackerNews; impl HnCommand for ...
use std::env; fn gcd2(mut a: u64, mut b: u64) -> u64 { while b != 0 { let c = b; b = a % b; a = c; } a } fn main() { // XXX skip(1) to skip program name: let nums = env::args().skip(1).map(|s| s.parse().unwrap()); let gcd = nums.fold(0, gcd2); println!("{}", gcd)...
use impl_ops::*; use rand::Rng; use std::ops::{self, Neg, Range}; #[derive(Debug, Clone, Copy)] pub struct Vec3 { x: f64, y: f64, z: f64, } impl Neg for Vec3 { type Output = Self; fn neg(self) -> Self::Output { self * -1.0 } } impl_op_ex!(+ |lhs: &Vec3, rhs: &Vec3| -> Vec3 { Vec3...
use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; #[allow(dead_code)] struct Scanner<'a> { cin: StdinLock<'a>, } #[allow(dead_code)] impl<'a> Scanner<'a> { fn new(cin: StdinLock<'a>) -> Scanner<'a> { Scanner { cin: cin } } fn read<T: FromStr>(&mut self) -> Option<T> { let t...
//! Provides information about the initial status of the system. mod freestanding; mod multiboot; mod multiboot2; #[cfg(target_arch = "x86_64")] use arch::{self, vga_buffer, Architecture}; use memory::{Address, MemoryArea, PhysicalAddress, PAGE_SIZE}; /// Lists possiblities for boot sources. enum BootMethod { ///...
use crate::{config::Config, Server}; use anyhow::{anyhow, Context, Result}; use futures::{io::BufReader, AsyncBufReadExt, AsyncReadExt, StreamExt}; use log::{debug, error, info}; use serde::Serialize; use spa_server::re_export::{ error::{ErrorBadRequest, ErrorInternalServerError}, get, http::StatusCode, ...
fn main() { println!("Hello, world!"); let mut user = User { username: String::from("user_i"), email: String::from("test@gmail.com"), sign_in_count: 2, active: true, }; user.email = String::from("test"); println!("email: {}",build_user(String::from("test@gmail.com"...
#[macro_use] extern crate serde_derive; mod config; use native_tls::{TlsConnector, TlsStream}; use std::io::Write; use std::net::TcpStream; use std::fs::File; use std::thread; use std::time::Duration; use mqtt::{Encodable, Decodable}; use mqtt::packet::*; use mqtt::{TopicName}; use mqtt::control::variable_header::Conn...
use once_cell::sync::OnceCell; use std::io::{Result, Write}; use std::sync::{Mutex, MutexGuard, PoisonError}; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream as Stream, WriteColor}; static TERM: OnceCell<Mutex<Term>> = OnceCell::new(); pub fn lock() -> MutexGuard<'static, Term> { TERM.get_or_init(||...
pub const ITIMER_REAL: i32 = 0; pub const ITIMER_VIRTUAL: i32 = 1; pub const ITIMER_PROF: i32 = 2;
use std::env; use std::fs; trait Validator<T> { fn new(line: &str) -> T; fn valid(&self) -> bool; } struct CharacterCountValidator { character: char, min: u32, max: u32, password: String, } impl Validator<CharacterCountValidator> for CharacterCountValidator { fn new(line: &str) -> Charact...
use amethyst::{ core::transform::Transform, ecs::prelude::{Entities, Join, ReadStorage, System}, }; pub struct BelowZero; impl<'s> System<'s> for BelowZero { type SystemData = (Entities<'s>, ReadStorage<'s, Transform>); fn run(&mut self, (entities, transforms): Self::SystemData) { for (e, tra...
use std::collections::HashSet; use std::io::Cursor; use meilidb_core::DocumentId; use meilidb_schema::SchemaAttr; use rmp_serde::decode::{Deserializer as RmpDeserializer, ReadReader}; use rmp_serde::decode::{Error as RmpError}; use serde::{de, forward_to_deserialize_any}; use crate::database::Index; pub struct Deser...
use std::mem::size_of; use cfg_if::cfg_if; use super::buffers; pub trait Encoder { fn logpack_encode(&self, buf: &mut buffers::BufEncoder) -> Result<(), (usize, usize)>; fn logpack_sizer(&self) -> usize; } macro_rules! simple { ($a:tt) => { impl Encoder for $a { #[inline(always)] ...
#![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)] Namespaces_ListAuthorizationRules(#[f...
pub struct Score { pub team1: u32, pub team2: u32, pub in_goal_last_frame: bool, } impl Default for Score { fn default() -> Self { Score { team1: 0, team2: 0, in_goal_last_frame: false, } } }
use crate::typing::*; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; use std::borrow::Cow; use crate::TelegramApiMethod; pub mod webhook; pub mod send; pub mod info; pub mod inline; use webhook::*; use send::*; use info::*; use inline::*; #[derive(Debug, Serialize, Deserialize, Clone)...
use crate::libs::bcdice::js::CommandResult; #[derive(Debug, Clone)] pub struct Message(Vec<MessageToken>); #[derive(Debug, Clone)] pub enum MessageToken { Text(String), Reference(Reference), Command(Command), } #[derive(Debug, Clone)] pub struct Reference { pub name: Vec<Message>, pub args: Vec<A...
use nannou::noise::{NoiseFn, Perlin}; use nannou::prelude::*; struct Model {} fn main() { nannou::app(model).update(update).simple_window(view).run(); } fn model(_app: &App) -> Model { Model {} } fn update(_app: &App, _model: &mut Model, _update: Update) {} fn view(app: &App, _model: &Model, frame: Frame) ...
use dataloader::{ cached::{Item, Loader as CachedLoader}, Loader, }; use std::collections::BTreeMap; pub mod character; pub mod movie; pub mod movie_character; pub mod user; type _DataLoader<K, V, B> = Loader<K, V, (), B>; type CachedDataLoader<K, V, B> = CachedLoader<K, V, (), B, Cache<K, V, B>>; type Cache<...
#![cfg(all(test, feature = "test_e2e"))] use azure_core::prelude::*; use azure_cosmos::prelude::*; use azure_cosmos::responses::QueryDocumentsResponseRaw; use futures::stream::StreamExt; mod setup; const FN_BODY: &str = r#" function tax(income) { if (income == undefined) throw 'no input'; if (income <...
use async_trait::async_trait; use common::cache::Cache; use common::infrastructure::cache::InMemCache; use common::result::Result; use crate::domain::token::{Data, TokenId, TokenRepository}; #[derive(Default)] pub struct InMemTokenRepository { cache: InMemCache<TokenId, Data>, } impl InMemTokenRepository { ...
use crate::shape::bar::Bar; use crate::{ BandScale, BarLabelPosition, BarsValues, Error, LinearScale, Orientation, Scale, View, }; use std::collections::HashMap; use svg::node::Node; const DEFAULT_BAR_LABEL_VISIBLE: bool = true; const DEFAULT_BAR_LABEL_POSITION: BarLabelPosition = BarLabelPosition::Center; /// Ve...
use derive_more::Display; use thiserror::Error as ThisError; #[derive(Debug, ThisError, Display)] pub enum InfraError { #[display(fmt = "home directory not found")] HomeDirectoryNotFound, #[display(fmt = "favorites not found")] FavoritesNotFound, } #[derive(Debug, ThisError, Display)] pub enum Project...
#[doc = "Reader of register FMC_CSQIER"] pub type R = crate::R<u32, super::FMC_CSQIER>; #[doc = "Writer for register FMC_CSQIER"] pub type W = crate::W<u32, super::FMC_CSQIER>; #[doc = "Register FMC_CSQIER `reset()`'s with value 0x0002_0000"] impl crate::ResetValue for super::FMC_CSQIER { type Type = u32; #[inl...
#[doc = "Register `CR1` reader"] pub type R = crate::R<CR1_SPEC>; #[doc = "Register `CR1` writer"] pub type W = crate::W<CR1_SPEC>; #[doc = "Field `UE` reader - USART enable"] pub type UE_R = crate::BitReader; #[doc = "Field `UE` writer - USART enable"] pub type UE_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>...
//! Loop for accepting new connections //! and passing on all network packets use types::event::*; use types::*; use std::fmt::Debug; use std::io::Write; use std::net::ToSocketAddrs; use std::sync::mpsc::Sender; use std::sync::Mutex; use futures::{Future, Stream}; use websocket::server::async::Server; use websocket:...
use std::cmp::Ordering; /// if the list size grows greater than the load factor, we split it. /// If the list size shrinks below the load factor, we join two lists. pub const DEFAULT_LOAD_FACTOR: usize = 1000; /// Inserts into a list while maintaining a preexisting ordering. pub fn insert_sorted<T: Ord>(vec: &mut Vec...
// use diesel::PgConnection; // use diesel::BelongingToDsl; use chrono::NaiveDate; // use crate::schema; use crate::schema::courses; // use crate::schema::user_courses; // use crate::db_connection::PgPooledConnection; #[derive(Identifiable, Queryable, Serialize, Deserialize, Debug, Clone, PartialEq)] // #[table_name...
mod data_storage; mod error_helper; mod file_storage; mod metadata_storage; pub use file_storage::FileStorage; pub use metadata_storage::ROOT_INODE;
// Copyright 2019 King's College London. // Created by the Software Development Team <http://soft-dev.org/>. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option...
//! Our fleet of remote cameras. //! //! This is the umbrella module for code that works with all of our remote cameras as a fleet, //! hense the plural. pub mod handlers; mod camera; mod config; mod image; pub use self::config::{CameraConfig, Config};
//!# A custom derive implementation for `#[derive(Logpack)]` #![crate_type = "proc-macro"] #![recursion_limit = "250"] extern crate proc_macro; mod type_derive; mod encode_derive; use std::process::Command; use std::collections::HashSet; use proc_macro::TokenStream; use proc_macro2::{TokenStream as Tokens}; use syn...
#[macro_use] extern crate nom; use crate::event::{guard_event, Event, EventType}; use chrono::Timelike; use nom::types::CompleteStr; use std::collections::HashMap; mod event; /** You've sneaked into another supply closet - this time, it's across from the prototype suit manufacturing lab. You need to sneak inside...
#![allow(dead_code, unused_must_use, unused_imports, unstable)] extern crate rustc_serialize; extern crate log; // Old imports, refine last use utils; use std::fmt; use std::str; use std::string; use std::ops::Drop; use self::rustc_serialize::base64::{STANDARD, FromBase64, ToBase64}; // New imports for Rust 1.0 use s...
use rayon::prelude::*; use std::collections::HashSet; use std::fs::DirEntry; use std::fs::Metadata; use std::io; use std::path::Path; use std::sync::Mutex; use rust_decimal::Decimal; use rust_decimal::prelude::FromPrimitive; use rust_decimal::prelude::Zero; use rust_decimal::prelude::One; use nom::is_digit; use nom::t...
use crate::Guid; use core::{ prefab::{Prefab, PrefabValue}, Scalar, }; use serde::{Deserialize, Serialize}; use std::collections::HashMap; #[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)] pub enum Reference { None, Named(String), Guid(Guid), } impl Default for Reference { f...
#[doc = "Reader of register CTB_SW_SQ_CTRL"] pub type R = crate::R<u32, super::CTB_SW_SQ_CTRL>; #[doc = "Writer for register CTB_SW_SQ_CTRL"] pub type W = crate::W<u32, super::CTB_SW_SQ_CTRL>; #[doc = "Register CTB_SW_SQ_CTRL `reset()`'s with value 0"] impl crate::ResetValue for super::CTB_SW_SQ_CTRL { type Type = ...
#[cfg(test)] extern crate mockall; use std::collections::HashMap; #[cfg_attr(test, mockall::automock)] pub trait Shape { fn spec(&self) -> HashMap<String, u8>; fn area(&self) -> u16; } pub struct Square { pub x: u8, pub y: u8, } impl Shape for Square { fn spec<'a>(&self) -> HashMap<String, u8> { ...
use std::sync::Arc; use common::error::Error; use common::result::Result; use crate::domain::token::{Token, TokenService}; pub struct AuthorizationService { token_serv: Arc<TokenService>, } impl AuthorizationService { pub fn new(token_serv: Arc<TokenService>) -> Self { AuthorizationService { token_s...
//! This crate implements the "eytzinger" (aka BFS) array layout where //! a binary search tree is stored by layer (instead of as a sorted array). //! This can have significant performance benefits //! (see [Khuong, Paul-Virak, and Pat Morin. "Array layouts for comparison-based searching."][1]). //! //! # Usage //! //!...
fn dig_pow(n: i64, p: i32) -> i64 { let mut digits : Vec<i64> = vec![]; let mut num = n; while num > 0 { digits.push(num % (10 as i64)); num = num / 10; } digits.reverse(); let mut sum: i64 = 0; let mut start: u32 = p as u32; for elem in digits{ sum += elem.pow(start); start += ...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{chain::BlockChain, chain_metrics::CHAIN_METRICS}; use actix::Addr; use anyhow::{format_err, Error, Result}; use bus::{Broadcast, BusActor}; use config::NodeConfig; use crypto::HashValue; use logger::prelude::*; use starc...
use super::User; use crate::utils; use crate::utils::generate_uuid; use actix_web::{error, web, HttpResponse}; use bcrypt::{hash, DEFAULT_COST}; use chrono::prelude::*; use serde::{Deserialize, Serialize}; use std::borrow::Borrow; use std::convert::TryFrom; //#region Event #[derive(Debug, Serialize, Clone)] #[serde(r...
/* chapter 4 syntax and semantics */ fn main() { /* fn takes_two_of_the_same_things<T>(x: T, y: T) { // ... } */ } // output should be: /* */
use crate::vec2::Vec2; const EPSILON: f64 = 0.000001; fn is_vector_belonging_to_half_plane(v: &Vec2, (origin, direction): &(Vec2, Vec2)) -> bool { Vec2::det(*direction, *v - *origin) >= 0. } pub fn solve_linear_program_step( obj_dir: &Vec2, // The objective direction obj_max_norm: f64, ...
#[doc = "Register `RCC_MC_AHB5LPENCLRR` reader"] pub type R = crate::R<RCC_MC_AHB5LPENCLRR_SPEC>; #[doc = "Register `RCC_MC_AHB5LPENCLRR` writer"] pub type W = crate::W<RCC_MC_AHB5LPENCLRR_SPEC>; #[doc = "Field `GPIOZLPEN` reader - GPIOZLPEN"] pub type GPIOZLPEN_R = crate::BitReader; #[doc = "Field `GPIOZLPEN` writer -...
#[doc = "Register `EXTI_FPR1` reader"] pub type R = crate::R<EXTI_FPR1_SPEC>; #[doc = "Register `EXTI_FPR1` writer"] pub type W = crate::W<EXTI_FPR1_SPEC>; #[doc = "Field `FPIF0` reader - FPIF0"] pub type FPIF0_R = crate::BitReader; #[doc = "Field `FPIF0` writer - FPIF0"] pub type FPIF0_W<'a, REG, const O: u8> = crate:...
extern crate procedure; use procedure::{error, info, proceed, success, warning, Progress}; #[test] fn example() { let a = proceed( "Download", "example_file.jpg", |progress: &mut Progress| -> Result<(&str, &str), &str> { for _ in 0..100 { std::thread::sleep(std:...
use std::io::Write; use anyhow::{anyhow, Result}; use crate::command::Command; use crate::ops::io::walk; use crate::ops::path::{path_has_extension, path_is_hidden}; use crate::Recurse; pub(crate) struct WalkCommand {} impl Command for WalkCommand { fn execute(subcmd: Recurse, mut writer: impl Write) -> Result<(...
mod read_cursor; pub mod multiqueue;
/* * 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 */ /// SyntheticsTestPauseStatus : Define whether you want to start (`live`) or pause (`paused`) a Syntheti...
use {AsNative, Backend, ResourceIndex, BufferPtr, SamplerPtr, TexturePtr}; use internal::{Channel, FastStorageMap}; use range_alloc::RangeAllocator; use window::SwapchainImage; use std::borrow::Borrow; use std::cell::RefCell; use std::{fmt, iter}; use std::ops::Range; use std::os::raw::{c_void, c_long}; use std::sync:...
extern crate pocket_prover; extern crate pocket_prover_set; use pocket_prover::*; use pocket_prover_set::*; fn main() { println!("Result {}", Set::imply( |s| s.fin_many, |s| not(s.inf_many) )); }
#![deny(warnings)] extern crate warp; extern crate hyper; extern crate handlebars; #[macro_use] extern crate serde_json; use warp::Filter; use handlebars::Handlebars; use std::sync::Arc; fn main() { let template = "<!DOCTYPE html> <html> <head> <ti...
//! Contains all types used by soft use error::*; use std::fmt; /// All soft commands #[derive(Clone, Debug, PartialEq)] pub enum Command { /// Login to server Login(String, String), /// Get a file Get(String), /// Put a file Put(String), /// List directory List(String), /// Get cur...
use crate::data_io::AlephDataFor; use core::result::Result; use log::{debug, error, warn}; use sc_client_api::Backend; use sp_api::{BlockId, NumberFor}; use sp_runtime::{ traits::{Block, Header}, Justification, }; use std::sync::Arc; pub(crate) fn finalize_block<BE, B, C>( client: Arc<C>, hash: B::Hash...
#![allow(unused)] mod wago; use wago::WagoModule::*; use wago::*; fn main() { let mut w315 = Wago750315 { res_io: AddrIO(0, 0, 0, 0), io: AddrIO(0, 0, 0, 0), }; let mut w430 = Wago750430 { res_io: AddrIO(0, 8, 0, 0), io: AddrIO(0, 0, 0, 0), }; let mut w530 = Wago750...
use std::cell::RefCell; use std::fmt; use std::rc::Rc; use crate::environment::Environment; use crate::object::Object; use crate::parser::Node; #[derive(Debug, Clone)] pub enum Value { Nothing, Number(i32), String(String), Boolean(bool), NativeFunction(fn(Option<Value>, Vec<Value>) -> Value), ...
mod edge; pub mod graph; mod node;
use crate::error::*; use crate::*; use std::io::Write; use tempfile::Builder; pub struct Exe; pub type EditorExeInstaller = Installer<UnityEditor, Exe, InstallerWithDestinationAndOptionalCommand>; pub type ModuleExeTargetInstaller = Installer<UnityModule, Exe, InstallerWithDestinationAndOptionalCommand>; pub t...
use std::process; use std::collections::HashMap; use std::net::{TcpStream, TcpListener, SocketAddr, IpAddr}; use std::io::Write; use std::path::Path; use std::{env, fs, thread}; use std::str::FromStr; use std::collections::VecDeque; use std::sync::{Mutex, Arc, Barrier}; use local_ipaddress; use pnet::datalink; use he...
use std::cell::RefCell; use std::fs::File; use std::io::{self, BufReader, Read, Write}; use serde_derive::{Deserialize, Serialize}; use crate::{ input::{Lexer, Parser}, player::Player, types::{CmdResult, ItemMap}, util::read_line, world::World, }; /// A command line interface for controlling inte...
// Copyright 2018-2020 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) a...
pub fn three_sum(nums: Vec<i32>) -> Vec<Vec<i32>> { let mut res = Vec::new(); // 排序 let mut nums = nums; nums.sort(); let n = nums.len(); for a in 0..n { // 过滤掉重复的 if a != 0 && nums[a] == nums[a - 1] { continue; } let mut c = n - 1; let targ...
extern crate presentrs; use presentrs::Server; fn main() { let mut server = Server::new("target/deploy"); server.run("0.0.0.0:8080").unwrap(); }
#[cfg(test)] mod tests { use goban::pieces::goban::Goban; use goban::pieces::stones::Color; use goban::pieces::stones::Color::Black; use goban::pieces::stones::Stone; use goban::pieces::uint; use goban::pieces::util::coord::Order; use goban::pieces::zobrist::ZOBRIST; use goban::rules::ga...
use std::process; pub fn get(url: &str) -> Option<Vec<u8>> { let url = url.replace("[", "\\["); let url = url.replace("]", "\\]"); // FIXME: Will panic if curl is not found let data = process::Command::new("curl") .arg("-L") .arg(url) .output() .unwrap(); if data.s...
// Copyright (C) 2015-2021 Swift Navigation Inc. // Contact: https://support.swiftnav.com // // This source is subject to the license found in the file 'LICENSE' which must // be be distributed together with this source. All other rights reserved. // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - LTDC identification register"] pub ltdc_idr: LTDC_IDR, #[doc = "0x04 - LDTC layer count register"] pub ltdc_lcr: LTDC_LCR, #[doc = "0x08 - This register defines the number of horizontal synchronization pixels minus 1 an...
#[doc = "Reader of register DFSDM_FLT2CR1"] pub type R = crate::R<u32, super::DFSDM_FLT2CR1>; #[doc = "Writer for register DFSDM_FLT2CR1"] pub type W = crate::W<u32, super::DFSDM_FLT2CR1>; #[doc = "Register DFSDM_FLT2CR1 `reset()`'s with value 0"] impl crate::ResetValue for super::DFSDM_FLT2CR1 { type Type = u32; ...
mod evenger; mod evdev; mod foreign; mod muxer; use evenger::Evenger; fn main() { let mut app = Evenger::new() .expect("app init failed"); app.open_device("mouse", "/dev/input/event2") .expect("can't open mouse"); app.open_device("keyboard", "/dev/input/event4") .expect("can'...
extern crate pancurses; use std::env; use std::fs; use std::collections::{HashMap, VecDeque}; use std::thread; use std::time; use pancurses::{Window, Input}; const TILE_WALL: u8 = 1; const TILE_BLOCK: u8 = 2; const TILE_PADDLE: u8 = 3; const TILE_BALL: u8 = 4; const MODE_POS: i64 = 0; const MODE_IMM: i64 = 1; const ...