text
stringlengths
8
4.13M
/* * 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 */ use reqwest; use crate::apis::ResponseContent; use super::{Error, configuration}; /// struct for typ...
#[macro_use] extern crate serde_derive; #[macro_use] extern crate envy; extern crate dotenv; #[macro_use] extern crate lazy_static; use dotenv::dotenv; use std::collections::HashMap; use std::env; use std::path::Path; /// # Example environment variables. /// /// The simple program which lookups for 3 environment varia...
use parenchyma::error::Result; use parenchyma::extension_package::Dependency; use parenchyma::frameworks::NativeContext as Context; use parenchyma::tensor::SharedTensor; use super::super::{Extension, Package}; use super::super::extension_package::{Backward, Forward}; impl<P> Backward for Context<P> where P: Depen...
use buf_redux::Buffer; use super::slsk_buffer::SlskBuffer; pub(crate) trait Message: Send { fn as_buffer(&self) -> Buffer; } impl dyn Message { pub fn login_request(username: &'static str, password: &'static str) -> Box<LoginRequest> { Box::new(LoginRequest { username, password }) } } pub struct ...
//! This module describes the transport-agnostic concept of a transfer, //! which boils down to some metadata to uniquely identify it, as well //! as a serialized buffer of data, which encodes DSDL-based data. use crate::internal::InternalRxFrame; use crate::time::Timestamp; use crate::types::*; use crate::Priority; ...
enum Cell { Dead = 0, Alive = 1, } fn main() { // let cells: Vec<u32> = (0..10) // .map(|i| { // match i { // 3 => 0, // 5 => 0, // 10 => 0, // _ => 1 // } // }) // .collect(); // print!("{:...
use crate::libs::js_object::Object; use crate::libs::try_ref::TryRef; use async_trait::async_trait; use js_sys::Promise; use std::rc::Rc; use wasm_bindgen::{prelude::*, JsCast}; use wasm_bindgen_futures::JsFuture; #[async_trait] trait LoadFrom<T> { async fn load_from(x: T) -> Data; } pub struct ImageData { el...
use std::io; use std::io::Write; use std::io::BufRead; use std::fs; use std::path; use glib::user_config_dir; use crate::app::*; pub struct AppEnvironment { recent_dir: path::PathBuf } impl AppEnvironment { pub fn new() -> Result<AppEnvironment, io::Error> { let dir = AppEnvironment::recent_dir(); ...
use crate::{Context, Error, PrefixContext}; /// Evaluates Go code #[poise::command(prefix_command, discard_spare_arguments)] pub async fn go(ctx: PrefixContext<'_>) -> Result<(), Error> { poise::say_reply(ctx.into(), "No").await?; Ok(()) } /// Links to the bot GitHub repo #[poise::command(prefix_command, disc...
#[doc = "Register `SPI2S_SR` reader"] pub type R = crate::R<SPI2S_SR_SPEC>; #[doc = "Field `RXP` reader - RXP"] pub type RXP_R = crate::BitReader; #[doc = "Field `TXP` reader - TXP"] pub type TXP_R = crate::BitReader; #[doc = "Field `DXP` reader - DXP"] pub type DXP_R = crate::BitReader; #[doc = "Field `EOT` reader - E...
extern crate otaku; extern crate clap; use otaku::config::Config; use clap::{App, Arg, SubCommand}; use std::process; use std::env; use std::path::PathBuf; static VERSION: &'static str = "0.1"; static AUTHOR: &'static str = "Matt Valentine-House <matt@eightbitraptor.com>"; fn main() { let arg_config = Arg::with_...
//! # rlink-sink-conf //! //! A library to upgrade [rlink](https://docs.rs/rlink) task smoothly. //! //! # Example //! //! ``` //! use rlink_sink_conf::sink_config::{init_sink_config, get_sink_topic}; //! use std::collections::HashMap; //! //! let sin_conf_url = "testUrl"; //! let application_name = "tlb_base_qa"; //! ...
use actix_web::{ HttpResponse, web, }; use super::super::{ service, request, response, }; pub fn index(payload: web::Query<request::developper::Index>) -> HttpResponse { let (domain_developpers, total) = &service::developper::index( payload.page, payload.page_size, ); re...
use bitvec::vec::*; use rand::Rng; use serde::{Deserialize, Serialize}; // TODO: This boundary is way too strict, especially for very deeply nested trees. the boundary should grow exponentially with the tree const DEFAULT_BOUNDARY: u64 = 10; const DEFAULT_INITIAL_BASE: u8 = 3; // start with 2^3 /// A tree identifier...
#![allow(unstable)] extern crate rusql; use rusql::{rusql_exec, Rusql, LiteralValue}; fn test(sql_str: &str, expected: Vec<LiteralValue>) { let mut db = Rusql::new(); let result_table = rusql_exec(&mut db, sql_str, |_,_| {}).unwrap(); let results = result_table.data.get(&1).unwrap(); assert_eq!(&ex...
use crate::common::Ownable; use crate::common::StorageKey; use crate::series::NftSeriesSale; use chrono::{DateTime, Timelike, Utc}; use near_contract_standards::non_fungible_token::metadata::NFTContractMetadata; use near_contract_standards::non_fungible_token::metadata::NonFungibleTokenMetadataProvider; use near_contra...
// Copyright 2018-2020 argmin developers // // 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...
use std::io::Read; use std::str::FromStr; use std::{fs::File, sync::Arc}; use anyhow::{anyhow, Result}; use druid::KbKey; use druid::{ Color, Data, Env, EventCtx, ExtEventSink, KeyEvent, Modifiers, Target, WidgetId, WindowId, }; use toml; use crate::{ command::LapceCommand, state::{LapceFocus, LapceTa...
mod expression; mod select_item; pub(crate) use expression::ExprDb; pub(crate) use select_item::SelectDb;
use priv_prelude::*; use std; use future_utils; use spawn; /// Spawn a function into a new network namespace with a network interface described by `iface`. /// Returns a `SpawnComplete` which can be used to join the spawned thread, along with a channel which /// can be used to read/write ethernet frames to the spawned...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ConnectedRegistry { #[serde(flatten)] pub proxy_resource: ProxyResource, #[serde(default, skip_serializ...
mod utils; mod fraction; mod primes; mod fib; mod queue; mod poker; use crate::utils::get_all_order; use std::collections::HashMap; use std::collections::HashSet; fn main() { let mut list = vec![]; for i in 3..=8 { list.push(P::new(i)); } let order_list: Vec<Vec<usize>> = get_all_order(&vec![0...
pub mod convert; pub mod validate;
extern crate midir; use std::error::Error; use std::io::{stdin, stdout, Write}; use std::thread::sleep; use std::time::Duration; use midir::{MidiOutput, MidiOutputPort}; fn main() { match run() { Ok(_) => (), Err(err) => println!("Error: {}", err), } } fn run() -> Result<(), Box<dyn Error>> ...
pub mod pull_requests;
use testutil::*; use seven_client::analytics::{AnalyticsParams, Analytics}; mod testutil; fn init_client() -> Analytics { Analytics::new(get_client()) } fn default_params() -> AnalyticsParams { AnalyticsParams { end: None, label: None, start: None, subaccounts: None, } } ...
use crate::renderer::managers::*; use crate::ui::get_text_character_rect; use crate::ui::text_character::CharacterSizeManager; use rider_config::{ConfigAccess, ConfigHolder}; use sdl2::rect::Rect; use sdl2::render::Texture; use sdl2::render::TextureCreator; use sdl2::ttf::Font; use sdl2::ttf::Sdl2TtfContext; use std::c...
use super::{u256mod, ModulusTrait}; // Comparison - equality and ordering // Equality impl<M: ModulusTrait> std::cmp::PartialEq for u256mod<M> { fn eq(&self, other: &u256mod<M>) -> bool { return self.value == other.value; } } impl<M: ModulusTrait> std::cmp::Eq for u256mod<M> {} // Ordering impl<M: ...
pub trait Real { fn zero() -> Self; } impl Real for f32 { #[inline] fn zero() -> f32 { 0.0f32 } } impl Real for f64 { #[inline] fn zero() -> f64 { 0.0f64 } }
fn naive(x: &[u8]) -> u64 { x.iter().fold(0, |a, b| a + b.count_ones() as u64) } /// Computes the [Hamming /// weight](https://en.wikipedia.org/wiki/Hamming_weight) of `x`, that /// is, the population count, or number of 1. /// /// This is a highly optimised version of the following naive version: /// /// ```rust /...
#[doc = "Register `OTG_HCINTMSK10` reader"] pub type R = crate::R<OTG_HCINTMSK10_SPEC>; #[doc = "Register `OTG_HCINTMSK10` writer"] pub type W = crate::W<OTG_HCINTMSK10_SPEC>; #[doc = "Field `XFRCM` reader - XFRCM"] pub type XFRCM_R = crate::BitReader; #[doc = "Field `XFRCM` writer - XFRCM"] pub type XFRCM_W<'a, REG, c...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. //! A list of error types which are produced during an execution of the protocol use thiserror::Error; /// Represents an error in the ma...
use crate::proto::kvraftpb::*; use futures::Future; use std::fmt; use std::sync::atomic::AtomicU64; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::time::Duration; const ERR_RETRY_DUR: Duration = Duration::from_millis(200); enum Op { Put(String, String), Append(String, String), }...
#[doc = "Register `ECR` reader"] pub type R = crate::R<ECR_SPEC>; #[doc = "Field `TEC` reader - TEC"] pub type TEC_R = crate::FieldReader; #[doc = "Field `REC` reader - TREC"] pub type REC_R = crate::FieldReader; #[doc = "Field `RP` reader - RP"] pub type RP_R = crate::BitReader; #[doc = "Field `CEL` reader - CEL"] pub...
use std::error::Error; use std::fmt; use std::fmt::{Display, Formatter}; pub type BoxResult<T> = Result<T, Box<dyn Error>>; #[derive(Debug, Clone)] pub struct NoneError; impl Display for NoneError { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "NoneError") } } impl Error for NoneE...
#[doc = "Register `IER` reader"] pub type R = crate::R<IER_SPEC>; #[doc = "Register `IER` writer"] pub type W = crate::W<IER_SPEC>; #[doc = "Field `TAMP1IE` reader - Tamper 1 interrupt enable"] pub type TAMP1IE_R = crate::BitReader; #[doc = "Field `TAMP1IE` writer - Tamper 1 interrupt enable"] pub type TAMP1IE_W<'a, RE...
/** * トレイト境界 * 「あるトレイトを実装する型」をジェネリクスで受け取ることもできる。これをトレイト境界という。 * 型の集合を定義するもの * 関数をまとめた関数みたいなもの **/ trait DuckLike { // トレイトを実装する型が実装するべきメソッドを定義 fn quack(&self); // デフォルトメソッドを定義することもできる fn walk(&self) { println!("walking"); } } // トレイトを実装するためだけのデータ型なら、Unit構造体が便利 struct Duck; // `impl ...
#![feature(test)] extern crate test; use decimal::d128; use roc_dec::RocDec; use std::convert::TryInto; use test::{black_box, Bencher}; #[bench] fn dec_mul1(bench: &mut Bencher) { let dec1: RocDec = "1.2".try_into().unwrap(); let dec2: RocDec = "3.4".try_into().unwrap(); bench.iter(|| { black_bo...
use chore::*; #[test] fn general() -> Result<()> { for (args, expect_stdout, expect_confirm, expect_tasks) in &[ ( vec!["modify", "+done"], concat!( "DEL (M) 2001-02-03 @home +chore add tests\n", "ADD x (M) 2001-02-03 @home +chore add tests\n", ...
use escargot::CargoBuild; use std::io::{Read, Result, Write}; use std::net::{Shutdown, TcpStream}; use std::process::{Child, Stdio}; pub struct ServerWrapper { stream: TcpStream, child: Child, } impl ServerWrapper { fn setup_server() -> Result<Child> { CargoBuild::new() .bin("server") ...
use crate::i2c::{Error, Instance, SclPin, SdaPin}; use crate::time::Hertz; use core::marker::PhantomData; use embassy::util::Unborrow; use embassy_extras::unborrow; use embedded_hal::blocking::i2c::Read; use embedded_hal::blocking::i2c::Write; use embedded_hal::blocking::i2c::WriteRead; use crate::pac::i2c; use crate...
#[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::BODCTRL { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w m...
extern crate image; // DMDBG: Not sure if this should really be speaking 'image' directly use std::boxed::Box; use std::collections::HashMap; use crate::shape; use crate::geometry; use geometry::{Ray, RayHit}; pub struct Scene { pub lights: HashMap<String, shape::PointLight>, pub shapes: HashMap<String, Box...
#[doc = "Register `SQR1` reader"] pub type R = crate::R<SQR1_SPEC>; #[doc = "Register `SQR1` writer"] pub type W = crate::W<SQR1_SPEC>; #[doc = "Field `SQ13` reader - 13th conversion in regular sequence"] pub type SQ13_R = crate::FieldReader; #[doc = "Field `SQ13` writer - 13th conversion in regular sequence"] pub type...
//! Analog to a Python boolean type. //! //! It supports & and | operators, and comparison to Rust bool types. //! To return to Python use the ```into_raw``` method and return a raw pointer. //! //! # Safety //! You can convert a raw pointer to a bool type with ```from_ptr_into_bool``` method, //! or to a ```&PyBool```...
/* Узнав на уроке информатики про шифрование данных при помощи открытых ключей, Вика и Катя решили создать собственный шифр. У Кати есть открытый ключ — набор из N чисел a1, a2, ..., aN. Вика передаёт ей N текстовых строк. Расшифровка будет являться словом, составленным из букв переданных строк. Первая буква должна вст...
//! Virtualization implementation for normal, 'unstaged' Rust use quote::Tokens; use std::cmp::{PartialEq}; use std::mem; use std::ops::{Add, Sub, Not}; use codegen::{__Codegen, Tokenize}; use expr::{Pat, __ExprBlock, __ExprTuple, __Ref, __RefMut}; use ops::{__Not, __PartialEq, __Add, __Sub}; impl<CG, T> __Not<T> f...
use std::slice; use ggez::graphics; pub use resources::Sounds; pub const CARD_WIDTH: f32 = 123.0; pub const CARD_HEIGHT: f32 = 233.0; pub const BUTTON_RADIUS: f32 = 30.0; pub const BUTTON_RADIUS_SQUARED: f32 = BUTTON_RADIUS * BUTTON_RADIUS; pub type Point2 = ggez::nalgebra::Point2<f32>; pub type Vector2 = ggez::na...
table! { anime (id) { id -> Integer, name -> Varchar, episodes -> Nullable<Integer>, slot1 -> Bool, slot2 -> Bool, slot3 -> Bool, } } table! { decisions (tournament, left_anime, right_anime) { tournament -> Integer, left_anime -> Integer, ...
pub use self::{clip::*, comp::*, converter::*, prim::*, shape::*, transform::*, value::*}; use crate::{Model, SystemMessage}; pub mod builder; pub mod clip; pub mod comp; pub mod converter; pub mod prim; pub mod shape; pub mod transform; pub mod value; pub enum Node<M: Model> { Prim(Prim<M>), Comp(Comp), } i...
use std::{collections::HashMap, path::PathBuf}; use structopt::StructOpt; use serde::Deserialize; type R<T> = Result<T, Box<dyn std::error::Error>>; #[derive(StructOpt)] struct Args { #[structopt(short, long)] /// The path to a json file containing an array of strings representing /// the target zip code...
//! Module for the message struct. use serde::{Deserialize, Serialize}; /// The struct representing a message. #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Message {}
extern crate wasm_bindgen; use wasm_bindgen::prelude::*; use shortscale::shortscale; #[wasm_bindgen] pub fn numwords(num: u64) -> String { return shortscale(num); }
pub mod addstream; pub mod removestream; pub mod tracked; use std::{borrow::Cow, sync::Arc}; use twilight_model::application::interaction::{ application_command::CommandOptionValue, ApplicationCommand, }; use crate::{ util::{constants::common_literals::NAME, CowUtils}, Args, BotResult, Context, Error, };...
use async_std::task; pub struct Script { }
use std::io; use rotor::mio; use rotor::{Scope, Time, PollOpt, EventSet}; use rotor::{_scope, _Timeo, _Notify, _LoopApi}; /// Operation that was done with Scope #[derive(Debug, PartialEq, Eq)] pub enum Operation { Register(EventSet, PollOpt), Reregister(EventSet, PollOpt), Deregister, Shutdown, } str...
#[doc = "Reader of register RX_MATCH"] pub type R = crate::R<u32, super::RX_MATCH>; #[doc = "Writer for register RX_MATCH"] pub type W = crate::W<u32, super::RX_MATCH>; #[doc = "Register RX_MATCH `reset()`'s with value 0"] impl crate::ResetValue for super::RX_MATCH { type Type = u32; #[inline(always)] fn re...
use super::types::{DiffOptions, Only}; use crate::data::{Entry, Item}; use crate::index::Indexer; use crate::path_str; use anyhow::Result; use std::path::PathBuf; pub struct DiffHandler { indexer: Indexer, items: Vec<Item>, options: DiffOptions, } impl DiffHandler { pub fn new( home: PathBuf, ...
use super::FPS_INTERVAL; /// Tracks frames per second. pub struct FpsCounter { fps: f64, time_acc: f64, frames_acc: f64, } impl FpsCounter { pub fn new() -> FpsCounter { FpsCounter { fps: 0.0, time_acc: 0.0, frames_acc: 0.0, } } pub fn fps(&...
use seed::{prelude::*, *}; use std::borrow::Cow; pub const TITLE: &str = "Example D"; pub const DESCRIPTION: &str = "Click button 'Send request` to send request to endpoint with configurable delay. Click again to disable timeout - otherwise the request will time out."; const TIMEOUT: u32 = 2000; fn get_reque...
use anyhow::Result; fn main() { let input = load("input/day4").unwrap(); println!("{}", validate_part1(&input)); println!("{}", validate_part2(&input)); } fn load(input: &str) -> Result<String> { Ok(std::fs::read_to_string(input)?) } #[test] fn test_load() { assert_eq!(load("input/day4tdd").unwra...
extern crate dmbc; extern crate exonum; extern crate exonum_testkit; extern crate hyper; extern crate iron; extern crate iron_test; extern crate mount; extern crate serde_json; pub mod dmbc_testkit; use std::collections::HashMap; use dmbc_testkit::{DmbcTestApiBuilder, DmbcTestKitApi}; use exonum::crypto; use hyper::...
//! Parenchyma extension package for backend-agnostic deep neural network (NN) operations. #![allow(unused_variables)] #![feature(non_modrs_mods)] extern crate ocl; extern crate parenchyma; pub use self::extension_package::{Extension, Package}; pub mod frameworks; mod extension_package;
use std::io::{stdin, stdout, Write}; use std::str::FromStr; #[doc(hidden)] pub fn get__<F: FromStr>() -> Result<F, <F as FromStr>::Err> { let mut s = String::new(); let _ = stdout().flush(); stdin() .read_line(&mut s) .expect("user did not enter correct string"); if let Some('\n') = s.chars().next_ba...
use super::super::HasTable; use super::{Component, FromWorldMut, UnsafeView, World}; use crate::tables::unique_table::UniqueTable; use crate::tables::TableId; use std::ops::{Deref, DerefMut}; use std::ptr::NonNull; pub struct UnwrapViewMut<Id: TableId, C: Component<Id>>(NonNull<UniqueTable<Id, C>>); impl<'a, Id: Tabl...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub mod container_host_mappings { use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; ...
use std::os::raw::c_char; use std::io::{Error, ErrorKind}; use libc::O_NOATIME; redhook::hook! { unsafe fn open64( path: *const c_char, flags: i32, mode: i32 ) -> i32 => fileopen64 { let ret = redhook::real!(open64)( path, flags | O_NOATIME, mode ); if ret < 0 && Error::last_os_error...
use std::ops::Add; #[derive(Debug)] struct Point { x: i32, y: i32, } impl Add for Point { type Output = Point; fn add (self, other: Point) -> Point { Point { x: self.x + other.x, y: self.y + other.y } } } fn main() { let p1 = Point { x: 1, y:0 }; let p2 = Point { x: 1, y:3 }; ...
#![doc(html_root_url = "https://docs.rs/thetvdb/0.1.0-beta.2")] #![deny(missing_docs, missing_debug_implementations, unsafe_code)] //! This crate provides an async [client] as well as helpful types to request //! and interact with data from **TheTVDB API v3**. //! //! You will need a valid API key to create a new clie...
use std::cell::RefCell; use std::cmp::{max, Ordering}; use std::rc::Rc; use std::fmt::Display; pub struct Node<T> { key: T, left: Link<T>, right: Link<T>, height: i32, } pub type Link<T> = Option<Rc<RefCell<Node<T>>>>; pub struct AVLTree<T> { root: Link<T>, } impl<T> Node<T> { fn new(key: T)...
fn main() -> Result<(), Box<dyn std::error::Error>> { let chap2_iface_files = &["api/v1/protos/product_info.proto"]; let dirs = &["."]; // Chapter 2: Unary gRPC Pattern tonic_build::configure() .compile(chap2_iface_files, dirs) .unwrap(); // Chapter 3: gRPC Communication Patte...
use ignore::Walk; use std::fs::metadata; use trigram::find_words_iter; use std::fs::File; use std::io::{prelude::*, BufReader}; fn main() { let args: Vec<String> = std::env::args().collect(); if args.len() != 1+1 { eprintln!("Usage: ff pattern This will search for pattern in files in the current direct...
use exonum::crypto::{Hash, PublicKey}; use super::proto; /// Wallet information stored in the database. #[derive(Clone, Debug, ProtobufConvert)] #[exonum(pb = "proto::User", serde_pb_convert)] pub struct User { /// `PublicKey` of the user. pub key: PublicKey, /// Name of the user. pub name: String, } ...
use std::io::Cursor; use rodio::{Decoder, Sink}; use audio::{DecoderError, Source}; use audio::output::Output; /// This structure provides a way to programmatically pick and play music. pub struct Dj { sink: Sink, pub(crate) picker: Option<Box<FnMut(&mut Dj) -> bool + Send + Sync>>, } impl Dj { /// Crea...
use std::collections::HashMap; // struct that holds info for the columns in the parsed file #[derive(Debug, Clone)] pub struct CsvRows { pub date: String, pub time: String, pub info: HashMap<String, String> }
fn if_let_pattern_test() { let tmp_str = String::from("red"); let fav_color: Option<&str> = Some(&tmp_str); // let fav_color: Option<&str> = None; let is_tuesday = true; let age: Result<u8, _> = "34".parse(); if let Some(color) = fav_color { println!("Using your favorite color, {}, as t...
use cryptanalysis::english; use bitwise::bitwiseops; use bitwise::hex_rep::ToHexRep; use challengeinfo::challenge::{Challenge, ChallengeInfo}; use std::io::{BufRead, BufReader}; use std::fs::File; use num_rational::Ratio; pub const FILE: &'static str = "data/set1/ex4.txt"; pub const INFO4: ChallengeInfo<'static> = C...
extern crate diesel; use rocket::State; use rocket_contrib::json::Json; use crate::auth::crypto_auth; use crate::db::models::*; use crate::db::user; use crate::db::auth_info; pub fn create_signup(database_url: State<String>, create_info: Json<CreateInfo>) -> Result<CreateResult, &str> { let user_to_insert: User = ...
pub mod textures;
use super::{ filters::{AudioFilter, VideoFilter}, graph, }; use crate::{source::Decoder, Result}; use stainless_ffmpeg::{ audio_decoder::AudioDecoder, format_context::FormatContext, video_decoder::VideoDecoder, }; use std::sync::{Arc, Mutex}; #[derive(Debug, PartialEq)] pub struct StreamDescriptor { pub index:...
use std::io::{Write, Read}; #[derive(Debug)] struct TempDir(std::path::PathBuf, std::process::Child); impl TempDir { fn new<P: AsRef<std::path::Path>> (p: P) -> TempDir { let here = std::env::current_dir().unwrap(); let p = here.join(p); println!("remove test repository"); std::fs::...
use nix::sched::{clone, CloneFlags}; use nix::sys::signal::Signal; use nix::sys::utsname::uname; use nix::sys::wait::waitpid; use nix::unistd::sethostname; use std::env; use std::process; use std::thread; use std::time::Duration; const STACK_LENGTH: usize = 1024 * 1024; fn child_func(hostname: &String) -> isize { ...
use super::*; use osgood_v8::wrapper::{Local, Valuable}; use osgood_v8::V8; pub fn v8_headers(header_map: &HeaderMap) -> Local<V8::Object> { let context = get_context(); let mut v8_headers = V8::Object::new(); for (h_name, h_value) in header_map { v8_headers.set(context, h_name.as_str(), h_value.to...
// This file is part of Substrate. // Copyright (C) 2017-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...
pub fn sum_of_multiples(limit: u32, factors: &[u32]) -> u32 { let mut mult = Vec::new(); for num in 1..limit { let multiples = factors.iter().map(|f| { if *f == 0 { 0 } else { match num % f { 0 => 1, _ => 0 ...
use crate::conv_req::convert_req; use crate::Options; use actix_web::{http::StatusCode, web, HttpRequest, HttpResponse}; use fmterr::fmt_err; use perseus::{ err_to_status_code, serve::get_page_for_template, stores::{ImmutableStore, MutableStore}, TranslationsManager, }; use serde::Deserialize; #[derive...
use alloc::vec::Vec; use util::Hash; use super::{EdonR, P384}; pub struct EdonR384(EdonR<u64>); impl EdonR384 { pub fn new() -> Self { Self::default() } } impl Default for EdonR384 { fn default() -> Self { Self(EdonR::<u64>::new(P384)) } } impl Hash for EdonR384 { fn hash_to_by...
pub mod vec2; pub mod vec3; pub mod quaternion; pub mod mat4x4; pub mod transform; pub use vec2::Vec2 as Vec2; pub use vec3::Vec3 as Vec3; pub use quaternion::Quaternion as Quaternion; pub use mat4x4::Mat4x4 as Mat4x4; pub use transform::Transform as Transform;
//! Bindings to [HDF5][1]. //! //! [1]: http://www.hdfgroup.org/HDF5 #![allow(non_camel_case_types, non_snake_case)] extern crate libc; mod H5ACpublic; mod H5Apublic; mod H5Cpublic; mod H5Dpublic; mod H5Epublic; mod H5FDpublic; mod H5Fpublic; mod H5Gpublic; mod H5Ipublic; mod H5Lpublic; mod H5MMpublic; mod H5Opublic...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - control register 1"] pub cr1: CR1, #[doc = "0x04 - control register 2"] pub cr2: CR2, #[doc = "0x08 - slave mode control register"] pub smcr: SMCR, #[doc = "0x0c - DMA/Interrupt enable register"] pub dier: D...
use js_sys::Date; use log; use log::{Level, LevelFilter, Metadata, Record}; struct SimpleLogger; impl log::Log for SimpleLogger { fn enabled(&self, metadata: &Metadata) -> bool { //metadata.level() < Level::Trace true } fn log(&self, record: &Record) { if self.enabled(record.metad...
use kompact::prelude::*; use std::marker::PhantomData; use tokio::sync::broadcast::Receiver; use tokio::sync::broadcast::Sender; use crate::control::Control; use crate::data::Sharable; use crate::prelude::*; #[derive(Collectable, Finalize, NoTrace, NoSerde, NoDebug)] pub struct Pushable<T: Sharable>(Sender<T::T>); ...
#[cfg(test)] pub mod test_formatting { use super::super::super::euler_library::utilities; #[test] fn milliseconds_less_than_10() { assert_eq!(utilities::format_milliseconds(6),"00:00:00:006"); } #[test] fn milliseconds_less_than_100() { assert_eq!(utilities::format_millisecond...
//! Encoding of a binary [`Envelope`]. //! //! ```text //! //! +-------------+--------------+----------------+----------------+ //! | | | | | //! | Principal | Amount | Gas Limit | Gas Fee | //! | (Address) | (u64) | (u64) ...
#[derive(Debug)] struct BigStruct { one : i32, two : i32, three : i32 } fn foo(x : Box<BigStruct>) -> BigStruct { *x } fn main() { let a = BigStruct {one:1, two:2, three:3}; println!("address of struct {:p}", &a); let x = Box::new(a); println!("address of boxed struct {:p}", &*x); ...
//! Hydroflow surface syntax #![warn(missing_docs)] #![cfg_attr( feature = "diagnostics", feature(proc_macro_diagnostic, proc_macro_span) )] #![allow(clippy::let_and_return)] #![allow(clippy::explicit_auto_deref)] pub mod diagnostic; pub mod graph; pub mod parse; pub mod pretty_span; pub mod union_find;
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under both the MIT license found in the * LICENSE-MIT file in the root directory of this source tree and the Apache * License, Version 2.0 found in the LICENSE-APACHE file in the root directory * of this source tree. */ // Th...
use super::*; #[test] fn greet_yields_greeting() { // given a greeter let greeter = greet; // when it is invoked let result = greeter(); // then it should return the appropriate greeting let expected_greeting = match 0_usize.count_zeros() { 32 => "Hello, 32-bit world!".to_owned(), ...
#[doc = "Reader of register SM_SHIFTCTRL"] pub type R = crate::R<u32, super::SM_SHIFTCTRL>; #[doc = "Writer for register SM_SHIFTCTRL"] pub type W = crate::W<u32, super::SM_SHIFTCTRL>; #[doc = "Register SM_SHIFTCTRL `reset()`'s with value 0x000c_0000"] impl crate::ResetValue for super::SM_SHIFTCTRL { type Type = u3...
#[doc = "Register `HASH_CSR48` reader"] pub type R = crate::R<HASH_CSR48_SPEC>; #[doc = "Register `HASH_CSR48` writer"] pub type W = crate::W<HASH_CSR48_SPEC>; #[doc = "Field `CS48` reader - CS48"] pub type CS48_R = crate::FieldReader<u32>; #[doc = "Field `CS48` writer - CS48"] pub type CS48_W<'a, REG, const O: u8> = c...