text
stringlengths
8
4.13M
mod hs100; pub mod timer; pub use self::hs100::{Location, HS100}; use self::timer::{Rule, RuleList, Timer}; use crate::cloud::{Cloud, CloudInfo}; use crate::config::Config; use crate::device::Device; use crate::emeter::{DayStats, Emeter, MonthStats, RealtimeStats}; use crate::error::Result; use crate::sys::Sys; use cr...
use ws::{connect, CloseCode}; use std::rc::Rc; use std::cell::Cell; use serde_json::{Value}; use crate::api::config::Config; use crate::api::message::amount::Amount; use crate::api::message::local_sign_tx::{LocalSignTx}; use crate::base::local_sign::sign_tx::{SignTx}; use crate::base::misc::util::{ downcast_to_st...
use axum::{extract::Query, routing::get, Router}; use serde::Deserialize; use std::net::SocketAddr; #[derive(Debug, Deserialize)] struct Param { keyword: Option<String>, size: Option<usize>, } #[tokio::main] async fn main() { let app = Router::new() .route("/", get(handler)) .route("/samp...
// 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. use failure::{format_err, Error, ResultExt}; use std::fs; use std::io; use std::path::Path; use fidl; use fidl::endpoints::ServiceMarker; use fidl_fuchsi...
use crate::vec2::{Vec2, vec2}; use crate::Framebuffer; use crate::data::DataDef; mod player; pub struct Entity { pub data: EntityData, pub kind: EntityKind } pub struct EntitySet { pub inner: [Entity; 32], } pub struct EntityEntry { pub x: u8, pub y: u8, pub kind: u8 } pub struct Sprite { ...
mod computer; use computer::Wire; #[aoc_generator(day3)] fn generator(input: &str) -> Vec<Wire> { input .lines() .map(|instructions| Wire::from_str(instructions)) .collect() } #[aoc(day3, part1)] fn part_one(input: &[Wire]) -> i32 { let first_wire = input[0].clone(); let second_wi...
#![allow(unused_imports, unused_qualifications, unused_extern_crates)] extern crate chrono; use serde::{Serialize, Deserialize}; use serde::ser::Serializer; use std::collections::HashMap; use std::string::ParseError; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "conversion", derive...
//! A lot of this module is copied from LD44. use amethyst::renderer::sprite::SpriteSheetHandle; use json::JsonValue; use crate::components::prelude::*; /// Generate an Animation from the given properties. pub fn animation_from( spritesheet_handle: SpriteSheetHandle, properties: &JsonValue, ) -> Option<Anima...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct AlternateNormalizationFormat(pub i32); impl AlternateNormalizationFormat { pub const NotNormalized: Self = Self(0i32); p...
//! Build configuration extern crate tinyrick; /// Run clippy fn clippy() { tinyrick::exec!("cargo", &["clippy"]); } /// Generate documentation fn doc() { tinyrick::exec!("cargo", &["doc"]); } /// Static code validation fn lint() { tinyrick::deps(doc); tinyrick::deps(clippy); } /// Lint, and then i...
mod control_handle; mod control_base; mod window; mod button; mod check_box; mod radio_button; mod text_input; mod label; mod image_frame; #[cfg(feature = "textbox")] mod text_box; #[cfg(feature = "rich-textbox")] mod rich_text_box; #[cfg(feature = "rich-textbox")] mod rich_label; #[cfg(feature = "status-bar")] mod...
#[link(wasm_import_module = "wapc")] extern { fn __console_log(ptr: *const u8, len: usize); fn __guest_request(op_ptr: *mut u8, ptr: *mut u8); fn __guest_response(ptr: *const u8, len: usize); } #[no_mangle] extern fn __guest_call(op_len: i32, req_len: i32) -> i32 { let mut op_buf = vec![0; op_len as _...
#[cfg(test)] #[path = "./game_test.rs"] pub mod game_test; use std::fmt; use std::rc::Rc; use bat::SuperBat; use map::{gen_rand_valid_path_from, is_adj, RoomNum}; use message::Message; use pit::BottomlessPit; use player::{Action, Player}; use util::*; use wumpus::Wumpus; pub const MAX_TRAVERSABLE: usize = 5; pub tr...
#[doc = "Reader of register ITLINE8"] pub type R = crate::R<u32, super::ITLINE8>; #[doc = "Reader of field `UCPD1`"] pub type UCPD1_R = crate::R<bool, bool>; #[doc = "Reader of field `UCPD2`"] pub type UCPD2_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - UCPD1"] #[inline(always)] pub fn ucpd1(&self) ->...
//! Realize the character input and output of the console //! //! # format output //! //! [`core::fmt::Write`] trait //! -- need [`write_str`] //! -- comes with implementation, but depends on [`write_str`] and [`write_fmt`] //! //! we declare one type, implement [`write_str`], then we can use [`write_fmt`] to format o...
use crate::otvar::{ Delta, PackedDeltas, PackedDeltasDeserializer, PackedPoints, TupleIndexFlags, TupleVariationHeader, TupleVariationHeaderDeserializer, }; use otspec::types::*; use otspec::{read_field, stateful_deserializer}; use serde::de::DeserializeSeed; use serde::de::SeqAccess; use serde::de::Visitor; us...
// Advent of Code: Day 10 // // We have a complicated situation with various power adapters on a // plane, but essentially we have a list of numbers and we want to // sort the numbers and then count up the number of distinct differences // between the numbers. For example, how many numbers when sorted have // a differe...
extern crate url; extern crate regex; #[macro_use] extern crate lazy_static; extern crate idna; mod types; mod ip; mod email; mod length; mod range; mod urls; mod must_match; mod contains; pub use types::{Errors, Validate, Validator}; pub use ip::{validate_ip, validate_ip_v4, validate_ip_v6}; pub use email::{valida...
use chrono::Duration; use iso8601_duration as iso8601; use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value}; /// Implement the Duration scalar /// /// The input/output is a string in ISO8601 format. #[Scalar( internal, name = "Duration", specified_by_url = "https://en.wikipedia.org/wi...
// 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 ...
#[test] fn smoke_test() { let _it = timeit::timeit("loooong"); std::thread::sleep(std::time::Duration::from_millis(199)); }
use crate::config::ScriptDeviceConfiguration; use crate::utils::LogCommandExt; use crate::*; use anyhow::bail; use std::{fmt, fs, process}; #[derive(Debug, Clone)] pub struct ScriptDevice { pub id: String, pub conf: ScriptDeviceConfiguration, } impl ScriptDevice { fn command(&self, _build: &Build) -> Resu...
#[doc(inline)] pub use config::Config; #[doc(inline)] pub use scraper::{LoadedData, Scraper}; pub mod config; pub mod data; pub mod scraper;
extern crate itertools; #[cfg(test)] extern crate quickcheck; extern crate llvm_sys as llvm; pub mod ir; pub mod opt; pub mod backend; #[cfg(test)] mod tests { use super::{ir, backend, opt}; use ir::Atom; use quickcheck::{quickcheck, TestResult}; use std::io::Cursor; const LOOP_LIMIT: usize = 255...
use crate::allocator::block::Block; use crate::prelude::*; use utilities::prelude::*; use std::marker::PhantomData; use std::sync::Arc; #[derive(Debug)] pub struct Memory<T> { device: Arc<Device>, pub(crate) block: Block, data_type: PhantomData<T>, } impl<T> Memory<T> { pub(crate) fn forced_requir...
use super::*; #[derive(Debug, PartialEq)] pub struct Method { name: String, params: MethodParameters, body: Node, } #[derive(Debug, PartialEq)] pub struct MethodParameters { pub required: Vec<String>, pub optional: Vec<Parameter>, pub array: Option<String>, pub proc: Option<String>, } #[d...
use crate::input_error::InputError; pub struct ExpenseReport { values: Vec<usize>, } impl ExpenseReport { pub fn new(values: &Vec<String>) -> Result<ExpenseReport, InputError> { let mut parsed_values = Vec::<usize>::new(); for value in values { parsed_values.push( v...
use std::fs; use std::path::Path; pub struct TestResources { file: String, } impl TestResources { pub fn new(file: &str) -> TestResources { TestResources { file: String::from(file), } } } impl Drop for TestResources { fn drop(&mut self) { let path = Path::new(&self...
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // 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 ...
use tree_sitter::Node; use crate::lint::core::Filter; pub struct NothingFilter; impl Filter for NothingFilter { fn filter(&self, _node: &Node, _source: &str) -> bool { true } }
use digest::Digest; use num_bigint::BigUint; use rand::{thread_rng, Rng}; // This is mostly taken from https://github.com/RustCrypto/RSA/pull/18 // For the love of crypto, please delete as much of this as possible and use the RSA crate // directly when that PR is merged pub fn encrypt<D: Digest>(key: &[u8], message: ...
extern crate futures; extern crate hyper; extern crate hyper_tls; extern crate tokio_core; use futures::{Future, Stream}; use std::io::Write; fn main() { let mut core = tokio_core::reactor::Core::new().unwrap(); let handle = core.handle(); let client = hyper::Client::configure() .connector(hyper_t...
pub mod point; pub mod fpoint; pub mod ipoint; pub mod irange; pub mod pointrng;
//! World deserialization types. use serde::{ de::{MapAccess, Visitor}, Deserialize, Deserializer, }; use super::{ archetypes::de::ArchetypeLayoutDeserializer, entities::de::EntitiesLayoutDeserializer, EntitySerializer, UnknownType, WorldField, }; use crate::{ internals::{ storage::{archet...
use crate::sim::*; // searches for the commit at which bisecting yields minimum expected entropy pub struct MinExpectedEntropy; impl MinExpectedEntropy { pub fn new(_: &SimulationState) -> Self { Self } } impl BisectStrategy for MinExpectedEntropy { fn name(&self) -> String { "entropy".to_string() } fn ...
use franklin_crypto::{ bellman::{plonk::better_better_cs::cs::ConstraintSystem, Engine, SynthesisError}, plonk::circuit::{allocated_num::Num, linear_combination::LinearCombination}, }; pub trait SpongeGadget<E: Engine, const RATE: usize, const WIDTH: usize> { fn specialize( &mut self, capac...
use errors::{Error, ErrorKind, Result}; use futures::prelude::*; use futures::sync::oneshot::Receiver; use futures::sync::mpsc::UnboundedReceiver; use proto::{MqttString, QualityOfService}; pub struct MqttFuture<T>(Receiver<Result<T>>); impl<T> From<Receiver<Result<T>>> for MqttFuture<T> { fn from(value: Receiver...
fn main() { let double = |x| x * 2; println!("{:?}", double_with_two(double)); } fn double_with_two<F>(f: F) -> i32 where F: Fn(i32) -> i32 { f(2) }
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // 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 ...
#[doc = "Reader of register AWD3TR"] pub type R = crate::R<u32, super::AWD3TR>; #[doc = "Writer for register AWD3TR"] pub type W = crate::W<u32, super::AWD3TR>; #[doc = "Register AWD3TR `reset()`'s with value 0x0fff_0000"] impl crate::ResetValue for super::AWD3TR { type Type = u32; #[inline(always)] fn rese...
use ndarray::prelude::*; use petgraph::visit::{EdgeRef, IntoEdges, IntoNodeIdentifiers}; use std::{collections::HashMap, f32::INFINITY, hash::Hash}; pub fn warshall_floyd<G, F>(graph: G, length: F) -> Array2<f32> where G: IntoEdges + IntoNodeIdentifiers, G::NodeId: Eq + Hash, F: FnMut(G::EdgeRef) -> f32, {...
#![deny(warnings)] extern crate futures; extern crate tokio_mock_task; extern crate tokio_sync; use tokio_mock_task::*; use tokio_sync::oneshot; use futures::prelude::*; macro_rules! assert_ready { ($e:expr) => {{ match $e { Ok(futures::Async::Ready(v)) => v, Ok(_) => panic!("not...
use criterion::{criterion_group, criterion_main, Criterion, Throughput}; use iox_data_generator::{ agent::Agent, specification::{ AgentAssignmentSpec, AgentSpec, DataSpec, DatabaseWriterSpec, FieldSpec, FieldValueSpec, MeasurementSpec, }, tag_set::GeneratedTagSets, write::PointsWrite...
// 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 ...
#[macro_use] extern crate lazy_static; pub mod common; pub mod day07; pub mod day08; pub mod day09; pub mod day10; pub mod day11; pub mod day12; pub mod day13; pub mod day14; pub mod day15; pub mod day16; pub mod day17; pub mod day18; pub mod day19; pub mod day20; pub mod day21; pub mod day22; pub mod day24; pub mod d...
/*! An application that runs in the system tray. Requires the following features: `cargo run --example system_tray_d --features "tray-notification message-window menu cursor"` */ extern crate native_windows_gui as nwg; extern crate native_windows_derive as nwd; use nwd::NwgUi; use nwg::NativeUi; #[derive(De...
use std::time::Duration; use imgui_winit_support::WinitPlatform; use legion::*; use winit::window::Window; use imgui::*; use imgui_wgpu::{Renderer, RendererConfig}; use crate::{ wgpu_state::WgpuState, app_state::AppState, application::DeltaTime, events::Events, command::Command, }; pub struct UiSta...
pub struct ProconReader<R: std::io::Read> { reader: R, } impl<R: std::io::Read> ProconReader<R> { pub fn new(reader: R) -> Self { Self { reader } } pub fn get<T: std::str::FromStr>(&mut self) -> T { use std::io::Read; let buf = self .reader .by_ref() ...
use crate::vec3::Color; use crate::ray::Ray; pub fn write_color(pixel_color: Color, samples_per_pixel: i32, output: &mut String) { // Write the translated [0,255] value of each color component // let r = (255.999 * pixel_color.r()) as i32; // let g = (255.999 * pixel_color.g()) as i32; // let b = (255....
//! # Erasure Coding and Recovery //! //! Blobs are logically grouped into erasure sets or blocks. Each set contains 16 sequential data //! blobs and 4 sequential coding blobs. //! //! Coding blobs in each set starting from `start_idx`: //! For each erasure set: //! generate `NUM_CODING` coding_blobs. //! ind...
use test_data_object::*; use windows::core::*; use Windows::Win32::Foundation::*; use Windows::Win32::System::Com::*; #[implement(Windows::Win32::System::Com::IDataObject)] #[derive(Default)] #[allow(non_snake_case)] struct Test { GetData: bool, GetDataHere: bool, QueryGetData: bool, GetCanonicalFormat...
//! This implementation has been deprecated, but still used in the Python //! binding due to an unknown issue with the v1 implementation, to reproduce: //! //! 1. `let g:clap_force_python = 1`. //! 2. open https://github.com/subspace/subspace/blob/c50bec907ab8ade923a2a0b4888f43bfc47e8a7f/polkadot/node/collation-generat...
//! C API wrappers for calling Telamon through FFI. //! //! The goal of the C API is to provide thin wrappers over existing Rust //! functionality, and only provides some cosmetic improvements to try and //! provide a somewhat idiomatic C interface. #[macro_use] pub mod error; pub mod explorer; pub mod ir; pub mod se...
//! ```elixir //! # label 2 //! # pushed to stack: (document) //! # returned form call: {:ok, existing_child} //! # full stack: ({:ok, existing_child}, document) //! # returns: {:ok, parent} //! {:ok, parent} = Lumen.Web.Document.create_element(parent_document, "div") //! :ok = Lumen.Web.Node.append_child(document, par...
#![recursion_limit = "256"] mod components; mod utils; use crate::components::game::Game; use wasm_bindgen::prelude::*; use yew::prelude::*; #[wasm_bindgen(start)] pub fn run_app() { App::<Game>::new().mount_to_body(); }
use ash::vk; use gpu_allocator::{vulkan::Allocation, MemoryLocation}; use super::{ allocator::Allocator, queue, surface::{self, SurfaceWrapper}, GraphicsResult, }; const PREFERRED_IMAGE_COUNT: u32 = 3; #[allow(dead_code)] pub struct SwapchainWrapper { pub swapchain_loader: ash::extensions::khr::S...
//! Utility wrappers to simplify writing OpenGL code. //! //! This crate aspires to provide an abstraction over OpenGL's raw API in order to simplify the //! task of writing higher-level rendering code for OpenGL. `gl-util` is much in the vein of //! [glutin](https://github.com/tomaka/glium) and [gfx-rs](https://github...
// Copyright 2020-2021, The Tremor 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 agr...
use vec3::*; use ray::*; use util::*; fn random_in_unit_disk(rng: &mut Rng) -> Vec3<f64> { loop { let p = 2.0 * Vec3::new(rng.rand64(), rng.rand64(), 0.0) - Vec3::new(1.0, 1.0, 0.0); if dot(&p, &p) < 1.0 { return p; } } } #[derive(Debug)] pub struct Camera { /// Positio...
use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::Term; #[native_implemented::function(erlang:erase/1)] pub fn result(process: &Process, key: Term) -> Term { process.erase_value_from_key(key) }
//! Tests are based on //! https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf Appendix F extern crate aes; extern crate data_encoding; use data_encoding::HEXLOWER; use aes::*; fn as_vec(input: &str) -> Vec<u8> { HEXLOWER.decode(input.as_bytes()).unwrap() } #[test] fn vec_conversion() ...
use glam::Vec2; use legion::prelude::*; use super::input::InputQueue; use super::Game; use crate::engine::components::all::*; use crate::engine::events::timed_event::*; use crate::engine::resources::map_data::*; impl Game { pub fn insert_cores(&mut self, cores: Vec<(usize, CoreData)>) { let mut replicatio...
use std::{collections::HashSet, io}; #[derive(Debug, Clone, Copy)] enum Direction { Up, Down, Left, Right, } #[derive(Debug, Clone, Copy)] struct Movement { dir: Direction, len: i32, } #[derive(Debug, Default, Clone, Copy, Hash, PartialEq, Eq)] struct Position { x: i32, y: i32, } imp...
use std::time::SystemTime; const NN: usize = 312; const MM: usize = 156; const MATRIX_A: u64 = 0xB5026F5AA96619E9; const UM: u64 = 0xFFFFFFFF80000000; const LM: u64 = 0x7FFFFFFF; const F: u64 = 6364136223846793005; const MAG01: [u64; 2] = [0, MATRIX_A]; pub struct Random { mt: [u64; NN], index: usize, } impl...
fn main() { let contents = std::fs::read_to_string("/injected_dir/injected_file").expect("read injected file"); assert_eq!(contents, "injected file contents"); }
#[macro_use] extern crate slog; extern crate slog_term; extern crate bytes; //extern crate byteorder; extern crate futures; extern crate tokio_io; extern crate tokio_service; pub mod error; pub mod ipc; pub mod util;
//! Rust encoder and decoder in order to work with the Confluent schema registry. //! //! This crate contains ways to handle encoding and decoding of messages making use of the //! [confluent schema-registry]. This happens in a way that is compatible to the //! [confluent java serde]. As a result it becomes easy to wor...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qmainwindow.h // dst-file: /src/widgets/qmainwindow.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block be...
use std::rc::Rc; use serialize::json::Json; use vec::Vec3; use material::{ Color, Material }; use object::{ Object, Objects, Rotate, Sphere, Plane, Dir, AARect, AABox, AAHexa }; use light::{ Light, Lights, Bulb, Sun }; use scene::{ Picture, Eye, Scene }; pub fn load(input: &str) -> (Eye, Scene, Picture) { let root...
#![cfg_attr(not(feature = "std"), no_std)] #[macro_export] macro_rules! write_all { ($owner:expr => $($cells:expr),*) => {{ $crate::write_all!(@destruct [()] [$(($cells))*] $owner.write_all($crate::hlist!($(&$cells as &$crate::ICell<_, _>),*))) }}; (@destruct [$($rest:tt)*] [$first:tt $($cells:tt)*...
use crate::homogeneous::Homogeneous; use numpy::{IntoPyArray, PyArray1, PyArray2}; use pyo3::prelude::{pyfunction, pymodule, Py, PyModule, PyResult, Python}; use pyo3::wrap_pyfunction; #[pyfunction] fn to_homogeneous_vec(py: Python<'_>, x: &PyArray1<f64>) -> Py<PyArray1<f64>> { Homogeneous::to_homogeneous(&x.as_ar...
//! The following is derived from Rust's //! library/std/src/os/fd/mod.rs at revision //! fa68e73e9947be8ffc5b3b46d899e4953a44e7e9. //! //! All code in this file is licensed MIT or Apache 2.0 at your option. //! //! Owned and borrowed Unix-like file descriptors. #![cfg_attr(staged_api, unstable(feature = "io_safety", ...
// Copyright 2020 - 2021 Alex Dukhno // // 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...
use std::fs::File; use std::io::prelude::*; // The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no in...
// Copyright 2020 IOTA Stiftung // // 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 w...
#![forbid(unsafe_code)] #[macro_use] extern crate prost_derive; /// Protocol for communicating with a daemon managing a central store in multi-user mode. pub mod daemon { include!(concat!(env!("OUT_DIR"), "/deck.daemon.v1alpha1.rs")); }
// Copyright 2023 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 ag...
pub use lzma_sys::*;
// Copyright 2021 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 crate::prelude::*; use std::os::raw::c_void; use std::ptr; #[repr(C)] #[derive(Debug)] pub struct VkMappedMemoryRange { pub sType: VkStructureType, pub pNext: *const c_void, pub memory: VkDeviceMemory, pub offset: VkDeviceSize, pub size: VkDeviceSize, } impl VkMappedMemoryRange { pub fn n...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type SceneLightingEffect = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct SceneLightingEffectReflectanceModel(pub i32); impl SceneLightingEffectR...
//! Implements custom visitors to handle de-serializing string or vec //! of strings. use serde::de; use serde::Deserialize; use std::fmt; use std::marker::PhantomData; /// Actually utilized [OptionalVecOrStringVisitor]. Used with serde's attribute /// macro. /// /// e.g.: /// ```ignore /// #[serde(default)] /// #[ser...
// 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. use cm_fidl_validator; use cm_json::{self, cm, Error}; use fidl_fuchsia_data as fdata; use fidl_fuchsia_sys2::{ CapabilityType, ChildDecl, ComponentDec...
const ALL_KEYS: &'static [&'static str] = &["KEY_RESERVED", "KEY_ESC", "KEY_1", "KEY_2", "KEY_3", "KEY_4", "KEY_5", "KEY_6", "KEY_7", "KEY_8", "KEY_9", "KEY_10", "KEY_MINUS", "KEY_EQUAL", "KEY_BACKSPACE", "KEY_TAB", "KEY_Q", "KEY_W", "KEY_E", "KEY_R", "KEY_T", "KEY_Y", "KEY_...
use crate::{FunctionData, Instruction, Map, BinaryOp, UnaryOp, Type, Cast, IntPredicate, Value}; #[derive(Default, Copy, Clone, Debug)] struct KnownBits { mask: u64, known: u64, } impl KnownBits { fn sign(&self, ty: Type) -> Option<bool> { let ty_size = ty.size_bits(); if self.mask & (1 ...
#![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces, unused_qualifications)] //! documentation for pokemon //! Yep. extern crate rustc_serialize; extern crate...
//! # Container module for motor types #[macro_use] mod dc_motor_macro; #[macro_use] mod servo_motor_macro; #[macro_use] mod tacho_motor_macro; mod large_motor; pub use self::large_motor::LargeMotor; mod medium_motor; pub use self::medium_motor::MediumMotor; mod tacho_motor; pub use self::tacho_motor::TachoMotor; ...
//! Contains a struct which is one measurement run of the coincidence counter //! should be used to extract the time information from the fifo data use std::thread; use std::time::Duration; use crate::types::{HydraHarpError, CTCStatus}; const OVERFLOW_PERIOD: u64 = 33554432; const OVERFLOW_MASK: u32 = (63 << 25); con...
use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, Block, FnArg, Ident, ImplItem, ItemImpl, LitStr}; /// Generate a blocking method for each async method in an impl block. Supports either `tokio` or `async-std` backend. /// Generated methods are suffixed with `_blocking`. /// /// # Example `to...
use crate::sig::*; use nom::{ bytes::complete::{tag, take}, number::complete::le_u64, IResult, }; use std::fmt; #[derive(Debug)] pub struct WallascnUni { source: Vec<u8>, } impl HasWrite for WallascnUni { fn write(&self) -> Vec<u8> { let mut out = self.name().as_bytes().to_vec(); ou...
use stringify::Stringify; use std::ffi::{CStr, CString}; use std::borrow::Cow; #[test] fn i32_convert_to_cow_str_test() { let integer = 1; assert_eq!(integer.convert_to_cow_str(), Cow::Borrowed("1")); } #[test] fn i32_convert_to_cstr_test() { let integer = 1; let cstr = unsafe { CStr::from_ptr(CString::new("1...
use std::collections::HashSet; use std::borrow::Cow; #[derive(Debug, PartialEq, Clone, Copy)] pub enum Token<'a> { INSTRUCTION(&'a str), UNKNOWN(char), REGISTER(u16), INDEX, DT, ST, KEY, F, B, NEWLINE, MINUS, COMMA, EOF, LBRACKET, RBRACKET, BYTE(u16), ...
//! `malloc`-based Box. use stable_deref_trait::StableDeref; use std::cmp::Ordering; use std::convert::{AsMut, AsRef}; use std::fmt::{Debug, Display, Formatter, Pointer, Result as FormatResult}; use std::hash::{Hash, Hasher}; use std::iter::{DoubleEndedIterator, FromIterator, IntoIterator}; use std::marker::Unpin; us...
mod actions; extern crate telegram_bot; //use self::telegram_bot::*; pub fn resolve (command: &str) -> String { let mut acao = command; if command.to_lowercase().contains("dara é doida"){ acao = "/daraedoida"; }else if command.to_lowercase().contains("alana"){ acao = "/alanaacha"; }els...
use bintree_strrepr::Tree; pub fn main() { let tree = Tree::from_string("a(b(d,e),c(,f(g,)))"); println!("{:?}", tree); }
use core::marker::PhantomData; use {Future, Poll, Async}; /// Future for the `from_err` combinator, changing the error type of a future. /// /// This is created by the `Future::from_err` method. #[derive(Debug)] #[must_use = "futures do nothing unless polled"] pub struct FromErr<A, E> where A: Future { future: A,...
#[doc = "Reader of register OAR1"] pub type R = crate::R<u32, super::OAR1>; #[doc = "Writer for register OAR1"] pub type W = crate::W<u32, super::OAR1>; #[doc = "Register OAR1 `reset()`'s with value 0"] impl crate::ResetValue for super::OAR1 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
use regex::Regex; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; struct Program { mask: String, // is making this a lifetime &str better? memory: HashMap<u64, u64>, } impl Program { fn new() -> Program { Program { ma...
use std::fmt::{Debug, Error, Formatter}; use std::ops::{Deref, DerefMut}; #[cfg(feature = "img")] use image::*; use libwebp_sys::{WebPFree, WebPPicture, WebPPictureFree}; /// This struct represents a safe wrapper around memory owned by libwebp. /// Its data contents can be accessed through the Deref and DerefMut trai...
#![windows_subsystem = "windows"] use std::ffi::CString; use core::ptr; #[link(name = "user32")] extern "stdcall" { pub fn MessageBoxA( hWnd: *const i8, lpText: *const i8, lpCaption: *const i8, uType: u32 ) -> i32; } fn main() { let msg =...