text
stringlengths
3.09k
13.9k
use crate::mem::Zeroize; // Carry-less Multiplication #[inline] fn cl_mul(a: u64, b: u64, dst: &mut [u64; 2]) { dst[0] = 0; dst[1] = 0; for i in 0u64..64 { if (b & (1u64 << i)) != 0 { dst[1] ^= a; } // Shift the result dst[0] >>= 1; if (dst[1] & (1u64...
extern crate clap; extern crate redif; use std::sync::{Arc,Mutex}; use redif::{Value, Handler}; fn main() { let args = clap::App::new("Redis Server Framework") .version("0.1.0") .author("<EMAIL>") .about("redis protocol server framework") .arg(clap::Arg::with_name("port") ...
use crate::dbutils; use async_trait::async_trait; use bytes::Bytes; use dbutils::{DupSort, Table}; use ethereum_types::Address; use futures::{future::LocalBoxFuture, stream::LocalBoxStream}; use std::{cmp::Ordering, future::Future, pin::Pin}; pub type ComparatorFunc = Pin<Box<dyn Fn(&[u8], &[u8], &[u8], &[u8]) -> Orde...
//! `stringsext` searches for multi-byte encoded strings in binary data.\ //! `stringsext` is a Unicode enhancement of the GNU strings tool with //! additional functionalities: stringsext recognizes Cyrillic, CJKV characters //! and other scripts in all supported multi-byte-encodings, while GNU strings //! fails in fi...
use std::io::prelude::*; // parse use std::net::{TcpStream}; use std::path::Path; // gestion repertoires use ssh2::{Session, Channel}; use clap::{Arg, App}; // arguments fn _do_exit(mut channel: Channel, rc: i32) { _close_connexion(channel); std::process::exit(rc); } fn _close_connexion(mut channel: Channe...
use std::{collections::HashMap, ops::Deref}; use aoc::{lines, PuzzleInput}; type Input = Passport; type Output = usize; register!( "input/day4.txt"; (input: input!(blocks Input)) -> Output { part1(&input); part2(&input); } ); fn part1(items: &[Input]) -> Output { items.iter().filter(...
// Copyright 2019 Cargill Incorporated // // 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-2.0 // // Unless required by applicable law or agre...
use syn::export::{Span, TokenStream2}; use syn::spanned::Spanned; use syn::{Error, FnArg, ImplItemMethod, Pat, Type}; use quote::quote; use std::collections::HashMap; use std::iter::FromIterator; /// Check that narrows down argument types and return type descriptive enough for deserialization and serialization. pub f...
use std::collections::{HashMap, HashSet}; use common::{ parse::{spaces, unsigned_number}, prelude::*, }; use nom::{ bytes::complete::tag, combinator::{all_consuming, into}, multi::{many_m_n, separated_list1}, sequence::{separated_pair, terminated}, IResult, }; use uuid::Uuid; pub fn run()...
// Copyright 2021 BlockPuppets developers. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // excep...
use git_url_parse::GitUrl; use std::{env::current_dir, fs, path::PathBuf, str::FromStr}; use structopt::StructOpt; use toml_edit::{decorated, Document, InlineTable}; use walkdir::WalkDir; /// Which dependencies should be rewritten? #[derive(Debug, Clone)] enum Rewrite { All, Substrate(Option<String>), Polk...
use std::env; use std::sync::Once; use std::time::Instant; use gccjit::{ Context, FunctionType, GlobalKind, }; use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::dep_graph; use rustc_middle::middle::cstore::EncodedMetadata; use rustc_middle::middle::exported_symbols; use rustc_middle::ty::TyCtxt; use ru...
use std::{ cmp, sync::{ atomic::{AtomicBool, AtomicU32, Ordering}, Arc, }, time::Instant, }; use futures_intrusive::channel::shared::{channel, Receiver, Sender}; use futures_util::future::FutureExt; use tokio::{task, time::timeout}; use crate::{error::Error, Connection, Database}; use...
use { super::{mat4_na_to_sierra, Renderer, RendererContext}, crate::{ camera::Camera3, graphics::{ mesh::Mesh, vertex::{Color, Normal3, Position3, VertexType as _}, Graphics, Scale, }, scene::Global3, viewport::Viewport, }, bump...
use std::ops; #[derive(Clone, Copy, Debug, PartialEq)] pub struct SquareMeter(u32); impl ops::Add for SquareMeter { type Output = SquareMeter; fn add(self, other: SquareMeter) -> Self::Output { SquareMeter(self.0 + other.0) } } pub struct House { windows: u32, doors: u32, rooms: u32,...
use anyhow::{bail, Result}; use structopt::StructOpt; use crate::api::config::{ config::{write_config, Config}, configuration::Configuration, }; use super::{aspect_ratio::AspectRatio, minimum_size::MinimumSize, subreddit::OutFormat, Format}; #[derive(Debug, StructOpt, Clone)] pub enum Profile { /// Sets the main ...
/* Copyright (c) Fortanix, Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ pub type Hash = [u8; 32]; pub trait SgxHashOps { fn new() -> Self; fn ...
// Copyright 2019 Canonical Ltd. All rights reserved. Use // of this source code is governed by a BSD-style license that can be // found in the LICENSE file. extern crate changelog; extern crate git; use std::fmt::{self, Display}; use std::fs; use std::path::PathBuf; use std::process::Command; use changelog::Change...
//Copyright (c) 2016, <NAME>, <NAME> //All rights reserved. use std::error::Error; use std::fs; use std::fs::OpenOptions; use std::path::{Path, PathBuf}; use std::str::FromStr; extern crate clap; use clap::{Arg, App}; #[macro_use] extern crate log; use log::LogLevelFilter; extern crate hyper; mod commands; mod con...
use super::super::dst::{DstAddr, Route}; use super::super::{classify, identity}; use crate::proxy::http::{router, settings}; use crate::proxy::server::Source; use crate::transport::{connect, tls}; use crate::{tap, Conditional, NameAddr}; use http; use indexmap::IndexMap; use std::fmt; use std::net::SocketAddr; use std:...
use anyhow::Context; use clap::{crate_authors, crate_version, values_t_or_exit, App, Arg, ArgMatches, SubCommand}; use grep_cli::{is_readable_stdin, is_tty_stdout, stdout, stdout_buffered_line}; use std::{ borrow::Borrow, ffi::{OsStr, OsString}, fs::File, io::{self, BufRead, BufReader}, iter::{self,...
// Passthrough decoder for librespot use super::{AudioDecoder, AudioError, AudioPacket}; use ogg::{OggReadError, Packet, PacketReader, PacketWriteEndInfo, PacketWriter}; use std::fmt; use std::io::{Read, Seek}; use std::time::{SystemTime, UNIX_EPOCH}; fn get_header<T>(code: u8, rdr: &mut PacketReader<T>) -> Result<Box...
/* * Copyright (c) Meta Platforms, Inc. and 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. */ #![...
use core::mem::MaybeUninit; /// `Vec` that can be used in a constant context. #[doc(hidden)] pub struct ComptimeVec<T: Copy> { // FIXME: Waiting for <https://github.com/rust-lang/const-eval/issues/20> storage: [MaybeUninit<T>; MAX_LEN], len: usize, } const MAX_LEN: usize = 256; impl<T: Copy> ComptimeVec<...
#![allow(clippy::many_single_char_names)] use cosmwasm_std::entry_point; use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; use std::result::Result; use crate::engine::Game as ChessGame; use crate::error::ContractError; use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; u...
use crate::input::Input; use std::collections::HashMap; enum EntryType { BeginShift { guard_id: u32 }, FallsAsleep, WakesUp, } struct LogEntry { minute: u32, entry: EntryType, } fn parse_input(input_string: &str) -> Result<Vec<LogEntry>, String> { let mut lines: Vec<&str> = input_string.lines...
use std::fs::read_to_string; use std::io::{stdin, stdout, Write}; use colored::Colorize; use quicli::fs::write_to_file; use regex::Regex; use crate::consts::CONFIG_FILE; use crate::modules::commands::replicate::run_replicate; use crate::modules::services::databases; use crate::modules::services::utils::{get_config_in...
// Copyright 2017 <NAME>. // Licensed under the MIT license (http://opensource.org/licenses/MIT) // This file may not be copied, modified, or distributed // except according to those terms. use std::collections::{vec_deque, VecDeque}; use std::error::Error; use std::mem; use crate::bcf::{self, Read}; /// A buffer fo...
extern crate rusty_gbc; use rusty_gbc::gbc::Cpu; use rusty_gbc::debugger::Debugger; use rusty_gbc::{SCREEN_HEIGHT, SCREEN_WIDTH}; use rusty_gbc::gbc::gpu::Gpu; use std::env; extern crate sdl2; use sdl2::keyboard::Keycode; use sdl2::event::Event; use std::fs::File; use std::io::prelude::*; use std::time::Instant; mo...
//! Waveform `Generator` implementations. use std::f32::consts::PI; use std::sync::mpsc; use std::thread; use anyhow::Result; use byteorder::{BigEndian, ByteOrder}; use cpal::traits::{HostTrait, DeviceTrait, StreamTrait}; use ringbuf::RingBuffer; use crate::{Generator, Pot}; use crate::sampling::SampleTrack; /// G...
use cryptonum::unsigned::*; use cryptonum::signed::ModInv; use dsa::params::*; use dsa::rfc6979::DSASignature; use simple_asn1::{ASN1Block,ASN1Class,ASN1EncodeErr,ToASN1}; use sha::Hash; use std::cmp::min; use utils::TranslateNums; /// A DSA public key, parameterized by its DSA parameters (so that you don't /// accide...
use crate::{ draw_target::DrawTarget, geometry::Dimensions, iterator::contiguous::Cropped, primitives::Rectangle, transform::Transform, Pixel, }; /// Clipped draw target. /// /// Created by calling [`clipped`] on any [`DrawTarget`]. /// See the [`clipped`] method documentation for more. /// /// [`clipped`]: cr...
/* * Copyright (c) 2021 Works Applications Co., Ltd. * * 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-2.0 * * Unless required by applica...
use yew::prelude::*; use yew_router::prelude::*; use yew_router::components::RouterButton; //use Context; use common::fetch::Networking; use util::button::*; //use yew::format::Json; //use yew::services::fetch::{Response}; //use failure::Error; use wire::user::*; //use context::networking::*; //use Route; //use supe...
use std::collections::HashSet; use axum::{ extract::{Extension, Path}, Json, }; use hyper::StatusCode; use sea_orm::{entity::prelude::*, ActiveValue::Set, QueryOrder}; use sea_orm::{ActiveModelTrait, DatabaseConnection, QuerySelect}; use super::{EndpointIn, EndpointOut}; use crate::{ core::{ secur...
use alloc::sync::{Arc, Weak}; use core::intrinsics; use bitflags::_core::alloc::Layout; use spin::Mutex; use system::bits::flags::PageTableFlags; use system::ia_32e::{PhysAddr, VirtAddr}; use system::ia_32e::paging::{Frame, Page, Page4KB, PageRangeInclude}; use system::ia_32e::paging::mapper::Mapper; use crate::memor...
//! [CAIP-2] Blockchain IDs //! //! This module provides a struct [ChainId] to represent a CAIP-2 blockchain id, that can be //! converted to and from a string. //! //! ## Example //! Round-trip parse and serialize a CAIP-2 string. //! ``` //! use ssi::caip2::ChainId; //! use std::str::FromStr; //! //! let chain_id_str...
use std::path::Path; use file; use crate::{Language, File, dump_file, dump_file_ws, TextRange, TextUnit, tu}; use difference::Changeset; pub fn extract_range(input: &str, caret: &str) -> (String, TextRange) { let left_offset = input.find(caret).expect( &format!("No caret ({}) in\n{}\n", caret, input) ...
use crate::table::{ScriptHash, SyncNumber}; use db_xsql::rbatis::executor::{RBatisConnExecutor, RBatisTxExecutor}; use db_xsql::rbatis::sql; #[sql( tx, "UPDATE mercury_cell AS cell SET consumed_block_number = consume.consumed_block_number, consumed_block_hash = consume.consumed_block_hash, consum...
// Copyright © 2018 <NAME> // [This program is licensed under the "MIT License"] // Please see the file LICENSE in the source // distribution of this software for license terms. //! Map data management for Plan B. extern crate serde; extern crate serde_json; //Had to import noisy_floats to Ord and Eq for waypoints ...
//! This module is responsible for spawning the laser entity. A lot of it is //! fairly standard, but many of the parameters need to be generalized or //! accessed as some shared game state. //! //! In some cases, debugging values are used, and thus this code is not //! independent of the environment in which it is typ...
use coarsetime::Instant; use crossbeam_channel::{Receiver, Sender}; use std::borrow::Cow; use std::io::Read; use std::net::TcpListener; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; use usiem::components::common::{ SiemComponentCapabilities, SiemComponentStateStorage, SiemFunct...
//! Evolution will be a 2D genetic algorithm simulation. //! //! A `Fish` will first spawn at a random location in the window. //! The `Fish` will then go on to seek and eat `Food` and `Poison`. use ggez::{conf, event, graphics, nalgebra::Point2, timer, Context, ContextBuilder, GameResult}; use rand::{rngs::ThreadRng,...
use tokio::io; use crate::Bytes; use crate::resp::Message; use crate::stats::add_network_output_bytes; pub const DEFAULT_CLIENT_OUTPUT_BUF: usize = 128; pub const RESP_TYPE_STRING: u8 = b'+'; pub const RESP_TYPE_ERR: u8 = b'-'; pub const RESP_TYPE_INTEGER: u8 = b':'; pub const RESP_TYPE_BULK: u8 = b'$'; pub const RESP...
//! BonsaiDb command line tools. use std::{ffi::OsString, fmt::Debug, path::PathBuf}; use bonsaidb_client::{fabruic::Certificate, Client}; use bonsaidb_core::async_trait::async_trait; #[cfg(any(feature = "password-hashing", feature = "token-authentication"))] use bonsaidb_core::connection::AsyncStorageConnection; use...
use self::{graph_node_ui::*, node_finder::NodeFinder}; use crate::prelude::*; use editor_state::GraphEditorState; use egui::*; use super::graph_types::AnyParameterId; pub mod editor_state; pub mod graph_node_ui; pub mod node_finder; pub fn draw_graph_editor(ctx: &CtxRef, state: &mut GraphEditorState) { let mou...
use std::fs::File; use std::io::{self, BufRead, Write}; use std::path::PathBuf; use std::process::Command; use std::time::SystemTime; use anyhow::Result; use extracted_fzy::match_and_score_with_positions; use fuzzy_matcher::skim::fuzzy_indices; use rayon::prelude::*; use serde_json::json; use structopt::clap::arg_enum...
use std::rc::Rc; use crate::data::maps::Map; use crate::algos::Algorithm; use crate::scenes::{Scene, SceneParams::EndOfProgram}; use crate::algos::AlgoStatus; use crate::graphics::renderer::Renderer; use crate::scenes::SceneParams; use crate::{max, GRID_HORZ_COUNT, GRID_VERT_COUNT}; use ggez::{Context, GameError, timer...
extern crate acme_lib; use crate::browse::{ browse_alfahosting_domain_create_acme, browse_alfahosting_domain_delete_last_dns_entry, }; use crate::config::{AcmeConfig, Certpath}; use acme_lib::create_p384_key; use acme_lib::order::{CsrOrder, NewOrder}; use acme_lib::persist::FilePersist; use acme_lib::{Certificate,...
use polodb_bson::{Document, Value}; use crate::DbResult; use crate::page::{RawPage, PageHandler}; use super::{BTreeNode, BTreeNodeDataItem, SearchKeyResult}; use super::wrapper_base::BTreePageWrapperBase; use crate::error::DbErr; use crate::data_ticket::DataTicket; pub(crate) struct InsertBackwardItem { pub conten...
use super::engine::{Action, ActionError, ScoringRules}; use super::engine::{CardEvent, GameEvent, TrickEvent}; use super::state::GameState; pub trait GamePhase { /// Return the number of possible actions fn possible_actions(&self, gs: &GameState) -> Vec<Action>; fn is_game_over(&self) -> bool; /// pe...
use std::fs::{File, DirBuilder, read_dir, metadata, remove_file}; use std::path::Path; use std::error::Error; use std::io::prelude::*; use std::time::{Duration, SystemTime}; use std::thread::{self, sleep}; use iron::prelude::*; use uuid::Uuid; use serde_json::Value; use multipart::server::{Multipart, Entries, SaveResu...
// in this example we show how you can serialize structs with the custom derive macro // It is very similar to protobuf in that it numbers the fields but it doesn't require an external schema, the source code is the schema extern crate cbor_enhanced; #[cfg(feature = "protocol_derive")] mod derive_main { use cbor_e...
//! This crate provides several free functions for managing other processes //! running in the host operating system: //! //! * [`list_processes`] &ndash; poll the operating system for a list of the //! current running processes, along with paths to the primary image //! (executable file) of each process and the se...
use{ crate::{*, glue_helper::*}, std::{ io::Write, fmt::Display, cmp::*, } }; /// # Glued together probability /// * you can [write it to a file](#method.write), maybe the file makes more sense /// * If you have problems understanding the fields, /// please, first look at the [docu...
const H: [u32; 8] = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19, ]; const K: [u32; 64] = [ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb...
//! Implementation and error definitions for the in process memory backend. use crate::Holder; use std::{ collections::HashMap, error::Error as StdError, fmt::{Display, Formatter, Result as FmtResult}, hash::Hash, mem, time::Duration, }; use super::Backend; /// Error enum for [`InMemoryBackend...
// Copyright 2015-2020 Parity Technologies (UK) Ltd. // This file is part of Open Ethereum. // Open Ethereum 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 o...
use clap::{Arg, App, SubCommand, crate_version}; use csv::ReaderBuilder; use zip::read::ZipArchive; use nem_mms::{ flatfile::FlatFile, packages, zip::read_zip, error::Error, manage::state::DepositoryState, }; use std::{ fs::OpenOptions, path::Path, }; fn main() { match _main() { ...
use regex::Regex; use tree_sitter::{LogType, Node, Parser}; const TEXT: &str = "DELETE column, column3 FROM keyspace.table WHERE column2 = 'foo' IF column4 = ?"; //const TEXT: &str = "Drop aggregate if exists foo"; //const TEXT: &str = "BEGIN LOGGED BATCH USING TIMESTAMP 5 INSERT INTO keyspace.table (col1, col2) V...
#[macro_use] extern crate clap; #[macro_use] extern crate lazy_static; extern crate regex; use std::io::prelude::*; use std::fs::File; use regex::Regex; type Register = usize; #[derive(Debug, Clone, Copy)] enum Value { Reg(Register), Lit(i64), } #[derive(Debug, Clone, Copy)] enum Instruction { Cpy(Val...
use super::range_vec::InclRange; use super::range_vec::*; use rayon::prelude::*; use regex::Regex; #[derive(Debug, Clone)] pub enum Divider { Delimited { prefix: Regex, open: Regex, close: Regex, }, Headings { fuzzed: Regex, strict: Option<Regex>, indent: Str...
//! This crate exports the Yk API via the C ABI. //! //! We use a dedicated crate for exporting to C, as you quickly get into linkage trouble if you try //! and mix Rust dynamic libraries (namely you can get duplicate copies of dependencies). //! //! The sane solution is to have only one `cdylib` crate in our workspace...
// (C) 2020 <NAME> <<EMAIL>> use geom::{bbox, point2, BBox}; use crate::common::GlyphID; use crate::error::*; use crate::loca::Loca; use crate::types::{get_i16, get_u16}; #[derive(Debug)] pub(crate) struct Glyf(Vec<Option<Glyph>>); impl Glyf { pub(crate) fn load(data: &[u8], loca: &Loca) -> Result<Glyf> { ...
use std::os::raw::{c_int, c_uchar, c_uint}; use std::process; use x11::{xlib, keysym}; use core::WindowManager; use client::{ClientL, ClientW}; use layout::Layout; const FOCUSED_BORDER_COLOR: &'static str = "RGBi:0.0/1.0/1.0"; const NORMAL_BORDER_COLOR: &'static str = "RGBi:0.0/0.3/0.3"; const BORDER_WIDTH: c_int =...
use super::error::Error; use super::io_utils::{ReadBytes, WriteBytes}; use super::Entry; use flate2::read::DeflateDecoder; use flate2::write::DeflateEncoder; use flate2::Compression as DeflateCompression; use integer_encoding::{VarInt, VarIntWriter}; use std::convert::TryInto; use std::io::{Cursor, Write}; #[derive(Co...
use rand::{thread_rng, seq::SliceRandom}; use std::cmp::Ordering; mod input { use std::io; pub fn uint(msg: &str) -> usize { loop { println!("{}", msg); let mut input = String::new(); io::stdin() .read_line(&mut input) .expect("Failed...
use std::collections::HashMap; use std::fs::File; use std::io::BufRead; use std::io::BufReader; trait Die { fn roll(&mut self) -> u64; } struct DeterministicDie { rolls: u64, } impl DeterministicDie { fn new() -> DeterministicDie { DeterministicDie { rolls: 0 } } } impl Die for DeterministicDie { fn roll(&mut...
mod counts; mod globals; mod list; use std::sync::Arc; use twilight_model::application::{ command::CommandOptionChoice, interaction::{application_command::CommandOptionValue, ApplicationCommand}, }; use crate::{ commands::{ osu::{option_country, option_discord, option_mode, option_mods_explicit, ...
/* * lilgitd serves as a ~daemon component paired with a shell profile/prompt * plugin. The shell plugin prints $PWD to lilgitd's stdin once per prompt * and waits for it to print a response on stdout. lilgitd will read-loop on * stdin, treat each line as a path, and attempt to print 3 values on stdout * as a resp...
// Copyright © 2015, <NAME> // Licensed under the MIT License <LICENSE.md> //! DSound procedure declarations, constant definitions and macros STRUCT!{struct DSCAPS { dwSize: ::DWORD, dwFlags: ::DWORD, dwMinSecondarySampleRate: ::DWORD, dwMaxSecondarySampleRate: ::DWORD, dwPrimaryBuffers: ::DWORD, ...
use input::Button; use input::Button::{Keyboard, Mouse}; use input::Key; use input::mouse::MouseButton; use tool; use tool::InteractionState; struct Control { button: Button, pressed: bool, } impl Control { fn new(button: Button) -> Control { Control { button, pressed: fa...
use super::*; use std::iter::once; #[test] fn can_mix_pickup_delivery_jobs() { let a = ActivityData::new; let stop2 = StopData::new(( 3., 3, 2, 0, (3., 10.), vec![ a(("job3", Some(3.), "delivery", Some((3., 4.)), Some((None, None)))), a(("...
use std::{fmt, io}; use std::borrow::Cow; use std::fmt::{Display, Formatter}; use std::net::SocketAddr; use chrono::Duration; use rand::prelude::{SliceRandom, ThreadRng}; use tokio::net::{ToSocketAddrs, UdpSocket}; use crate::{common, output}; use crate::common::{default_listen_ip, Format, IpMode, respond_connect, se...
/*! The components required to define a plugin API. The types defined in this module are required in defining the plugin API, the # Example - Define Plugin ```rust use dygpi::plugin::Plugin; # #[derive(Debug)] struct SoundEngine; # #[derive(Debug)] struct MediaStream; #[derive(Debug)] struct SoundEffectPlugin { ...
use esp_idf_sys::EspError; use esp_idf_sys::*; use once_cell::sync::OnceCell; use smart_leds_trait::{SmartLedsWrite, RGB8}; use std::cmp::min; use std::ffi::c_void; const WS2812_TO0H_NS: u16 = 400; const WS2812_TO0L_NS: u16 = 850; const WS2812_TO1H_NS: u16 = 800; const WS2812_TO1L_NS: u16 = 450; static WS2821_ITEM_EN...
//! Register windows handling use self::super::super::super::super::isa::{GeneralPurposeRegisterBank, SpecialPurposeRegister}; use bear_lib_terminal::terminal::{with_colors, print_xy, put_xy}; use self::super::super::super::super::rw::ReadWritable; use num_traits::{Unsigned, PrimInt, Num}; use self::super::colours_fo...
use std::{ fs::File, io::{self, BufWriter, Write}, path::Path, }; /// Write input data as an .xvg formatted file. pub fn write_xvg<T: XYData>(path: &Path, data: &T) -> Result<(), io::Error> { let fp = File::create(&path)?; let mut writer = BufWriter::new(fp); for (x, y) in data.x().iter().zip(...
pub mod user; pub mod xlive; use log::{debug, trace}; use std::sync::Arc; use crate::cache; use crate::error::{ApiError, ApiResult}; use serde::Serialize; use self::user::User; use self::xlive::Xlive; struct ApiRequestBuilder { ctx: crate::Context, api_info_getter: Option<fn(&str) -> &serde_json::Value>, } ...
extern crate utilities; use std::collections::HashSet; use std::path::PathBuf; use structopt::StructOpt; use utilities::files::open_file; #[derive(Debug, StructOpt)] #[structopt(name = "day8", version = "1.0.0")] struct Args { #[structopt(short = "f", long, parse(from_os_str))] file: PathBuf, } fn parse_input...
mod cli; mod mysql_variables; use cli::Opts; use configparser::ini::Ini; use mysql::params; use mysql::prelude::*; use mysql_variables::VariableDefinition; use std::fs::File; use std::io::Read; use std::{collections::HashMap, path::Path}; use structopt::StructOpt; use users::get_current_username; #[derive(Debug)] str...
use crate::opts::Opts; use crate::config::Configuration; use chrono::Utc; use colored::Colorize; use std::env; use std::fmt; use tracing::{field::Field, info_span, trace, Level}; use tracing_core::{Event, Subscriber}; use tracing_subscriber::field::{MakeExt, MakeVisitor, RecordFields, VisitFmt}; use tracing_subscriber...
/* Copyright 2020-2022 Adobe All Rights Reserved. NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the Adobe license agreement accompanying it. */ mod ngl; extern crate base64; use chrono::prelude::*; use eyre::{eyre, Result, WrapErr}; pub use ngl::get_adobe_device_i...
use crate::gameboy::helpers::*; use crate::gameboy::memory::memory::Memory; use crate::gameboy::interrupts::*; use crate::gameboy::gpu::Gpu; pub struct Registers { pub a: u8, pub b: u8, pub c: u8, pub d: u8, pub e: u8, pub f: u8, pub h: u8, pub l: u8, pub sp: u16, pub pc: u16 }...
use nom::bytes::streaming::take; use nom::number::complete::be_u32; use nom::number::streaming::be_u16; use sawp_flags::{Flag, Flags}; use crate::enums::{RecordClass, RecordType}; use crate::rdata::RDataType; use crate::{custom_count, ErrorFlags, IResult, Name}; #[cfg(feature = "ffi")] use sawp_ffi::GenerateFFI; //...
use futures::future::BoxFuture; use futures::io::{AsyncRead, AsyncWrite, AsyncWriteExt}; use libp2p::core::{upgrade, InboundUpgrade, OutboundUpgrade, UpgradeInfo}; use std::io::{Error, ErrorKind, Result}; use std::sync::Arc; const PROTOCOL_INFO: &[u8] = b"/ax/broadcast/1.0.0"; #[derive(Clone, Copy, Debug, Eq, Hash, O...
use deadpool_postgres::{Client, ManagerConfig, Pool, RecyclingMethod}; use lazy_static::lazy_static; use openssl::ssl::{SslConnector, SslMethod}; use postgres_openssl::MakeTlsConnector; use serde::Deserialize; use std::collections::{HashMap, HashSet}; use itertools::Itertools; #[allow(unused_imports)] use crate::{fun...
// Copyright 2021 The BitcoinMW Developers // // 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-2.0 // // Unless required by applicable law or ...
use crate::win32::resources_helper as rh; use crate::{NwgError, OemCursor, OemImage}; use std::ptr; use winapi::um::winnt::HANDLE; use winapi::um::winuser::IMAGE_CURSOR; #[cfg(feature = "embed-resource")] use super::EmbedResource; /** A wrapper over a cursor file (*.cur) Cursor resources can be used with the `cursor...
pub mod alphabeta; pub mod cache; pub mod history; pub mod moveordering; pub mod quiescence; pub mod reserved_memory; pub mod searcher; pub mod statistics; pub mod timecontrol; use crate::board_representation::game_state::*; use crate::search::searcher::Thread; use crate::search::timecontrol::TimeControlInformation; u...
//! Create and parses JWT (JSON Web Tokens) //! //! Documentation: [stable](https://docs.rs/jsonwebtoken/) #![recursion_limit = "300"] #![deny(missing_docs)] #[macro_use] extern crate error_chain; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate serde; extern crate base64; extern crate ri...
//! `dns/resolvconf.rs`: Functions for interacting with resolv.conf use byte; use ip4; use libc; use openreadclose::openreadclose; use stralloc::StrAlloc; use tai::Tai; use taia::TaiA; static mut DATA: StrAlloc = StrAlloc { s: 0i32 as (*mut u8), len: 0u32, a: 0u32, }; static mut OK: i32 = 0i32; static m...
use crate::drop::{Drop, DropSim, Item}; /// Represents a single speed run, in which barters are made and blazes are fought. /// The results of bartering and fighting are stored as a list of drops that can be interrogated /// to see exactly how lucky or unlucky the run was. #[derive(Debug, Deserialize, Serialize, Clone...
//! [`UdpSocket`](../struct.UdpSocket.html) split support. //! //! The [`split`](../struct.UdpSocket.html#method.split) method splits a //! `UdpSocket` into a receive half and a send half, which can be used to //! receive and send datagrams concurrently, even from two different tasks. //! //! The halves provide access ...
use crate::{ make_save_file_selector, make_scene_file_filter, menu::{create_menu_item, create_menu_item_shortcut, create_root_menu_item}, scene::EditorScene, settings::{Settings, SettingsWindow}, GameEngine, Message, }; use rg3d::{ core::pool::Handle, gui::{ file_browser::{FileSelect...
// Copyright 2016 <NAME> // // 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-2.0 // // Unless required by applicable law or agreed to in writi...
use dashmap::DashMap; use serde::{Deserialize, Serialize}; use std::num::NonZeroU32; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::Arc; const ROOT_CHANNEL_ID: u32 = 0; const USER_TREE_NAME: &[u8] = b"users"; const CHANNEL_TREE_NAME: &[u8] = b"channels"; type Sha1Hash = [u8; 20]; type SessionId = u32; t...
use polars::error::PolarsError; use polars::prelude::{col, lit, DataType, Expr, LiteralValue, Result, TimeUnit}; use sqlparser::ast::{ BinaryOperator as SQLBinaryOperator, DataType as SQLDataType, Expr as SqlExpr, Function as SQLFunction, Value as SqlValue, WindowSpec, }; fn map_sql_polars_datatype(data_type:...
use crate::std::string::String; use crate::std::vec::Vec; use crate::std::borrow::ToOwned; use parity_wasm::{elements, builder}; use byteorder::{LittleEndian, ByteOrder}; use crate::optimizer::{import_section, export_section}; type Insertion = (usize, u32, u32, String); pub fn update_call_index(instructions: &mut e...
#[derive(Clone)] pub struct RollingOptionsFixedWindow { /// The length of the window. pub window_size: usize, /// Amount of elements in the window that should be filled before computing a result. pub min_periods: usize, /// An optional slice with the same length as the window that will be multiplied...