text
stringlengths
8
4.13M
//! Tests auto-converted from "sass-spec/spec/css/supports" #[allow(unused)] use super::rsass; // From "sass-spec/spec/css/supports/error.hrx" mod error { #[allow(unused)] use super::rsass; mod syntax { #[allow(unused)] use super::rsass; mod anything { #[allow(unused)] ...
use iced::Renderer; use crate::gui::types::message::Message; use crate::translations::translations::{notifications_translation, overview_translation}; use crate::translations::translations_2::inspect_translation; use crate::utils::types::icon::Icon; use crate::{Language, StyleType}; /// This enum defines the current ...
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>,...
#[no_mangle] pub extern fn physics_single_chain_swfjc_thermodynamics_isometric_legendre_force(number_of_links: u8, link_length: f64, well_width: f64, end_to_end_length: f64, temperature: f64) -> f64 { super::force(&number_of_links, &link_length, &well_width, &end_to_end_length, &temperature) } #[no_mangle] pu...
pub mod axiom_translation; pub mod class_translation; pub mod property_translation; pub mod annotation_translation; pub mod translation;
use winapi::shared::minwindef::MAX_PATH; use winapi::um::sysinfoapi::GetSystemDirectoryW; use rusty_xinput::XInputHandle; use crate::input::types::*; use crate::input::XInputDeviceId; lazy_static! { static ref XINPUT_HANDLE: XInputHandle = open_xinput(); } fn get_system_directory() -> String { let mut vec = Vec...
use std::collections::HashSet; use aoc_lib::AocImplementation; fn main() { let day = Day3{}; day.start(3); } struct Day3 {} impl AocImplementation<Vec<String>> for Day3 { fn process_input(&self, input: &str) -> Vec<Vec<String>> { input.split('\n').map(|line| line.split(',').map(|c| c.to_owned())...
use std::collections::HashMap; fn main() { let mut floating_bits = Vec::new(); let mut floating_mask = !0; let mut overrides = 0; let mut memory = HashMap::new(); String::from_utf8(std::fs::read("input/day14").unwrap()) .unwrap() .split_terminator('\n') .for_each(|line| { ...
#![no_main] #![no_std] extern crate panic_halt; use core::{cell::RefCell, /* f32::consts::PI, */ ops::DerefMut}; use cortex_m::interrupt::Mutex; use cortex_m_rt::entry; use stm32f4xx_hal as hal; use hal::{ adc::{config::AdcConfig, Adc}, delay::Delay, gpio::gpioa::PA0, // PA6, PA7 gpio::gpiob::{PB8,...
extern crate terminal; extern crate crdt; use terminal::{Events,Terminal}; struct Cursor { index: usize, col: u16, // row: u16, } struct Editor { crdt: crdt::CrText, cursor: Cursor } impl Events for Editor { fn on_key_press(&mut self, s:&str) { self.crdt.update(self.cursor.index,0,s); self.cursor.inc(); ...
use crate::error::ConvertBytesToBgpMessageError; #[derive(PartialEq, Eq, Debug, Clone, Copy, Hash, PartialOrd, Ord)] pub struct AutonomousSystemNumber(u16); impl From<AutonomousSystemNumber> for u16 { fn from(as_number: AutonomousSystemNumber) -> u16 { as_number.0 } } impl From<u16> for AutonomousSys...
use crate::{ ast_types::ast_base::AstBase, utils::Ops, }; use serde::Serialize; use std::any::Any; /* FUNCTION DEFINITION */ pub trait FnDefinitionBase { fn get_def_name(&self) -> String; fn new(def_name: String, body: Vec<Box<dyn self::AstBase>>, arguments: Vec<String>) -> Self; } #[derive(Clone, Deb...
use amethyst::core::Transform; use amethyst::ecs::{Entities, Join, LazyUpdate, Read, ReadStorage, System, WriteStorage}; use crate::map::Map; use crate::components::{Direction, Action, Intent, Tile}; #[derive(Default)] pub struct MoveSystem; impl<'s> System<'s> for MoveSystem { type SystemData = ( WriteS...
use crate::api::*; use crate::data::{get_book, get_order}; use fp_core::compose; use fp_core::compose::compose_two; use futures::future::*; use futures::prelude::*; use std::future::Future; fn book_service(id: &String) -> impl Future<Output = Option<&'static Book>> { ready(get_book(id)) } fn order_service(id: &St...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct OperationListResult { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub value: Vec<Operation>, }...
//! Helper to store persistent or temporary data to disk. //! //! This module provides methods to store workflow related data //! (such as settings, configurations, ...) to disk. Additionally using the non-method functions //! workflow authors can save/load data to workflow's cache directory. //! //! To store/retrieve ...
use std::{fmt, num::NonZeroU32}; use anyhow::Result; use necsim_core::{ impl_report, lineage::MigratingLineage, reporter::{ boolean::{Boolean, False, True}, FilteredReporter, Reporter, }, }; use necsim_core_bond::{NonNegativeF64, PositiveF64}; use necsim_impls_std::event_log::recorder...
use crate::grammar::ast::{BinaryExpression, BinaryOp, Expression}; use crate::grammar::model::HasSourceReference; use crate::grammar::testing::TestingContext; use crate::grammar::tracing::input::OptionallyTraceable; use std::time::Instant; #[test] fn check_whitespace_simple() { let tcx = TestingContext::with(&["2 ...
#![cfg(all(test, feature = "test_e2e"))] use azure_core::Context; use azure_cosmos::prelude::*; mod setup; #[tokio::test] async fn permissions() { const DATABASE_NAME: &str = "cosmos-test-db-users"; const COLLECTION_NAME: &str = "cosmos-test-db-users"; const USER_NAME1: &str = "someone@cool.net"; cons...
impl Solution { pub fn number_of_arithmetic_slices(mut nums: Vec<i32>) -> i32 { let(mut res,mut n) = (0,nums.len()); for i in (1..n).rev(){ nums[i] -= nums[i - 1]; } let mut i = 1; while i < n { let mut j = i; while j < n && nums[j] == nums...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ExtensionProperties { #[serde(rename = "extensionId", default, skip_serializing_if = "Option::is_none")] pu...
use nom::bytes::streaming::take; use nom::combinator::{map, map_parser, verify}; use nom::number::streaming::{be_u32, be_u8}; use nom::{Err, IResult, Needed}; use std::net::Ipv4Addr; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct RadiusAttributeType(pub u8); #[allow(non_upper_case_globals)] impl RadiusAttrib...
use proconio::{input, marker::Usize1}; fn main() { input! { r: usize, c: usize, k: usize, rcv: [(Usize1, Usize1, u64); k], } println!("{}", DP::new(&rcv, r, c).calc()); } struct DP { dp: Vec<Vec<Vec<Option<u64>>>>, b: Vec<Vec<u64>>, r: usize, c: usize, } i...
fn main() { let company: &str = "TutorialsPoint"; let location: &str = "Hyderabad"; println!("company is : {}, location is : {}", company, location); let company_1: &'static str = "TutorialsPoint"; let location_1: &'static str = "Hyderabad"; println!("company is : {}, location is : {}", company...
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>,...
#[doc = "Register `MACL3A20R` reader"] pub type R = crate::R<MACL3A20R_SPEC>; #[doc = "Register `MACL3A20R` writer"] pub type W = crate::W<MACL3A20R_SPEC>; #[doc = "Field `L3A20` reader - Layer 3 Address 2 Field When the L3PEN0 and L3SAM0 bits are set in the L3 and L4 control 0 register (ETH_MACL3L4C0R), this field con...
use bindgen; use cmake; use std::env; //FIXME: complaining about missing struct tags in bindgen (even though they are typedef'd) (had to be manually changed) //TODO: test above in a normal c project, could be a V-EZ issue //TODO: fork V-EZ so we can fix cmake output dir to be in our build location? fn main() { l...
// 2019-01-15 // Jouons à utiliser les modules. // cette hiérarchie crée un arbre de module pour le crate. // J'ai du mal à comprendre. Dans cette hiérarchie, comme dans un système de // fichiers, on définit des CHEMINS. // Pour appeler une fonction, on doit connaître son chemin. mod sound; fn main() { // ch...
use crate::components::{wiring, NANDGate, ORGate}; pub struct NORGate { pub input1: wiring::Wire, pub input2: wiring::Wire, pub output: wiring::Wire, or: ORGate, nand: NANDGate, } impl Default for NORGate { fn default() -> Self { NORGate { input1: wiring::Wire::default(), ...
// =============================================================================== // Authors: AFRL/RQQA // Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division // // Copyright (c) 2017 Government of the United State of America, as represented by // the Secretary of th...
use std::collections::HashMap; pub fn count(nucleotide: char, dna: &str) -> Result<usize, char> { if !"ACGT".contains(nucleotide) { return Err(nucleotide); } dna.chars().try_fold(0, |tot, nuc| { match nuc { nuc if nuc == nucleotide => Ok(tot + 1), 'A' | 'C' | 'G' | ...
use std::io; fn main() { let mut f; loop { println!("Convert fahrenheit or celsius? (f/c)"); f = String::new(); io::stdin().read_line(&mut f) .expect("Failed to read line"); if f.trim() == "f" { convert_f_to_c(); break; } else if ...
use lexical_analyzer::token::*; use syntax_analyzer::SyntaxAnalyzer; use std::env; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Write}; fn main() { let mut reader: Box<dyn BufRead> = match env::args().nth(1) { None => Box::new(BufReader::new(stdin())), Some(filena...
use crate::error::*; use crate::platform::Platform; use crate::unity::version::{Version, VersionType}; use reqwest::Url; use std::convert::Into; use std::ops::Deref; const BASE_URL: &str = "https://download.unity3d.com/download_unity/"; const BETA_BASE_URL: &str = "https://beta.unity3d.com/download/"; #[derive(Debug)...
use std::fs::File; use std::io::{self, prelude::*, BufReader}; use std::cmp; pub fn part1() -> io::Result<(u32)> { let file = File::open("input.txt")?; let reader = BufReader::new(file); let mut result: u32 = 0; for line in reader.lines() { let line = line.unwrap(); let mass: u32 = line...
#[doc = "Register `CCIPR1` reader"] pub type R = crate::R<CCIPR1_SPEC>; #[doc = "Register `CCIPR1` writer"] pub type W = crate::W<CCIPR1_SPEC>; #[doc = "Field `USART1SEL` reader - USART1 clock source selection"] pub type USART1SEL_R = crate::FieldReader; #[doc = "Field `USART1SEL` writer - USART1 clock source selection...
use crate::actions::Action; use crate::error::Result; use crate::shared::packages::{PackageRepository, PackageSet, PackageSetGroup}; use crate::shared::{FileSystemResource, Name}; // ------------------------------------------------------------------------------------------------ // Public Types // --------------------...
mod log; mod metrics; mod serializer; pub use log::{LogLayer, LogMiddleware}; pub use metrics::{MetricsLayer, MetricsMiddleware}; pub use serializer::{ToJsonLayer, ToJsonMiddleware}; use super::mqtt_client::JsonMqttRequest; use super::ClientError; use super::MqttRequest;
#[macro_use] extern crate glib; extern crate clap; extern crate serde_json; use clap::{App, Arg}; use gst::prelude::*; use gstreamer as gst; mod process; use std::fs; use std::io::Write; use std::time::SystemTime; fn main() { let matches = App::new("Pristine") .version("0.2.0") .author("CAIMEO") ...
use crate::vec3::Vec3; use crate::ray::Ray; use crate::hitable::HitRecord; use crate::material::lambertian::Lambertian; use crate::material::dielectric::Dielectric; use crate::material::metal::Metal; pub mod lambertian; pub mod metal; pub mod dielectric; pub fn reflect(v: Vec3, n: Vec3) -> Vec3 { v - (2.0 * v.dot...
use crossterm::{cursor, event, execute, queue, style, terminal}; use std::io::Write; mod board; mod help; fn run() -> crossterm::Result<()> { let mut stdout = std::io::stdout(); let mut state = State::Board; let dur = std::time::Duration::from_millis(50); let (width, height) = terminal::size()?; l...
#[doc = "Reader of register DDRCTRL_PSTAT"] pub type R = crate::R<u32, super::DDRCTRL_PSTAT>; #[doc = "Reader of field `RD_PORT_BUSY_0`"] pub type RD_PORT_BUSY_0_R = crate::R<bool, bool>; #[doc = "Reader of field `RD_PORT_BUSY_1`"] pub type RD_PORT_BUSY_1_R = crate::R<bool, bool>; #[doc = "Reader of field `WR_PORT_BUSY...
// q0165_compare_version_numbers struct Solution; impl Solution { pub fn compare_version(version1: String, version2: String) -> i32 { let mut v1: Vec<usize> = version1.split('.').map(|x| x.parse().unwrap()).collect(); let mut v2: Vec<usize> = version2.split('.').map(|x| x.parse().unwrap()).collect...
use crossterm::event::{self, Event, KeyCode}; use feroxbuster::{ banner, config::{CONFIGURATION, PROGRESS_BAR, PROGRESS_PRINTER}, heuristics, logger, progress::{add_bar, BarType}, reporter, scan_manager::{self, ScanStatus, PAUSE_SCAN}, scanner::{self, scan_url, SCANNED_URLS}, statistics:...
use crate::{Cursor, CursorBlink, Display}; pub struct DisplayMode { pub cursor_visibility: Cursor, pub cursor_blink: CursorBlink, pub display: Display, } impl Default for DisplayMode { fn default() -> DisplayMode { DisplayMode { cursor_visibility: Cursor::Visible, cursor_blink: CursorBlink::On, display: Display...
extern crate aoc_utils; extern crate regex; #[macro_use] extern crate lazy_static; use regex::Regex; lazy_static! { static ref COORDINATE_REGEX: Regex = Regex::new(r"(?P<x>\d+), (?P<y>\d+)").unwrap(); } pub fn parse_coordinates(contents: &str) -> Vec<(i32, i32)> { contents .split('\n') .filt...
pub mod common; pub mod angle; pub mod vector; pub mod rect;
use alloc::boxed::Box; use arch::context::EnvVar; use collections::string::String; use core::cmp::min; use fs::resource::ResourceSeek; use fs::{KScheme, Resource}; use system::error::{EINVAL, Error, Result}; pub struct EnvScheme; impl KScheme for EnvScheme { fn scheme(&self) -> &str { "env" } fn ...
mod commands; use std::{ collections::HashSet, env, sync::Arc, }; use serenity::{ async_trait, client::bridge::gateway::{ShardManager, GatewayIntents}, framework::{ StandardFramework, standard::macros::group, }, http::Http, model::{ event::VoiceServerUpdateE...
use common::model::AggregateRoot; use common::result::Result; use identity::domain::role::*; use identity::domain::user::*; use publishing::domain::category::{Name as CategoryName, *}; use crate::container::Container; pub async fn populate(c: &Container) -> Result<()> { // Identity let mut admin_role = Role::...
/// An enum to represent all characters in the Latin1Supplement block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Latin1Supplement { /// \u{80}: '€' Control0080, /// \u{81}: '' Control0081, /// \u{82}: '‚' Control0082, /// \u{83}: 'ƒ' Control0083, /// \u{84}: '„' ...
pub mod kflog;
#![no_std] #![feature(asm)] #![feature(naked_functions)] #![feature(ptr_internals)] #![feature(thread_local)] pub mod elf; pub mod scheduler; pub mod task;
// 2019-04-26 // Fonctions de mémoire basiques use std::mem; // défintion : "A List is either Empty or an Element followed by a List" // pub enum List { // Empty, // Elem(i32, Box<List>), // } // Mais pour tout un tas de raison de pointeurs, il vaut mieux faire ça : // pub enum List { // Empty, // E...
use std::io::{BufReader, BufRead}; use std::fs::File; use regex::Regex; struct Claim { id: i32, x: usize, y: usize, w: usize, h: usize, } fn read_input() -> Vec<Claim> { let file = File::open("input/day03.txt").unwrap(); let re = Regex::new(r"#(\d+) @ (\d+),(\d+): (\d+)x(\d+)").unwrap(); ...
// q0009_palindrome_number struct Solution; impl Solution { pub fn is_palindrome(x: i32) -> bool { if x < 0 { return false; } let s = x.to_string(); let sb = s.as_bytes(); let mut i = 0; let mut j = sb.len() - 1; loop { if i >= j { ...
use byteorder::{LittleEndian, ReadBytesExt}; use std::io::Read; const FILE_IDENTIFIER: [u8; 12] = [ 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x32, 0x30, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A, ]; #[derive(Debug, Copy, Clone)] pub struct Header { pub format: u32, pub type_size: u32, pub pixel_width: u32, pub pixel_heig...
///// chapter 4 "structuring data and matching patterns" ///// program section: // fn main() { let aliens = ["cherfer", "fynock", "shirack", "zuxu"]; println!("{:?}", aliens); } ///// output should be: /* */// end of output
use super::{DataClass, DataIdDefinition, Flags8}; use ::std::marker::PhantomData; pub type DataIdSimpleType = (Flags8, u8); pub(crate) static DATAID_DEFINITION : DataIdDefinition<DataIdSimpleType, DataIdType> = DataIdDefinition { data_id: 2, class: DataClass::ConfigurationInformation, read...
pub use self::context::NativeContext; pub use self::device::NativeDevice; pub use self::framework::Native; pub use self::memory::NativeMemory; mod context; mod device; mod framework; mod memory; pub const HOST: NativeDevice = NativeDevice;
use itertools::Itertools; #[derive(Debug)] struct Spell { cost: u32, mana: u32, damage: u32, armour: u32, hp: u32, rounds: u32 } #[derive(Debug)] struct Player { hp: i32, damage: u32, armour: u32, } impl Spell { fn magic_missle() -> Self { Spell { cost: 53,...
use crate::event_hub::{ delete_message, peek_lock, peek_lock_full, receive_and_delete, renew_lock, send_event, unlock_message, PeekLockResponse, }; use chrono::Duration; use hyper_rustls::HttpsConnector; use ring::hmac::Key; type HttpClient = hyper::Client<HttpsConnector<hyper::client::HttpConnector>>; pub st...
pub mod endpoints; pub mod service; use crate::service::AuthorizationServiceConfig; use drogue_cloud_api_key_service::service::KeycloakApiKeyServiceConfig; use drogue_cloud_service_common::{defaults, health::HealthServerConfig, openid::Authenticator}; use serde::Deserialize; pub struct WebData<S> where S: service...
pub mod interpreter { use crate::ast::*; use crate::memory::*; use crate::memory::memory_handler::IntRep; pub fn run(mut ast: Vec<Box<ExprTree>>) -> IntRep{ let len = ast.len(); for _i in 0..len { match ast.pop() { Some(fun) => { m...
extern crate advent_of_code_2017_day_3 as advent; fn main() { println!( "the answer for part 1 is {}", advent::solve_puzzle_part_1(289_326) ); println!( "the answer for part 2 is {}", advent::solve_puzzle_part_2(289_326) ); }
mod mapper; mod mapper_000; mod mapper_001; mod mapper_002; mod mapper_003; mod mapper_004; mod nesrom; use std::io::{Read, Seek}; use crate::error::LoadError; // use crate::rom::Rom; pub use mapper::*; pub use nesrom::{NesHeader, NesVersion, MirrorMode, PrgRom, ChrRom, Trainner}; pub fn parse_stream<R: Read + Seek>...
mod output; mod remote; pub use output::OutputEvent; use anyhow::{anyhow, Result}; use output::Output; use remote::Remote; use std::{ collections::HashMap, sync::{Arc, Mutex}, }; use tokio::sync::mpsc::UnboundedReceiver; use uuid::Uuid; /// An engine represents an abstraction on top of the OS /// that allows...
#[doc = "Reader of register ENC_INTR"] pub type R = crate::R<u32, super::ENC_INTR>; #[doc = "Writer for register ENC_INTR"] pub type W = crate::W<u32, super::ENC_INTR>; #[doc = "Register ENC_INTR `reset()`'s with value 0"] impl crate::ResetValue for super::ENC_INTR { type Type = u32; #[inline(always)] fn re...
extern crate rand; extern crate libc; use libc::int32_t; pub struct Psygen { used: Vec<i32>, max: usize, } impl Psygen { fn new(max:usize) -> Psygen { Psygen{ used: vec![0;max+1], max:max } } fn add_used(&mut self, used:i32){ self.used[(used as usize)] = 1; } fn next(&mu...
use crate::arena::resource::ResourceId; use crate::libs::color::Pallet; use crate::libs::select_list::SelectList; use std::rc::Rc; #[derive(Clone)] pub enum TableTool { Hr(Rc<String>), Selector, TableEditor, Pen(PenTool), Shape(SelectList<ShapeTool>), Eraser(EraserTool), Character(Character...
use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use cosmwasm_std::{CanonicalAddr, Decimal, Order, ReadonlyStorage, StdResult, Storage}; use cosmwasm_storage::{ bucket, bucket_read, singleton, singleton_read, Bucket, ReadonlyBucket, Singleton, }; use spectrum_protocol::common::{ calc_range_end, ...
#![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; pub mod keypair; pub mod public; pub mod secret; pub mod signature; pub mod error; mod constant; mod hash; mod base58; mod network; use error::Result;
use futures::prelude::*; use std::sync::Arc; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::cell::RefCell; use std::collections::HashMap; type BoxUnitFuture = Box<Future<Item=(), Error=()>>; struct GtkEventLoopAsyncExecutorBackend { next_id: AtomicUsize, spawns: RefCell<HashMap<...
use TagComponentArray; use downcast_rs::Downcast; use entity::Entity; use std::cell::RefCell; use rayon::iter::{IntoParallelIterator, ParallelIterator}; use std::collections::HashMap; use std::collections::HashSet; use std::rc::Rc; use worker::schema::DynamicComponentHandler; use worker::schema::{Component, GeneratedSc...
mod unquoted_attribute; use core::str::from_utf8_unchecked; use alloc::borrow::Cow; use alloc::string::String; use alloc::vec::Vec; #[cfg(feature = "std")] use std::io::{self, Write}; pub use unquoted_attribute::*; macro_rules! escape_impl { (@inner [$dollar:tt] $name:ident; $($l:expr => $r:expr),+ $(,)*) => {...
#![feature(plugin)] #![plugin(dom_macros)] extern crate dom; #[test] fn dom_element() { // let a = Link::new("google.com"); // let b = Link::new("facebook.com"); // let c = Button::new("Click Me"); // // let f = || -> Node { a.render() }; // let g = || -> Node { b.render() }; // let h = ||...
use anyhow::Result; use elements::Txid; use futures::lock::Mutex; use crate::{esplora, wallet::current, Wallet}; pub async fn get_transaction_history( name: String, current_wallet: &Mutex<Option<Wallet>>, ) -> Result<Vec<Txid>> { let wallet = current(&name, current_wallet).await?; // We have a single...
use glium::{Display, DrawParameters, Frame, Program, Surface, VertexBuffer}; use glium::index::{NoIndices, PrimitiveType}; use wrapped2d::b2; use std::f32; use DataHelper; use graphics::Camera; use math::Aabb; pub struct DebugDraw { display: Display, line_vertices: Vec<DebugVertex>, vertex_buffer: Vertex...
use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; #[allow(dead_code)] struct Scanner<'a> { cin: StdinLock<'a>, } #[allow(dead_code)] impl<'a> Scanner<'a> { fn new(cin: StdinLock<'a>) -> Scanner<'a> { Scanner { cin: cin } } fn read<T: FromStr>(&mut self) -> Option<T> { let t...
use std::str::FromStr; #[derive(Debug, PartialEq, Eq)] pub(crate) struct StringlyTyped<'s, Component> { pub inner: StringlyTypedInner<'s, Component>, pub component: Component, pub quasi: Option<StringlyTypedInner<'s, Component>>, } #[derive(Debug, PartialEq, Eq)] pub(crate) enum StringlyTypedInner<'s, Com...
#[doc = "The document model"]; type ast_id = int; type cratedoc = ~{ topmod: moddoc, }; type moddoc = ~{ id: ast_id, name: str, path: [str], brief: option<str>, desc: option<str>, mods: modlist, fns: fnlist, consts: constlist, enums: enumlist }; type constdoc = ~{ id: ast...
#[doc = "Reader of register USBPHY_DIRECT"] pub type R = crate::R<u32, super::USBPHY_DIRECT>; #[doc = "Writer for register USBPHY_DIRECT"] pub type W = crate::W<u32, super::USBPHY_DIRECT>; #[doc = "Register USBPHY_DIRECT `reset()`'s with value 0"] impl crate::ResetValue for super::USBPHY_DIRECT { type Type = u32; ...
// Copyright (c) 2016, <daggerbot@gmail.com> // This software is available under the terms of the zlib license. // See COPYING.md for more information. use std::convert::TryFrom; use std::mem; use std::os::raw::*; use std::rc::Rc; use std::slice; use std::sync::Arc; use std::vec; use x11_dl::xlib; use device::Device...
//! Block cipher encryption and decryption using various modes of operation. mod aes; mod null; use std::fmt; use std::error; use utils::data::Data; use utils::xor::xor; /// Algorithms that can be used for the encryption and decryption of a single block. pub enum Algorithms { /// The AES algorithm. Aes, ...
use evitable::*; use indexmap::IndexMap; use skorm_iri::{try_parse, Iri, IriBorrowed, IriBuf}; use std::borrow::Cow; #[evitable] pub enum Context { #[evitable(description = "The prefix \"_\" is reserved.")] ReservedPrefix, #[evitable(description("The prefix \"{}\" is already in use.", prefix))] PrefixInUse { ...
use self::packets::*; use crate::{ dev::*, error::{Error, WireError}, types::{BoxNonce, BoxPublicKey, Coords, Handle, RootUpdate, WireCoords, MTU}, }; use futures_codec::{Decoder, Encoder, FramedRead, FramedWrite}; use std::marker::PhantomData; use zerocopy::{AsBytes, FromBytes, LayoutVerified}; /// /// TO...
fn pyramid(n: usize) -> Vec<Vec<u32>> { let mut result = Vec::with_capacity(n); let mut i = 0; while i < n { i += 1; result.push(vec![1; i]); } result } fn main() { /* let mut array = [1, 2, 3]; let sl1 = &array[0..2]; let sl2 = &array; array[1] = 20; print...
use crate::uses::*; use alloc::collections::BTreeMap; use super::Irq; // TODO: probably delete because this isn't needed #[derive(Debug)] pub struct IrqManager { map: BTreeMap<Irq, Irq>, } impl IrqManager { pub const fn new() -> Self { IrqManager { map: BTreeMap::new(), } } pub fn get_irq(&self, irq: Irq)...
fn main() { let data = (10, 'x', 12, 183.19, 'q', false, -9); println!("{}", data.2 + data.6); }
#![allow(non_snake_case)] #![feature(globs)] #![allow(dead_code)] extern crate libc; use win::types::{LPARAM,WPARAM,MSG,HINSTANCE}; use win::api::*; use win::encode::*; use win::wnd::{TWnd,DWnd}; use event::eventlistener::{TEventProcesser,EventProcesser}; use win::types::{ INITCOMMONCONTROLSEX,C_NULL,WndProc,POINT,...
use hyperltl::{HyperLTL, Op}; use serde_derive::{Deserialize, Serialize}; use std::collections::HashSet; #[derive(Debug, Serialize, Deserialize)] pub struct Specification { pub(crate) semantics: Semantics, pub(crate) inputs: Vec<String>, pub(crate) outputs: Vec<String>, assumptions: Vec<HyperLTL>, ...
use http::{StatusCode}; use now_lambda::{error::NowError, IntoResponse, Request, Response}; use image::{DynamicImage}; use image::ImageOutputFormat::PNG; fn handler(req: Request) -> Result<impl IntoResponse, NowError> { // Get the path let uri = req.uri(); // Split the path let uri_split = uri.path().split("/"...
use std::collections::{BinaryHeap, HashMap}; #[derive(Debug, PartialEq, Eq)] pub struct HuffNode { pub symbol: u8, pub freq: usize, } impl PartialOrd for HuffNode { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { self.freq.partial_cmp(&other.freq) } } impl Ord for HuffNode...
use std::marker::PhantomData; use std::ptr::NonNull; use vapoursynth_sys as ffi; use crate::api::API; /// A frame context used in filters. #[derive(Debug, Clone, Copy)] pub struct FrameContext<'a> { handle: NonNull<ffi::VSFrameContext>, _owner: PhantomData<&'a ()>, } impl<'a> FrameContext<'a> { /// Wraps...
#[macro_use] extern crate serde_derive; extern crate serde; extern crate serde_json; use std::io; #[derive(Deserialize, Default, Debug)] struct Data { pub people: Vec<Person> } #[derive(Deserialize, Default, Debug)] struct Person { pub name: String, pub address: Option<Address>, pub worksFor: Option<...
use std::collections::HashMap; use std::error::Error; use std::fmt; use std::fs; use std::path::PathBuf; use std::time::{SystemTime, UNIX_EPOCH}; use palette::luma::Luma; use palette::{encoding, Pixel, Srgb}; use structopt::StructOpt; #[derive(StructOpt, Debug)] #[structopt(name = "posterust")] pub struct Opt { /...
enum color { red, green, blue, black, white, } fn main() { // Ideally we would print the name of the variant, not the number assert (uint::to_str(red as uint, 10u) == #fmt["%?", red]); assert (uint::to_str(green as uint, 10u) == #fmt["%?", green]); assert (uint::to_str(white as uint, 10u) == #fmt["%?",...
//! Unicode string slices. //! //! *[See also the `str` primitive type][str].* //! //! The `&str` type is one of the two main string types, the other being `String`. //! Unlike its `String` counterpart, its contents are borrowed. //! //! # Basic Usage //! //! A basic string declaration of `&str` type: //! //! ``` //! #...
pub mod syl_core; pub mod syl_tcp;
use super::*; use crate::requests; use crate::resources::ResourceType; use crate::ReadonlyString; use azure_core::{HttpClient, No}; /// A client for Cosmos database resources. #[derive(Debug, Clone)] pub struct DatabaseClient { cosmos_client: CosmosClient, database_name: ReadonlyString, } impl DatabaseClient ...