text
stringlengths
8
4.13M
use std::vec::Vec; use server::player::Player; pub enum ZirconError { FailedToBind } /// This is the base implementation of any server. /// ZirconServer may be overridden in custom environments where certain requirements /// are neededt that we don't provide. pub trait ZirconServer { fn start(&self...
use ::log::{LogRecord, LogMetadata}; ///The Logger used by Netherrack /// ///For now, it simply logs to standard output. In future versions, it will be extended pub struct NetherrackLogger; impl ::log::Log for NetherrackLogger { ///Checks to see if a LogRecord can be accepted based on LogMetadata #[allow(unu...
#[derive(Eq, PartialEq, Debug)] pub struct Ident(pub String); #[derive(Debug)] pub struct Num(pub f64); #[derive(Debug)] pub struct FuncHead { pub name: Ident, pub params: ParamList, } pub type ParamList = Vec<RVal>; #[derive(Debug)] pub enum RVal { Num(Num), LVal(LVal), FuncCall(FuncCall), ...
use hyper::client::request::Request; use hyper::net::Fresh; use hyper::client::response::Response; use hyper::status::StatusCode; use std::error::Error as StdErr; use err::Error; use error::ApiError; use std::fmt; use std::rc::Rc; use std::cell::RefCell; use hyper::header::Headers; use body_builder::{BodyBuilder, Reque...
pub struct View { value: u64, } impl View { pub fn new() -> Self { Self { value: 1 } } pub fn value(&self) -> u64 { self.value } }
use std::io::{ self, BufRead }; use clap::{ Arg, App, crate_name, crate_version, crate_authors, }; use chunks; fn main() -> Result<(), io::Error> { let matches = App::new(crate_name!()) .version(crate_version!()) .author(crate_authors!()) .about("Splits (large...
use std::convert::Infallible; use std::error::Error; use serde::Serialize; use slog::{info, Logger}; use warp::http::StatusCode; use warp::{reject, Rejection, Reply}; use crate::node_runner::{LightNodeRunnerError, LightNodeRunnerRef}; use crate::tezos_client_runner::{ BakeRequest, SandboxWallets, TezosClientRunne...
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service. use runtime; use sc_service::{ error::{Error as ServiceError}, AbstractService, Configuration, }; use sp_inherents::InherentDataProviders; use sc_executor::native_executor_instance; pub use sc_executor::NativeExecutor; use sc_c...
mod types; mod allocator; mod allocator_jni; mod transformer_jni;
use std::io; use IRustError::*; #[derive(Debug)] pub enum IRustError { IoError(io::Error), CrosstermError(crossterm::ErrorKind), Custom(String), RacerDisabled, ParsingError(String), } impl std::error::Error for IRustError {} impl From<io::Error> for IRustError { fn from(error: io::Error) -> ...
extern crate autograd as ag; use crate::abs_model::{MNISTModel, NdArray}; use crate::dataset::load; use ag::ndarray_ext as array; use ag::optimizers::adam; use ag::rand::seq::SliceRandom; use ag::tensor::Variable; use ag::Graph; use ndarray::s; use ndarray_npy::{ReadNpyExt, WriteNpyExt}; use std::fs::File; use std::syn...
//! Tokens use std::fmt; use parser::util::{rcstr, SharedString}; // --- Token -------------------------------------------------------------------- /// A token #[derive(Clone, PartialEq)] pub enum Token { LPAREN, RPAREN, LBRACE, RBRACE, STRING(SharedString), SYMBOL(SharedStri...
use skulpin::app::MouseButton; use skulpin::skia_safe::*; use crate::ui::*; use crate::util::quantize; pub enum SliderStep { Smooth, Discrete(f32), } pub struct Slider { value: f32, min: f32, max: f32, step: SliderStep, sliding: bool, } #[derive(Clone, Copy)] pub struct SliderArgs { ...
#![cfg_attr( all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows" )] use r2d2_sqlite::SqliteConnectionManager; fn main() { let mut path = dirs::cache_dir().unwrap(); path.push("tauri-app.sql"); let manager = r2d2_sqlite::SqliteConnectionManager::file(path); let pool = r2d2::Poo...
pub fn implement(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let max_dimensions = 4; let vec_type = syn::parse_macro_input!(input as syn::Ident); let vec_type_name = vec_type.to_string(); let scalar_type_name = &vec_type_name[0..vec_type_name.len() - 1]; let scalar_fn_name = voca_rs::case::lo...
mod controls; #[macro_use] mod renderer; mod bounding_volume; mod camera; mod assets; mod particle; mod planet; mod star; use iced_wgpu::{wgpu, Backend, Renderer, Settings, Viewport}; use iced_winit::{ conversion, futures, futures::task::SpawnExt, program, Debug, Size, winit, winit::event::{Event, WindowEvent}...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Device address and endpoint control"] pub addr_endp: ADDR_ENDP, #[doc = "0x04 - Interrupt endpoint 1. Only valid for HOST mode."] pub addr_endp1: ADDR_ENDP1, #[doc = "0x08 - Interrupt endpoint 2. Only valid for HOST mod...
use std::process::{Command, Stdio}; fn exo4_pipes(){ let ls = Command::new("ls") .stdout(Stdio::piped()) .spawn() .expect(" ls? What is it?"); let ls_stdout = Stdio::from(ls.stdout.expect("Failed")); let process = Command::new("grep") .arg("Hello") .stdin(ls_stdout) .spawn() ...
use regex::Regex; use serenity::client::Context; use serenity::futures::StreamExt; use serenity::http::CacheHttp; use serenity::model::guild::Member; use serenity::model::id::{GuildId, UserId}; use serenity::model::user::User; use std::ops::Add; #[derive(Debug, Copy, Clone)] pub enum ParameterType { Word, Numb...
#![allow(dead_code)] // If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. // The sum of these multiples is 23. // // Find the sum of all the multiples of 3 or 5 below 1000. pub fn problem() -> usize { (1..1000).fold(0, |acc, x| { if x % 3 == 0 || x % 5 == 0 { ...
struct Point<T, U> { x: T, y: U, } impl<T, U> Point<T, U> { fn mixup<V, W>(self, other: Point<V, W>) -> Point<T, W> { Point { x: self.x, y: other.y, } } fn x(&self) -> &T { &self.x } } pub fn generic_struct() { println!("{}", "------------ge...
use criterion::{black_box, criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion}; macro_rules! bench_lib { ($name:ident, $data_fn:expr, $({ $lib_name:expr, $lib_table:expr }),* $(,)?) => { pub fn $name(c: &mut Criterion) { let mut group = c.benchmark_group(stringify!($name)); ...
/**********************************************************\ | | | hprose | | | | Official WebSite: http://www.hprose.com/ | | ...
#![no_std] pub mod slice;
mod r#impl; mod noop; pub use self::{ noop::NoopRepository, r#impl::{Repository, SingleEntityRepository}, }; use futures_util::stream::Stream; use std::{future::Future, pin::Pin}; pub type GetEntityFuture<'a, T, E> = Pin<Box<dyn Future<Output = Result<Option<T>, E>> + Send + 'a>>; pub type ListEntitiesFu...
extern crate community; mod requirements; mod checklists; mod db;
/* env.rs: This module contains the definition of an environment in RLisp. An environment is a map, that contains mappings from symbols to expressions. An environment is used by the Evaluator tho evaluate expressions. See eval.rs. */ // load functionality from sibling modules use crate::stdlib::core; ...
mod off_icon; mod on_icon; pub use off_icon::*; pub use on_icon::*; use crate::bool_to_option; use gloo::events::EventListener; use std::borrow::Cow; use wasm_bindgen::prelude::*; use web_sys::Node; use yew::prelude::*; #[wasm_bindgen(module = "/build/mwc-icon-button-toggle.js")] extern "C" { #[derive(Debug)] ...
//! Data structure for mapping string keys to numeric identifiers. #[cfg(test)] use arrow2::io::parquet::read::read_metadata; use hashbrown::hash_map::{HashMap, Keys}; use std::borrow::Borrow; use std::fs::File; use std::hash::Hash; use std::path::Path; use anyhow::Result; use log::*; use polars::prelude::*; use serde...
use crate::domain::{repository::IRepository, service::search}; use crate::interface::presenter::suggest; use crate::{command::CommandError, domain::model::Favorite}; use anyhow::Error; use skim::prelude::*; use std::io::Cursor; use std::process::Command; pub enum JumpTo { Key(String), ProjectRoot, FuzzyFin...
#[doc = "Reader of register INTR_SET"] pub type R = crate::R<u32, super::INTR_SET>; #[doc = "Writer for register INTR_SET"] pub type W = crate::W<u32, super::INTR_SET>; #[doc = "Register INTR_SET `reset()`'s with value 0x0600"] impl crate::ResetValue for super::INTR_SET { type Type = u32; #[inline(always)] ...
use super::*; #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] #[repr(transparent)] pub struct BlendControl(u16); impl BlendControl { const_new!(); bitfield_bool!(u16; 0, bg0_1st_target, with_bg0_1st_target, set_bg0_1st_target); bitfield_bool!(u16; 1, bg1_1st_target, with_bg1_1st_target, set_bg1_1st_target)...
#![no_std] #![no_main] #![feature(asm)] #![feature(min_type_alias_impl_trait)] #![feature(impl_trait_in_bindings)] #![feature(type_alias_impl_trait)] #![allow(incomplete_features)] #[path = "../example_common.rs"] mod example_common; use embassy::executor::Spawner; use embassy_rp::gpio::{Input, Level, Output, Pull}; ...
use core::{Point, SourceByteRange}; #[derive(Clone,Copy)] enum State { Code, Comment, CommentBlock, String, Char, Finished } #[derive(Clone,Copy)] pub struct CodeIndicesIter<'a> { src: &'a str, pos: Point, state: State } impl<'a> Iterator for CodeIndicesIter<'a> { type Item = ...
use std::env; fn main() { println!("rerun-if-changed=\"Cargo.toml\""); println!("rerun-if-env-changed=\"OPT_LEVEL\""); let opt_level = env::var("OPT_LEVEL").unwrap(); match opt_level.parse::<u32>() { Ok(opt_level) => { if opt_level > 0 { println!("cargo:rustc-cfg=o...
/* * 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 */ /// PagerDutyService : The PagerDuty service that is available for integration with Datadog. #[derive...
use crate::geometry::rect::Rect; use cgmath::{ElementWise, EuclideanSpace, Point2, Vector2}; use ggez::graphics::{Color, DrawMode, MeshBuilder, Vertex, WHITE}; pub struct ShapeRenderer { pub color: Color, pub mode: DrawMode, pub meshbuilder: MeshBuilder, pub screen_box: Rect, pub empty: bool, p...
/// MigrateRepoOptions options for migrating repository's /// this is used to interact with api v1 #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct MigrateRepoOptions { pub auth_password: Option<String>, pub auth_token: Option<String>, pub auth_username: Option<String>, pub clone_add...
// FIXED fn main() { let n = [0]; let [x] = n; }
use std::ops::Range; use std::marker::PhantomData; use num_traits::AsPrimitive; use renderer::Drawable; use point::Point2; #[derive(Clone, Copy, Debug)] pub struct Rectangle<T> { x0: T, x1: T, y0: T, y1: T, } impl<T> Rectangle<T> { #[inline(always)] pub fn new(x0: T, x1: T, y0: T, y1: T) -> ...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use super::{models, API_VERSION}; #[non_exhaustive] #[derive(Debug, thiserror :: Error)] #[allow(non_camel_case_types)] pub enum Error { #[error(transparent)] PublicMaintenanceConfigurations_List(...
#[doc = "Register `C1ISR` reader"] pub type R = crate::R<C1ISR_SPEC>; #[doc = "Field `ISFm` reader - CPU(n) semaphore m status bit before enable (mask)"] pub type ISFM_R = crate::FieldReader<u32>; impl R { #[doc = "Bits 0:31 - CPU(n) semaphore m status bit before enable (mask)"] #[inline(always)] pub fn isf...
use std::path::Path; use std::io::BufReader; use std::io::prelude::*; use std::fs::File; use std::collections::HashMap; fn main() { solve_problem_1_phase_1(); solve_problem_1_phase_2(); } fn solve_problem_1_phase_1() -> i32 { let input = read_input(); for (num, count) in input.iter() { let re...
use actix_web::HttpResponse; use cloudevents::http; use cloudevents::Event; use serde::Serialize; pub struct EventWriter {} impl http::EventWriter<HttpResponse> for EventWriter { fn write_cloud_event(res: http::HttpEvent) -> Result<HttpResponse, http::WriterError> { match res { http::HttpEvent...
use crate::{BotResult, CommandData, Context}; use std::sync::Arc; #[command] #[short_desc("https://youtu.be/SyJMQg3spck?t=43")] #[bucket("songs")] #[no_typing()] async fn saygoodbye(ctx: Arc<Context>, data: CommandData) -> BotResult<()> { let (lyrics, delay) = _saygoodbye(); super::song_send(lyrics, delay, c...
use crate::stratum::StratumClient; use crate::worker::{start_worker, WorkerController, WorkerMessage}; use actix::{Actor, Arbiter, Context, System}; use anyhow::Result; use config::MinerConfig; use futures::channel::mpsc; use futures::stream::StreamExt; use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; use lo...
tonic::include_proto!("helloworld"); tonic::include_proto!("grpc.examples.echo"); wasm_bindgen_test_configure!(run_in_browser); use js_sys::Date; use grpc_web_client::Client; use wasm_bindgen_test::*; #[wasm_bindgen_test] async fn hello_world() { let client = Client::new("http://127.0.0.1:8080".to_string()); ...
use std::{ffi::CString, io::SeekFrom}; use crate::{ items::{BlockGroupType, ChunkItem}, sizes, Checksum, DiskKey, DiskKeyType, }; use bitflags::bitflags; use enum_primitive::*; use fal::{read_u16, read_u32, read_u64, read_u8, read_uuid, write_u64, write_u8}; const SUPERBLOCK_OFFSETS: [u64; 4] = [64 * sizes::...
use { crate::{ client::{self, RequestType}, entities::*, Client, }, serde_json::json, std::error::Error, }; /// Log into an existing listen.moe account pub async fn login( username: String, password: String, otp: Option<String>, ) -> Result<Client, Box<dyn Error>> { ...
use super::*; fn do_open(path: &str, flags: u32, mode: u32) -> Result<FileDesc> { let current = current!(); let fs = current.fs().lock().unwrap(); let file = fs.open_file(path, flags, mode)?; let file_ref: Arc<Box<dyn File>> = Arc::new(file); let fd = { let creation_flags = CreationFlags:...
use libpulse_binding::{sample, stream}; use libpulse_simple_binding::Simple; use std::net::{SocketAddr, UdpSocket}; use std::sync::{Arc, RwLock}; use std::thread; const SAMPLING_RATE: u32 = 48000; const FRAME_SIZE: usize = 2880; fn main() { let clients: Arc<RwLock<Vec<SocketAddr>>> = Arc::new(RwLock::new(Vec::new...
use std::env; use std::io::BufReader; use std::io::BufRead; use std::fs::File; use std::collections::HashMap; fn gen_seq() { let mut pos: HashMap<usize, usize> = HashMap::new(); let mut prev = 0; let mut cur = 0; println!("{}", cur); let mut i = 1; loop { if pos[&cur] == 0 { ...
use regex::Regex; use std::cmp::max; use std::collections::HashMap; use std::io::{self}; fn get_happiness(names: &Vec<&str>, scores: &HashMap<&str, HashMap<&str, i32>>) -> i32 { let mut total_score = 0; for i in 0..names.len() { let left_neighbour = if i > 0 { names[i - 1] } else { ...
use super::{Node, Priority, BLOCK_SIZE}; use itertools::Itertools; use rand::random; use std::ops::Range; pub struct ITreap<C> { root: Node<C>, } impl<C> std::ops::Index<usize> for ITreap<C> { type Output = C; /// Borrows the `i`th element. /// Cost is O(log(n/B)). fn index(&self, i: usize) -> &Se...
use std::net::SocketAddr; use rsocket_rust::async_trait; use rsocket_rust::{error::RSocketError, transport::ServerTransport, Result}; use tokio::net::TcpListener; use crate::{client::TcpClientTransport, misc::parse_tcp_addr}; #[derive(Debug)] pub struct TcpServerTransport { addr: SocketAddr, listener: Option...
use dialoguer::{theme::ColorfulTheme, Checkboxes}; use parser::Parser; use lexer::Lexer; use parser::Visitor; use super::printer::PrintVisitor; use super::prompt::{PromptOption, Prompt, PromptResult}; use errors::error_index::Error::UnexpectedEOF; #[derive(Default, Clone)] struct Options{ show_ast: bool, show_t...
fn main() -> Result<(), ()> { let date_txt: &'static str = "2019-03-21 09:50"; println!("This ifinterp implementation in Rust is a stub as of {}", date_txt); Ok(()) }
use std::fs::read_to_string; use std::{iter, thread, time}; use std::fmt::{Debug, Formatter, Error}; use itertools::Itertools; const INPUT_FILE: &str = "data/day_18.txt"; const TEST_GRID: &str = r#".#.#.# ...##. #....# ..#... #.#..# ####.."#; #[derive(Clone)] struct Grid { data: Vec<bool>, width: usize, ...
/*! WORM directory abstraction. */ #[cfg(feature = "mmap")] mod mmap_directory; mod directory; mod managed_directory; mod ram_directory; mod read_only_source; mod shared_vec_slice; /// Errors specific to the directory module. pub mod error; use std::io::{BufWriter, Seek, Write}; pub use self::directory::{Directo...
#![no_std] #![no_main] extern crate atsamd21_hal as hal; extern crate panic_abort; extern crate cortex_m_rt; pub use hal::atsamd21e18a::*; use hal::prelude::*; pub use hal::*; use cortex_m_rt::entry; #[entry] fn main() -> ! { let mut peripherals = Peripherals::take().unwrap(); let mut pins = peripherals.POR...
#[doc = "Register `SR2` reader"] pub type R = crate::R<SR2_SPEC>; #[doc = "Field `MSL` reader - Master/slave"] pub type MSL_R = crate::BitReader; #[doc = "Field `BUSY` reader - Bus busy"] pub type BUSY_R = crate::BitReader; #[doc = "Field `TRA` reader - Transmitter/receiver"] pub type TRA_R = crate::BitReader; #[doc = ...
use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen_futures; use wasm_bindgen_futures::JsFuture; use web_sys::Request; use web_sys::RequestInit; use web_sys::RequestMode; use web_sys::Response; pub async fn get(address: &str) -> Result<String, JsValue> { let mut opts = RequestInit::new(); ...
use redoxfs::{archive_at, DiskSparse, FileSystem, TreePtr, BLOCK_SIZE}; use std::path::{Path, PathBuf}; use std::process::{self, Command}; use std::time::{SystemTime, UNIX_EPOCH}; use std::{fs, io}; use crate::redoxfs::RedoxFs; use crate::{installed, redoxer_dir, status_error, syscall_error, target, toolchain}; const...
#![windows_subsystem = "windows"] extern crate iui; extern crate romhack_backend; use iui::controls::{Button, HorizontalSeparator, Label, Spacer, VerticalBox}; use iui::prelude::*; use romhack_backend::{apply_patch, DontPrint}; use std::cell::RefCell; use std::path::PathBuf; use std::rc::Rc; struct State { iso: ...
#[macro_use] extern crate log; extern crate env_logger; extern crate rustygear; extern crate rustygeard; use rustygeard::server::GearmanServer; fn main() { env_logger::init(); info!("Binding to 0.0.0.0:4730"); let address = "0.0.0.0:4730".parse().unwrap(); GearmanServer::run(address); }
//mod prefix_read; mod doc; pub mod error; mod prefix; use error::*; use skorm_curie::CurieStore; use skorm_store::RdfStore; use std::ffi::OsStr; use std::fs::File; use std::path::Path; use std::path::PathBuf; use tracing::debug; const PREFIX_FILE_NAME: &'static str = "_prefix.ttl"; pub struct Walker<'a> { path: &...
#[macro_export] macro_rules! create_dep { ($obj:expr, $container:expr) => {{ $container.add($obj).unwrap() }}; ($obj:expr, $container:expr, $($t:tt)+) => {{ $container.add($obj).unwrap()$($t)+ }}; } #[macro_export] macro_rules! inject_dep { ($struct:ident, $container:expr) => {{ ...
// https://projecteuler.net/problem=19 /* You are given the following information, but you may prefer to do some research for yourself. - 1 Jan 1900 was a Monday. - Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or ...
/* * Copyright (c) Facebook, Inc. and its 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. */ #[cfg...
mod intcode; use std::collections::HashMap; use std::fs; use std::sync::mpsc; use std::{thread, time}; fn main() { let input = fs::read_to_string("input.txt").expect("Something went wrong reading the file"); let program: Vec<i64> = input.trim_end().split(",").map(|n| n.parse().unwrap()).collect(); run_r...
use fantoccini::error::CmdError; use fantoccini::{Client, Locator}; use futures::future::Future; use tokio; fn main() { // expects WebDriver instance to be listening at port 4444 let client = Client::new("http://localhost:4444"); let get_started_button = r#"//a[@class="button button-download ph4 mt...
use crate::{fetch_path, ABI}; use color_eyre::eyre::{bail, eyre, Result, WrapErr}; use lazy_static::lazy_static; use regex::Regex; use std::borrow::Cow; use std::fmt; use std::fs::File; use std::io::Write; use std::path::Path; pub struct Table<'a> { pub arch: &'a str, pub path: &'a str, pub abi: &'a [ABI<'...
#[cfg(test)] mod test; use crate::{ bson::{doc, Document}, cmap::{Command, RawCommandResponse, StreamDescription}, error::{ErrorKind, Result}, index::IndexModel, operation::{append_options, remove_empty_write_concern, OperationWithDefaults}, options::{CreateIndexOptions, WriteConcern}, resu...
pub mod prelude { pub use super::HtmlFile; pub use super::Response; } use std::fs; use std::path::Path; use super::status::HttpStatus; use crate::HTML_DIR; pub enum Response { File(HttpStatus, HtmlFile), Text(HttpStatus, String), } impl Response { pub fn raw(&self) -> String { match self...
pub mod apparent_pk; pub mod full_pk;
pub mod category; pub mod comment; pub mod drive; pub mod embed; pub mod handler; pub mod info; pub mod node; pub mod page; pub mod post; pub mod topic; pub mod user;
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use azul::prelude::*; use rand::Rng; use std::borrow::BorrowMut; #[cfg(debug_assertions)] use std::time::Duration; const FONT_RALEWAY: &[u8] = include_bytes!("../assets/fonts/Raleway/Raleway-Regular.ttf"); macro_rules! CSS_PATH { () => { ...
//! Developer note: //! //! This is a set of embed builders for rich embeds. //! //! These are used in the [`Context::send_message`] and //! [`ExecuteWebhook::embeds`] methods, both as part of builders. //! //! The only builder that should be exposed is [`CreateEmbed`]. The rest of //! these have no real reason for bei...
use std::borrow::Cow; use darling::ast::Fields; use proc_macro2::{Span, TokenStream}; use quote::{quote, quote_spanned, ToTokens, TokenStreamExt}; use syn::{self, Attribute, Generics, Ident, Path}; use crate::util; /// Receiver for trait impl; this gets the struct ident and the fields /// in the struct. pub struct T...
use std::env::var; use std::fmt; use std::fmt::{Display, Formatter}; use std::fs::read_to_string; use std::path::PathBuf; use anyhow::{Context, Result}; use serde::de::DeserializeOwned; use serde::Serialize; use crate::cfg::global::GLOBAL_FILE_NAME; use crate::cfg::{GlobalCfg, LocalCfg}; use crate::utils::find::find_...
use minifb::{Key, WindowOptions, Window, Scale, KeyRepeat}; const CHAR_0: [u8; 5] = [ 0b01100000, 0b10010000, 0b10010000, 0b10010000, 0b01100000, ]; const CHAR_1: [u8; 5] = [ 0b00100000, 0b01100000, 0b00100000, 0b00100000, 0b01110000, ]; const SPRITE: [u8; 5] = [ 0b0010010...
#![feature(core)] //! //! # Usage //! //! ```test_harness //! extern crate "youtube3-dev" as youtube3; //! extern crate hyper; //! //! # #[test] //! # fn test() { //! # // TODO - generate ! //! # } //! ``` use std::marker::PhantomData; use std::cell::RefCell; use std::borrow::BorrowMut; use std::default::Default; us...
use tui::backend::Backend; use tui::Frame; use tui::layout::{Corner, Rect}; use tui::widgets::{Block, Borders, Widget}; use crate::format::MessageFormat; use crate::tui::App; use crate::tui::notification_list::{Notification, NotificationsList}; pub fn draw_retain_tab<B>(f: &mut Frame<B>, area: Rect, app: &App, format...
use super::{AuthTokenExtractor, Response}; use crate::agent; use crate::server::Server; use axum::extract::Extension; use axum::Json; use hyper::StatusCode; use log::{error, info}; use std::sync::Arc; pub async fn promote_handler( auth_token: AuthTokenExtractor, server: Extension<Arc<Server>>, ) -> (StatusCode...
mod fish; fn main() { let mut }
#![allow(unused_variables)] #![allow(dead_code)] fn main() { // ----------- Part 01 -------------- struct User { name: String, email: String, dead: bool, } // order isn't required let mut user001 = User { email: String::from("numberOne@example.com"), n...
extern crate amethyst; use amethyst::{Application, Event, State, Trans, VirtualKeyCode, WindowEvent}; use amethyst::asset_manager::AssetManager; use amethyst::config::Element; use amethyst::ecs::World; use amethyst::gfx_device::DisplayConfig; use amethyst::renderer::Pipeline; struct GameState; impl State for GameSta...
use diesel::prelude::*; use std::collections::HashMap; use crate::models::*; use crate::schema::settings::dsl::*; use crate::{database, errors::MetaphraseError}; use actix_web::web; use actix_web::Responder; pub async fn index() -> Result<impl Responder, MetaphraseError> { let connection = database::establish_co...
// Copyright 2020 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 use wasmlib::*; //@formatter:off pub struct Auction { pub color: ScColor, // color of tokens for sale pub creator: ScAgentId, // issuer of start_auction transaction pub deposit: i64, // deposit by auction...
use crate::net::UnixStream; #[cfg(debug_assertions)] use crate::poll::SelectorId; use crate::unix::SocketAddr; use crate::{event, sys, Interest, Registry, Token}; use std::io; use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use std::os::unix::net; use std::path::Path; /// A non-blocking Unix domain soc...
#![no_main] #[macro_use] extern crate libfuzzer_sys; extern crate gbl; use gbl::{AppImage, Gbl, P256KeyPair}; #[rustfmt::skip] // FIXME: https://github.com/rust-lang/rustfmt/issues/3234 fuzz_target!(|data: &[u8]| { if let Ok(app_img) = AppImage::parse(data) { let keypair = P256KeyPair::from_pem(include_str!("....
use std::{ collections::{ HashMap, VecDeque }, borrow::Borrow }; use super::{ IfExpr, BasicExpr, TypedExpr, ExprValue, BinOp, UnaryOp }; use crate::parser::token::Token; #[derive(Clone, Debug, PartialEq, Eq)] pub enum Type { Unit, Bool, Int, Double,...
use indexmap::IndexMap; use crate::pos::Spanned; #[derive(Debug, Clone)] pub enum TypeData { Identifier(String), Record(IndexMap<String, String>), Array(String), } pub type Type = Spanned<TypeData>; #[derive(Debug, Clone)] pub struct TypeDeclData { pub name: String, pub decl: Type, } pub type T...
pub mod attestations;
pub mod validators;
use crate::{ cmd::oui::*, traits::{TxnEnvelope, TxnFee, TxnSign, TxnStakingFee}, }; use helium_api::ouis; use structopt::StructOpt; /// Allocates an Organizational Unique Identifier (OUI) which /// identifies endpoints for packets to sent to The transaction is not /// submitted to the system unless the '--comm...
/// Should check if the inputted ABI's are valid /// Convert the String to a list of ABI's pub fn input_to_abi_vec(input: &str, bp: bool) -> Vec<String> { if input.is_empty() { return vec![]; } let list: Vec<String> = input.split(",").map(|s| s.to_string()).collect(); return parse_abi_for_build...
fn main() { let x: i32 = 5; }
use spin::RwLock; use std::collections::HashMap; use rand::prelude::*; use rand::rngs::OsRng; use x25519_dalek::PublicKey; use x25519_dalek::StaticSecret; use crate::messages; use crate::noise; use crate::peer::Peer; use crate::types::*; pub struct Device<T> { pub sk: StaticSecret, // static s...
//! **N**ox's **A**bstract **A**bstract **M**achine //! //! Highly experimental framework to design higher-level virtual machines //! fearlessly. #![no_std] #[cfg(feature = "alloc")] extern crate alloc; pub mod builder; pub mod builtins; pub mod cpu; pub mod debug_info; mod id; pub mod tape; use crate::builder::{Bu...