text
stringlengths
8
4.13M
// Licensed: Apache 2.0 // Memory for these data types is owned externally // mod plain_ptr; // allow some unused utility functions #![allow(dead_code)] use ::plain_ptr::{ PtrMut, PtrConst, null_mut, // null_const, }; macro_rules! into_expand { ($($names:ident),*) => { $(let $names = ::...
use bevy::{prelude::*,}; use crate::{credits, game_controller }; pub struct LevelOverEvent {} pub struct LevelOverText {} // TODO: change this to like "BetweenLevelEntity" or something marker or something pub fn setup_level_over_screen( mut commands: Commands, mut windows: ResMut<Windows>, asset_server: R...
// This file is part of rdma-core. 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/rdma-core/master/COPYRIGHT. No part of rdma-core, including this file, may be copied, modified, propagated, or distributed ...
pub mod server; pub mod client; use server::*; fn main() { server_ui(); }
use amethyst::{ core::{Transform}, ecs::prelude::{Join, Read, ReadStorage, System, WriteStorage}, input::{InputHandler, StringBindings}, }; use crate::components::map::Zoomable; use crate::utilities::Clampable; pub struct ZoomingSystem; impl<'s> System<'s> for ZoomingSystem { type SystemData = ( ...
use super::assets::Assets; use crate::constants::*; use crate::ui::ViewAttr::*; use crate::ui::*; use crate::{define_class, input::GameInput, scene::Scene}; use sdl2::{render::Canvas, video::Window}; #[derive(Debug, Copy, Clone)] pub struct UIProps { selected_idx: i8, } enum UIActions { MoveCursor(i8), } def...
//! Helper module to build a genesis configuration for the weight-fee-runtime use super::{ AccountId, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, SudoConfig, SystemConfig, GenericAssetConfig, WASM_BINARY, }; use sp_consensus_babe::{AuthorityId as BabeId}; use sp_finality_grandpa::{AuthorityId as Grand...
use std::error::Error; use structopt::StructOpt; #[derive(StructOpt)] #[structopt(name="sequ", about="Write a sequence to stdout.")] struct Opt { #[structopt(short, long, help="min width of vals (0-padded)")] width: Option<usize>, lower: String, upper: Option<String>, } fn unwrap_exit<T>(result: Resu...
use std::thread::sleep; use std::io::BufReader; use std::io::Read; use std::io::BufRead; use std::io; use std::time::Duration; pub trait LogLineGenerator<R: Read>: Iterator<Item = io::Result<String>> { fn from_reader(r: R) -> Self; } pub struct DefaultLogLineGenerator<R: Read> { reader: BufReader<R>, } impl<...
use super::Solution; impl Solution { pub fn longest_common_prefix(strs: Vec<String>) -> String { if strs.len() == 0 { return "".to_string(); } let mut result = String::new(); let mut current: char; let mut index = 0; let first = strs.first().unwrap(); for ch in first...
/* * Terminal: * * cd C:\Users\むずでょ\source\repos\practice-rust\tokio * set RUST_BACKTRACE=full * cargo check --example ep7-uec-nngs * cargo build --example ep7-uec-nngs * cargo run --example ep7-uec-nngs * * NNGS: admin * * adminmatch Kifuwarabe Warabemoti b 19 30 0 * * [Reading and Writing Data](https://t...
pub fn sum_of_multiples(limit: u32, factors: &[u32]) -> u32 { (1..limit).fold(0, |acc, x| { if !factors.iter().any(|&n| n != 0 && x % n == 0) { return acc; } acc + x }) }
use crate::ping_clients::ping_client_tcp::PingClientTcp; use crate::*; #[cfg(any(not(target_os = "windows"), not(target_arch = "aarch64")))] use crate::ping_clients::ping_client_quic::PingClientQuic; pub type PingClientFactory = fn(protocol: &RnpSupportedProtocol, config: &PingClientConfig) -> Option<Box<dyn PingClie...
struct Solution; impl Solution { // 283. 移动零 pub fn move_zeroes(nums: &mut Vec<i32>) { let mut left = 0; for right in 0..nums.len() { if nums[right] != 0 { nums.swap(left, right); left += 1; } } } } #[cfg(test)] mod tests { ...
#[derive(Debug, Copy, Clone)] enum Command { North, South, East, West, Left, Right, Forward } #[derive(Debug)] struct Ship { x_pos: i32, y_pos: i32, facing: Command } fn rotate_left(cmd: Command) -> Command { match cmd { Command::North => Command::West, Comm...
use crate::reactive::{ListMutation, TrackingVec}; use cope::singleton::react; use cope_dom::elements::ElementBuilder; use wasm_bindgen::UnwrapThrowExt; use web_sys::Element; // TODO: generalize this pub trait ElementBuilderChildren { fn children<T, F>(self, list: MapChildren<T, F>) -> Self where T: 'st...
use crate::{ opcode::{execute_rot, BitOperand8, Opcode, Prefix}, smallnum::U2, tables::F3F5_TABLE, RegName16, RegName8, Z80Bus, FLAG_CARRY, FLAG_HALF_CARRY, FLAG_PV, FLAG_SIGN, FLAG_ZERO, Z80, }; /// Instruction group which operates on bits /// Includes rotations, bit set/reset/test /// Covers CB, DDCB...
use actix; use actix::actors::resolver::*; use actix::prelude::*; use tokio::io::*; use tokio::codec::*; struct TcpClientActor; impl Actor for TcpClientActor { type Context = Context<Self>; fn started(&mut self, ctx: &mut Self::Context) { println!("TcpClientActor started!"); // The Connec...
pub mod idt; pub mod gdt; pub mod mem; use crate::kernel::InitResult; pub fn init() -> InitResult<()> { if let Err(e) = gdt::init() {return Err(e)} if let Err(e) = idt::init() {return Err(e)} Ok(()) }
//! The `solana` library implements the Solana high-performance blockchain architecture. //! It includes a full Rust implementation of the architecture (see //! [Server](server/struct.Server.html)) as well as hooks to GPU implementations of its most //! paralellizable components (i.e. [SigVerify](sigverify/index.html))...
//! The course "Standard" library customised for this course. //! Provides useful components for common Programming challenges as well as external tools #![crate_type="lib"] #![crate_name="algs_std"] #![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)] #![allow(unused_imports)] use std::io::{Error, E...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 #![recursion_limit = "1024"] mod invoice; mod message_processor; pub mod node; mod node_command; use std::time::{SystemTime, UNIX_EPOCH}; //#[cfg(test)] pub mod test_helper; mod node_test; pub fn get_unix_ts() -> u64 { let ...
use crate::utils::lines_from_file; use std::time::Instant; pub fn main() { let start = Instant::now(); assert_eq!(part_1_test(), 7); // println!("part_1 {:?}", part_1()); println!("part_2 {:?}", part_2()); let duration = start.elapsed(); println!("Finished after {:?}", duration); } fn part_...
//! Specs are responsible for describing meta-information. use std::{ vec::Vec }; pub trait Schema { fn to_schema(); } pub struct SchemaProperty { pub name: String, pub kind: String, } pub struct SchemaNode { pub name: String, pub props: Vec<SchemaProperty>, }
use std::fmt; use std::fmt::Display; use std::net::Ipv4Addr; const RESPONSE_BASE_LEN: usize = 57; const RESPONSE_NAME_LEN: usize = 15; const RESPONSE_NAME_BLOCK_LEN: usize = 18; pub struct NetBiosPacket { pub ip: Ipv4Addr, pub data: [u8; 1024], pub length: usize, } impl Display for NetBiosPacket { fn...
//! Contains utilities for creating virtual TUN/TAP network interfaces. mod tap; mod tun; mod build; pub use self::tap::{EtherIfaceBuilder, EtherIface, UnboundEtherIface}; pub use self::tun::{Ipv4IfaceBuilder, Ipv4Iface, UnboundIpv4Iface}; pub use self::build::IfaceBuildError;
mod transform; mod tokens; mod position; mod tokenizer; mod name_analysis; mod parser; mod symbol; mod ast; mod context; mod utils; mod value; mod eval; use tokenizer::*; use name_analysis::*; use parser::*; use eval::*; use value::*; use utils::*; use context::*; use std::time::{Instant}; fn print_val(v: Value) -...
use rusqlite::{params, Connection}; use vt::types::*; pub fn get_conn(dir: &String) -> MyResult<Connection> { let path = std::path::Path::new(&dir).join("filetracker"); Connection::open(path) .or_else(|e| error(format!("Failed to connect to sqlite database: {}", e))) } pub fn ensure_table(conn: &Con...
#[macro_use] extern crate log; use rust_tdlib::{client::Client, types::*}; #[tokio::main] async fn main() { env_logger::init(); let tdlib_parameters = TdlibParameters::builder() .database_directory("tdlib") .use_test_dc(false) .api_id(env!("API_ID").parse::<i64>().unwrap()) .ap...
#[doc = "Register `OPAMP2_OTR` reader"] pub type R = crate::R<OPAMP2_OTR_SPEC>; #[doc = "Register `OPAMP2_OTR` writer"] pub type W = crate::W<OPAMP2_OTR_SPEC>; #[doc = "Field `TRIMOFFSETN` reader - Trim for NMOS differential pairs"] pub type TRIMOFFSETN_R = crate::FieldReader; #[doc = "Field `TRIMOFFSETN` writer - Trim...
use crate::config::Config; use crate::response_helpers; use crate::tweet::Tweet; use anyhow::{Context, Result}; use chrono::{offset, DateTime, FixedOffset}; use futures::stream::StreamExt; use itertools::Itertools; use reqwest::{Client, ClientBuilder}; use std::ffi::OsStr; use std::path::Path; use tokio::fs::File; use...
use my_random::random::Dice; fn main() { let dice = Dice{max: 6} ; let x = dice.get(); println!("x is {}", x ); let mut data = vec![0,0,0]; dice.fill( &mut data ); for i in data { println!("i is {}", i ); } }
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use cid::{multihash, Cid, Codec}; use commcid::FilecoinMultihashCode; use interpreter::DefaultSyscalls; use runtime::*; use vm::{RegisteredProof, SealVerifyInfo}; #[test] fn verify_seal_test() { let db = db::MemoryDB::default(); l...
extern crate oxygengine_core as core; pub mod component; pub mod nav_mesh_asset_protocol; pub mod resource; pub mod system; pub mod prelude { pub use crate::{component::*, nav_mesh_asset_protocol::*, resource::*, system::*}; } use crate::{ component::{NavAgent, SimpleNavDriverTag}, resource::NavMeshes, ...
#![no_std] #![no_main] #![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 defmt::panic; use embassy::executor::Spawner; use embassy::traits::gpio::{WaitForHigh, WaitForLow...
pub use crate::*; use std::ops::{Index, IndexMut, Range}; const LVAR_ARRAY_SIZE: usize = 32; #[derive(Debug, Clone)] pub struct Context { pub is_fiber: bool, pub self_value: Value, pub block: Option<MethodRef>, lvar_ary: [Value; LVAR_ARRAY_SIZE], lvar_vec: Vec<Value>, pub iseq_ref: ISeqRef, ...
/* * 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 */ /// LogsAttributeRemapper : The remapper processor remaps any source attribute(s) or tag to another targ...
#[doc = "Reader of register CONN_3_DATA_LIST_SENT"] pub type R = crate::R<u32, super::CONN_3_DATA_LIST_SENT>; #[doc = "Writer for register CONN_3_DATA_LIST_SENT"] pub type W = crate::W<u32, super::CONN_3_DATA_LIST_SENT>; #[doc = "Register CONN_3_DATA_LIST_SENT `reset()`'s with value 0"] impl crate::ResetValue for super...
use std::io::{self, Read}; mod internal; pub use internal::Result; use internal::{update_consul, Errors, Settings, KV}; use serde_json::Value; pub async fn run() -> Result<()> { let settings = Settings::new(); println!("{:?}", settings); let mut buf = Vec::new(); let mut stdin = io::stdin(); st...
use std::fs::File; use std::io::{BufReader, BufRead}; pub fn edges_from_file(filename: &String) -> Option<(usize, usize, Vec<(usize, usize)>)> { let f = match File::open(filename) { Ok(f) => f, Err(f) => panic!(f.to_string()) }; let mut reader = BufReader::new(f).lines().map(|l| { l.ok().e...
use core::MatrixArray; use core::dimension::{U1, U2, U3}; use geometry::{Rotation, IsometryBase, UnitQuaternion, UnitComplex}; /// A D-dimensional isometry. pub type Isometry<N, D> = IsometryBase<N, D, MatrixArray<N, D, U1>, Rotation<N, D>>; /// A 2-dimensional isometry using a unit complex number for its rotational...
pub mod cargo_toml; mod codegen; mod codegen_models; mod codegen_operations; pub mod config_parser; pub mod identifier; pub mod lib_rs; pub mod path; pub mod spec; mod status_codes; use config_parser::Configuration; use proc_macro2::TokenStream; use std::{ collections::HashSet, fs::{self, File}, io::prelude...
use super::{Cartridge, Mapper, Mirror, serialize::*}; pub struct Cnrom { cart: Cartridge, chr_bank_select: usize, } impl Cnrom { pub fn new(cart: Cartridge) -> Self { Cnrom{ cart: cart, chr_bank_select: 0, } } } impl Mapper for Cnrom { fn read(&self, addres...
use std::io; fn main() { println!("Enter a number n for which you'd like to find the nth Fibonacci Number:"); let mut n = String::new(); let num: u64 = loop { io::stdin().read_line(&mut n).expect("Failed to read line"); match n.trim().parse::<u64>() { Ok(num) => break num, ...
use adder; mod common; #[test] fn it_adds_two() { common::setup(); assert_eq!(5, adder::add_two(3)); }
// Copyright 2021 Google LLC // // 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 ...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use futures::channel::{mpsc::SendError, oneshot::Canceled}; use serde::{Deserialize, Serialize}; use thiserror::Error; #[derive(Clone, Debug, Deserialize, Error, PartialEq, Serialize)] pub enum Error { #[error("The requested data i...
/* * 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 bytes::BytesMut; use crate::gdbstub::commands::*; use crate::gdbstub::hex::*; #[derive(Partia...
fn main(){ let mut arr = [ 1, 2, 4, 3, 6, 5 ]; println!("Before: {:?}", arr); let mut total_loops: usize = 0; let array_length = arr.len(); loop { if total_loops == (array_length - 1) { break; } let min_index = get_min_index(&arr, total_loops); if min_index == total_loops { ...
#![cfg_attr(not(feature = "std"), no_std)] // Re-export pallet items so that they can be accessed from the crate namespace. pub use pallet::*; #[frame_support::pallet] pub mod pallet { use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*}; use frame_system::pallet_prelude::*; use sp...
use std::sync::{Arc, Mutex}; use render::camera::Camera; #[derive(Clone,Debug)] pub struct SceneManager { pub inner: Arc<Mutex<u8>>, cameras: Arc<Mutex<Vec<Camera>>>, } impl SceneManager{ fn new() -> Self { SceneManager { inner: Arc::new(Mutex::new(0)), cameras: Arc::new(M...
extern crate exonum; extern crate rand; use dmbc::currency::assets::MetaAsset; use dmbc::currency::transactions::builders::fee; use exonum::crypto::PublicKey; use rand::Rng; const MAX_AMOUNT: u64 = 10_000; const MAX_GEN_ASSETS: u8 = 5; pub fn generate_meta_assets(pk: PublicKey) -> Vec<MetaAsset> { let mut rng = ...
//! Data structures for representing syntax definitions //! //! Everything here is public becaues I want this library to be useful in super integrated cases //! like text editors and I have no idea what kind of monkeying you might want to do with the data. //! Perhaps parsing your own syntax format into this data struc...
use crate::block_status::BlockStatus; use crate::synchronizer::Synchronizer; use crate::types::{HeaderView, SyncSnapshot}; use crate::MAX_BLOCKS_IN_TRANSIT_PER_PEER; use ckb_logger::{debug, trace}; use ckb_network::PeerIndex; use ckb_store::ChainStore; use ckb_types::{core, packed}; pub struct BlockFetcher { synch...
// Copyright 2018 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. #![deny(warnings)] #[macro_use] extern crate failure; extern crate fidl; extern crate fidl_fuchsia_wlan_mlme as fidl_mlme; extern crate fidl_fuchsia_wlan_...
#[allow(dead_code)] use std::slice::{Iter, IterMut}; use std::net::{IpAddr, Ipv4Addr}; #[macro_use] use serde::{Serialize,Deserialize}; use serde_json::{Result,Value}; #[derive(Debug)] pub struct RaspberryPiCfg { led_pin : u8, //GPIO pin connected to the LED strip pixels (must support PWM) led_freq_hz : ...
extern crate regex; use regex::Regex; use std::{collections::HashMap, env, fs}; type Input = Vec<()>; // Parse blocks looking like this: // [D] // [N] [C] // [Z] [M] [P] // 1 2 3 fn parse_blocks(input: &[&str]) -> (HashMap<usize, Vec<char>>, usize) { let mut blocks = HashMap::new(); // Parse the nu...
#[doc = "Register `ASCR2` reader"] pub type R = crate::R<ASCR2_SPEC>; #[doc = "Register `ASCR2` writer"] pub type W = crate::W<ASCR2_SPEC>; #[doc = "Field `GR10_1` reader - GR10_1 analog switch control"] pub type GR10_1_R = crate::BitReader; #[doc = "Field `GR10_1` writer - GR10_1 analog switch control"] pub type GR10_...
//! The set of traits that need to be implemented to tell CrystalOrb how to use your external //! networking library to send and receive messages. use serde::{de::DeserializeOwned, Serialize}; use std::{error::Error, fmt::Debug}; use crate::{clocksync::ClockSyncMessage, timestamp::Timestamped, world::World}; /// Use...
#![allow(dead_code)] pub mod linalg; pub mod fileformat; pub mod solve; type Net = u32; type Nets = Vec<Net>; #[derive(Debug,Eq,PartialEq)] pub enum ElementType { Resistor, ConstantVoltage, ConstantCurrent, DependentVoltage, DependentCurrent, } #[derive(Debug)] pub struct Element { kind: El...
#[doc = "Register `SYSCFG_ITLINE21` reader"] pub type R = crate::R<SYSCFG_ITLINE21_SPEC>; #[doc = "Field `TIM16` reader - Timer 16 interrupt request pending"] pub type TIM16_R = crate::BitReader; impl R { #[doc = "Bit 0 - Timer 16 interrupt request pending"] #[inline(always)] pub fn tim16(&self) -> TIM16_R ...
use crate::fileops::FileOperations; // use std::error::Error; use anyhow::{Context, Result}; use std::path::PathBuf; pub trait CustomFile { fn new(file_content: &String, file_path: &PathBuf) -> Self; fn write(&self) -> Result<()>; fn parse(content: &str, start_tag: &str, end_tag: &str) -> Result<String> { le...
use bytes::Bytes; use super::misc::bytes_to_utf8; use crate::frame; #[derive(Debug, Clone)] pub struct Payload { m: Option<Bytes>, d: Option<Bytes>, } #[derive(Debug)] pub struct PayloadBuilder { value: Payload, } impl PayloadBuilder { fn new() -> PayloadBuilder { PayloadBuilder { ...
use crate::mock; use rand::{thread_rng, Rng}; const DOMAIN_SUFFIX: [&str; 10] = [ "com", "net", "org", "edu", "gov", "cc", "cn", "com.cn", "name", "mobi", ]; pub fn ip() -> String { let mut rng = thread_rng(); format!( "{}.{}.{}.{}", rng.gen_range(0, 255), rng.gen_range(0, 255), ...
use simple_error::bail; use std::collections; use std::error; use std::io; use std::io::BufRead; use crate::day; pub type BoxResult<T> = Result<T, Box<dyn error::Error>>; pub struct Day03 {} impl day::Day for Day03 { fn tag(&self) -> &str { "03" } fn part1(&self, input: &dyn Fn() -> Box<dyn io::Read>) { ...
pub fn test() { println!("some_mod.rs"); }
fn main() { let x = 5; // let x =, shadows by taking the original value and adding 1 so the value of x // Even if x is immutable, we can change its value/type by using the let keyword because we are effectively // creating a new variable // This helps in changing the value of immutable x, apply tr...
//! Examples of unsound code that IUI statically prevents from compiling. //! //! Here, we attempt to use-after-free some callbacks. //! //! ```compile_fail //! let ui = iui::UI::init().unwrap(); //! //! { //! let v = vec![1, 2, 3, 4]; //! ui.queue_main(|| { //! for i in &v { //! println!("{...
/* * 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 */ /// OrganizationSettingsSamlIdpInitiatedLogin : Has one property enabled (boolean). #[derive(Clone, D...
use crypto_api_chachapoly::{ ChachaPolyError, ChaCha20Ietf }; include!("read_test_vectors.rs"); #[derive(Debug)] pub struct TestVector { line: usize, key___: Vec<u8>, nonce_: Vec<u8>, input_: Vec<u8>, output: Vec<u8> } impl TestVector { pub fn test(&self) { // Create the cipher instance let cipher = ChaCha2...
use std::env; use std::fs::File; use std::io; use std::io::prelude::*; /// Default memory size (128MiB). pub const MEMORY_SIZE: u64 = 1024 * 1024 * 128; /// The CPU to contain registers, a program coutner, and memory. struct Cpu { /// 32 64-bit integer registers. regs: [u64; 32], /// Program counter to ho...
use core::cell::Cell; use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; use critical_section::CriticalSection; use embassy::interrupt::InterruptExt; use embassy::time::Clock; use embassy::util::{CriticalSectionMutex as Mutex, Unborrow}; use crate::interrupt::Interrupt; use crate::pac; use crate::{interrup...
use amethyst::ecs::{Component, DenseVecStorage}; #[derive(Clone, Debug)] pub struct Name { name: String } impl Component for Name { type Storage = DenseVecStorage<Self>; } impl Name { pub fn new(name: &str) -> Self { Name { name: name.to_string() } } pub fn name(&self...
use std::{ fmt::{Display, Formatter, Result as FmtResult}, rc::Rc, path::Path }; use super::rc_path_to_str; /// Position in an input file where an error occurred. // This structure is actually also used by the parser to keep track of where it's looking, not just for error reporting. #[derive(Clone, Debug, Eq, Parti...
use nalgebra::{ one, Isometry3, Matrix4, Point3, Translation3, Unit, UnitQuaternion, Vector2, Vector3, }; use ncollide3d::query::Ray; use projection::Projection; pub mod flycam; pub mod projection; pub struct Camera { pub eye: Point3<f32>, yaw: f32, pitch: f32, projection: Projection, pub vie...
use rand::Rng; use wasm_bindgen::__rt::core::cell::RefCell; pub struct Neuron { pub weights: Vec<f64>, pub bias: f64, pub last_output: RefCell<Option<f64>>, pub delta: f64, } impl Neuron { pub fn new(number_of_inputs: u32) -> Self { let mut rng = rand::thread_rng(); let weights: V...
use std::fmt; const CARD_NO_LEN: usize = 16; #[derive(RustcDecodable,Debug,RustcEncodable)] pub struct CardList { object: String, has_more: bool, url: String, pub data: Vec<Card>, } #[derive(RustcDecodable,Debug,RustcEncodable)] pub struct Card { id: String, object: String, last4: String,...
use crate::conn::ConnectionCache; use crate::files::FileService; use crate::session::SessionService; use std::sync::Arc; /// Contains information about the running application #[derive(Clone, Debug)] pub struct AppConfig { task: String, address: String, port: u16, files: Arc<FileService>, connections: Arc<C...
use ash::{version::DeviceV1_0, vk}; use std::{ffi::CString, rc::Rc}; use crate::vulkan::vkstate::VulkanState; pub struct VkShader { pub bytecode: Vec<u32>, pub module: vk::ShaderModule, pub layouts_bindings: Vec<vk::DescriptorSetLayoutBinding>, pub layout: Vec<vk::DescriptorSetLayout>, pub pipelin...
use day_14::{get_max_points, race_reindeers, Reindeer}; use regex::Regex; use std::io::{self}; fn main() -> io::Result<()> { let files_results = vec![("test.txt", 2660, 1564), ("input.txt", 2655, 1059)]; for (f, result_1, result_2) in files_results.into_iter() { println!("File: {}", f); let fil...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - global CTB and power control"] pub ctb_ctrl: CTB_CTRL, #[doc = "0x04 - Opamp0 and resistor0 control"] pub oa_res0_ctrl: OA_RES0_CTRL, #[doc = "0x08 - Opamp1 and resistor1 control"] pub oa_res1_ctrl: OA_RES1_CTRL, ...
//#![feature(associated_type_bounds)] //use simply_wayland; //mod helper; //use helper::*; //mod types; //mod simply_wayland; use simply_wayland::wl::core as wl; use simply_wayland::wl::types as wt; use std::sync::mpsc::channel; use num_enum::TryFromPrimitive; //use std::convert::TryFrom; //use std::cell::RefCel...
use Result; use std::path::PathBuf; use schema::Schema; use DocId; use std::fmt; use core::SegmentId; use directory::{ReadOnlySource, WritePtr}; use indexer::segment_serializer::SegmentSerializer; use super::SegmentComponent; use core::Index; use std::result; use directory::Directory; use core::SegmentMeta; use directo...
use super::util::{Pack, PackDepth}; use super::ArenaMut; use async_trait::async_trait; use wasm_bindgen::{prelude::*, JsCast}; mods! { pub image_data::ImageData; pub block_texture::BlockTexture; } #[derive(Clone)] pub enum Url { Local(String), Global(String), } impl std::fmt::Display for Url { fn...
//============================================================================== // Notes //============================================================================== // mcu::i2c.rs //============================================================================== // Crates and Mods //===============================...
use pairing::{Engine, Field}; use bellman::SynthesisError; use crate::cs::{Backend, Variable, Coeff}; pub struct SxPerm<E: Engine> { y: E::Fr, max_n: usize, current_q: usize, /// Current value of y^{q} yq: E::Fr, /// Coefficients of X^{-i+n+1} term u: Vec<E::Fr>, u_q: Vec<usize>, ...
use yew::{*, prelude::*, services::{ConsoleService, fetch::{FetchService, FetchTask, Request, Response}}, format::{Json, Nothing}}; use yew_geolocation::*; use failure::Error; use derive_new::*; use serde_derive::*; fn main() { yew::initialize(); App::<Model>::new().mount_to_body(); yew::run_loop(); } #[derive(Deb...
use actix_web::{Responder, HttpResponse, web::{ Json }}; use serde_json::{ Value, to_value, from_value }; use serde::{Serialize, Deserialize}; use deadpool_postgres::Pool; use actix_web::web::Data; #[derive(Serialize, Deserialize, Debug)] pub struct JsonInput { pub email: String, pub input: Value } #[derive(S...
//! Basic HAL functions for communicating with the radio device //! //! This provides decoupling between embedded hal traits and the RF device implementation. // Copyright 2019 Ryan Kurte use hal::blocking::delay::DelayMs; use embedded_spi::Error as WrapError; use embedded_spi::{Busy, PinState, Reset, Transactional};...
pub mod loader; pub mod pass; pub mod scene; mod swapchain; // ------------------------------------------------------------------------------------------------- use std::sync::Arc; use std::collections::HashMap; use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState}; use vulkano::device::{Device, Devi...
#![deny(warnings)] #[macro_use] extern crate warp; #[macro_use] extern crate log; extern crate log4rs; use warp::{Filter, Rejection}; fn main() { log4rs::init_file("config/log4rs.yaml", Default::default()).unwrap(); let hello2 = path!("hello2").map(|| { "hello2" }); let routes = hello_world_endpoint()....
#[allow(clippy::float_cmp)] mod aabb; use aabb::AABB; mod camera; use camera::Camera; mod object; use object::{ Box, FlipFace, HitRecord, Object, RotateY, Sphere, Translate, XYRect, XZRect, YZRrect, }; mod ray; use ray::Ray; mod bvh; use bvh::BvhNode; mod texture; use texture::{CheckerTexture, SolidColor, Texture};...
use std::{ error, io::{self, prelude::*}, net, str, thread, }; fn main() -> Result<(), Box<dyn error::Error>>{ let listener = net::TcpListener::bind("127.0.0.1:50000")?; loop { let(stream, _) = listener.accept()?; thread::spawn(move || { handler(stream).unwrap(); }); } }...
fn main() { // A binary crate root println!("Hello, world!"); }
use crate::ast::{Expression, MutatingVisitor, Statement}; use crate::token::Token; use std::collections::BTreeMap; use std::fmt; #[derive(Debug)] pub struct ResolverError<'a> { message: String, token: Option<&'a Token<'a>>, } impl<'a> fmt::Display for ResolverError<'a> { fn fmt(&self, f: &mut fmt::Formatt...
use super::CPU; impl CPU { pub(super) fn skip_if_equal(&mut self, x: usize, value: u8) { if self.registers[x] == value { self.advance_counter(); } } pub(super) fn skip_if_not_equal(&mut self, x: usize, value: u8) { if self.registers[x] != value { self.advanc...
use crate::messages::submessage_flag::SubmessageFlag; use crate::messages::submessage_kind::SubmessageKind; use speedy::{Context, Endianness, Readable, Reader, Writable, Writer}; #[derive(Debug, PartialEq)] pub struct SubmessageHeader { pub submessage_id: SubmessageKind, pub flags: SubmessageFlag, pub subm...
//! WASM API mod call; mod deploy; mod error; mod inputdata; mod receipt; mod spawn; pub use call::{decode_call, encode_call}; pub use deploy::encode_deploy; pub use error::{error_as_string, into_error_buffer}; pub use inputdata::{decode_inputdata, encode_inputdata}; pub use receipt::decode_receipt; pub use spawn::{d...
use opencv::prelude::*; use opencv::highgui::*; use vision_traits::{Configurable, DynErrResult, input::InputSingular, Node}; #[derive(Configurable)] pub struct DebugDisplayS { name: String, } pub struct DebugDisplay { settings: DebugDisplayS, } impl Node for DebugDisplay { const NAME: &'static str = "Deb...
#![recursion_limit = "2048"] #![deny(unused_must_use)] #![deny(rust_2018_idioms)] pub extern crate pahkat_types as types; #[cfg(feature = "ffi")] pub mod ffi; pub mod config; pub mod defaults; pub mod package_store; pub mod repo; pub mod transaction; mod cmp; mod download; mod ext; mod fbs; pub use self::config::{...