text
stringlengths
8
4.13M
use bytes::Buf; use hyper::{header, Body, Request, Response, StatusCode}; use serde::{Deserialize, Serialize}; use super::error::ApiError; pub async fn json_request<T: for<'de> Deserialize<'de>>( request: &mut Request<Body>, ) -> Result<T, ApiError> { let whole_body = hyper::body::aggregate(request.body_mut()...
use syntax::{ast, codemap, parse}; use syntax::ptr::P; use syntax::ext::base; use super::Generator; #[macro_use] mod macro_ext; mod parser; mod generator; #[derive(Clone)] pub struct ModelState { pub mod_name: ast::Ident, pub model: P<ast::Item>, pub primary_key: Option<Vec<String>>, pub before_creat...
//! stdlib implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/stdlib.h.html #![no_std] #![feature(core_intrinsics)] #![feature(global_allocator)] extern crate ctype; extern crate errno; extern crate platform; extern crate ralloc; use core::{ptr, str}; use errno::*; use platform::ty...
use std::path::BytesContainer; use http::headers::content_type::MediaType; use self::mimegen::get_generated_content_type; mod mimegen; pub fn get_content_type(path: &Path) -> Option<MediaType> { let path_str = path.container_as_str().unwrap(); let ext_pos = regex!(".[a-z0-9]+$").find(path_str); let mut ...
pub type IDirectMusic = *mut ::core::ffi::c_void; pub type IDirectMusic8 = *mut ::core::ffi::c_void; pub type IDirectMusicBuffer = *mut ::core::ffi::c_void; pub type IDirectMusicCollection = *mut ::core::ffi::c_void; pub type IDirectMusicDownload = *mut ::core::ffi::c_void; pub type IDirectMusicDownloadedInstrument = *...
use crate::color; use pancurses::{Window, COLOR_PAIR}; use rand::{thread_rng, Rng}; pub struct Food<'a> { pub x: i32, pub y: i32, form: char, color: i16, window: &'a Window, } impl<'a> Food<'a> { pub fn new(window: &'a Window, form: char, color: i16) -> Self { Self { x: thr...
use std::cell::RefCell; use std::collections::HashMap; use crate::array::*; use crate::shader::Vertex; use gfx; #[derive(Copy, Clone)] pub struct BlockState { pub value: u16, } pub const EMPTY_BLOCK: BlockState = BlockState { value: 0 }; #[derive(Copy, Clone)] pub struct BiomeId { pub value: u8, } #[derive...
extern crate actix; extern crate actix_broker; use std::time::Duration; use actix::{clock::sleep, prelude::*}; use actix_broker::{Broker, BrokerSubscribe, SystemBroker}; #[derive(Clone, Message)] #[rtype(result = "()")] struct TestMessage; #[derive(Default)] struct TestActor { count: u8, } impl Actor for TestA...
use futures::{stream, StreamExt}; use tokio::task::JoinError; use web3::{ transports, types::{BlockId, BlockNumber, Transaction, TransactionReceipt, H160, H256, U256}, Transport, Web3 as Web3Generic, }; type Web3 = Web3Generic<transports::Http>; pub struct TxInfo { pub hash: H256, pub from: H160, ...
//! Generic encoding and decoding. //! //! This module contains the generic `Codec` trait and a protobuf codec //! based on prost. mod decode; mod encode; #[cfg(feature = "prost")] mod prost; #[cfg(test)] mod tests; pub use self::decode::Streaming; pub(crate) use self::encode::{encode_client, encode_server}; #[cfg(f...
use directories::{ProjectDirs, UserDirs}; use std::io::{BufRead, BufReader, Write}; use std::path::PathBuf; use crate::Errors; fn project_dir() -> Result<ProjectDirs, Errors> { ProjectDirs::from("info", "Fuzen", "Melody").ok_or(Errors::FailedToGetAppDirectory) } #[derive(Debug)] pub struct Settings { pub vol...
#![feature(try_trait)] #![feature(map_into_keys_values)] #![feature(hash_drain_filter)] #![feature(hash_set_entry)] #![feature(min_const_generics)] mod utils; //mod day1; //mod day2; //mod day3; //mod day4; //mod day5; //mod day6; //mod day7; //mod day8; //mod day9; //mod day10; //mod day11; //mod day12; //mod day13; ...
use super::downcast::downcast_pf; use super::error::RuntimeErr; use super::pine_ref::PineRef; use super::ref_data::RefData; use super::series::Series; use super::traits::{ Arithmetic, Category, Comparator, ComplexType, DataType, Negative, PineClass, PineFrom, PineStaticType, PineType, SecondType, SimpleType, };...
#[macro_use] extern crate random_number; extern crate chrono; extern crate ctrlc; extern crate redis; #[macro_use] extern crate colour; pub mod exchange; pub mod parser; pub mod account; pub mod buffer; pub mod database; pub use crate::exchange::{Exchange, Market, Request}; pub use crate::account::{Users}; pub use cr...
use std::path::{PathBuf, Path}; use std::io::prelude::*; use std::io::Error; use std::fs::File; use std::fs; use rustc_serialize::json::Json; use semver::Version; use semver::VersionReq; fn match_current_node(package_version: String, installed_versions: Vec<String>) -> Option<String> { let installed_semver = inst...
use proptest::{prelude::*, *}; use rand::{distributions::Bernoulli, seq::SliceRandom}; use crate::{cnf::CnfFormula, lit::Lit}; /// Generate small hard unsat instances. /// /// Implementation of http://www.cs.qub.ac.uk/~i.spence/sgen/ but with random partitions pub fn sgen_unsat_formula( blocks: impl Strategy<Val...
#![allow(warnings)] use rodio::Sink; use std::fs::File; use std::io::BufReader; fn main() { let (_stream, handle) = rodio::OutputStream::try_default().unwrap(); // load the music let music = File::open("assets/music/spacelifeNo14.ogg").unwrap(); let source = rodio::Decoder::new(BufReader::new(music))...
//! This module represents the logoff request and response. //! The SMB2 LOGOFF Request packet is sent by the client to request termination of a particular session. //! This request is composed of an SMB2 header, followed by this request structure. //! The SMB2 LOGOFF Response packet is sent by the server to confirm th...
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // 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 ...
pub type IChannelCredentials = *mut ::core::ffi::c_void;
#![allow(dead_code)] use circuit_desc::circuit_desc_gen::*; use circuit_desc::gate_desc::*; #[derive(Clone, Debug)] pub struct CircuitState<C: CircuitDesc> { pub new_wire_label: usize, pub new_input_wire_label: usize, pub new_output_wire_label: usize, pub circuit: C, } impl <C: CircuitDesc> CircuitSta...
#[macro_use] extern crate quicli; extern crate reqwest; use quicli::prelude::*; use std::process::Command; use reqwest::header::{Authorization, Basic, ContentType}; use std::env; /// Generates git branch names based on JIRA Issues #[derive(Debug, StructOpt)] struct Cli { /// Jira issue number issue: String, } #...
pub mod addr; pub mod socket; pub mod epoll; pub mod tcp; pub mod buff; extern crate libc as c; pub use self::socket::Socket as Socket; pub use self::epoll::Selector as Selector; pub use self::tcp::TcpStream as TcpStream; pub use self::tcp::TcpListener as TcpListener; pub use self::buff::Buff as Buff; pub enum Event...
#[doc = "Reader of register USTAT"] pub type R = crate::R<u32, super::USTAT>; #[doc = "Writer for register USTAT"] pub type W = crate::W<u32, super::USTAT>; #[doc = "Register USTAT `reset()`'s with value 0"] impl crate::ResetValue for super::USTAT { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
use crate::{ helper::Helper, types::{ElGamalParams, ModuloOperations}, }; use num_bigint::BigUint; #[derive(Clone, Eq, PartialEq, Debug, Hash)] pub struct KeyGenerationProof { pub challenge: BigUint, pub response: BigUint, } impl KeyGenerationProof { /// GenKeyPairProof Algorithm 8.7 (CHVoteSpec 3...
use std::fmt; use std::result; use ff::FF; use sbox; use util; #[derive(Debug, PartialEq)] pub struct State { state: [[u8; 4]; 4] } impl State { pub fn from_slice(slice: &[u8]) -> State { let mut state = [[0; 4]; 4]; for c in 0..4 { for r in 0..4 { state[r][c] = slice[c*4 + r]; } } State{sta...
use std::fmt::Display; use data_types::{CompactionLevel, ParquetFile}; use crate::{ components::{ divide_initial::multiple_branches::order_files, files_split::FilesSplit, split_or_compact::SplitOrCompact, }, file_classification::{ CompactReason, FileClassification, FilesForProgress...
use amethyst::assets::{AssetStorage, Loader}; use amethyst::core::transform::Transform; use amethyst::ecs::prelude::{Entity}; use amethyst::prelude::*; use amethyst::ui::{Anchor, TtfFormat, UiText, UiTransform}; use amethyst::renderer::{ Camera, PngFormat, Projection, SpriteSheet, SpriteSheetFormat, SpriteSheetHandle, ...
use std::{sync::Arc, io::Read}; use sourcerenderer_core::{Vec2, Platform, graphics::*, platform::IO}; use crate::{renderer::{renderer_resources::HistoryResourceEntry, render_path::RenderPassParameters}, ui::UIDrawData}; pub struct UIPass<P: Platform> { device: Arc<<P::GraphicsBackend as Backend>::Device>, pi...
use deadpool::{ managed::{BuildError, PoolConfig}, Runtime, }; use crate::{Manager, Pool}; /// Configuration object. By enabling the `config` feature you can /// read the configuration using the [`config`](https://crates.io/crates/config) /// crate. /// /// ## Example environment /// ```env /// SQLITE__PATH=d...
use crate::smb2::requests::tree_connect::TreeConnect; /// Serializes a tree connect request from the corresponding struct. pub fn serialize_tree_connect_request_body(request: &TreeConnect) -> Vec<u8> { let mut serialized_request: Vec<u8> = Vec::new(); serialized_request.append(&mut request.structure_size.clon...
use crate::{ config::Config, steamworks_util::{ OneShotRecvError, UgcQueryBuilder, }, }; use conrod_core::{ widget, widget_ids, Borderable, Colorable, Labelable, Positionable, Sizeable, Widget, }; use parking_lot::Mutex; use std::{ borrow::Cow, error::...
use crate::errors::*; use crate::version::Version; use bytes::*; use std::cell::RefCell; use std::mem; use std::rc::Rc; pub const MARKER: u8 = 0xC1; #[derive(Debug, PartialEq, Clone)] pub struct BoltFloat { pub value: f64, } impl BoltFloat { pub fn new(value: f64) -> BoltFloat { BoltFloat { value } ...
use std::collections::HashSet; use console::style; use reqwest::header::AUTHORIZATION; use reqwest::StatusCode; use serde_json::json; use super::cli; use super::issue; use issue::Issue; const API_ENDPOINT: &str = "https://api.github.com"; pub struct Request { client: reqwest::Client, url: String, remot...
use std::collections::{VecDeque, HashMap}; use redcode::types::*; use redcode::traits; pub type SimulationResult<T> = Result<T, SimulationError>; pub type LoadResult<T> = Result<T, LoadError>; /// Errors that can occur during simulation #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum SimulationError { ///...
use day03; fn main() { let input: Vec<&str> = include_str!("../../input/2018/day3.txt").lines().collect(); println!("Part 1: {}", day03::part1(&input)); println!("Part 2: {}", day03::part2(&input)); }
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //! Defines an interface for request filters and some basic filters. use fidl_fuchsia_ledger_cloud::{DeviceSetRequest, PageCloudRequest, PositionToken}; u...
use crate::{proto, Client, MakeClient, RateLimit}; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, }; use tokio::sync::Semaphore; use tracing::{debug, debug_span, trace}; use tracing_futures::Instrument; #[derive(Clone)] pub struct Runner { clients: usize, streams: usize, rate_limit: RateLim...
//! To run this code, clone the rusty_engine repository and run the command: //! //! cargo run --release --example layer use rusty_engine::prelude::*; fn main() { let mut game = Game::new(); let mut layer = 0.0; let preset_iterator = SpritePreset::variant_iter().peekable(); for (x, sprite_preset)...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qtablewidget.h // dst-file: /src/widgets/qtablewidget.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block ...
use std::collections::VecDeque; use input_i_scanner::InputIScanner; use join::Join; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.s...
use super::chal39::{RsaKeyPair, RsaPubKey}; use num::{BigUint, One, Zero}; /// input an RSA public key, the ciphertext, and the oracle /// outpus the decryption pub fn rsa_parity_oracle_attack(pk: &RsaPubKey, ct: &BigUint, oracle: &Oracle) -> BigUint { // inclusive upper and lower bounds let mut upper = &pk.n ...
use super::player::*; use super::io::*; use super::board::*; #[test] fn human_player_get_move_returns_zero_based_move_when_valid() { // Typing in 1 to choose the first space // is more natural than typing 0 let io = TestIo::new("3".to_string()); let human_player = HumanPlayer::new(io, 1); let board...
use yew::prelude::*; use yew_router::{route::Route, switch::Permissive}; mod pages; use pages::{ about::About, home::Home, page_not_found::PageNotFound, job_page::JobPage, }; mod switch; use switch::{AppAnchor, AppRoute, AppRouter, PublicUrlSwitch}; mod models; pub enum Msg { ToggleNavbar, } pub struct Model...
use std::fs::File; use std::io::prelude::*; use curl::easy::Easy; use hurl::http::libcurl; use hurl::http::libcurl::client::ClientOptions; use hurl::http::libcurl::core::*; use server::Server; macro_rules! t { ($e:expr) => { match $e { Ok(e) => e, Err(e) => panic!("{} failed with ...
extern crate glob; use std::string::String; use std::process::{Stdio, Command}; use std::fs::File; use std::os::unix::io::FromRawFd; use std::os::unix::io::AsRawFd; pub struct RashCmd { cmd: Command, name: String, args: Vec<String>, stdin: Stdio, stdout: Stdio, stderr: Stdio, pred: Option<...
use std::ffi::c_void; use std::fmt::{self, Display}; use super::*; use crate::support::{self, MlirStringCallback}; use crate::Context; extern "C" { type MlirAffineMap; } #[repr(transparent)] #[derive(Copy, Clone)] pub struct AffineMap(*mut MlirAffineMap); impl AffineMap { /// Creates a zero-result affine map...
use failure::Fallible; use std::collections::HashMap; use futures::stream::Stream; use std::sync::{Arc, Mutex}; use core::fmt::Debug; use futures::Future; use futures::future::IntoFuture; use failure::Error; use futures_locks::Mutex as FuturesMutex; /// Convenience type to wrap other types in a Future pub type FutureI...
#[doc = "Writer for register TIMBICR"] pub type W = crate::W<u32, super::TIMBICR>; #[doc = "Register TIMBICR `reset()`'s with value 0"] impl crate::ResetValue for super::TIMBICR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Delayed Protection Flag Clear\n\n...
struct Counter { count: u32 } fn main() { let mut counter = Counter { count: 0 }; for _ in 1..=3 { std::thread::spawn(move || { counter.count += 1 }); } }
use chrono::{Datelike, Duration, NaiveDate, Weekday}; use crate::{ database::{period::Period, task_data::TaskData}, time_frame::TimeFrame, }; pub fn get_done_fraction( task: &TaskData, done_timestamps: &[NaiveDate], time_frame: &TimeFrame, ) -> f64 { match task.period { Period::Week =>...
#[doc = "Reader of register C1_APB1HENR"] pub type R = crate::R<u32, super::C1_APB1HENR>; #[doc = "Writer for register C1_APB1HENR"] pub type W = crate::W<u32, super::C1_APB1HENR>; #[doc = "Register C1_APB1HENR `reset()`'s with value 0"] impl crate::ResetValue for super::C1_APB1HENR { type Type = u32; #[inline(...
use crate::{ engine::world::WorldCameraExt, engine::Engine, game::GameState, render::components::Cursor, }; use cvar::{INode, IVisit}; pub use gfx2d::math::*; use hecs::World; mod cli; mod entities; mod render; mod spawner; pub use render::RenderState; #[derive(Default)] pub struct DebugState { ...
use std::fmt::{Debug, Error, Formatter}; use libwebp_sys::*; use crate::shared::{PixelLayout, WebPImage, WebPMemory}; /// A decoder for WebP images. It uses the default configuration of libwebp. /// Currently, animated images are not supported. pub struct Decoder<'a> { data: &'a [u8], } impl<'a> Decoder<'a> { ...
use node::Node; use traits::{Leaf, PathInfo, SubOrd}; use node::NodesPtr; use self::actions::{NodeAction, LeafAction}; pub trait CursorNav: Sized { type Leaf: Leaf; type NodesPtr: NodesPtr<Self::Leaf>; type PathInfo: PathInfo<<Self::Leaf as Leaf>::Info>; fn _is_root(&self) -> bool; fn _path_info(&...
#[cfg(feature="never")] mod will_fail { use std::cmp::max; unsafe fn make_room<T>(v : &mut Vec<T>, req : usize) { let new_size = max(req, v.len()); v.reserve(new_size); v.set_len(new_size); } fn array_copy<T : Clone>( src : &Vec<T>, dest : &mut Vec<T>, ...
use crate::{Coordinate, CoordinateType, Line, Point, Triangle}; use std::iter::FromIterator; use std::ops::{Index, IndexMut}; /// An ordered collection of two or more [`Coordinate`s](struct.Coordinate.html), representing a /// path between locations. /// /// # Examples /// /// Create a `LineString` by calling it direc...
use crate::manager::{AccountStatus, OnChainIdentity}; use crate::primitives::{Account, AccountType, Fatal, Judgement, NetAccount}; #[cfg(test)] use crate::tests::mocks::MatrixEventMock; use crossbeam::channel::{unbounded, Receiver, Sender}; #[cfg(test)] use matrix_sdk::identifiers::{RoomId, UserId}; use tokio::time::{s...
use crate::{ buffers::{Buffers, DefaultBuffers}, lexer::{Lexer, Token, TokenType}, words::{Atom, Word, WordsOrComments}, Callbacks, Comment, GCode, Line, Mnemonic, Nop, }; use core::{iter::Peekable, marker::PhantomData}; /// Parse each [`GCode`] in some text, ignoring any errors that may occur or /// [...
//! Quicksilver uses the `View` structure as an abstraction for both graphical and input projection. //! //! This means that a view can be thought of like a camera: it //! determines what coordinates in draw calls appear where on screen, as well as the relationship //! between the mouse location on the screen and the r...
use crate::{executor, sys}; impl sys::sGaugeDrawData { /// Get the width of the target instrument texture. pub fn width(&self) -> usize { self.winWidth as usize } /// Get the height of the target instrument texture. pub fn height(&self) -> usize { self.winHeight as usize } ...
pub trait MonteCarloStatsCollector { fn accumulate_result(&mut self, result: f64); fn running_stats(&self) -> Vec<Vec<f64>>; } pub struct MonteCarloMeanCollector { running_sum: f64, paths_done: usize } impl MonteCarloMeanCollector { pub fn new() -> MonteCarloMeanCollector { MonteCarloMeanC...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - DMA interrupt status register"] pub bdma_isr: BDMA_ISR, #[doc = "0x04 - DMA interrupt flag clear register"] pub bdma_ifcr: BDMA_IFCR, #[doc = "0x08 - DMA channel x configuration register"] pub bdma_ccr0: BDMA_CCR0, ...
#[derive(Debug, Clone)] pub struct InputSeed { pub is_favored:bool, pub was_fuzzed:bool, pub seed_vec:Vec<u8>, } impl InputSeed { // pub fn emptyNew()-> InputSeed { // InputSeed { // is_favored:true, // was_fuzzed:false, // seed_vec:Vec::new(), ...
use crate::cpu::Cpu; use crate::trap::Exception; pub fn execute(_cpu: &mut Cpu, _inst: u64) -> Result<(), Exception> { /* let opcode = inst & 0x7f; let rd = ((inst >> 7) & 0x1f) as usize; let rs1 = ((inst >> 15) & 0x1f) as usize; let rs2 = ((inst >> 20) & 0x1f) as usize; let funct3 = (inst >> 1...
#![feature(test)] extern crate test; use test::Bencher; use coruscant_nbt::{from_slice, to_gzip_writer, to_vec, to_writer, Compression}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; #[derive(Serialize, Deserialize)] #[serde(rename = "wrap")] struct Wrap { #[serde(rename = "inner")] inne...
//! A module containing the structure of the valgrind XML output. //! //! Only the memcheck tool is implemented in accordance to [this][link] //! description]. //! //! Note, that not all fields are implemented. //! //! [link]: https://github.com/fredericgermain/valgrind/blob/master/docs/internals/xml-output-protocol4.t...
use diesel::pg::PgConnection; use diesel::r2d2::ConnectionManager; use lazy_static::*; use r2d2::{Pool, PooledConnection}; use crate::util::env_vars::{DB_MAX_POOL_SIZE, DB_URL}; lazy_static! { static ref DB_CONNECTION_POOL: Pool<ConnectionManager<PgConnection>> = { let manager = ConnectionManager::new(&*D...
// When the logging feature is not used, these should effectively do nothing. // However, if we simply ignore the arguments passed to the macro, we'll get // a bunch of warnings about dead code, unused variables, etc. To get around // this, we can bind all of the arguments in a local scope. However, simply // bindi...
#[doc = "Reader of register DINR15"] pub type R = crate::R<u32, super::DINR15>; #[doc = "Reader of field `DIN15`"] pub type DIN15_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:15 - Input data received from MDIO Master during write frames"] #[inline(always)] pub fn din15(&self) -> DIN15_R { DIN15_...
mod game_world; mod position; mod region; pub use game_world::*; pub use position::*; pub use region::*;
use crate::token::Token; pub trait Node { fn token_literal(&self) -> String; } #[derive(Debug)] pub enum Statement { Let(LetStatement), Return(ReturnStatement), Expression(ExpressionStatement), } impl Node for Statement { fn token_literal(&self) -> String { match self { Statem...
use std::io; use num::BigUint; use crate::{rsa, io as asdf}; use std::error::Error; fn print_help() { println!("Key generation: "); println!("\t k -> Generate new key and store in memory"); println!("\t wk -> Write key stored in memory to file"); println!("\t rk -> Read key from disk. Must be present ...
#[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::INTENCLR { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w ...
#[doc = "Reader of register MPCBB2_VCTR2"] pub type R = crate::R<u32, super::MPCBB2_VCTR2>; #[doc = "Writer for register MPCBB2_VCTR2"] pub type W = crate::W<u32, super::MPCBB2_VCTR2>; #[doc = "Register MPCBB2_VCTR2 `reset()`'s with value 0xffff_ffff"] impl crate::ResetValue for super::MPCBB2_VCTR2 { type Type = u3...
//! Core runtime support for SQLx. **Semver-exempt**, not for general use. #[cfg(not(any( feature = "runtime-actix-native-tls", feature = "runtime-async-std-native-tls", feature = "runtime-tokio-native-tls", feature = "runtime-actix-rustls", feature = "runtime-async-std-rustls", feature = "runt...
extern crate ndbx_core; extern crate xml; use std::fs::File; use std::io::BufReader; use xml::reader::{EventReader, XmlEvent}; fn indent(size: usize) -> String { const INDENT: &'static str = " "; (0..size) .map(|_| INDENT) .fold(String::with_capacity(size * INDENT.len()), |r, s| r + s) } // fn parse_...
// MinIO Rust Library for Amazon S3 Compatible Cloud Storage // Copyright 2022 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE...
pub enum Action { List, Clone, Pull, Checkout, MirrorPull, MirrorPush, } impl Action { pub fn from(input: &str) -> Result<Action, &str> { let action = match input { "list" => Action::List, "clone" => Action::Clone, "pull" => Action::Pull, ...
use crate::*; use num_derive::FromPrimitive; use num_traits::FromPrimitive; #[derive(PartialEq, Eq, Hash, Clone, Debug, Serialize, Deserialize)] pub struct ScoreId(HashSha256, PlayMode); impl ScoreId { pub fn new(sha256: HashSha256, mode: PlayMode) -> ScoreId { ScoreId(sha256, mode) } pub fn sha2...
use std::mem::uninitialized; /// Estimates the Shannon entropy of the given byte buffer, which must be less /// than or equal to 65536 bytes long. pub fn entropy_estimate(src: &[u8]) -> f64 { assert!(src.len() < 65536); let mut probabilities: [u16; 256] = unsafe { uninitialized() }; for n in 0..256 { proba...
use actix_web::actix::Addr; use crate::filestore::{FileNode, FileStore}; use crate::model::db::Database; use crate::model::{ member::Member, project::{CreateProject, Project, ProjectById, ProjectMembers}, user::{User, UserById, UserProjects}, }; use futures::Future; use juniper::Context; use juniper::RootNo...
use crate::{permute_comp, PoseidonState}; use stark_curve::FieldElement; /// Hashes two elements using the Poseidon hash. /// /// Equivalent to [`poseidon_hash`](https://github.com/starkware-libs/cairo-lang/blob/12ca9e91bbdc8a423c63280949c7e34382792067/src/starkware/cairo/common/builtin_poseidon/poseidon.cairo#L5). pu...
use crate::core::{ attribute::TypedAttribute, channel_list::{ChannelListRef, ChannelListRefMut}, cppstd::CppString, error::Error, preview_image::{PreviewImage, PreviewImageRef}, refptr::{OpaquePtr, Ref, RefMut}, tile_description::TileDescription, Compression, LineOrder, }; use openexr_s...
#![allow(unused_assignments)] use types::*; macro_rules! syscall { ($id:expr, $name:ident) => { #[inline(always)] #[no_mangle] pub unsafe extern fn $name() -> int_t { let mut ret: int_t = $id; asm!("syscall" : "+{rax}"(ret) : : ...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qitemeditorfactory.h // dst-file: /src/widgets/qitemeditorfactory.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end //...
use clippy_utils::diagnostics::span_lint; use clippy_utils::trait_ref_of_method; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty::TypeFoldable; use rustc_middle::ty::{Adt, Array, Ref, Slice, Tuple, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::so...
use core::f32; use core::u32; #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn fmodf(x: f32, y: f32) -> f32 { let mut uxi = x.to_bits(); let mut uyi = y.to_bits(); let mut ex = (uxi >> 23 & 0xff) as i32; let mut ey = (uyi >> 23 & 0xff) as i32; let sx = uxi & 0x80000000; let mu...
//! Audio file helpers //! //! use std::f64; pub fn audio_file_samples(path: &str) -> Vec<i16> { let mut reader = hound::WavReader::open(path).unwrap(); let samples = reader.samples::<i16>(); let mut samples_vec: Vec<i16> = Vec::new(); let mut count = 0; { let sampels_vec2 = ...
// // Sysinfo // // Copyright (c) 2017 Guillaume Gomez // #![crate_type = "bin"] #![allow(unused_must_use, non_upper_case_globals)] extern crate sysinfo; use sysinfo::{NetworkExt, Pid, ProcessExt, ProcessorExt, Signal, System, SystemExt}; use sysinfo::Signal::*; use std::io::{self, BufRead, Write}; use std::str::...
pub use VkStencilFaceFlags::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkStencilFaceFlags { VK_STENCIL_FACE_FRONT_BIT = 0x00000001, VK_STENCIL_FACE_BACK_BIT = 0x00000002, VK_STENCIL_FRONT_AND_BACK = 0x3, } use crate::SetupVkFlags; #[repr(C)] #[derive(Clone, Copy, Eq, PartialEq,...
use std::{path::Path, process::Command, time::Duration}; use criterion::{criterion_group, criterion_main, BatchSize, BenchmarkGroup, Criterion}; use test_dir::{fs_fn, join_all, TestDir}; pub fn clone_repo<P: AsRef<Path>>(url: &str, path: P) { let path = path.as_ref(); println!("git cloning path {}", path.di...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - DFSDM channel configuration 0 register 1"] pub dfsdm_chcfg0r1: DFSDM_CHCFG0R1, #[doc = "0x04 - DFSDM channel configuration 0 register 2"] pub dfsdm_chcfg0r2: DFSDM_CHCFG0R2, #[doc = "0x08 - DFSDM analog watchdog and sho...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. #[allow(clippy::unnecessary_wraps)] pub fn parse_create_activity_error( response: &http::Response<bytes::Bytes>, ) -> std::result::Result<crate::output::CreateActivityOutput, crate::error::CreateActivityError> { let generic = crate...
use std::sync::Arc; use mixer::{Controller, MixerIn, ChannelIn}; use sequence::{Sequence, Field, Command, Note}; pub struct Track { pub seq: Sequence, chan: Vec<Channel>, row_jump: Option<usize>, row: usize, tick_count: u8, tick_rate: u8, bpm: u8, pcm: ...
#[derive(PartialEq, Eq, Clone, Debug)] pub struct ListNode { pub val: i32, pub next: Option<Box<ListNode>>, } impl ListNode { #[inline] fn new(val: i32) -> Self { ListNode { next: None, val } } } pub fn merge_two_lists( list1: Option<Box<ListNode>>, _list2: Option<Box<ListNode>>, )...
use std::fmt; use std::rc::Rc; use super::{ffi, PowerDevice, PowerManager}; use crate::platform::traits::BatteryIterator; use crate::Result; pub struct PowerIterator { #[allow(dead_code)] manager: Rc<PowerManager>, inner: ffi::DeviceIterator, } impl Iterator for PowerIterator { type Item = Result<Pow...
use crate::interface::model::lock::StakeLock; use crate::interface::{BlockHeight, ContractBalances, StorageUsage}; use crate::{ domain::RedeemLock, interface::{ BatchId, BlockTimeHeight, RedeemStakeBatch, StakeBatch, StakeTokenValue, TimestampedNearBalance, TimestampedStakeBalance, }, }; use...
use itertools::{EitherOrBoth, Itertools}; use crate::{BitPage, BitPageVec}; // @author shailendra.sharma use crate::bit_page::{zero_masks, BitPageWithPosition}; use crate::bit_page_vec::BitPageVecKind; impl BitPageVec { pub fn active_bits_count(&self) -> usize { match self.kind { BitPageVecKin...
use super::{random_bytes, SrpClient}; use bytes::Buf; use dh::{mod_p::Dh, DH}; use encoding::hex; use hmac::{Hmac, Mac}; use hyper::{Body, client::Client, Method, Request, Uri}; use num::BigUint; use rocket::{self, get, post, routes}; use rocket::{ config::{Config, Environment, LoggingLevel}, http::Status, ...