text
stringlengths
8
4.13M
use libc::{c_int, c_uint, c_char, uint32_t}; pub type SDL_bool = c_int; pub type SDL_errorcode = c_uint; pub const SDL_ENOMEM: SDL_errorcode = 0; pub const SDL_EFREAD: SDL_errorcode = 1; pub const SDL_EFWRITE: SDL_errorcode = 2; pub const SDL_EFSEEK: SDL_errorcode = 3; pub const SDL_UNSUPPORTED: SDL_errorcode = 4; pu...
pub struct Cli { pub schema_path: std::path::PathBuf, }
//! This module contains the tree connect contexts //! The SMB2_TREE_CONNECT_CONTEXT structure is used by the //! SMB2 TREE_CONNECT request and the SMB2 TREE_CONNECT response //! to encode additional properties. /// The SMB2_TREE_CONNECT_CONTEXT structure is used by the SMB2 TREE_CONNECT /// request and the SMB2 TREE_...
#[doc = "Reader of register ERR"] pub type R = crate::R<u32, super::ERR>; #[doc = "Reader of field `TEC`"] pub type TEC_R = crate::R<u8, u8>; #[doc = "Reader of field `REC`"] pub type REC_R = crate::R<u8, u8>; #[doc = "Reader of field `RP`"] pub type RP_R = crate::R<bool, bool>; impl R { #[doc = "Bits 0:7 - Transmi...
use crate::intcode_compute::computer_1202; use std::collections::VecDeque; use std::fs; pub fn boost_01() -> VecDeque<i64> { let filename = "./src/aoc09/input.txt"; let contents = fs::read_to_string(filename).expect("Something went wrong reading the file"); let result = computer_1202(&contents, false, &mut VecDe...
use super::*; mod with_atom; #[test] fn without_atom_errors_badarg() { run!( |arc_process| { ( Just(arc_process.clone()), strategy::term::is_not_non_negative_integer(arc_process.clone()), strategy::term(arc_process.clone()), strat...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::FR { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w m...
use std::path::{Path, PathBuf}; use std::io::{BufRead, BufReader, Read, Write}; use std::process::{Command, Output}; use structopt::StructOpt; use serde::{Deserialize, Serialize}; #[macro_use] extern crate error_chain; mod conan_package; mod err; use crate::conan_package::*; use filesystem::FileSystem; use std::fs...
pub mod primitives; pub mod widgets;
use crate::util::{self, color}; use crate::{cmd::edit, config, err}; use anyhow::Result; use std::collections::HashMap; use std::env; use std::fs::File; use std::process::Command; pub fn remove() -> Result<()> { use std::io::prelude::*; let machine_id = util::machine_id()?; let mut temp_dests_path = env::temp_...
use std::error::Error; use std::ops::Deref; use std::path::PathBuf; use std::sync::{Arc, Mutex}; use meilisearch_core::{Database, DatabaseOptions, Index}; use sha2::Digest; use crate::error::{Error as MSError, ResponseError}; use crate::index_update_callback; use crate::option::Opt; use crate::dump::DumpInfo; #[deri...
extern crate gl; extern crate sdl2; extern crate log; use super::std::mem; use self::sdl2::video; use self::sdl2::video::GLAttr; pub enum GLVersion { Core((i32, i32)), } pub struct WindowOptions { pub gl_version: GLVersion, pub title: String, pub initial_size: (i32, i32), } pub struct Window { ...
#![allow(dead_code)] //! Architecture //! ============ //! //! Game Loop //! --------- //! //! +---> P ---> A ---> I ---> U ---+ //! | | //! ^ GAME LOOP v //! | | //! +---------| running? |----------+ //! //! * `Present`...
use env::*; use objects::*; fn init_port(env: &mut SchemeEnv) { env.add_global("call-with-input-file", &SchemeObject::new_prim()); env.add_global("call-with-output-file", &SchemeObject::new_prim()); env.add_global("input-port?", &SchemeObject::new_prim()); env.add_global("output-port?", &SchemeObject::...
use byteorder::{BigEndian, ByteOrder}; use bytes::{Buf, BufMut, BytesMut}; use futures::SinkExt; use prost::Message; use std::{error::Error, fmt, fs, io, usize}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::UnixListener; use tokio::signal; use tokio_stream::StreamExt; use tokio_util::codec::{Decoder, E...
#[macro_use] extern crate cpython; use cpython::{PyResult, Python}; py_module_initializer!(libtfidf, initlibtfidf, PyInit_libtfidf, |py, m| { m.add(py, "__doc__", "tf-idf")?; m.add(py, "tfidf", py_fn!(py, tfidf_py(docs: Vec<Vec<usize>>)))?; m.add(py, "tf", py_fn!(py, tf_py(docs: Vec<Vec<usize>>)))?; O...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ...
mod algo; pub use algo::*; mod edges; pub use edges::*; mod graph; pub use graph::*; mod traversal; pub use traversal::*; mod visit; pub use visit::*; pub mod prelude; // Index into the NodeIndex and EdgeIndex arrays /// Edge direction. #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] #[repr(us...
pub fn raindrops(n: u32) -> String { let mut raindrop_sound = "".to_owned(); if n%3 == 0 { raindrop_sound.push_str("Pling") } if n%5 == 0 { raindrop_sound.push_str("Plang") } if n%7 == 0 { raindrop_sound.push_str("Plong") } if raindrop_sound.is_empty() { r...
extern crate sdl2; extern crate imgui; use sdl2::sys as sdl2_sys; use imgui::sys as imgui_sys; use sdl2::video::Window; use sdl2::EventPump; use sdl2::mouse::{Cursor,SystemCursor}; use imgui::{ImGui,ImGuiMouseCursor}; use std::time::Instant; use std::os::raw::{c_char, c_void}; use sdl2::event::Event; pub struct Img...
use dlal_component_base::component; use std::f32::consts::PI; component!( {"in": [], "out": ["audio"]}, [ "run_size", "sample_rate", "uni", "check_audio", {"name": "field_helpers", "fields": ["freq", "amp"], "kinds": ["rw", "json"]}, ], { freq: f32, ...
//! Data structures used to read the content streams of a compressed file, //! i.e. sequences of indices that map either into a static dictionary //! or into a dynamic dictionary. use bytes::varnum::ReadVarNum; use TokenReaderError; use binjs_shared::SharedString; use std::io::Cursor; /// A data structure used to r...
#[macro_export] macro_rules! error_and_panic { ($message:expr) => {{ error!("{}", $message); panic!($message); }}; ($message:expr, $error:expr) => {{ error!("{}: [{}]", $message, $error); panic!("{}: [{}]", $message, $error); }}; } #[macro_export] macro_rules! log_and_t...
use libc; use std::{ env, fs::File, io::{self, BufWriter, Write}, path::Path, }; fn main() { let output_dir = env::var("OUT_DIR").expect("Could not determine OUT_DIR from environment"); generate_os_consts_file(output_dir).expect("Failed to write OS consts file"); } fn generate_os_consts_file<...
// This file is part of linux-epoll. 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/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
mod handler; mod nrsync; #[macro_use] extern crate log; use clap::Clap; use env_logger::{Builder, Target}; use std::env; macro_rules! crate_version { () => { env!("CARGO_PKG_VERSION") }; } #[derive(Clap)] #[clap(version= crate_version!(), author = "Kavashen Pather")] pub struct Opts { /// New Rel...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /// Tests for Bonding procedures pub mod bonding; /// Tests for the fuchsia.bluetooth.control.Control protocol pub mod control; /// Tests for the Bluetoo...
use std::io::{Read, Result as IOResult}; use crate::{PrimitiveRead, StringRead}; pub struct Model { pub name: String, pub model_type: i32, pub bounding_radius: f32, pub meshes_count: i32, pub mesh_index: u64, pub vertices_count: i32, pub vertex_index: i32, pub tangents_index: i32, pub attachments_...
use std::cmp::{max, min}; use std::collections::{BinaryHeap, HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; // ワーシャル フロイド 法 // kを中継地点としてkを小さい順にO(n^3)で最短路を求めるdpを使っている方法 // 本当はn * nのdpで十分 fn main() { let (n, m): (usize, usize) = parse_line().unwrap(); let mut map: Vec<Vec<usize>> = vec!...
use std::fmt; use std::ops::Range; use std::str; use std::sync::Arc; use bstr::{BStr, ByteSlice}; use bytes::Bytes; use thiserror::Error; use crate::object::{Id, Parser, ID_LEN}; #[derive(Clone)] pub struct Tree { data: Bytes, entries: Arc<[TreeEntryRaw]>, } pub struct TreeEntry<'a> { data: &'a [u8], ...
use serde::Serialize; use std::{ cell::RefCell, collections::{HashMap, HashSet, VecDeque}, ops::DerefMut, path::PathBuf, sync::{ atomic::{AtomicBool, Ordering}, Arc, }, }; use steamworks::{PublishedFileId, QueryResult, QueryResults, SteamError, SteamId}; use parking_lot::Mutex; use super::{users::SteamUser...
#[doc = "Reader of register APB4FZ1"] pub type R = crate::R<u32, super::APB4FZ1>; #[doc = "Writer for register APB4FZ1"] pub type W = crate::W<u32, super::APB4FZ1>; #[doc = "Register APB4FZ1 `reset()`'s with value 0"] impl crate::ResetValue for super::APB4FZ1 { type Type = u32; #[inline(always)] fn reset_va...
pub enum ResponseCode { NoError, FormErr, ServFail, NXDomain, NotImp, Refused, YXDomain, YXRRSet, NXRRSet, NotAuth, NotZone, Unassigned(u8), } impl Default for ResponseCode { fn default() -> ResponseCode { ResponseCode::NoError } } pub fn unpack(value: u...
pub use super::constants::*; pub use super::core::*; pub use super::ext::*; pub use super::khr::*; pub use super::nv::*; pub use super::types::*; pub use super::voidfunction::*;
pub mod guards; pub mod membership_token;
use super::*; use std::collections::*; use syn::parse::*; use syn::Ident; use syn::*; custom_keyword!(extend); #[derive(Default)] pub struct ImplementMacro { pub implement: BTreeSet<TypeDef>, pub extend: Option<TypeDef>, pub overrides: BTreeSet<&'static str>, } impl ImplementMacro { pub fn interfaces...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qrawfont.h // dst-file: /src/gui/qrawfont.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= m...
/* Input: a vector of points (x, y) output: a vector of lines (xbeg, ybeg, xend, yend) */ pub fn run(input:&vec<(f64, f64)>, output:&mut vec<Line>) { }
use crate::backend::c; use bitflags::bitflags; bitflags! { /// `MS_*` constants for use with [`mount`]. /// /// [`mount`]: crate::mount::mount #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct MountFlags: c::c_uint { /// `MS_BIND` const BIND = li...
use std::io; use std::default::Default; use crate::{Battery}; use crate::platform::traits::{BatteryManager}; use super::SysFsIterator; static SYSFS_ROOT: &'static str = "/sys/class/power_supply"; #[derive(Debug)] pub struct SysFsManager; impl SysFsManager { pub fn iter(&self) -> SysFsIterator { SysFsIt...
use std::io::Read; use std::fs::File; fn parse_file(filename: &String, out: &mut Vec<String>) { let mut content: String = String::new(); let mut file = File::open(filename).unwrap(); file.read_to_string(&mut content).unwrap(); let iter = content .lines() .map(|x| x.to_string()); ...
//use failure_derive::*; -- using thiserror insted use thiserror::*; #[derive(Error, Debug)] pub enum BlobError { #[error("No Room")] NoRoom, #[error("Too Big")] TooBig(u64), #[error("Item Not Fount")] NotFound, #[error("{}", 0)] Bincode(bincode::Error), #[error("{}", 0)] IO(std:...
//! Partial assignment and backtracking. use partial_ref::{partial, PartialRef}; use varisat_formula::{lit::LitIdx, Lit, Var}; use crate::{ context::{parts::*, Context}, decision::make_available, }; use super::Reason; /// Current partial assignment. #[derive(Default)] pub struct Assignment { assignment:...
extern crate serde; mod test_utils; use flexi_logger::LoggerHandle; use hdbconnect_async::types::BLob; use hdbconnect_async::{Connection, HdbResult, HdbValue}; use log::{debug, info}; use rand::{thread_rng, RngCore}; use serde::{Deserialize, Serialize}; use serde_bytes::{ByteBuf, Bytes}; use sha2::{Digest, Sha256}; ...
use std::collections::btree_map::{IterMut, OccupiedEntry, RangeMut, VacantEntry}; // revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { v //[base]~^ ERROR mismatched types //[nll]~^...
use ascii::AsciiChar; use core::ptr::Unique; use krnl::port; use krnl::port::Port; use spin::Mutex; use volatile::Volatile; // // ------------------> y (80) // | > _ | // | console | // | | // x-----------------x // (25) pub const MAX_ROW: usize = 25; pub const MAX_COLUMN: usi...
// Copyright 2019. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
//! Traits and structures relating to and for managing commands. Commands are messages sent from //! outside the physics simulation to alter how the physics simulation runs. For example, causing a //! rigid body for a player to jump requires a jump command, and causing a player to spawn requires //! a spawn command. u...
#[macro_use] mod common; use common::util::*; static UTIL_NAME: &'static str = "tac"; #[test] fn test_stdin_default() { let (_, mut ucmd) = testing(UTIL_NAME); let result = ucmd.run_piped_stdin("100\n200\n300\n400\n500"); assert_eq!(result.stdout, "500400\n300\n200\n100\n"); } #[test] fn test_stdin_non_...
use handler::{RequestHandler, RequestRouter}; use request::{Bundle, Request}; use state::Container; pub use vostok_codegen::request; pub use vostok_codegen::routes; pub mod handler; pub mod request; pub mod response; pub struct Vostok<Req: 'static, Res: 'static> { state: Container, router: RequestRouter<Req,...
use std::process; pub fn print_usage_error(code: u32) { if code == 1 { println!("ERROR::USAGE:: Enter each row of a sudoku puzzle seperated by spaces, use a '.' for an empty value"); } if code == 2 { println!("ERROR::USAGE:: Each row must be exactly 9 characters"); } if code...
/* * Copyright (C) 2020 Zixiao Han */ static SEED_C89: u64 = 0b10110110_00101111_10100100_01011000_00001000_01100100_11010111_11111010; static SEED_A86: u64 = 0b10111001_11010011_00111100_00010100_00110000_00100110_11001111_10110110; const fn rotate(x: u64, k: usize) -> u64 { (x << k) | (x >> (64 - k)) } pub s...
/* * @lc app=leetcode.cn id=415 lang=rust * * [415] 字符串相加 * * https://leetcode-cn.com/problems/add-strings/description/ * * algorithms * Easy (43.32%) * Total Accepted: 5.3K * Total Submissions: 12.2K * Testcase Example: '"0"\n"0"' * * 给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和。 * * 注意: * * * num1 和num2 的长...
mod state; mod timer; mod audio; mod winner; mod ball; mod paddle; mod taunt; mod persistence; use amethyst::{ prelude::*, renderer::{ plugins::{RenderFlat2D, RenderToWindow}, types::DefaultBackend, RenderingBundle, }, utils::application_root_dir, Result, }; use amethyst::co...
use std::io; use std::cmp::Ordering; use rand::Rng; fn main() { println!("Hello, rusty!"); loop { println!("Guess a number (type 'c' to exit): "); let mut guess = String::new(); io::stdin() .read_line(&mut guess) .expect("Faile to read line"); let gues...
#[doc = "Reader of register FLTINR3"] pub type R = crate::R<u32, super::FLTINR3>; #[doc = "Writer for register FLTINR3"] pub type W = crate::W<u32, super::FLTINR3>; #[doc = "Register FLTINR3 `reset()`'s with value 0"] impl crate::ResetValue for super::FLTINR3 { type Type = u32; #[inline(always)] fn reset_va...
#![allow(non_camel_case_types)] #![allow(dead_code)] use libc::{c_char, c_int, c_uint, c_void, size_t}; pub type c_bool = c_int; pub type csh = *const c_void; pub type cs_err = c_int; pub type cs_opt_type = c_int; #[repr(C)] pub struct cs_insn { pub id: c_uint, pub address: u64, pub size: u16, pub b...
use wasm_bindgen::JsValue; use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn parse_golang_fmt_print(mut code: &str) -> Result<Vec<u8>, JsValue> { if code.starts_with('[') { code = &code[1..]; } if code.ends_with(']') { code = &code[..code.len() - 1]; } let str_forms = code.split...
use backend::x86::X86Platform; use backend::Platform; use error::CompileError; use std::env; use std::fmt::Display; use std::fs::File; use std::io::{BufWriter, Read, Write}; use std::path::Path; extern crate hashbrown; #[macro_use] extern crate lalrpop_util; extern crate term; extern crate unicode_xid; pub mod backen...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "UI_WebUI_Core")] pub mod Core; #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struc...
use std::io::{self, Write}; mod ast; mod evaluator; mod lexer; mod object; mod parser; mod token; use evaluator::*; use lexer::*; use object::*; use parser::*; fn main() -> io::Result<()> { let mut env = Environment::new(); let prompt = ">>"; println!( "Hello mrnugget! This is the Monkey programmi...
#[macro_use] extern crate log; extern crate log4rs; static CONFIG: &'static str = " appenders: main: kind: console root: level: warn appenders: - main loggers: log4rs_issue: level: debug log4rs_issue::nested: level: trace "; mod nested { pub fn calls_trace() { trace!("calls_tr...
#![cfg_attr(feature = "bench", feature(test))] #![feature(nll)] #![feature(test)] #![feature(external_doc)] #![doc(include = "../README.md")] #![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")] //! Note that docs will only build on nightly Rust until //! [RFC 1990 stabilizes](https://github.com...
use super::*; use bitflags::bitflags; use linux_object::time::*; impl Syscall<'_> { #[cfg(target_arch = "x86_64")] /// set architecture-specific thread state /// for x86_64 currently pub fn sys_arch_prctl(&mut self, code: i32, addr: usize) -> SysResult { const ARCH_SET_FS: i32 = 0x1002; ...
extern crate windows_winmd as winmd; #[test] fn win32() { let reader = winmd::TypeReader::get(); if let winmd::Type::TypeDef(def) = reader.expect_type(("Windows.Foundation", "IStringable")) { assert!(def.name() == ("Windows.Foundation", "IStringable")); } else { panic!(); } if let...
use crate::random::GameRandom; use game_lib::rand::SeedableRng; #[derive(Clone, Debug, Default)] pub struct RandomConfig { pub seed: Option<<GameRandom as SeedableRng>::Seed>, }
mod with_atom_module; use proptest::strategy::Just; use crate::erlang::spawn_3; use crate::test::strategy; #[test] fn without_atom_module_errors_badarg() { run!( |arc_process| { ( Just(arc_process.clone()), strategy::term::is_not_atom(arc_process.clone()), ...
// Copyright 2018 The Exonum Team // // 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 i...
use crate::collections::HashMap; use crate::context::Handler; use crate::{ConstValue, Hash, Item, TypeCheck}; use std::fmt; use std::sync::Arc; /// Static run context visible to the virtual machine. /// /// This contains: /// * Declared functions. /// * Declared instance functions. /// * Built-in type checks. #[derive...
use crate::responses::listing::GenericListing; use crate::responses::{FullName, GenericResponse}; use serde::Deserialize; use serde_json::Value; #[derive(Deserialize, Debug)] pub struct Message { pub associated_awarding_id: Option<Value>, pub author: String, pub author_fullname: Option<FullName>, pub b...
#[doc = "Reader of register HWCFGR6"] pub type R = crate::R<u32, super::HWCFGR6>; #[doc = "Writer for register HWCFGR6"] pub type W = crate::W<u32, super::HWCFGR6>; #[doc = "Register HWCFGR6 `reset()`'s with value 0x1f1f_1f1f"] impl crate::ResetValue for super::HWCFGR6 { type Type = u32; #[inline(always)] f...
pub use pathfinding_data::*; use game::*; use std::marker::PhantomData; pub fn pathfind<T1, State, T: Node<T1, State>>(game: &Game1, settings: &PathfindingSettings, state: &mut PathfindingState<T1, State, T>, poly_state: &mut State, target_node: T)->Result<T1,bool>{ //Returns either a path or err(should_continue_sear...
use serde::{Deserialize, Serialize}; use serde_json::Result; #[derive(Serialize, Deserialize)] pub struct SubscribeCommand { #[serde(rename="id")] id: u64, #[serde(rename="command")] command: String, #[serde(rename="streams")] streams: Vec<String>, } impl SubscribeCommand { pub fn with_p...
struct Person; impl Person { fn hello(&self) { println!("Hello brother"); } } fn main() { let p: Person = Person{}; p.hello(); }
// Copyright 2022 Datafuse Labs. // // 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 ...
use super::player_input; use super::VisibilitySystem; //this is possible because i use visiblity_system::* in main.rs use super::{draw_tile_vector, TileType}; use super::{Position, Renderable}; use rltk::{GameState, Rltk}; use specs::prelude::*; pub struct State { pub ecs: World, } impl GameState for State { ...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ...
use clap::Parser; use orfail::OrFail; use rofis::{ dirs_index::DirsIndex, http::{HttpMethod, HttpRequest, HttpResponse, HttpResponseBody}, }; use std::{ net::{TcpListener, TcpStream}, path::{Path, PathBuf}, time::{Duration, SystemTime}, }; /// Read-only HTTP file server. #[derive(Debug, Parser)] #[...
use crate::errors::ServiceError; use crate::models::device::{Device as Object, GetList, GetWithShop, GetWithShopRes, New, Update}; use crate::models::msg::Msg; use crate::models::DbExecutor; use crate::schema::user_device::dsl::{id, name, sw_token, user_device as tb, user_id}; use actix::Handler; use diesel; use diese...
extern crate std; use std::net::{Ipv4Addr,Ipv6Addr,SocketAddr,IpAddr}; use uuid::Uuid; use std::borrow::Cow; use std::ops::Deref; use std::error::Error; use def::CowStr; #[derive(Debug,Clone)] pub enum RCErrorType { ReadError, WriteError, SerializeError, ConnectionError, NoDataError, GenericE...
fn print(s: &str) { eprintln!("{}", s); } fn main() { // When to use String and when to use sting slice (&str) // * String when you have to modify it // * &str when you don't // Owned let mut my_string: String = String::new(); // Wrapper around Vec<u8> my_string.push_str("hello world")...
pub mod exchanges; use net_client; use ex_api; pub trait Api { fn current_price<E>(&self, net: &mut net_client::Client, api: &E, coin: &str) -> f64 where E: ex_api::exchanges::Exchange; } pub struct ApiCall {} impl ApiCall { pub fn new() -> ApiCall { ApiCall {} } } impl Api for ApiCall ...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. ///! Serves Client policy services. ///! Note: This implementation is still under development. ///! Only connect requests will cause the underlying S...
use segment::*; use std::net::*; use std::sync::mpsc::*; use std::collections::VecDeque; use std::cmp::*; use std::time::Duration; use utils::*; const WINDOW_SIZE: usize = 65000; const MAX_PAYLOAD_SIZE: usize = 1500; const TIMEOUT: u64 = 1; // In seconds #[derive(Debug, Copy, Clone, PartialEq)] pub enum TCBState { ...
#[doc = "Reader of register ISR"] pub type R = crate::R<u32, super::ISR>; #[doc = "Writer for register ISR"] pub type W = crate::W<u32, super::ISR>; #[doc = "Register ISR `reset()`'s with value 0"] impl crate::ResetValue for super::ISR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
// Copyright 2017 PingCAP, Inc. // // 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 i...
use std::collections::HashMap; use std::env; use std::error::Error; use std::path::Path; use std::str; use colored::*; use log::*; use serde_json::json; use tokio::process::Command; use crate::ext::rust::PathExt; use crate::stack::parser::AWSService; const LOCALSTACK_LAMBDA_ENDPOINT: &str = "http://localhost:4574"; ...
use sqs_executor::errors::{ CheckedError, Recoverable, }; #[derive(thiserror::Error, Debug)] pub enum NodeIdentifierError { #[error("Unexpected error")] Unexpected, } impl CheckedError for NodeIdentifierError { fn error_type(&self) -> Recoverable { Recoverable::Transient } }
#![feature(dbg_macro)] #[macro_use] extern crate aoc_runner_derive; use aoc_runner_derive::aoc_lib; pub mod day1; pub mod day2; aoc_lib! { year = 2018 }
use cc::Build; use dunce::canonicalize; use std::{env, path::PathBuf}; const HEADER_FILES: &[&str] = &["imath.h", "imrat.h", "iprime.h"]; const SRC_FILES: &[&str] = &["imath.c", "imrat.c", "iprime.c"]; const FUNCTION_REG: &str = "mp_.*"; const VAR_REG: &str = "(mp|MP)_.*"; const TYPE_REG: &str = "((mp_.*)|mpq_t|mpz_...
#[doc = "Reader of register SR"] pub type R = crate::R<u32, super::SR>; #[doc = "Writer for register SR"] pub type W = crate::W<u32, super::SR>; #[doc = "Register SR `reset()`'s with value 0x04"] impl crate::ResetValue for super::SR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
pub mod exc { pub trait Exercise { fn run(&self); // fn run_self<T: Self>(&self){ // T::run(); // } } }
//! Hexagonal grids with overlaid coordinate systems. pub mod shape; pub mod coords; pub use coords::*; use crate::geo::*; use crate::grid::shape::Shape; use nalgebra::core::Vector2; use nalgebra::geometry::Point2; use std::collections::HashMap; /// A grid is a contiguous arrangement of hexagonal tiles with /// an o...
use crate::context::RpcContext; use crate::v02::types::ContractClass; use anyhow::Context; use pathfinder_common::{BlockId, ClassHash, ContractAddress}; use starknet_gateway_types::pending::PendingData; crate::error::generate_rpc_error_subset!(GetClassAtError: BlockNotFound, ContractNotFound); #[derive(serde::Deseria...
use std::any::TypeId; /// An Enum with a variant for every Event that can be sent to a remote host pub trait EventType: Clone { // write & get_type_id are ONLY currently used for reading/writing auth events.. // maybe should do something different here /// Writes the typed Event into an outgoing byte strea...
//! Korat provides rusoto implementations for using an structs as dynamodb items #[macro_use] extern crate quote; extern crate proc_macro; extern crate syn; mod dynamodb_item; use proc_macro::TokenStream; use dynamodb_item::expand; #[proc_macro_derive(DynamoDBItem, attributes(hash, range))] pub fn dynamodb_item(...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn parse_http_generic_error( response: &http::Response<bytes::Bytes>, ) -> Result<smithy_types::Error, smithy_json::deserialize::Error> { crate::json_errors::parse_generic_error(response.body(), response.headers()) } pub fn de...
use chrono::{DateTime, Utc}; use futures_util::StreamExt; use graphql_ws::{raw::ClientPayload, GraphQLWebSocket, Request}; // https://github.com/serde-rs/serde/issues/994 mod json_string { use serde::de::{self, Deserialize, DeserializeOwned, Deserializer}; use serde_json; pub fn deserialize<'de, T, D>(des...
//! Utilities such as [`HashableHashSet`] and [`HashableHashMap`]. Those two in particular are useful //! because the corresponding [`HashSet`] and [`HashMap`] do not implement [`Hash`], meaning they cannot //! be used directly in models. //! //! For example, the following is rejected by the compiler: //! //! ```rust c...
// Copyright 2019 // by Centrality Investments Ltd. // and Parity Technologies (UK) Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/...