text
stringlengths
8
4.13M
use crate::{ queries::tokens::Token, }; use actix::Message; use chrono::{DateTime, Utc}; use derive_more::From; use serde::{Serialize, Deserialize, Deserializer}; use std::{ convert::Infallible, result::Result, }; use strum_macros::AsRefStr; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Permis...
pub let kill_AV: bool = false; pub let bypass_AV: bool = false;
extern crate httpserver; use httpserver::options::Options; use httpserver::webserver::WebServer; fn main() { let options = Options::new(String::from("127.0.0.1:8080"), 4); let server = WebServer::new(options); server.start(); }
use byteorder; use std::io::Cursor; use self::byteorder::{ByteOrder, BigEndian, WriteBytesExt, ReadBytesExt}; pub type Instructions = Vec<u8>; pub trait InstructionsFns { fn string(&self) -> String; fn fmt_instruction(op: &Op, operands: &Vec<usize>) -> String; } impl InstructionsFns for Instructions { fn...
use std::fs::File; use std::io::{self, Read as _}; use std::time::Instant; use json; use simsearch::SimSearch; fn main() -> io::Result<()> { let mut engine = SimSearch::new(); let mut file = File::open("./books.json")?; let mut content = String::new(); file.read_to_string(&mut content)?; let j =...
extern crate timely; extern crate differential_dataflow; #[macro_use] extern crate abomonation_derive; extern crate abomonation; #[macro_use] extern crate serde_derive; use std::string::String; use std::boxed::Box; use std::ops::Deref; use std::collections::{HashMap, HashSet}; use timely::dataflow::*; use timel...
use std::ops::RangeInclusive; pub trait RangeExt<T> { /// Constrains the value to be contained within the range fn clamp(&self, t: T) -> T where T: Clone + Ord; } impl<T> RangeExt<T> for RangeInclusive<T> { fn clamp(&self, t: T) -> T where T: Clone + Ord, { if &t < self...
mod fake; pub use fake::FakeKV;
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig, ALL_WEBSOCKET_PROTOCOLS}; use async_graphql::Schema; use async_graphql_axum::{ graphql_subscription, GraphQLRequest, GraphQLResponse, SecWebsocketProtocol, }; use axum::extract::{self, ws::WebSocketUpgrade, TypedHeader}; use axum::response::{self...
mod map; pub use map::MapBundle;
// Macros #[macro_use] extern crate clap; #[macro_use] extern crate lazy_static; #[macro_use] extern crate prettytable; #[macro_use] extern crate indexmap; #[macro_use] extern crate anyhow; // Std use std::collections::{HashMap, HashSet}; use std::env; use std::str; // Crates use anyhow::{Context, Result}; use chrono...
use piston_window::{rectangle, Context, G2d}; use piston_window::types::Color; pub fn draw_rectangle( color: Color, x: f64, y: f64, width: f64, height: f64, con: &Context, g: &mut G2d, ){ //let gui_x = x; //let gui_y = to_coord(y); rectangle( color, [ ...
#![no_std] #![no_main] extern crate panic_halt as _; extern crate stm32f1xx_hal as hal; use crate::hal::{ gpio::*, prelude::*, stm32::{interrupt, Interrupt, Peripherals, TIM2}, timer::*, }; use core::cell::RefCell; use cortex_m::{ asm::wfi, interrupt::Mutex, peripheral::Peripherals as ...
#[doc = "Register `FDCAN_TTOCN` reader"] pub type R = crate::R<FDCAN_TTOCN_SPEC>; #[doc = "Register `FDCAN_TTOCN` writer"] pub type W = crate::W<FDCAN_TTOCN_SPEC>; #[doc = "Field `SGT` reader - Set Global time"] pub type SGT_R = crate::BitReader; #[doc = "Field `SGT` writer - Set Global time"] pub type SGT_W<'a, REG, c...
/// An enum to represent all characters in the Phagspa block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Phagspa { /// \u{a840}: 'ꡀ' PhagsDashPaLetterKa, /// \u{a841}: 'ꡁ' PhagsDashPaLetterKha, /// \u{a842}: 'ꡂ' PhagsDashPaLetterGa, /// \u{a843}: 'ꡃ' PhagsDashPaLetterNg...
use structopt::StructOpt; #[derive(Debug, StructOpt)] #[structopt(name = "Cat", about = "Read a file and display its content.")] pub struct CatArgs { pub file_name: String, }
use std::{io, net::SocketAddr, process::exit, sync::Arc, sync::atomic::{AtomicBool, Ordering}, sync::mpsc::{channel, Sender}, thread::{JoinHandle, sleep}, thread, time::Duration}; use std::fmt::{Display, Formatter}; use std::sync::atomic::Ordering::SeqCst; use structopt::StructOpt; use crate::{ blockchain::Blockc...
//! //! Snippet Archive for Line Protocol Formatting/Parsing //! // pub fn from_line(line: &str) -> InfluxResult<Self> // { // let parts = line.split(" ") // .collect::<Vec<&str>>(); // if parts.len() != 3 { // return Err(format!("Invalid measurement line: '{}'. Please consult the InfluxDB li...
--- cargo-crates/termios-0.2.2/src/lib.rs.orig 2016-01-20 16:52:20 UTC +++ cargo-crates/termios-0.2.2/src/lib.rs @@ -89,6 +89,11 @@ //! cfsetspeed(termios, termios::os::macos::B230400) //! } //! +//! #[cfg(target_os = "dragonfly")] +//! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { +//! cfs...
use std::io::*; use std::sync::Arc; use flicbtn::*; #[tokio::main] async fn main() -> Result<()> { let event = event_handler(|event| { println!("ping response: {:?}", event); }); let client = FlicClient::new("127.0.0.1:5551") .await? .register_event_handler(event) .await; ...
use actix::prelude::*; use diesel::prelude::*; use failure_derive::Fail; use unicode_normalization::UnicodeNormalization; use crate::db::models::{NewUser, User, UserLog}; use crate::db::DbExecutor; use crate::utils::PerfLog; use actix_web::{dev::Body, http::StatusCode, web::HttpResponse, ResponseError}; use rand::Rng;...
// Copyright (C) 2017 1aim GmbH // // 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 wr...
use lazy_static::lazy_static; use regex::Regex; use serde_json::Value; use crate::validator::{scope::ScopedSchema, state::ValidationState}; lazy_static! { // data:text/plain;name=test.txt;base64,aGV... static ref FILE_REGEX: Regex = Regex::new(r"^data:.*;name=(.*);([a-zA-Z0-9]+),(.*)$").unwrap(); } p...
extern crate rand; mod ability; mod action; mod confirmation; mod dice; mod game; mod map; mod player; mod room; mod test_world; use ability::{Ability, AbilityFactory}; use game::Game; use player::PlayerBuilder; use std::io; fn main() { println!("D20 System Initializing"); let mut player_builder = PlayerBuilder::n...
/* * Copyright (C) 2019-2021 TON Labs. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an ...
use bitcoin::hashes::hex::ToHex; use bitcoin::{Script, Txid}; use types::{Param, ToElectrumScriptHash}; pub struct Batch { calls: Vec<(String, Vec<Param>)>, } impl Batch { pub fn script_list_unspent(&mut self, script: &Script) { let params = vec![Param::String(script.to_electrum_scripthash().to_hex()...
#![crate_type = "lib"] #![crate_name = "rsnova"] #![recursion_limit = "256"] #[macro_use] extern crate log; #[macro_use] extern crate lazy_static; #[macro_use] extern crate futures; pub use self::config::Config; mod channel; pub mod config; mod debug; mod rmux; mod tunnel; mod utils; use futures::FutureExt; use s...
use platform; use std::env; fn main() { let args: Vec<String> = env::args().collect(); let app = platform::commands::new_app(); app.run(args); }
#![allow(dead_code)] use crate::cpu::CpuInterface; use crate::cpu::Interface; use crate::savable::Savable; /// Bus used for easier cpu testing pub struct TestBus { ram: [u8; 0x800], program: Vec<u8>, } impl Interface for TestBus { fn read(&mut self, addr: u16) -> u8 { match addr { 0x0...
#[doc = "Register `DINR8` reader"] pub type R = crate::R<DINR8_SPEC>; #[doc = "Field `DIN8` reader - Input data received from MDIO Master during write frames"] pub type DIN8_R = crate::FieldReader<u16>; impl R { #[doc = "Bits 0:15 - Input data received from MDIO Master during write frames"] #[inline(always)] ...
#[doc = "Register `DDRPHYC_DX1GSR0` reader"] pub type R = crate::R<DDRPHYC_DX1GSR0_SPEC>; #[doc = "Field `DTDONE` reader - DTDONE"] pub type DTDONE_R = crate::BitReader; #[doc = "Field `DTERR` reader - DTERR"] pub type DTERR_R = crate::BitReader; #[doc = "Field `DTIERR` reader - DTIERR"] pub type DTIERR_R = crate::BitR...
use crate::renderer::con_back::ConBackError; use log::error; pub trait LogError { fn log(&self); } #[derive(Debug, Clone, Eq, PartialEq)] pub enum Error { Static(&'static str), Owned(String), ConBack(ConBackError), // IO(std::io::Error), } impl std::fmt::Display for Error { fn fmt(&self, f: &m...
use std::ops::{Bound, Not}; use std::sync::Arc; use anyhow::Context; use axum::extract::{Extension, Path}; use chrono::Utc; use hyper::{Body, Response}; use serde_derive::Deserialize; use svc_agent::AgentId; use svc_authn::AccountId; use svc_utils::extractors::AccountIdExtractor; use uuid::Uuid; use super::{find, App...
extern crate nom; use nohash_hasher::IntMap; use std::fs; //use std::collections::IntMap; pub enum Either<L, M, R> { Left(L), Middle(M), Right(R), } use nom::{ branch::alt, character::complete::char, character::complete::{digit1, space0, anychar}, combinator::map_res, multi::many0, ...
//! Power configuration and management //! //! At present this module only contains functions to permit setting the appropriate VCore range //! for a desired frequency. You should probably not need to use this API yourself, as this is done //! by the `Rcc::freeze` method. //! //! If you _do_ decide to use this directly...
use std::error::Error; use modify::Modify; mod modify; mod kvdb; pub mod inner; mod allocator; #[macro_use] mod cache; mod crc64; mod mmap; mod cmd; /// Storage represents the internal-facing server part of TinyKV, it handles sending and receiving from other /// TinyKV nodes. As part of that responsibility, it also ...
// Copyright (c) The diem-x Contributors // SPDX-License-Identifier: MIT OR Apache-2.0 use structopt::StructOpt; use testrunner::dispatch::Opts; fn main() -> anyhow::Result<()> { let opts = Opts::from_args(); opts.exec() }
use clap::{App, AppSettings, Arg, }; use zmq::{Context, Socket}; use crate::socket::{SocketParameters, create_socket}; use std::error::Error; pub struct Chat { #[allow(dead_code)] ctx: Context, socket: Socket } impl Chat { pub fn new(parameters: &SocketParameters) -> Result<Self, Box<dyn Error>> { ...
#[doc = "Register `RXF0S` reader"] pub type R = crate::R<RXF0S_SPEC>; #[doc = "Register `RXF0S` writer"] pub type W = crate::W<RXF0S_SPEC>; #[doc = "Field `F0FL` reader - Rx FIFO 0 Fill Level"] pub type F0FL_R = crate::FieldReader; #[doc = "Field `F0FL` writer - Rx FIFO 0 Fill Level"] pub type F0FL_W<'a, REG, const O: ...
use std::{ env, fmt, fs, io::{self, Write}, process, }; use stacc::{interpreter::Interpreter, parser::Parser}; fn unwrap<T, E: fmt::Display + fmt::Debug>(result: Result<T, E>) -> T { if let Err(err) = result { eprintln!("{}", err); process::exit(1); } result.unwrap() } fn mai...
#[derive(juniper::GraphQLObject, Clone, Serialize, Deserialize)] pub struct Drive { pub id: i32, pub location: Option<String>, }
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // 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 http://opensource.org/licenses/MIT>,...
use std::thread; use std::fs; use std::sync::mpsc; struct Filenames { source: String, destination: String, } impl Drop for Filenames { fn drop(&mut self) { if thread::panicking() { println!("dropped due to panic"); } else { println!("dropped without panic"); ...
use chrono::Utc; use proptest::prelude::*; use taskwarrior_rust::{taskstorage, Operation, Server, DB}; use uuid::Uuid; fn newdb() -> DB { DB::new(Box::new(taskstorage::InMemoryStorage::new())) } #[derive(Debug)] enum Action { Op(Operation), Sync, } fn action_sequence_strategy() -> impl Strategy<Value = V...
// libmain.rs // loads a module from a compiled library as an extern mod // compile using "rustc libmain.rs -L ./libmodules/" extern mod libworld; fn main() { use libworld::libearth::libexplore; use libtrek = libworld::libearth::libexplore; io::println(~"hello " + libexplore()); io::println(~"hello " + libtr...
#[doc = "Register `PCTLR` reader"] pub type R = crate::R<PCTLR_SPEC>; #[doc = "Register `PCTLR` writer"] pub type W = crate::W<PCTLR_SPEC>; #[doc = "Field `DEN` reader - Digital Enable"] pub type DEN_R = crate::BitReader; #[doc = "Field `DEN` writer - Digital Enable"] pub type DEN_W<'a, REG, const O: u8> = crate::BitWr...
fn main() { // declaring some variables let hello: i32 = 10; let mut goodbye = 11; println!("goodbye is now: {}", goodbye); // hello = 12; // goodbye = "its now a string!" goodbye = 44; println!("goodbye is now: {}", goodbye); let v = vec![1, 2, 3, 4, 5]; //v.push(4); ...
extern crate image; extern crate rand; use rand::Rng; use std::fs::File; struct Point{ x: u32, y: u32, } const WIDTH: u32 = 800; const HEIGHT: u32 =600; fn main() { let mut img =image::ImageBuffer::from_fn(WIDTH,HEIGHT,|x,y|{ if x==0 && y==0{ image::Luma([0u8]) }else{ ...
#[doc = "Reader of register IIDR"] pub type R = crate::R<u32, super::IIDR>; #[doc = "Reader of field `IIDR`"] pub type IIDR_R = crate::R<u32, u32>; impl R { #[doc = "Bits 0:31 - IIDR"] #[inline(always)] pub fn iidr(&self) -> IIDR_R { IIDR_R::new((self.bits & 0xffff_ffff) as u32) } }
// // Win module // mod win_push_button;
use std::{ collections::{HashSet, VecDeque}, env::args, }; mod http; mod login; mod parse; use crate::{ http::HttpClient, login::login, parse::{body, code, get_header, internal_url, scrape, DropUntilFirstOccurrence}, }; const BASE_URL: &str = "https://fakebook.3700.network/fakebook/"; const LOGIN_...
#![allow(unused)] // Custom KORG nanoKONTROL2 setup. // [16, 24) = knobs // [24, 32) = sliders // [70, 78) = S buttons // [78, 86) = M buttons // [86, 94) = R buttons // 102, 103 = track left/right // 104, 105, 106 = marker set, left, right // 107 = cycle // [108, 113) = prev, next, stop, play, record pub const KORG_K...
use super::*; use crate::gui::*; use physics::*; #[derive(Default)] pub struct GUISystem; impl<'a> System<'a> for GUISystem { type SystemData = ( ( Entities<'a>, ReadStorage<'a, CharacterMarker>, ReadStorage<'a, Lifes>, ReadStorage<'a, Shield>, R...
use std::io::{Error as IoError, Read, Seek, SeekFrom}; use bbs::prelude::{DeterministicPublicKey, PoKOfSignature}; use bbs::{ keys::PublicKey, signature::Signature, ProofNonce, SignatureMessage, G1_COMPRESSED_SIZE, }; use super::block::{Block, SignatureEntry, MESSAGES_MAX}; use super::header::{header_messages, Re...
use lib::*; #[derive(Debug)] pub enum Error { UnknownSignature, NoLengthForSignature, NoFallback, ResultCantFit, UnexpectedEnd, InvalidPadding, InvalidUtf8, } pub type Hash = [u8; 32]; /// Converts u32 to right aligned array of 32 bytes. pub fn pad_u32(value: u32) -> Hash { let mut padded = [0u8; 32]; padde...
#[doc = "Register `SYSCFG_IOCTRLCLRR` reader"] pub type R = crate::R<SYSCFG_IOCTRLCLRR_SPEC>; #[doc = "Register `SYSCFG_IOCTRLCLRR` writer"] pub type W = crate::W<SYSCFG_IOCTRLCLRR_SPEC>; #[doc = "Field `HSLVEN_TRACE` reader - HSLVEN_TRACE"] pub type HSLVEN_TRACE_R = crate::BitReader; #[doc = "Field `HSLVEN_TRACE` writ...
use std::{ collections::HashMap, fs::read_dir, io::{self, Write}, process::Command, time::Instant, }; use rand::{seq::SliceRandom, thread_rng}; use statistical::{mean, standard_deviation}; const REPS_DEFAULT: usize = 2; const ITERS: usize = 2; #[inline(never)] fn time(benchmark: &str) -> String {...
extern crate ci_test; extern crate redis; extern crate postgres; use ci_test::{add_two, fetch_an_integer}; use postgres::{Connection, TlsMode}; fn main() { let conn = Connection::connect("postgres://postgres@postgres", TlsMode::None).unwrap(); loop { println!("{:?}", add_two(2)); let result = ...
//! Tests auto-converted from "sass-spec/spec/libsass-todo-tests" #[allow(unused)] use super::rsass; mod errors;
use std::process::Output; use std::fmt::Display; extern crate term; use std::io::prelude::*; pub enum MessageType { Stdout, Stderr } pub fn print_message(message: String, message_type: MessageType) { let mut stdout_terminal = term::stdout().unwrap(); let mut stderr_terminal = term::stderr().unwrap(); ...
use crate::utils::lines_from_file; use lazy_static::lazy_static; use regex::Regex; use std::time::Instant; pub fn main() { let start = Instant::now(); assert_eq!(part_1_test(), 5); // println!("part_1 {:?}", part_1()); assert_eq!(part_2_test(), 8); println!("part_2 {:?}", part_2()); let dura...
//! PCI Drivers use crate::arch::x86; pub trait HostBusBridge { fn pci_cs_read(&self, bus: u8, device: u8, func: u8, register: u8) -> u32; fn pci_cs_write(&self, bus: u8, device: u8, func: u8, register: u8, val: u32); } pub struct x86PIO; pub fn x86_pio_calculate_addr(bus: u8, device: u8, func: u8, register:...
/* * 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 clap::Parser; use reverie::syscalls::Displayable; use reverie::syscalls::Syscall; use reverie::...
use std::sync::Arc; use actix_web::{error, web, HttpResponse, Result}; use arc_swap::ArcSwap; use chrono::{DateTime, Duration, Utc}; use once_cell::sync::Lazy; use rand::Rng; use reqwest::Client; use serde::Deserialize; pub fn configure(cfg: &mut web::ServiceConfig) { cfg.service(web::resource("/{file}").route(we...
extern crate rusthub; extern crate rustc_serialize; use rusthub::notifications; use rustc_serialize::json; #[test] #[ignore] fn decode_token_response() { let response = notifications::get_notifications_basic("username", "aaaaaaaaaxaaaaaaaaaxaaaaaaaaaxaaaaaaaaax"); println!("{:#?}", response.unwrap()); } #[tes...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Account { #[serde(flatten)] pub tracked_resource: TrackedResource, #[serde(default, skip_serializing_if...
use std::fmt; use std::fmt::Write; use std::ops; use rand::{thread_rng, Rng}; #[derive(Copy, Clone)] pub struct Vec3 { pub x: f32, pub y: f32, pub z: f32, } impl Vec3 { pub fn new() -> Vec3 { Vec3 { x: 0_f32, y: 0_f32, z: 0_f32 } } pub fn one() -> Vec3 { Vec3 { x: 1_f32, y: 1_...
#[doc = "Register `CCVALR` reader"] pub type R = crate::R<CCVALR_SPEC>; #[doc = "Field `ANSRC1` reader - compensation value for the NMOS transistor This value is provided by the cell and must be interpreted by the processor to compensate the slew rate in the functional range."] pub type ANSRC1_R = crate::FieldReader; #...
// https://www.investopedia.com/articles/active-trading/101014/basics-algorithmic-trading-concepts-and-examples.asp use rust_decimal::Decimal; use alpaca_client::client::{Client, AccountType}; pub struct TradeDecision { pub name: String, pub confidence: Decimal } pub struct Stock { pub symbol: String, ...
use crate::mem::mapper::{Mapper, RAM_BANK_SIZE, ROM_BANK_SIZE}; pub struct Mbc1Mapper { /// Mapped to the ROM area. Up to 2 MiB in size. rom: Box<[u8]>, /// Mapped to the RAM area. Up to 32 KiB in size. ram: Box<[u8]>, current_rom_bank: u8, current_ram_bank: u8, ram_enabled: bool, ram_...
use crate::blockchain::block::Block; use crate::blockchain::verifier::Verifier; pub mod block; pub mod proof; pub mod transaction; pub mod verifier; pub mod smart_contract; #[derive(Debug)] pub struct Blockchain { pub chain: Vec<Block>, verificator: Verifier, } impl Default for Blockchain { fn default()...
extern crate httparse; //use httparse::*; use std::collections::VecDeque; use std::io; // use std::io::prelude::*; use std::io::{BufRead, BufReader, ErrorKind, Read, Write}; use std::rc::Rc; // use byteorder::{BigEndian, ByteOrder}; use bytes::{Buf, BufMut, Bytes, BytesMut}; use mio::net::TcpStream; use mio::unix::U...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// DashboardList : Your Datadog Dashboards. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize...
use crossterm::{execute, queue}; use std::io::{Stdout, Write}; pub type Result<T> = std::result::Result<T, crossterm::ErrorKind>; pub fn read() -> Result<Event> { match crossterm::event::read() { Ok(r) => Ok(r.into()), Err(e) => Err(e), } } pub fn move_to(stdout: &mut Stdout, loc: (u16, u16)) ...
#[macro_use] extern crate clap; extern crate monolith; use clap::{App, Arg}; use monolith::html::{html_to_dom, print_dom, walk_and_embed_assets}; use monolith::http::{is_valid_url, retrieve_asset}; fn main() { let command = App::new("monolith") .version(crate_version!()) .author(crate_authors!()) ...
use std::cmp::Ordering; use std::collections::HashSet; use std::fmt; const INPUT: &str = include_str!("../input"); const MAX_DISTANCE: usize = 10_000; const UPPERCASE_LETTERS: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const LOWERCASE_LETTERS: &str = "abcdefghijklmnopqrstuvwxyz"; type Result<T> = ::std::result::Result<T, B...
use bytes::Bytes; use futures::Future; use tokio::sync::{broadcast, mpsc}; use tokio_stream::{wrappers::ReceiverStream, StreamExt, StreamMap}; use tracing::error; use uuid::Uuid; use crate::broadcast_stream::BroadcastStream; use crate::connection::{ DataStream, Message::{self, *}, NewConnection, }; const ...
fn main() { cbm8032_to_vulkan::run(); }
use component::{Component, Position}; use entity::factory::FactoryEntities; mod _const; mod component; mod entity; mod system; fn main() { let mut factory_entities = FactoryEntities::new(); let character = factory_entities.create_character(); let character_position = system::position::get(character); ...
use either::Either; use itertools::Itertools; use llvm_ir::function::{FunctionAttribute, ParameterAttribute}; use llvm_ir::instruction; use llvm_ir::module::{Alignment, Endianness, Mangling, PointerLayout}; use llvm_ir::terminator; use llvm_ir::types::{FPType, NamedStructDef, Typed}; #[cfg(feature = "llvm-9-or-greater"...
#![cfg(feature = "derive")] use anyhow::Result; use itertools::Itertools as _; use pcd_rs::{ DataKind, DynRecord, Field, PcdDeserialize, PcdSerialize, Reader, Schema, ValueKind, WriterInit, }; #[derive(Debug, PcdDeserialize, PcdSerialize, PartialEq)] pub struct Point { #[pcd(rename = "new_x")] x: f32, ...
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use address::Address; use cid::Cid; use encoding::Cbor; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use vm::Serialized; /// Constructor parameters pub struct ConstructorParams { pub network_name: String, } impl Ser...
mod modules; fn main() { println!("hello"); modules::hoge(); modules::hello_world::greet(); modules::greet(); }
use std::sync::Arc; use std::marker::PhantomData; use std::{fmt, mem, borrow, cmp, hash}; use std::ops::Deref; /// Slightly bigger and slower than RMBA, but same functionality. /// Mostly used just to verify correctness of the real RMBA. #[derive(Debug)] pub enum SlowRMBA<'a, T: 'a + ?Sized> { Ref(&'a T), Ref...
mod auth; mod common; mod inbound; mod outbound; mod relay; mod server; mod utils; use anyhow::{Context, Result}; use clap::{AppSettings, Clap}; use log::error; use utils::{config, logger}; #[derive(Clap)] #[clap(version, author, about)] #[clap(setting = AppSettings::ColoredHelp)] struct Opts { #[clap(short, long...
extern crate cribbage; use serde::{Deserialize, Serialize}; use std::io::{Read, Write}; use std::net; use std::sync::mpsc; // Simply sends the message to the client and guarantees its arrival fn simple_notification( client_stream: &mut net::TcpStream, game_handler_transmitter: &mpsc::Sender<super::messages::Cl...
use crate::math::{Mat2d, Rect, Vec2}; use core::ecs::Entity; use std::collections::HashMap; #[derive(Debug, Default)] pub struct CompositeTransformCache { matrix: HashMap<Entity, Mat2d>, matrix_inverse: HashMap<Entity, Mat2d>, } impl CompositeTransformCache { pub fn matrix(&self, entity: Entity) -> Option...
mod binary; mod decoder; mod types; mod instructions; use binary::module::Module; use binary::module::Section; use binary::*; use binary::exportsection::ExportSection; use decoder::Decoder; use std::fs::File; use std::io; use std::io::BufReader; use std::io::Read; fn main() { let wasm = File::open("./add.wasm")....
pub mod file; pub mod url_parser; pub mod url_util; pub mod date_util;
// Copyright 2017 rust-ipfs-api 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 accord...
use sqlparser::ast::Statement; use sqlparser::dialect::Dialect; use sqlparser::parser::{Parser as SqlParser, ParserError}; pub mod collector; pub mod rewriter; pub struct Parser {} impl Parser { /// Parse SQL using our CSVDialect pub fn parse_sql(str: &str) -> Result<Vec<Statement>, ParserError> { Sql...
pub mod screens; use oxygengine::user_interface::raui::core::prelude::*; pub fn setup(app: &mut Application) { app.register_component("intro", screens::intro::intro); app.register_component("loading", screens::loading::loading); app.register_component("menu", screens::menu::menu); app.register_compone...
extern crate rand; extern crate time; extern crate crypto; extern crate nix; use rand::{Rng, SeedableRng, StdRng}; use rand::distributions::{IndependentSample, Range}; use crypto::md5::Md5; use crypto::digest::Digest; use nix::sys::statfs::statfs; use nix::sys::statfs::vfs::Statfs; use std::cmp; use std::path::Path; u...
use clap::clap_app; use rustbust::fuzz; use std::error::Error; fn main() -> Result<(), Box<Error>> { let matches = clap_app!(fuzz => (about: "Fuzzes a webpage, but in a fail-safe and parallel way") (version: "0.1.0") (@arg URL: +required "URL to fuzz") (@arg source: -s --source +tak...
mod codec; mod handshake; pub use self::{codec::ApCodec, handshake::handshake}; use std::io; use futures_util::{SinkExt, StreamExt}; use num_traits::FromPrimitive; use protobuf::{self, Message}; use thiserror::Error; use tokio::net::TcpStream; use tokio_util::codec::Framed; use url::Url; use crate::{authentication:...
pub fn run() { let age = 21; let knows_person_of_age: bool = true; if age >= 21 || knows_person_of_age { println!("Give a beer"); } else { println!("Give a candy"); } //Short hand if let is_of_age = if age >= 21 { true } else { false }; println!("is Of age : {}", is_of_a...
use reqwest::Client; use crate::storage::request_text; #[derive(Serialize, Deserialize, Debug)] pub struct Request { // id: String, pub url: String, // unique_key: String, // method: String, // payload: String, // retry: bool, // retry_count: i32, // error_messages: Vec<Stri...
// ObjectVersions #![forbid(unsafe_code)] #![deny(missing_docs)] use anyhow::Result; use std::str::FromStr; /// `ObjectVersions` represents which objects we're going to sum when /// operating in S3 mode. #[derive(Debug)] pub enum ObjectVersions { /// Sum size of all object versions (both `Current` and `NonCurrent`...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// SloHistoryMetricsSeriesMetadataUnit : An Object of metric units. #[derive(Clone, Debug, PartialEq...
use crossbeam::queue::MsQueue; use std::mem; use std::ops::{Deref, DerefMut}; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::sync::Arc; pub struct GenerationItem<T> { generation: usize, item: T, } pub struct Pool<T> { queue: Arc<MsQueue<GenerationItem<T>>>, freshest_gene...