text
stringlengths
8
4.13M
use super::color::Color; use super::object::Object; use super::ray::Ray; use std::cmp::Ordering; pub struct Scene { pub background: Color, pub objects: Vec<Object> } pub struct Intersection<'a> { pub object: &'a Object, pub distance: f64 } impl<'a> Intersection<'a> { pub fn new(object: &'a Object...
/* cell.rs Implementation of cell for Scrabble board */ use crate::tile::Tile; pub enum Bonus { None, DoubleLetter, DoubleWord, TripleLetter, TripleWord, } pub struct Cell { pub _tile: Option<Tile>, pub _bonus: Bonus, } impl Cell { pub fn normal_cell() -> Cell { Cell { ...
fn foo() { use auto_impl::auto_impl; #[auto_impl(Fn)] trait Foo<'a, T> { fn execute<'b>( &'a self, arg1: &'b T, arg3: &'static str, ) -> Result<T, String>; } #[auto_impl(&, &mut, Box, Rc, Arc)] trait Bar<'a, T> { fn execute<'b>( ...
use super::blockid::BlockId; use super::logmanager::LogMgr; use super::logrecord::SETSTRING; use super::page::Page; use std::cell::RefCell; use std::fmt; use std::mem; use std::sync::Arc; use anyhow::Result; pub struct SetStringRecord { txnum: i32, offset: i32, val: String, blk: BlockId, } impl fmt:...
use std::str; use std::slice; use vm::api::{Getable, Pushable}; use vm::types::VMIndex; use vm::vm::{RootedThread, Thread, Value, VMInt}; use super::Compiler; // TODO What should the c api return as errors // TODO How should error messages be returned #[repr(C)] pub enum Error { Ok, Unknown, } pub extern "C...
extern crate inkwell; use self::inkwell::context::Context; use std::env::temp_dir; use std::fs::{File, remove_file}; use std::io::Read; #[test] fn test_write_bitcode_to_path() { let mut path = temp_dir(); path.push("temp.bc"); let context = Context::create(); let module = context.create_module("my_m...
// Copyright 2018 Vlad Yermakov // // 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 ...
pub use super::instr::{self, Instruction, Label, Register}; pub fn optimize(program: &mut Vec<(Label, Instruction)>) { eliminate_zero_loads(program); eliminate_noplike_jumps(program); } fn eliminate_zero_loads(program: &mut [(Label, Instruction)]) { // Loads of a constant zero can be transformed into a 'c...
use fal::{read_u32, read_u64}; use crate::{ObjPhys, ObjectIdentifier, TransactionIdentifier}; #[derive(Debug)] pub struct ReaperPhys { pub header: ObjPhys, pub next_reaper_id: u64, pub completed_id: u64, pub head: ObjectIdentifier, pub tail: ObjectIdentifier, pub flags: u32, pub rlcount: u...
#[doc = "Reader of register FDCAN_TEST"] pub type R = crate::R<u32, super::FDCAN_TEST>; #[doc = "Writer for register FDCAN_TEST"] pub type W = crate::W<u32, super::FDCAN_TEST>; #[doc = "Register FDCAN_TEST `reset()`'s with value 0"] impl crate::ResetValue for super::FDCAN_TEST { type Type = u32; #[inline(always...
use anyhow::{anyhow, Result}; use jsonrpc_core::Params; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use crate::datastore::RECENT_FILES_IN_MEMORY; use crate::stdio_server::types::GlobalEnv; use crate::stdio_server::GLOBAL_ENV; #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[serde(deny_unkno...
// Copyright 2017 pdb 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 to tho...
use config::Config; use api::TellerClient; use api::inform::{Outgoings, GetOutgoings}; use cli::arg_types::{AccountType, OutputFormat, Interval, Timeframe}; use command::representations::represent_list_amounts; use command::timeframe_to_date_range; fn represent_list_outgoings(hac: &Outgoings, output: &OutputFormat) ...
#![feature(proc_macro_diagnostic)] extern crate proc_macro; use darling::FromMeta; use proc_macro::TokenStream; use proc_macro2::Span; use quote::{format_ident, quote}; use std::iter; use syn::spanned::Spanned; use syn::{parse, Type, Visibility}; use syn::{ItemFn, ReturnType}; mod path; use path::ModulePrefix; #[d...
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ #![warn(missing_debug_implementations, missing_docs)] //! Vertex use std::array::TryFromSliceError; use vector::{FullPrecisionDistance, Metric}; /// Vertex with data type T and dimension N #[derive(Debug)] pub str...
pub enum EntityBlock { Player(u8), Trap, } pub struct Entity { pub pos: (u16, u16), pub block: EntityBlock, } impl Entity { pub fn new(block: EntityBlock, pos: (u16, u16)) -> Self { Self { block, pos } } }
#![feature(alloc_system)] #![feature(test)] extern crate alloc_system; extern crate test; #[macro_use] extern crate itertools; extern crate problems; extern crate utils; use std::env; use std::process; use std::fmt::Display; // use problems; fn run_problem<P,A: Display> (problem: P,name: &str) where P: Fn() -> ...
use std::io; fn main() { println!( "This program can helps you to convert temperatures between Fahrenheit and Celsius.\n" ); println!("What units do you want to convert to others?\n"); println!("Type one of following unit below:"); println!(" f - convert Fahrenheit to Celsius;"); pri...
// This file is part of lock-free-multi-producer-single-consumer-ring-buffer. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/lock-free-multi-producer-single-consumer-ring-buffer/master/COPYRIGHT. No part o...
use crate::block::{self, BlockId}; use crate::model::modeless::ModelessId; use crate::renderer::TableBlock; use crate::Color; #[derive(Clone)] pub enum Tool { Selector, Pen { line_width: f64, color: Color, show_option_menu: bool, }, Eracer { line_width: f64, show...
#![feature(core)] #![feature(path_ext)] #![feature(convert)] #![allow(deprecated)] extern crate term; extern crate itertools; mod version; mod paths; mod downloader; mod builder; mod reporter; use std::rc::Rc; use paths::Paths; use downloader::Downloader; use builder::Builder; fn main() { dump_env(); let ...
use bincode::{deserialize, serialize}; use faster_hex::hex_string; use hash::blake2b_256; use numext_fixed_hash::H256; use numext_fixed_uint::U256; use serde_derive::{Deserialize, Serialize}; use std::{fmt, mem}; pub use crate::{BlockNumber, Version}; pub const HEADER_VERSION: Version = 0; #[derive(Clone, Serialize,...
// thread 'rustc' panicked at 'not implemented: ty=Closure(DefId(0:4 ~ place_utils_81[317d]::main::{closure#0}), [i16, extern "rust-call" fn((i32,)), (&mut std::vec::Vec<i32>,)])' // analysis/src/abstract_domains/place_utils.rs:81:17 fn main() { let mut v: Vec<i32> = Vec::new(); let _ = (0..1).map(|_| { ...
use ash::version::DeviceV1_0; use ash::{vk, Device}; use std::ffi::CString; use anyhow::Result; use super::create_shader_module; use crate::vulkan::{texture::Texture, GfaestusVk}; use crate::{geometry::Point, vulkan::render_pass::Framebuffers}; pub struct PostProcessPipeline { descriptor_pool: vk::DescriptorPo...
use std::borrow::Cow; struct Args<'a> { data: &'a str, offset: usize, } impl<'a> Iterator for Args<'a> { type Item = Result<Cow<'a, str>, Error>; fn next(&mut self) -> Option<Self::Item> { #[derive(Eq, PartialEq)] enum State { Borrowed(usize, usize), Owned(Stri...
use proconio::input; fn main() { input! { _a: i64, b: i64, }; input! { c: i64, _d: i64, }; println!("{}", b - c); }
fn main() { rust_grpc_web::configure() .compile(&["../proto/chat.proto"], &["../proto/"]) .unwrap(); }
use std::io; use std::str::Split; use std::collections::{HashMap, BTreeMap}; use std::io::{BufReader, BufRead}; use std::path::Path; use std::fs::File; use crate::draw::{ObjDef, Vertex, load_data_to_gpu, MtlInfo, Light}; use glium::{Display, texture::Texture2d}; use derive_more::{Error, From}; use crate::quadoctree::{Q...
use anyhow::{Context, Result}; use cyclovander::{cond, tr_h}; use indicatif::ProgressBar; use rayon::prelude::*; use rayon::ThreadPoolBuilder; use std::fs::File; use std::io::{self, BufRead, BufReader, Write}; use std::path::PathBuf; use structopt::StructOpt; #[derive(StructOpt, Debug)] struct Opt { /// Compute tr...
#[doc = "Register `RTSR2` reader"] pub type R = crate::R<RTSR2_SPEC>; #[doc = "Register `RTSR2` writer"] pub type W = crate::W<RTSR2_SPEC>; #[doc = "Field `RT2` reader - Rising trigger event configuration bit of configurable line 34"] pub type RT2_R = crate::BitReader<RT2_A>; #[doc = "Rising trigger event configuration...
use std::collections::HashMap; use std::collections::hashmap::{Occupied, Vacant}; pub fn word_count(input: &str) -> HashMap<String, uint> { let mut map: HashMap<String, uint> = HashMap::new(); let norm = input.chars().map(|c| c.to_lowercase()).collect::<String>(); for word in norm.as_slice().split(|c: char...
pub mod builtin; pub mod env; pub mod objects; use std::cell::RefCell; use std::convert::TryFrom; use std::rc::Rc; use anyhow::Result; use crate::parser::{ast, tools}; use crate::evaluator::builtin::{Function, FALSE, NULL, TRUE}; use crate::evaluator::env::Environment; pub fn eval_node(node: &ast::Node, env: Rc<Re...
use crate::prelude::*; use serde::{Deserialize, Serialize}; use std::fmt; use std::str::FromStr; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize)] pub enum Operator { Equal, NotEqual, LessThan, GreaterThan, LessThanOrEqual, GreaterThanOrEqual, } impl T...
use std::collections::HashSet; use crate::get_result_i32; // https://adventofcode.com/2020/day/1 // https://www.reddit.com/r/rust/comments/k4hoyk/advent_of_code_2020_day_1/ const SUM_OBJECTIVE: i32 = 2020; const INPUT_FILENAME: &str = "inputs/input01"; pub fn solve() { get_result_i32(1, part01, INPUT_FILENAME); ...
use std::collections::HashMap; fn main() { let data = std::fs::read_to_string("../input.txt").unwrap(); let count = data .split("\n\n") .filter(|passport| { let mut data: HashMap<&str, &str> = HashMap::with_capacity(8); for field in passport.split_whitespace() { ...
use enumset::EnumSetType; use strum::{Display, EnumIter, EnumString, IntoStaticStr}; #[derive(Display, EnumIter, EnumSetType, EnumString, IntoStaticStr)] #[strum(serialize_all = "snake_case")] pub enum Category { Anime, Book, Music, Game, Real, } #[derive(Display, EnumIter, EnumSetType, EnumString...
fn read_line() -> String { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim_end().to_owned() } fn main() { let stdin = read_line(); let mut iter = stdin.split_whitespace(); let n: i64 = iter.next().unwrap().parse().unwrap(); let s: i64 = iter.next().un...
use super::PubNub; use crate::data::channel; use crate::runtime::Runtime; use crate::subscription::Subscription; use crate::transport::Transport; impl<TTransport, TRuntime> PubNub<TTransport, TRuntime> where TTransport: Transport + 'static, TRuntime: Runtime + 'static, { /// Subscribe to presence events fo...
#![cfg_attr(feature = "unstable", feature(plugin))] #![cfg_attr(feature = "unstable", plugin(clippy))] //! A small library meant to be used as a build dependency with Cargo for easily //! integrating [ISPC](https://ispc.github.io/) code into Rust projects. //! //! # Using ispc-rs //! //! You'll want to add a build scr...
mod char_stream; mod token_buffer; //https://tools.ietf.org/html/rfc2396#appendix-A use common_failures::prelude::*; use std::fmt::Write; use uri::char_stream::Char; use uri::token_buffer::TokenStream; use uri::token_buffer::*; fn uri<T>(tb: &mut TokenBuffer<Char, T>) -> Result<Option<Uri>> where T: TokenStream...
mod addressbook; pub use self::addressbook::AddressBookFactory; mod addressbook_tag; pub use self::addressbook_tag::AddressBookTagFactory; mod shared_addressbook; pub use self::shared_addressbook::SharedAddressBookFactory; mod email; pub use self::email::EmailFactory; mod phone; pub use self::phone::PhoneFactory; ...
extern crate anyhow; extern crate bio; extern crate csv; extern crate ndarray; extern crate ndarray_stats; extern crate num_traits; extern crate pretty_env_logger; #[macro_use] extern crate log; extern crate serde; #[macro_use] extern crate serde_derive; use std::env::set_var; use std::path::PathBuf; use anyhow::R...
use std::path::PathBuf; use std::sync::mpsc::{sync_channel, SyncSender}; use std::thread::spawn; use structopt::StructOpt; use structopt::clap::AppSettings; mod curses; pub mod color; pub mod gui; pub mod plain; use crate::dictionary::Entry; #[derive(StructOpt, Debug)] #[structopt(setting = AppSettings::InferSub...
//! [Confusable detection](https://www.unicode.org/reports/tr39/#Confusable_Detection) use core::iter; enum OnceOrMore<T, I> { Once(iter::Once<T>), More(I), } impl<T, I> Iterator for OnceOrMore<T, I> where I: Iterator<Item = T>, { type Item = T; fn next(&mut self) -> Option<T> { use Once...
use regex::Regex; use std::fs::File; use std::io::{BufRead, BufReader}; use lib::Token; // Int match part // <dec int> ::= <number>{<number>} // <number> ::= 0|1|2|3|4|5|6|7|8|9 // Regex for constant integers fn int_match(text: &mut String) -> Token::Token { let int_re = Regex::new(r"(^[0-9][0-9]*)\b")...
/* CIS198 Homework 1 Part 1: Implementing functions Complete and write at least one unit test for each function you implement. If it already has a unit test, either add assertions to it or add a new one. Also answer the questions in text. */ // Remove these once you are done editing the file! // T...
use cocoa::base::id; pub trait MTLRenderPassDepthAttachmentDescriptor { /// The depth to use when the depth attachment is cleared. /// /// # Discussion /// /// The default value is 1.0. /// /// If the `loadAction` property of the attachment is set to /// `MTLLoadActionClear`, then at th...
//! This is the documentation for the `chase` scheme. //! //! * Developped by Melissa Chase, "Structured Encryption and Controlled Disclousure", see Section 3 //! * Published in Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security 2017 //! * Available from https://eprint.iacr.org/2017/8...
use crate::read_lines::read_day; fn check_xmas(numbers : &Vec<u64>, len: usize) -> usize { println!("{} {}", len, numbers.len()); for i in len..numbers.len() { if !check_xmas_number(&numbers[i - len..i], numbers[i]) { return i; } } panic!("did not find any numbers") } fn check_xmas_number(slice: &[u64], nu...
use super::*; #[derive(Clone, Copy, Default, PartialEq, Eq)] #[repr(transparent)] pub struct InterruptFlags(pub(crate) u16); impl InterruptFlags { const_new!(); bitfield_bool!(u16; 0, vblank, with_vblank, set_vblank); bitfield_bool!(u16; 1, hblank, with_hblank, set_hblank); bitfield_bool!(u16; 2, vcount, with_...
// src/benchmark.rs #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; #[macro_use] extern crate lazy_static; mod ast; #[macro_use] mod code; mod compiler; mod evaluator; mod lexer; mod object; mod parser; mod repl; mod token; mod vm; use ast::*; use compiler::*; use evaluator::*; use lexer...
mod compression; mod data; mod entry; mod index; mod io_utils; mod series; mod commit_log; pub mod file_system; pub mod series_table; pub mod error; pub mod env; pub use compression::Compression; pub use entry::Entry; pub use series::{SeriesReader, SeriesIterator, SeriesWriter}; pub use series_table::SeriesTable;
pub mod simple_debug;
use id::ID; use std::result::Result as StdResult; /// Defines Quantized Density Fields errors. #[derive(Debug)] pub enum QDFError { /// Tells that specified space does not exists in container. SpaceDoesNotExists(ID), /// Tells that specified level does not exists in container. LevelDoesNotExists(ID), ...
use board::board::Board; use bitop::b36::B36; use std::env; fn execute(bp : u64, wp : u64, turn : i32, alpha : i32, beta : i32) { let mut board : Board<B36> = Board::<B36>::new(); let result : i32 = board.get_best_result_with_ab(bp, wp, turn, alpha, beta); println!("Result = {}", result); println!("Initial = {}...
//! Manages the saving and loading of settings, as well as providing menu data and a thread-safe API. use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use once_cell::sync::OnceCell; use crate::{ menu::{self, RowData, RowDetail}, resources, }; static SETTINGS: OnceCell<Settings> = OnceCell::n...
use anyhow::Error; use futures::{Stream, TryStreamExt}; use log::info; use postgres_query::{query, Error as PqError, FromSqlRow}; use smallvec::{smallvec, SmallVec}; use stack_string::StackString; use url::Url; use uuid::Uuid; use gdrive_lib::{date_time_wrapper::DateTimeWrapper, directory_info::DirectoryInfo}; use cr...
/* Mine simulator .. the mine is represented by an array ... a really poor one :D */ mod modules; use std::io; fn main() { let mut mine_size_str = String::new(); let mut mine_size: usize; loop { println!("Please enter the mine size. Choose a number between 1 and 20"); io::stdin() ...
use std::time::Duration; use bson::UuidRepresentation; use pretty_assertions::assert_eq; use serde::Deserialize; use crate::{ bson::{Bson, Document}, client::options::{ClientOptions, ConnectionString, ServerAddress}, error::ErrorKind, options::Compressor, test::run_spec_test, Client, }; #[deri...
use bevy::{asset::AssetServerSettings, prelude::*}; use bevy_prefab::prelude::*; fn main() { let asset_folder = std::env::current_dir() .unwrap() .as_path() .to_string_lossy() .to_string() + "/assets"; App::build() .insert_resource(AssetServerSettings { asset_fo...
use std::{ fs::File, io::{Error, ErrorKind, Read}, }; pub fn open_file(path: &str) { let f = File::open(path).unwrap_or_else(|error| { if error.kind() == ErrorKind::NotFound { File::create(path).unwrap_or_else(|error| { panic!("{:?}", &error); }) } el...
pub fn find_kth_largest(nums: Vec<i32>, k: i32) -> i32 { use std::collections::BinaryHeap; let mut heap = BinaryHeap::new(); for num in nums { heap.push(-num); if heap.len() > k as usize { heap.pop(); } } -*heap.peek().unwrap() }
//! PyGamer pins use super::{hal, target_device}; use crate::hal::gpio::{self, *}; use hal::define_pins; define_pins!( /// Maps the pins to their arduino names and /// the numbers printed on the board. struct Pins, target_device: target_device, /// Analog pin 0. Can act as a true analog output ...
mod signature; extern crate num_bigint; extern crate num_traits; use signature::*; use num_bigint::BigInt; fn main() { let h = BigInt::from(1234567890); println!("{}", signature(&h)); }
/* enum Option<T>{ Some(T), -> El valor None -> La ausencia del algun valor } */ /* fn obtener_valor(bandera: bool) -> Option<String> { if bandera { Some(String::from("Soy un mensaje para la tupla some!")) } else { None } } fn main() { // Option -> Si existe o no algun valor. ...
use glium::{ Vertex, VertexBuffer, Display, Program, Surface, Frame, index::IndicesSource, uniforms::Uniforms }; use crate::Color; pub enum BoundPolygonInterfaceAction <T> { Move(T), Set(T), Get(*mut T), Reset } pub trait BoundPolygonInterface <U> : Vertex { type Mo...
use wgs84; pub mod consts { pub const PIXELS_IN_TILE_ARRIS: u32 = 256; //pub const critical_latitude: f64 = 85.051_128_78; // Calculated with Vincenty method with WGS84, WebMercator parameters //pub const critical_latitude_in_meters: f64 = 9_417_539.062_5; } pub fn meters_per_pixel( latitude: f64, level_of_de...
//! A `Constant` holds a single value. //! //! Currently, only constant values upto 64-bits are supported. use std::fmt; use il::*; /// A constant value for Falcon IL #[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub struct Constant { value: u64, bits: usize } impl C...
#![no_std] #![feature(asm, lang_items, libc, no_std, start)] extern crate libc; const LEN: usize = 413; static OUT: [u8; LEN] = *b"\ 1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n\ 16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n\ 31\n32\...
#![cfg_attr(feature = "cargo-clippy", allow(clippy::boxed_local))] use crate::{ error::*, persistence::{Persistence, *}, plan_creator::{channel::*, plan::*, plan_steps::*, PlanStepTrait}, search::*, util::{self, StringAdd}, }; use fnv::FnvHashMap; use std::boxed::Box; pub(crate) type FieldRequestC...
use anyhow::{anyhow, Result}; use sha2::{Digest, Sha256}; use std::borrow::Borrow; use std::collections::HashMap; use std::convert::TryInto; use std::hash::Hash; use std::io::{stdout, Write}; use std::path::Path; use std::process::Command; use std::str::from_utf8; use crate::types::*; pub fn run_hasher<F>( path: ...
use rocksdb::{self, DBIterator, IteratorMode, Snapshot as RocksSnapshot}; extern crate varint; use std::f32; use std::io::Cursor; use std::iter::Peekable; use std::mem::transmute; use std::str; use self::varint::VarintRead; use crate::index::Index; use crate::json_value::JsonValue; use crate::key_builder::{KeyBuilde...
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) // from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70) // DO NOT EDIT use FilterOutputStream; use OutputStream; use Seekable; use ffi; use glib; use glib::object::Downcast; use glib::object::IsA; use glib::signal::SignalHandlerId; u...
// camera sub modules pub mod fish_eye; pub mod radial_tangential;
mod lib; use lib::*; use std::collections::HashSet; use std::iter::FromIterator; fn main() { // #[test] // fn node_eq() { let n01 = NodeType::new("node0"); let n02 = NodeType::new("node0"); let n11 = NodeType::new("node1"); assert_eq!(n01, n02); assert_ne!(n01, n11); ...
use crate::parse; #[test] fn parse_24_7() { assert!(parse("24/7").is_ok()); } #[test] fn parse_invalid() { assert!(parse("this is not a valid expression").is_err()); assert!(parse("10:00-100:00").is_err()); assert!(parse("10:00-12:00 tomorrow").is_err()); }
pub trait Memory { /// Used to fetch a 32bit opcode in ARM mode. fn fetch32(&mut self, address: u32, access: AccessType) -> (u32, Waitstates) { self.load32(address, access) } /// Used to to fetch a 16bit opcode in THUMB mode. fn fetch16(&mut self, address: u32, access: AccessType) -> (u16, ...
/*pub trait GenericEmiter2Arg<X,Y> { fn mov(&mut self,x64: bool,_: X,_: Y); fn add(&mut self,x64: bool,_: X,_: Y); fn sub(&mut self,x64: bool,_: X,_: Y); } */ use crate::assembler::*; use crate::assembler_x64::*; use crate::*; use crate::avx::*; use crate::constants_x64::*; macro_rules! generic_gen...
#![feature(proc_macro_hygiene, decl_macro, try_trait, backtrace)] #[macro_use] extern crate rocket; extern crate anyhow; extern crate hmac; extern crate jsonwebtoken; extern crate sha2; extern crate sled; use rocket_contrib::json::Json; use serde::{Deserialize, Serialize}; // use std::backtrace::Backtrace; use std::c...
use std::fmt::{Display, Formatter, Result}; use std::result::Result as StdResult; use std::rc::Rc; use std::io; use vec_map::VecMap; use Arg; use args::{AnyArg, HelpWriter}; use args::settings::{ArgFlags, ArgSettings}; #[allow(missing_debug_implementations)] #[doc(hidden)] pub struct PosBuilder<'n, 'e> { pub nam...
#[macro_use] #[path = "./mod_tests.rs"] mod mod_tests; use self::mod_tests::*; use bc::mem::Mem; define_tests!(Mem);
use actix::fut; use actix::prelude::*; use actix_web::*; use futures::future::Future; use serde_json; use std::time::Instant; use model::person::{PersonList, PersonUpdate}; use ws_server; use AppState; pub fn person_list(req: HttpRequest<AppState>) -> FutureResponse<HttpResponse> { req.state() .db ...
#[allow(dead_code)] #[derive(Debug)] pub struct Vector2 { pub x: f32, pub y: f32, } #[allow(dead_code)] impl Vector2 { pub fn new(x: f32, y: f32) -> Vector2 { Vector2 { x, y } } pub fn zero() -> Vector2 { Vector2::new(0.0, 0.0) } pub fn one() -> Vector2 { Vector2::...
use std::cell::RefCell; use std::{mem, os, iter, ptr}; use std::vec::Vec; use std::rc::Rc; use def::*; use core::{raw, slice}; use core::cell::{Ref}; use page; use page::{Page, PageHeader, DbRecord, RecordFlags, DbKey, DbValue, PageFlags}; use db::{Transaction, FlagTxnError, FlagDbValid}; use environ::{Environ, DbParam...
use crate::{qjs, Artifact, Mut, Ref, Set, Weak, WeakElement, WeakKey, WeakSet}; use derive_deref::Deref; use std::{ borrow::Borrow, fmt::{Display, Formatter, Result as FmtResult}, hash::{Hash, Hasher}, }; pub struct Internal { name: String, description: Mut<String>, artifacts: Mut<Set<Artifact>...
use libbeaglebone::enums::DeviceState; use libbeaglebone::gpio::GPIO; use libbeaglebone::gpio::PinDirection; use libbeaglebone::gpio::PinState; use libbeaglebone::pins::Pin; use crate::pinouts::digital::input::DigitalInput; use crate::pinouts::digital::output::DigitalOutput; pub struct GpioPinout { pin: GPIO, } ...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ use crate::gdbstub::commands::*; use crate::gdbstub::hex::*; #[derive(Debug, PartialEq)] pub struc...
use embedded_nal::{IpAddr, Ipv4Addr}; use mqttrust::encoding::v4::LastWill; #[derive(Clone, Debug, PartialEq)] pub enum Broker<'a> { Hostname(&'a str), IpAddr(IpAddr), } impl<'a> From<&'a str> for Broker<'a> { fn from(s: &'a str) -> Self { Broker::Hostname(s) } } impl<'a> From<IpAddr> for Bro...
use byteorder::{BigEndian, ByteOrder}; use tiny_keccak::Keccak; use parity_hash::H256; use lib::*; use super::{Signature, ValueType}; use super::util::Error; #[derive(Clone)] pub struct HashSignature { pub hash: u32, pub signature: Signature, } #[derive(Clone)] pub struct NamedSignature { name: Cow<'static,...
// Copyright © 2020, Oracle and/or its affiliates. // // Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Portions Copyright 2017 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-BSD-3-Clause file...
use crate::pubnub::PubNub; use crate::runtime::Runtime; use crate::subscription::subscribe_loop::ExitTx as SubscribeLoopExitTx; use crate::subscription::subscribe_loop_supervisor::{ SubscribeLoopSupervisor, SubscribeLoopSupervisorParams, }; use crate::transport::Transport; use futures_util::lock::Mutex; use std::sy...
//! A demonstration of an offchain worker that submits onchain callbacks #![cfg_attr(not(feature = "std"), no_std)] #[cfg(test)] mod tests; use frame_support::{ debug, dispatch::DispatchResult, decl_module, decl_storage, decl_event, decl_error, weights::SimpleDispatchInfo, }; use core::convert::{TryInto}; use f...
use crate::domain::domain::SysRes; use chrono::NaiveDateTime; use rbatis::utils::table_util::FatherChildRelationship; ///权限资源表 #[crud_enable(table_name: "sys_res" | table_columns: "id,parent_id,name,permission,path,del")] #[derive(Clone, Debug)] pub struct SysResVO { pub id: Option<String>, //父id(可空) pub p...
//! VapourSynth plugins. use std::ffi::{CStr, CString, NulError}; use std::marker::PhantomData; use std::ops::Deref; use std::ptr::NonNull; use vapoursynth_sys as ffi; use crate::api::API; use crate::map::{Map, OwnedMap}; use crate::plugins::{self, FilterFunction}; /// A VapourSynth plugin. #[derive(Debug, Clone, Co...
pub fn new_pixel_buffer(rows: usize, cols: usize) -> Vec<u8> { vec![0; rows * cols] }
//! Contains a different flavour of the [`Aggregate`] trait, //! while still maintaining compatibility through [`IntoAggregate`] type. //! //! Check out [`optional::Aggregate`](Aggregate) for more information. use async_trait::async_trait; /// An [`Option`]-flavoured, [`Aggregate`]-compatible trait /// to model Aggre...
use vec3::Vec3; use ray::Ray; #[derive(Debug)] pub struct Camera { pub lower_left_corner: Vec3, pub horizontal: Vec3, pub vertical: Vec3, pub origin: Vec3, } impl Camera { pub fn get_ray(&self, u: f32, v: f32) -> Ray { Ray { origin: Vec3::clone(&self.origin), direct...
use std::thread; use std::time::Duration; mod mutexes; fn main() { basic_threads(); threads_with_ownership(); mutexes::basic_mutexes(); mutexes::shared_mutex(); } fn basic_threads() { let handle = thread::spawn(|| { for i in 1..10 { println!("hi number {} from the spawned thr...
//! # Low level reader for PK files use super::file::{PKEntry, PKTrailer}; use super::parser; use crate::sd0; use crate::sd0::read::SegmentedDecoder; use nom::{Finish, IResult, Offset}; use std::convert::TryFrom; use std::error::Error; use std::fmt; use std::io::{self, ErrorKind}; use std::io::{BufRead, Read, Seek, ...
fn read_line() -> String { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim_end().to_owned() } fn main() { let a: Vec<i64> = read_line() .split_whitespace() .map(|v| v.parse().unwrap()) .collect(); println!("{}", a.iter().min().unwrap()...