text
stringlengths
8
4.13M
use crate::{Object, Args, Literal}; use crate::types::Number; use std::cmp::Ordering; use tracing::instrument; /// A mixinable class that defines comparison operators based on `<=>`. /// /// More specifically, the [`<`](Comparable::qs_lth), [`<=`](Comparable::qs_leq), [`>`](Comparable::qs_gth), and /// [`>=`](Comparab...
use crate::error::{Error, Result}; use crate::IntoSubdomain; use regex::Regex; use std::collections::HashSet; use std::sync::Arc; #[derive(Debug)] struct RapidnsResponse { body: String, } impl RapidnsResponse { pub fn new(body: String) -> Self { Self { body } } } impl IntoSubdomain for RapidnsRes...
use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use cosmwasm_std::{CanonicalAddr, ReadonlyStorage, Storage}; use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton}; pub const KEY_WRAPPED_ASSET: &[u8] = b"wrappedAsset"; // Created at initialization and reference original asset ...
// Copyright 2020-2022 The NATS Authors // 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 ...
mod database; pub use database::DatabaseRepository; mod collection; pub use collection::CollectionRepository; mod index; pub use index::IndexRepository; mod user; pub use user::UserRepository; mod document; pub use document::DocumentRepository; mod error; pub use error::{RepositoryError, RepositoryErrorKind};
extern crate rasp; use std::env; use std::io; use std::io::prelude::*; use std::fs::File; use rasp::read_and_eval; fn main() { let args: Vec<String> = env::args().skip(1).collect(); if args.len() >= 1 { for arg in args { let mut file = File::open(arg) .expect("Unable to fi...
use anyhow::Result; use crate::config::{QUEUE_NAME, CELERY_HEARTBEAT, AppState}; use celery::broker::RedisBroker; use celery::beat::{CronSchedule, DeltaSchedule}; use celery::task::TaskResult; use crate::tasks::{add, long_running_task, pull}; use substrate_subxt::Runtime; pub struct Consumer; impl Consumer { pub...
use std::collections::HashMap; use std::path::Path; use anyhow::{bail, Result}; use serde::{Deserialize, Serialize}; use starcoin_crypto::ed25519::{Ed25519PublicKey, Ed25519Signature}; use starcoin_crypto::multi_ed25519::multi_shard::MultiEd25519SignatureShard; use starcoin_crypto::multi_ed25519::{MultiEd25519PublicKe...
use super::{Ipod4g, Ipod4gControls}; use std::collections::HashMap; use crate::devices::platform::pp::Controls; use crate::gui::{ButtonCallback, ScrollCallback, TakeControls}; #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)] pub enum Ipod4gKey { Up, Down, Left, Right, Action, Hold, } #[der...
extern crate markdown; extern crate web_view; use web_view::*; fn main() { let html: String = markdown::to_html("[__I am markdown__](https://www.google.com/webhp?hl=zh-TW)"); let size = (800, 600); let resizable = true; let debug = true; let init_cb = |_webview| {}; let frontend_cb = |_...
#![cfg_attr(not(feature = "std"), no_std)] /// Edit this file to define custom logic or remove it if it is not needed. /// Learn more about FRAME and the core library of Substrate FRAME pallets: /// https://substrate.dev/docs/en/knowledgebase/runtime/frame use frame_support::{ decl_error, decl_event, decl_module, de...
use std::cell::Cell; use std::fmt::Display; use std::task::Waker; use crate::task::raw::TaskVTable; use crate::task::state::State; pub(crate) struct Header { pub state: State, pub waker: Option<Waker>, // Why is this wrapped in UnsafeCell? pub vtable: &'static TaskVTable, // Why &'static? Think cau...
use std::{iter, ptr}; use std::borrow::BorrowMut; use std::cell::{Cell, RefCell}; use std::marker::PhantomData; use std::mem::ManuallyDrop; use std::ops::Deref; use std::sync::{Arc, Mutex, RwLock}; use gfx_hal::adapter::Adapter; use gfx_hal::Backend; use gfx_hal::device::Device; use gfx_hal::format::{ChannelType, Form...
pub mod keyboard_controller;
use byteorder::{LittleEndian, ReadBytesExt}; use std::fs::File; use std::io; pub fn load_bin(path: &str) -> Result<Vec<u16>, io::Error> { let mut result = Vec::new(); let mut f = File::open(path)?; let mut keep_reading = true; while keep_reading { match f.read_u16::<LittleEndian>() { Ok(entry) => result.push(...
#![allow(dead_code)] // not sure why this is necessary? #[repr(C, packed)] pub(crate) struct Header { pub id: [u8; 10], pub version: i32, } #[repr(C, packed)] pub(crate) struct Vertex { pub flags: u8, pub vertex: [f32; 3], pub bone_id: i8, pub reference_count: u8, } #[repr(C, packed)] pub(cra...
extern crate roki; use roki::gfx::texture::Texture; use roki::gfx::pipeline::Pipeline; use roki::gfx::window::WindowBuilder; use roki::gfx::object::{ Object, ObjectBuilder }; fn main() { let mut winbuilder = WindowBuilder::new(); let mut win = winbuilder.dimension([400, 400]) .titl...
#[allow(unused_imports)] use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub struct DedupeReport { /// The phase of the job this report was generated for. #[serde(rename = "phase")] pub phase: Option<i32>, /// The report results. #[serde(rename = "results")] pub results: Option<...
/* * @lc app=leetcode id=6 lang=rust * * [6] ZigZag Conversion * * https://leetcode.com/problems/zigzag-conversion/description/ * * algorithms * Medium (32.59%) * Total Accepted: 343.6K * Total Submissions: 1.1M * Testcase Example: '"PAYPALISHIRING"\n3' * * The string "PAYPALISHIRING" is written in a z...
// 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 ...
use super::program::Program; use std::str; use std::str::FromStr; fn is_digit(c: char) -> bool { c.is_digit(10) } named!(children_list(&str) -> Vec<&str>, do_parse!( tag!(" -> ") >> children: many1!(do_parse!( opt!(tag!(", ")) >> name: take_while_s!(char::is_alphabetic) >> (name))) >> (children) ))...
use commons::io::load_file_lines; use itertools::Itertools; use petgraph::graphmap::GraphMap; use petgraph::{Directed, Direction}; use std::collections::HashMap; fn main() { let input: Vec<u32> = load_file_lines("input.txt") .map(|x| x.expect("Could not read input")) .sorted() .collect(); ...
use std::time::Duration; use tetra::Context; use tetra::graphics::{Texture, Rectangle, DrawParams}; use tetra::graphics::animation::Animation; use tetra::input::{is_key_down, Key}; use tetra::math::Vec2; pub struct Player { assets: PlayerAssets, stats: PlayerStats, pub position: Vec2<f32>, pub velocity: Vec2<f...
use std::fmt::Display; use std::str::FromStr; /// The four colors #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub enum Color { Black, Blue, Orange, Red, } impl Display for Color { fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { write!( fmt, ...
#[allow(unused_imports)] use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub struct JobTypes { #[serde(rename = "types")] pub types: Option<Vec <crate::models::JobTypeExtended>>, }
//! Helper code for character escaping. use crate::num::NonZeroUsize; use crate::ops::Range; const HEX_DIGITS: [u8; 16] = *b"0123456789abcdef"; /// Escapes a byte into provided buffer; returns length of escaped /// representation. pub(crate) fn escape_ascii_into(output: &mut [u8; 4], byte: u8) -> Range<u8> { let...
//! Parse in a power-of-two radix. use crate::{ arch::Word, buffer::Buffer, parse::ParseError, primitive::{WORD_BITS, WORD_BITS_USIZE}, radix::{self, Digit}, ubig::UBig, }; /// Parse an unsigned string to `UBig`. pub(crate) fn parse(src: &str, radix: Digit) -> Result<UBig, ParseError> { de...
#![cfg(feature = "backup-enable")] use crate::error::Result; use crate::workflow::host_input; use crate::workflow::*; use frame_host::engine::HostEngine; use sgx_types::sgx_enclave_id_t; #[derive(Debug, Default, Clone)] pub struct SecretBackup; impl SecretBackup { pub fn all_backup_to(&self, eid: sgx_enclave_id_t...
mod reversi; use crate::player::alphabeta::AlphaBetaSearchPlayer; use crate::player::cli::HumanPlayer; use crate::player::random::RandomPlayer; use crate::reversi::gm; use crate::reversi::player; use crate::reversi::util; use std::io::{stdout, Write}; fn main() { println!("choose players."); println!(" a : A...
#![allow(clippy::needless_range_loop)] //! 3-D Euclid vectors use num::traits::float::Float; use std::clone::Clone; //use std::cmp::{Eq, PartialEq}; use super::sphcoord::SphCoord; use std::convert::From; use std::marker::Copy; use std::ops::{Add, Div, Index, IndexMut, Mul, Sub}; /// 3-D Euclid vector #[derive(Debug, ...
use crate::graphics::renderer::Renderable; pub struct Element { } impl Renderable for Element { fn render() { println!("rendering element") } }
//! This crate gives a generic way to add a callback to any dropping value //! //! You may use this for debugging values, see the [struct documentation](struct.DropGuard.html) or the [standalone examples](https://github.com/dns2utf8/drop_guard/tree/master/examples). //! //! # Example: //! //! ``` //! extern crate drop_...
// //! Copyright 2020 Alibaba Group Holding Limited. //! //! 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 ...
use std::{collections::HashMap, hash::Hash, ops::Index}; use crate::{colors::colors::Color, models::*, structures::Move}; use itertools::Itertools; use rand::seq::SliceRandom; use serde::{Deserialize, Serialize}; pub type Point = (i32, i32); impl From<Point> for AxialCoord { fn from(p: Point) -> Self { ...
pub mod engine; pub mod go; pub mod aga;
use glutin_frontend::tile_map::{TileMapData, UpdateTileMapData, ShaderTemplateInfo}; use tile_buffer::TileBufferCell; use tile::{NUM_TILE_CHANNELS, OVERLAY_CHANNEL}; const TILE_STATUS_IDX: usize = 3; const STATUS_BITS_PER_CHANNEL: usize = 2; const CHANNEL_STATUS_BITS: usize = NUM_TILE_CHANNELS * STATUS_BITS_PER_CHANNE...
use advent_of_code_2019::*; use std::fs::read_to_string; pub fn main(input: Option<&str>) -> Result<()> { let _input = read_to_string(input.unwrap_or("input/day07.txt"))?; // answer!(07, 1, 42); Ok(()) }
use color::sample::*; use std::u16; use std::u8; const EIGHT_BIT_MAX: SamplePrecision = (u8::MAX as SamplePrecision) + 1.0 - 1e-6; const SIXTEEN_BIT_MAX: SamplePrecision = (u16::MAX as SamplePrecision) + 1.0 - 1e-6; #[inline(always)] fn clamp_color(color: SamplePrecision) -> SamplePrecision { color.min(1.0).max(0...
mod one; mod two; mod three; mod four; mod five; mod six; mod seven; mod eight; mod nine; mod ten; mod eleven_test; mod thirteen; mod fourteen; fn main(){ // one::one(); // two::two_point_zero(); // two::two_point_one(); // two::two_point_two(); // two::two_point_three(); // three::three_point_o...
use crate::data::Row; use crate::executor::Payload; use crate::parse::{parse, Query}; use crate::result::{Error, Result}; /// If you want to make your custom storage and want to run integrate tests, /// you should implement this `Tester` trait. /// /// To see how to use it, /// * [tests/sled_storage.rs](https://github...
use super::post::{post, PostError, Request}; use serde::Serialize; use serde_json::Value; use std::collections::HashMap; #[derive(Deserialize, Debug)] pub struct BotConfig { pub channel_secret: String, pub channel_access_token: String, pub target_group_id: String, } pub struct LineClient { pub channel...
use { copernica_common::{LinkId, InterLinkPacket, HBFI}, copernica_protocols::{FTP, Protocol}, std::{thread}, crossbeam_channel::{Sender, Receiver, unbounded}, copernica_identity::{PrivateIdentity}, //sled::{Db, Event}, anyhow::{Result}, //log::{debug}, }; #[derive(Clone, Debug)] enum F...
/* ----------------------------------------------------------------------------------- * src/take_vec.rs - A container that holds an item and the number of times it can be * "taken" out of the container. * beetle - Pull-based GUI framework. * Copyright © 2020 not_a_seagull * * This project is li...
extern crate bson; use futures::{future::Future, Poll}; use std::io; use std::net::{Shutdown, SocketAddr}; use std::str::FromStr; use tokio::io as tio; use tokio::net::TcpStream; // pub trait Layer: io::AsyncWrite + io::AsyncRead {} pub trait AsyncDatabase {} pub trait AsyncClient: tio::AsyncWrite { fn auth( ...
#[macro_use] extern crate log; use std::fs; use std::io::Read; use std::path::PathBuf; pub type DynResult<T> = Result<T, Box<dyn std::error::Error + Send + Sync>>; use structopt::StructOpt; use clicky_core::block::{self, BlockDev}; use clicky_core::gui::TakeControls; use clicky_core::sys::ipod4g::{BootKind, Ipod4g,...
extern crate clap; use std::io::prelude::*; use std::io::{Error, ErrorKind}; use std::fs::File; struct Triangle(u64, u64, u64); impl Triangle { fn is_valid(&self) -> bool { let &Triangle(a, b, c) = self; let mut s = [a, b, c]; s.sort(); s[0] + s[1] > s[2] } } fn invalid_data(...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Ethernet PTP time stamp control register (PTP_TSCTL)"] pub ptp_tsctl: PTP_TSCTL, #[doc = "0x04 - Ethernet PTP subsecond increment register"] pub ptp_ssinc: PTP_SSINC, #[doc = "0x08 - Ethernet PTP time stamp high registe...
extern crate confy; use serde::{ Serialize, Deserialize }; use thiserror::Error; use anyhow::{ Result }; use print_nanny_client::models::{ DeviceIdentity }; #[derive(Error, Debug, PartialEq)] pub enum ConfigError { #[error("Missing attribute: {0}")] MissingAttribute(String), } #[derive(Debug, Serialize, D...
use std::fs; use std::io::Write; use std::path::Path; use anyhow::{ensure, Result}; use interface::{BlobInfo, CertificateInfo, StorageNodeInfo}; use protocol::directory::storage::{MoveRequest, RegisterResponse}; use reqwest::Url; use super::constants; use crate::DirectoryHostConfig; pub struct RegisterResponseWra...
#![feature(slice_patterns)] use clap::{App, AppSettings, Arg, SubCommand}; mod command; use command::Command; mod datastore; mod domain; #[macro_use] extern crate serde_derive; use failure::Fail; fn main() { let app = App::new("monga") .version("0.0.1") .setting(AppSettings::ArgRequiredElseHelp...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program 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 Softwa...
use std::fmt; #[derive(Debug, Clone, Default)] pub struct Pos { pub filename: String, pub line: usize, pub column: usize, } impl fmt::Display for Pos { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}:{}:{}", self.filename, self.line, self.column) } }
use std::collections::HashMap; use std::borrow::Cow::{self, Borrowed, Owned}; use std::process::Command; extern crate serde; extern crate colored; extern crate regex; extern crate reqwest; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate serde_qs; extern crate confy; use colored::*; use r...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { _reserved0: [u8; 0x0100], #[doc = "0x100 - A security violation has been detected for the RAM memory space"] pub events_ramaccerr: EVENTS_RAMACCERR, #[doc = "0x104 - A security violation has been detected for the flash memory space"] p...
use fmt::Debug; use crate::{Context, Vector}; use std::{error::Error, fmt}; ///Action is type for command action. It returns Result<ActionResult, ActionError>. pub type Action = fn(Context) -> Result<ActionResult, ActionError>; #[derive(Debug)] ///ActionResult stores result of action. pub enum ActionResult { ///Don...
use crate::bios_parameter_block::BYTES_PER_SECTOR; use crate::fat_section_util::get_fat_entry; use crate::new_file::get_cluster_from_entry; use crate::shell_state::ShellState; pub fn read_file(shell_state: &ShellState, fat_entry: usize) -> Vec<u8> { let mut current_fat_entry = fat_entry; let file = vec!...
pub(crate) mod encode_decode; pub(crate) mod format;
use std::borrow::Borrow; use std::fs::{create_dir_all, rename, OpenOptions}; use std::io::Write; use std::path::{Path, PathBuf}; use failure::Error; use futures::future::{ok, result}; use futures::prelude::Future; use futures::stream::{futures_unordered, iter_ok}; use futures::Stream; use reqwest::r#async::{Chunk, Cli...
use kvr::ioutils::ByteBufWriter; use kvr::ioutils::u642bytes; use std::fs::File; use std::io::BufWriter; use byteorder::LittleEndian; fn main() { let f = File::create("/Volumes/Elements/data2e7.bin").unwrap(); let mut writer = ByteBufWriter::new(BufWriter::with_capacity(8 * 1024 * 1024, f)); for i in 0..20...
use chrono::{DateTime, Utc}; use serde_repr::{Deserialize_repr, Serialize_repr}; use std::collections::HashMap; #[derive(Debug, Serialize, Deserialize, Clone)] #[serde(rename_all = "camelCase")] pub struct ServerTime { pub server_time: u64, } #[derive(Debug, Serialize, Deserialize, Clone)] #[serde(rename_all = "c...
use anyhow::{bail, Result}; use async_std::{sync, task}; use serde::Deserialize; use shrinkwraprs::Shrinkwrap; use std::{ convert::TryFrom, fmt, path::{Path, PathBuf}, str::FromStr, time::Duration, }; use thiserror::Error; use url::Url; fn get_home_dir() -> PathBuf { use std::process; matc...
use crate::enum_parser_type::EnumParserType; use structopt::StructOpt; use std::error::Error; use strum::IntoEnumIterator; use std::convert::AsRef; use std::string::ToString; fn check_str(src: &str) -> Result<String,Box<dyn Error>> { let is_valid_parser_type = EnumParserType::iter().any(|x| x.as_ref() == src); ...
pub use self::game_struct::Game; pub use self::game_model::GameModel; pub use self::game_controller::GameController; pub use self::game_view::{GameView, AnimationEnum}; mod game_struct; mod game_model; mod game_controller; mod game_view;
use crate::pixel::*; use crate::PlaneData; use std::io::Read; use std::mem; fn copy_from_raw_u8<T: Pixel>(source: &[u8]) -> Vec<T> { match mem::size_of::<T>() { 1 => source.iter().map(|byte| T::cast_from(*byte)).collect(), 2 => { let mut output = Vec::with_capacity(source.len() / 2); ...
pub(crate) mod edit; pub(crate) mod interactive; pub(crate) mod order; #[cfg(target = "macos")] pub(crate) mod remind; use std::str::FromStr; use anyhow::Result; use clap::Clap; use crate::opt::Opt; /// Available subcommands #[derive(Clap, Debug, Clone, PartialEq, Copy)] pub(crate) enum Command { /// Edit or cre...
// while loop fn main() { for i in 0..10 { println!("Counting... {}", i); } println!("Done"); }
//mod print; //mod vars; //imports the vars file //mod types; //mod string; //mod tuple; //mod arrays; //mod vectors; //mod conditionals; //mod loops; //mod functions; //mod pointer_ref; mod structs; fn main() { structs::run();//uses the run() fn from --- }
use crate::ast::util::Transform; use crate::ast::*; use crate::config::Config; use crate::id::Id; use crate::pass::Pass; pub struct VarToConstructor { id: Id, } impl VarToConstructor { pub fn new(id: Id) -> Self { VarToConstructor { id } } fn generate_pass(&mut self, symbol_table: SymbolTable...
//! Allow parsed AST to be quote-embedded as eucalypt use crate::syntax::ast::*; /// Embed core representation in eucalypt syntax pub trait Embed { /// Represent core expression in a eucalypt AST structure fn embed(&self) -> Expression; } impl Embed for Literal { fn embed(&self) -> Expression { ma...
use structout::generate; generate!( { foo: u32, bar: u64, baz: String } => { WithoutFoo => [omit(foo)], WithoutBar => [omit(bar)], WithAttrs => [attr(#[object(context=Database)]), attr(#[object(config="latest")])], } );
use std::cell::RefCell; use std::mem; use std::panic; use std::thread; type Error = Box<dyn std::error::Error + 'static>; thread_local! { pub static LAST_ERROR: RefCell<Option<Error>> = RefCell::new(None); } pub trait ForeignObject: Sized { type RustObject; #[inline] unsafe fn from_rust(object: Self...
mod raw_guard; #[cfg(feature = "backend-std")] mod main { use std::io::{Read as _, Write as _}; use std::os::unix::io::AsRawFd as _; pub fn run(child: &pty_process::std::Child) { let _raw = super::raw_guard::RawGuard::new(); let mut buf = [0_u8; 4096]; let pty = child.pty().as_raw_...
pub const NUM_AXES : usize = 3; pub const NUM_VALUES : usize = 128; #[allow(dead_code)] pub mod bootloader_cmd { pub const VERSION : u8 = 0x00; pub const INTERRUPT_BOOT : u8 = 0x01; pub const WRITE_BLOCK : u8 = 0x02; pub const WRITE_BLOCK_ACK : u8 = 0x03; pub const NEXT_MCU : u8 = 0x07; pub con...
struct Solution {} impl Solution { pub fn last_stone_weight(stones: Vec<i32>) -> i32 { let mut stones = stones; while stones.len() > 1 { stones.sort(); let a = stones.pop().expect("a"); let b = stones.last_mut().expect("b"); if &a == b { ...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use libra_metrics::{ register_histogram, register_histogram_vec, register_int_counter, register_int_counter_vec, register_int_gauge, register_int_gauge_vec, DurationHistogram, Histogram, HistogramVec, IntCounter, IntCounter...
use rusty_engine::prelude::*; fn main() { let mut game = Game::new(); for (i, _sfx) in SfxPreset::variant_iter().enumerate() { game.game_state_mut() .timer_vec .push(Timer::from_seconds((i as f32) * 2.0, false)); } game.game_state_mut().timer_map.insert( "quit_t...
use log::info; use serde_derive::{Deserialize, Serialize}; use std::env; use std::error::Error; use std::fs::File; use std::path::Path; #[derive(Debug, Serialize, Deserialize)] pub struct Config { pub consumer_key: String, pub consumer_secret: String, pub access_key: String, pub access_secret: String, ...
use tavern_core::game::santorini::{State}; use tavern_core::{Slot, Packed1}; use game::{BoardWithMoves, UIState}; use aphid::HashSet; #[derive(Debug)] pub struct TentativeState { pub matching_slots : HashSet<Slot>, // matching positions for highlights pub move_count : usize, pub proposed_state: State, ...
//! This mutator attempts to remove various kinds of items from a wasm module. //! //! Removing an item from a wasm module is a somewhat tricky process because //! there are many locations where indices are referenced. That means that when //! this mutator is used it will need to renumber all indices in the wasm module...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use serde::Deserialize; use serde::Serialize; use serde_with::serde_as; #[serde_as] #[serde_with::skip_serializing_none] #[deriv...
use self::Entry::*; use std::borrow::{Borrow, BorrowMut}; use std::cmp::Ordering; use std::fmt; use std::fmt::Debug; use std::hash::{Hash, Hasher}; use std::iter::{FromIterator, Map}; use std::mem::swap; use std::ops::{Index, IndexMut}; use std::slice; use std::vec; use std::vec::Vec; #[derive(Clone, Default)] pub str...
pub fn escape_snapshot_name(name: String) -> String { let mut name = name .to_lowercase() // @todo Real escape? .replace("\r", "") .replace("\n", "") .replace("\t", "") .replace(">", "") .replace("<", "") .replace("'", "") .replace("::", "_") ...
use na::{Matrix4}; #[derive(Clone, Copy, Debug, PartialEq)] pub struct CameraMatrices { pub view: Matrix4<f32>, pub projection: Matrix4<f32>, } impl CameraMatrices { pub fn new(view: Matrix4<f32>, projection: Matrix4<f32>) -> Self { CameraMatrices { view, projection, } } } pub trait Camera { fn matri...
use std::net::{TcpListener, TcpStream}; use std::thread; use std::sync::mpsc::{channel, Receiver, Sender}; pub fn iterate(listener: TcpListener, tag: String) -> (Raii, TcpConnectionIterator) { let (tx, rx) = channel(); let killer = Raii { killer: tx.clone() }; thread::spawn(move || listener_thread(&listene...
mod sample_fsm; use super::*; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use crossbeam::channel::Receiver; use std::{ io::Write, time::{Duration, Instant}, }; const ENABLE_CHECK_NON_BLOCKING: bool = false; const NON_BLOCKING_THRESHOLD: Duration = Duration::from_millis(1); #[ctor::ctor] fn ...
tonic::include_proto!("bank"); use std::time::SystemTime; use solo_machine_core::{service::BankService as CoreBankService, DbPool, Event, Signer}; use tokio::sync::mpsc::UnboundedSender; use tonic::{Request, Response, Status}; use self::bank_server::Bank; pub struct BankService<S> { core_service: CoreBankServic...
/// #[derive(...)] statements define certain properties on the enum for you for /// free (printing, equality testing, the ability to copy values). More on this /// when we cover Enums in detail. /// You can use any of the variants of the `Peg` enum by writing `aux`, etc. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pu...
/* * Isilon SDK * * Isilon SDK - Language bindings for the OneFS API * * OpenAPI spec version: 5 * Contact: sdk@isilon.com * Generated by: https://github.com/swagger-api/swagger-codegen.git */ use std::borrow::Borrow; use std::rc::Rc; use futures; use futures::Future; use hyper; use super::{configuration, pu...
use serde::*; use super::*; use crate::crypto::*; #[derive(Serialize, Deserialize, Debug, Clone)] pub enum AteSessionInner { User(AteSessionUser), Sudo(AteSessionSudo), } impl AteSession for AteSessionInner { fn role<'a>(&'a self, purpose: &AteRolePurpose) -> Option<&'a AteGroupRole> { match self ...
use std::time::Instant; pub fn solve(){ let s = Instant::now(); println!("WARNING! this is kind of slow :("); const INPUT : &str = include_str!("../../inputs/2016/5"); let mut password = String::new(); let mut pass_chars = [u8::MAX;8]; for i in 0.. { let hash = md5::compute(format!("{}{...
use std::collections::VecDeque; pub struct Buffer { pub left: VecDeque<u8>, pub right: VecDeque<u8>, } impl Buffer { pub fn new() -> Self { Buffer { left: VecDeque::new(), right: VecDeque::new(), } } pub fn next_word_boundary(&self) -> i32 { self.ri...
use std::{ cmp::min, io::{Read, Write}, iter::FromIterator, ops::Bound, path::Path, }; use super::super::{cursor::BufferCursor, CharBuffer, Movement}; use crate::{ debugger_catch, only_in_debug, textbuffer::{ cursor::MetaCursor, metadata::{self, calculate_hash}, oper...
use crate::dom_types::{MessageMapper, View}; use crate::vdom::{App, Effect, RenderTimestampDelta, ShouldRender, UndefinedGMsg}; use futures::Future; use std::{collections::VecDeque, convert::identity, rc::Rc}; // ------ Orders ------ pub trait Orders<Ms: 'static, GMs = UndefinedGMsg> { type AppMs: 'static; ty...
extern crate proc_macro; use proc_macro2::{Ident, TokenStream}; use quote::quote; use syn::parse::{Parse, ParseStream, Result}; use syn::punctuated::Punctuated; use syn::spanned::Spanned; use syn::token::{Colon2, Comma}; use syn::{DeriveInput, Generics, PathSegment, TypePath}; struct MsgTypes { types: Vec<MsgVari...
pub mod debugger; pub mod command;
extern crate sha2; mod gen_list; use gen_list::*; use sha2::{Sha512, Sha256, Digest}; //lets a key be either hardened or not hardened, and public or private enum Key_Type { private_key, public_key, h_private_key, h_public_key, } //creates key-value pairs struct Key_Pair { private_key: Key_Type::p...
//! Tests for [`rustix::pty`]. #![cfg(feature = "pty")] #[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))] mod openpty;
pub const REMOTE : &str = "39.105.42.131"; pub const LOCAL : &str ="localhost";
extern crate ms3d; use std::fs::File; use ms3d::Model; const BYTES: &[u8] = include_bytes!("POA.ms3d"); #[test] fn test_reader() { Model::from_reader(File::open("tests/POA.ms3d").unwrap()).unwrap(); } #[test] fn test_slice() { Model::from_bytes(BYTES).unwrap(); }
use crate::frame::Source; use crate::ir_exec::Ret; use crate::types::{Value, IR}; use serde_derive::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct Trace { #[cfg(not(target_arch = "wasm32"))] start: std::time::Duration, #[cfg(not(target_arch = "wasm32"))] end: std::time::D...