text
stringlengths
8
4.13M
use std::io::{stdout, Write}; use crossterm::{ event, execute, style::{Color, Print, ResetColor, SetBackgroundColor, SetForegroundColor}, ExecutableCommand, Result, }; fn main() -> Result<()> { execute!(stdout(), SetForegroundColor(Color::Blue), SetBackgroundColor(Color::Red)...
extern crate http_muncher; use std::str; use http_muncher::{Parser, ParserHandler}; struct ServerHandler; impl ParserHandler for ServerHandler { // parser header that extracts from the header of the stream fn on_header_field(&mut self, parser: &mut Parser, header: &[u8]) -> bool { println!("{}: ", s...
#![allow(dead_code)] use ::std::{ boxed::Box, io::ErrorKind, iter::Extend, option::Option::{self, None, Some}, path::PathBuf, result::Result::{self, Err, Ok}, str, unimplemented, vec::Vec, }; pub(super) struct Md5CacheDir { root: PathBuf, child: Option<Box<Md5CacheDir>>, } imp...
use std::collections::VecDeque; use std::convert::TryFrom; fn main() { let mut x = Intcode::new([104, 23, 99].to_vec()); println!("{:?}", x.run([].to_vec())); } #[derive(Debug, PartialEq)] enum Status<T> { AwaitingInput(T), Halted(T), } impl<T> Status<T> { fn unwrap(&self) -> &T { match self { Sta...
/* chapter 4 syntax and semantics */ fn main() { let a = 5; let b = if a == 5 { 10 } else { 15 }; // b: i32 println!("{}", b); } // output should be: /* 10 */
/* * 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 std::borrow::Cow; use std::collections::BTreeMap; use std::ffi::CString; use std::ffi::OsStr; u...
/* * 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 */ /// UsageIncidentManagementHour : Incident management usage for a given organization for a given hour. ...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub async fn list_operations( operation_config: &crate::OperationConfig, ) -> std::result::Result<OperationListResult, lis...
use log::debug; use crate::{Participant, Slot, Stake, rand, MIN_STAKE, total_stakes, btc_hash, total_stakes2, ParticipantId, ParticipantIdx}; /// used in Config use serde::{Serialize,Deserialize}; use validator::{Validate, ValidationError}; use std::collections::HashMap; #[derive(Serialize, Deserialize, Validate)] #[...
pub use autorand_derive::Random; pub use rand; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, LinkedList, VecDeque}; use std::hash::{BuildHasher, Hash}; use rand::{distributions::Alphanumeric, Rng}; const LEN_LIMIT: usize = 16; const UINT_LIMIT: usize = u16::max_value() as usize; const INT_LOWER_LIMIT...
use abin::{NewSStr, SStr, StrBuilder, StrFactory, StrSegment}; use crate::BenchStr; #[derive(Clone)] pub struct SStrBenchStr(SStr); impl BenchStr for SStrBenchStr { fn from_str(slice: &str) -> Self { Self(NewSStr::copy_from_str(slice)) } fn from_static(slice: &'static str) -> Self { Self...
#![warn(rust_2018_idioms)] use failure::{bail, format_err, Error}; use fastcgi_client::{Client, Params}; use log::{error, trace}; use opcache::Opcache; use prometheus_exporter_base::{render_prometheus, MetricType, PrometheusMetric}; use std::net::{SocketAddr, TcpStream}; use std::path::PathBuf; use tokio; use structopt...
// Copyright 2019, 2020 Wingchain // // 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...
// What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2, ... , n) where n > 1? use std::time::Instant; fn main() { let now = Instant::now(); println!("e:{:?}, {:?} seconds", e(), now.elapsed()); } /* i x (1,..,n). i = 1, n=9, we have 123..9...
use std::{fs, path::Path}; use anyhow::*; use log::info; use wgpu_mipmap::{MipmapGenerator, RecommendedMipmapGenerator}; use winit::window::Window; pub struct WgpuState { surface: wgpu::Surface, device: wgpu::Device, queue: wgpu::Queue, swap_chain_descriptor: wgpu::SwapChainDescriptor, swap_chain...
use std::cell::RefCell; use std::collections::BTreeSet; use std::env; use std::process::exit; use crate::expression::{EvaluationContext, Expression}; use crate::parser::parse; use crate::tokens::{ParseError, tokenize}; mod tokens; mod expression; mod parser; fn print_usage(app_name: &str) { println!("Evaluates l...
extern crate alfred; #[macro_use] extern crate quicli; extern crate reqwest; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; use quicli::prelude::*; use std::io; use alfred::{ItemBuilder, Modifier}; use models::Gem; mod models; fn search_gems(query: &str) -> Result<Vec<Gem>> { ...
use std::io::BufReader; use std::io::prelude::*; use std::fs::File; use std::collections::HashMap; use std::collections::HashSet; use regex::Regex; fn main() { let (bag_contains, bag_contained_in) = create_graph(); phase_1(bag_contained_in); phase_2(bag_contains); } type Graph = HashMap<String, HashMap<St...
use hymns::runner::timed_run; const INPUT: &str = include_str!("../input.txt"); fn part1() -> u64 { todo!() } fn part2() -> u64 { todo!() } fn main() { timed_run(1, part1); timed_run(2, part2); } #[cfg(test)] mod tests { use super::*; #[test] fn test_part1() { assert_eq!(part1(...
/* * AA tree set test (Rust) * * Copyright (c) 2022 Project Nayuki. (MIT License) * https://www.nayuki.io/page/aa-tree-set * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without...
use std::fmt; #[derive(Debug)] pub enum Turn{ black, white, } impl Turn{ pub fn opponent(&self) -> Self { match *self { Turn::black => Turn::white, Turn::white => Turn::black, } } } impl fmt::Display for Turn{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::R...
//! The RFC 959 Make Directory (`MKD`) command // // This command causes the directory specified in the pathname // to be created as a directory (if the pathname is absolute) // or as a subdirectory of the current working directory (if // the pathname is relative). use crate::{ auth::UserDetail, server::{ ...
use std::mem; // use memmap2::{MmapMut, Mmap}; use mmap_rs::{Error, MmapOptions, MmapMut, Mmap}; use crate::parse_ruby::read_each_file; // Notes: // Can't make things RWX // This is big endian mod parse_ruby; struct Page { mem_write: Option<MmapMut>, mem_exec: Option<Mmap>, } impl Page { fn new() -> ...
//! This library contains the configuration stucts (along with their //! parsing functions) for the //! [cargo-i18n](https://crates.io/crates/cargo_i18n) tool/system. use std::fs::read_to_string; use std::io; use std::{ fmt::Display, path::{Path, PathBuf}, }; use log::{debug, error}; use serde_derive::Deseria...
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use rand::{thread_rng, Rng}; use subspace_archiving::archiver::Archiver; use subspace_core_primitives::crypto::kzg; use subspace_core_primitives::crypto::kzg::Kzg; const AMOUNT_OF_DATA: usize = 5 * 1024 * 1024; const SMALL_BLOCK_SIZE: usize = 500;...
use std::str::FromStr; mod variable_flags; pub use variable_flags::*; mod variable_name; pub use variable_name::*; lazy_static! { /// Vendor GUID of the EFI variables according to the specification pub static ref EFI_GUID: uuid::Uuid = uuid::Uuid::from_str("8be4df61-93ca-11d2-aa0d-00e098032b8c").unwr...
#[doc = "Register `FDCAN_IR` reader"] pub type R = crate::R<FDCAN_IR_SPEC>; #[doc = "Register `FDCAN_IR` writer"] pub type W = crate::W<FDCAN_IR_SPEC>; #[doc = "Field `RF0N` reader - RF0N"] pub type RF0N_R = crate::BitReader; #[doc = "Field `RF0N` writer - RF0N"] pub type RF0N_W<'a, REG, const O: u8> = crate::BitWriter...
//! Benchmarking for `pallet-transporter`. use super::*; use frame_benchmarking::v2::*; use frame_support::assert_ok; use frame_support::traits::Get; use frame_system::RawOrigin; use sp_messenger::endpoint::{ Endpoint, EndpointHandler as EndpointHandlerT, EndpointRequest, Sender, }; use sp_runtime::traits::Convert...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::format_err; use rand::prelude::*; use starcoin_crypto::ed25519::{Ed25519PrivateKey, Ed25519PublicKey}; use starcoin_crypto::Uniform; use starcoin_decrypt::{decrypt, encrypt}; use starcoin_types::transaction::helpers::Tra...
#![allow(dead_code, unused_variables)] use super::*; use crate::{ config::*, models::{ dockarea::DockArea, rect::Rect, screen::Screen, windowwrapper::WindowWrapper, Direction, }, xlibwrapper::{ util::{Position, Size}, xlibmodels::*, }, }; #[derive(Debug)] pub struct ColumnMa...
#![feature(box_syntax, advanced_slice_patterns, box_patterns)] #[macro_use] extern crate ast; extern crate rbtree; extern crate ivar; extern crate getopts; use getopts::{getopts, optflag}; use std::{old_io, env}; use std::cell::RefCell; use std::rt::unwind; pub use ast::{name, span, error}; use ast::CompilationUnit...
mod common; use regex::Regex; use std::collections::hash_map::{Entry, HashMap}; use std::collections::VecDeque; use std::str::FromStr; #[derive(Debug, PartialEq, Eq, Clone, Hash)] struct Bag { colour: String, } #[derive(Debug, PartialEq, Eq, Clone)] struct BagAmount { bag: Bag, amount: usize, } #[derive...
use papergrid::{ color::AnsiColor, config::{Entity, Sides}, }; use crate::{ grid::{ config::ColoredConfig, records::{ExactRecords, Records}, }, settings::{object::Object, Color, TableOption}, }; /// [`Colorization`] sets a color for the whole table data (so it's not include the bor...
use std::env; mod day01; mod day02; mod day03; mod day04; mod day05; mod day06; mod day07; mod day08; fn main() { println!("Hello, world2!"); let args: Vec<String> = env::args().collect(); let target = if args.len() >= 2 { &args[1] } else { "no target" }; println!("Running {ta...
use logos::{Lexer, Logos}; use std::fmt; pub type Tokens = Vec<Token>; pub fn lex(source: &str) -> Tokens { Token::lexer(&source).collect::<Tokens>() } // Encodes token if any, otherwise None fn stringify(lex: &mut Lexer<Token>) -> Option<String> { Some(lex.slice().parse::<String>().ok()?) } fn stringify_co...
/** * ジェネリクスは関数やデータ型を任意の型に対して動作するように一般化するときに使える仕組み。 * ジェネリクスを利用することで、何度も同じような関数や、データ型の定義をしなくてすむ。 * fn 関数名<型パラメータ, ...>(引数) -> 返り値の型 { * 関数本体 * } * 型パラメータとして指定したものは、引数と返り値の両方で使える。 */ // 任意の型の引数を2つ取り、タプルを返す関数を定義して使う fn pair<T, S>(t: T, s: S) -> (T, S) { (t, s) } fn main(){ // T = i32, S = f64で呼び出す。 ...
use super::expression::{Expression, OperatorKind}; /// 式をパースしてExpressionで表現した形にする /// /// # Params /// - expr (&str) : 式 /// /// # Return /// - Expression : Expressionで表現された式 /// /// # Examples /// ``` /// use expr_executor::parser::parse::parse; /// parse("1").calc(); // -> 1 /// ``` pub fn parse(expr: &str) -> Expre...
#![allow(non_camel_case_types)] use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage, MOCK_CONTRACT_ADDR}; use cosmwasm_std::{from_slice, to_binary, Api, Coin, Empty, Extern, HumanAddr, Querier, QuerierResult, QueryRequest, SystemError, Uint128, W...
pub mod point; pub mod line; pub mod triangle; pub mod shape;
//! Text Input style #![allow(clippy::module_name_repetitions)] use iced::widget::text_input; use iced::widget::text_input::Appearance; use iced::{Background, Color}; use crate::gui::styles::style_constants::get_alpha_round_borders; use crate::{get_colors, StyleType}; #[derive(Clone, Copy, Default)] pub enum TextIn...
use bevy_core::Byteable; use bevy_ecs::reflect::ReflectComponent; use bevy_reflect::Reflect; use bevy_render::{ camera::{CameraProjection, PerspectiveProjection}, color::Color, }; use bevy_transform::components::GlobalTransform; use std::ops::Range; /// A point light #[derive(Debug, Reflect)] #[reflect(Compone...
//! This example demonstrates using the [`Disable`] [`TableOption`] to remove specific //! cell data from a [`Table`] display. //! //! * ⚠️ Using [`Disable`] in combination with other [`Style`] customizations may yield unexpected results. //! It is safest to use [`Disable`] last in a chain of alterations. use tabled::...
extern crate lalrpop; extern crate regex; use regex::Regex; use std::collections::HashSet; use std::env; use std::fs::File; use std::io::{prelude::*, BufReader}; use std::path::Path; fn main() { extract_token_names("src/parser.lalrpop").unwrap(); lalrpop::Configuration::new() .emit_rerun_directives(tr...
pub mod kernel; pub mod prior;
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - control register"] pub cr: CR, _reserved1: [u8; 0x04], #[doc = "0x08 - device configuration register"] pub dcr1: DCR1, #[doc = "0x0c - device configuration register 2"] pub dcr2: DCR2, #[doc = "0x10 - device...
#![allow(clippy::too_many_arguments, clippy::unnecessary_mut_passed)] #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_core::crypto::KeyTypeId; use sp_runtime::ConsensusEngineId; use sp_std::vec::Vec; pub const KEY_TYPE: KeyType...
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use crate::ops; use crate::state::State; use crate::worker::Worker; use deno_core; use deno_core::ErrBox; use deno_core::StartupData; use futures::future::FutureExt; use std::future::Future; use std::ops::Deref; use std::ops::DerefMut; use std::...
use std::fs::File; use std::io::prelude::*; use std::iter::Iterator; #[derive(Debug)] struct Node { children: Vec<Box<Node>>, metadata: Vec<i32>, } impl Node { fn new(children: Vec<Box<Node>>, metadata: Vec<i32>) -> Node { Node { children, metadata } } fn from(values: &[i32]) -> Self { ...
//! The RFC 959 Store File Uniquely (`STOU`) command use crate::server::chancomms::DataChanCmd; use crate::{ auth::UserDetail, server::controlchan::{ error::ControlChanError, handler::{CommandContext, CommandHandler}, Reply, ReplyCode, }, storage::{Metadata, StorageBackend}, }; ...
use header::HdrVal; /// Parses a comma delimited string into each individual value. pub struct CommaDelimited<'a> { inner: &'a HdrVal, } impl<'a> CommaDelimited<'a> { /// Return a new comma delimited parser pub fn new(inner: &'a HdrVal) -> Self { CommaDelimited { inner, } }...
use slog::Drain; pub fn create_logger() -> slog::Logger { let drain = slog_json::Json::new(std::io::stdout()) .add_default_keys() .build() .fuse(); let drain = slog_async::Async::new(drain).build().fuse(); slog::Logger::root(drain, o!()) }
use crate::bytecode::{CallstackFrame, CallstackItem, VirtualMachine}; use crate::error::{Result, RuntimeError}; use crate::scm::Scm; #[derive(Debug)] pub struct Continuation { pub value_stack: Vec<Scm>, pub call_stack: Vec<CallstackItem>, pub exception_handler: Scm, } #[derive(Debug)] pub struct ExitProce...
use serde::{Deserialize, Serialize}; use validator::Validate; #[derive(Clone, Deserialize, Validate)] pub struct FormLogin { #[validate(email(message = "Invalid email address"))] pub email: String, pub password: String, } #[derive(Serialize, Deserialize)] pub struct ResultToken { pub success: bool, ...
use std::{sync::atomic::{AtomicBool, Ordering, AtomicUsize}, thread::{self, spawn}, cell::UnsafeCell}; const UNLOCKED: bool = true; const LOCKED: bool = false; struct Mutex<T> { locked: AtomicBool, v: UnsafeCell<T> } unsafe impl<T> Sync for Mutex<T> where T: Send {} impl<T> Mutex<T> { pub fn new(v: T) ...
#[cfg(unix)] mod cmsg; mod proto; mod socket; #[cfg(unix)] mod unix; pub use proto::{EcnCodepoint, RecvMeta, SocketType, Transmit, UdpCapabilities}; pub use socket::UdpSocket; /// Number of UDP packets to send/receive at a time when using sendmmsg/recvmmsg. pub const BATCH_SIZE: usize = { if cfg!(target_os = "lin...
use std::ops::{Deref, DerefMut}; use std::rand::Rng; use std::rand; use std::any::TypeId; use ship::{Ship, ShipRef}; use module; use module::{IModule, EngineModule, ProjectileWeaponModule, ShieldModule}; pub fn run_ai(ship: &mut Ship, enemy_ships: &Vec<ShipRef>) { // Random number generater let mut rng = rand...
use std::fmt; use std::thread; use rodio::{Decoder, OutputStream, Sink}; use serde::{Deserialize, Serialize}; use crate::notifications::types::sound::Sound::{Gulp, Pop, Swhoosh}; use crate::translations::translations::none_translation; use crate::Language; /// Enum representing the possible notification sounds. #[de...
#![feature(globs)] extern crate terminal; extern crate libc; extern crate serialize; extern crate collections; extern crate getopts; use getopts::{reqopt,getopts}; use std::os; use std::io::IoResult; use std::io::EndOfFile; use terminal::{Screen,Vte,ScreenError}; use terminal::c_bits::libtsm::*; use libc::{c_uint,c_vo...
/*! This crate is a port of [Haskell's QuickCheck](https://hackage.haskell.org/package/QuickCheck). For detailed examples, please see the [README](https://github.com/BurntSushi/quickcheck). # Compatibility In general, this crate considers the `Arbitrary` implementations provided as implementation details. Strategies...
use super::CPU; extern crate rand; use rand::{ Rng, SeedableRng }; use rand::rngs::StdRng; use std::mem::transmute; impl CPU { pub(super) fn random(&mut self, x: usize, value: u8) { let seeds: [u8; 32] = unsafe { transmute::<[u64; 4], [u8; 32]>(self.seed) }; let mut rng: StdRng = SeedableRng::fro...
use std::{ fmt::Debug, ops::{Deref, DerefMut}, }; use crate::util::impl_deref_wrapped; use crate::util::{impl_from_repeated, impl_from_repeated_copy}; use protocol::metadata::Restriction as RestrictionMessage; use librespot_protocol as protocol; pub use protocol::metadata::restriction::Catalogue as Restricti...
#[doc = "Reader of register CC_BUFF"] pub type R = crate::R<u32, super::CC_BUFF>; #[doc = "Writer for register CC_BUFF"] pub type W = crate::W<u32, super::CC_BUFF>; #[doc = "Register CC_BUFF `reset()`'s with value 0xffff_ffff"] impl crate::ResetValue for super::CC_BUFF { type Type = u32; #[inline(always)] f...
mod cache; mod error; mod fetching; mod parsing; mod types; #[macro_use] extern crate quick_error; use std::{ collections::{HashMap, VecDeque}, io::{BufReader, Cursor}, path::{Path, PathBuf}, sync::Arc, }; pub use bytes::Bytes; use quick_error::ResultExt; use rand::prelude::*; pub use rodio::{queue::...
pub mod interp;
use embedded_nal::{AddrType, Dns, IpAddr, SocketAddr, TcpClientStack}; use native_tls::{TlsConnector, TlsStream}; use std::io::{Read, Write}; use std::marker::PhantomData; use std::net::TcpStream; use dns_lookup::{lookup_addr, lookup_host}; /// An std::io::Error compatible error type returned when an operation is req...
use super::responses::StoreTransactionsResponse; use crate::Result; use reqwest::Client; /// Store transactions into the local storage. /// The trytes to be used for this call are /// returned by attachToTangle. pub async fn store_transactions( client: Client, uri: String, trytes: Vec<String>, ) -> Result<S...
/* * 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. */ #![feature(ffi_returns_twice)] #![cfg_attr(test, feature(bench_black_box))] //! This library provi...
fn main() { extern crate minisign; use minisign::{KeyPair, PublicKeyBox, SecretKeyBox, SignatureBox}; use std::io::Cursor; // Generate and return a new key pair // The key is encrypted using a password. // If `None` is given, the password will be asked for interactively. let KeyPair { pk, s...
use std::thread::spawn; use futures::{Future, Stream}; use tokio_core::reactor::Core; use netlink_packet_route::link::nlas::LinkNla; use rtnetlink::new_connection; fn main() { let args: Vec<String> = std::env::args().collect(); if args.len() != 2 { return usage(); } let link_name = &args[1]; ...
// ****BASIC IMPLEMENTATION**** // fn main() { // let width1 = 30; // let height1 = 50; // println!( // "The area of the rectange is {} square pixels.", // area(width1, height1) // ); // } // fn area(width: u32, height: u32) -> u32 { // width * height // } // ****WITH TUPLES****...
extern crate dmbc; extern crate exonum; extern crate exonum_testkit; extern crate hyper; extern crate iron; extern crate iron_test; extern crate mount; extern crate serde_json; pub mod dmbc_testkit; use dmbc_testkit::{DmbcTestApiBuilder, DmbcTestKitApi}; use exonum::crypto; use exonum::messages::Message; use hyper::s...
use super::DynamicAssetImpl; use rustzx_core::{ error::IoError, host::{BufferCursor, LoadableAsset, SeekFrom, SeekableAsset}, }; use std::{ io::{self, Read}, vec, vec::Vec, }; use flate2::read::GzDecoder; pub struct GzipAsset { buffer: BufferCursor<Vec<u8>>, } impl GzipAsset { pub fn ne...
#![deny(clippy::all)] #![allow(clippy::new_ret_no_self)] #![allow(clippy::useless_attribute)] #[macro_use] extern crate bitflags; #[macro_use] extern crate err_derive; #[macro_use] extern crate log; #[macro_use] extern crate num_derive; mod checksum; mod client; mod daemon; mod external; mod logging; mod misc; mod re...
use std::{marker::PhantomData, ops::Add}; /// A value representing the length of a dimension of a matrix. pub trait Dim: Copy + 'static { fn dim(&self) -> usize; } #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Fixed<const N: usize>; impl<const N: usize> Dim for Fixed<N> { #[inline] fn dim(&self...
use crate::datastructures::{Entailment, Op::AtomNeq, Pure::And, Rule}; /// Π ∧ E!=E | Σ |- Π' | Σ' pub struct Contradiction; impl Rule for Contradiction { fn predicate(&self, _goal: &Entailment) -> bool { true } fn premisses(&self, goal: Entailment) -> Option<Vec<Entailment>> { ...
//! Color space transformations. //! //! # Examples //! ``` //! # use lcms_prime::*; //! # fn create_aces_cg_profile_somehow() -> Profile { //! # Profile::new_rgb( //! # CIExyY { x: 0.32168, y: 0.33767, Y: 1. }, //! # CIExyYTriple { //! # red: CIExyY { x: 0.713, y: 0.293, Y: 1. }, //! # ...
use crate::{NodeJsInvokerBuildpack, NodeJsInvokerBuildpackError}; use libcnb::build::BuildContext; use libcnb::data::buildpack::StackId; use libcnb::data::layer_content_metadata::LayerTypes; use libcnb::layer::{ExistingLayerStrategy, Layer, LayerData, LayerResult, LayerResultBuilder}; use libcnb::Buildpack; use libhero...
use crate::compiler::constants::ConstantMap; use crate::core::instructions::DenseInstruction; use crate::rvals::Result; use serde::{Deserialize, Serialize}; pub struct ProgramBuilder(Vec<Vec<DenseInstruction>>); impl ProgramBuilder { pub fn new() -> Self { ProgramBuilder(Vec::new()) } pub fn push...
#![feature(into_cow, associated_type_defaults)] #[macro_use] extern crate log; pub mod sqlsyntax; pub mod tempdb; mod byteutils; mod columnvalueops; mod databaseinfo; mod databasestorage; mod identifier; mod queryplan; mod types;
#[doc(hidden)] // Macro dependencies pub mod private { pub use paste::item; pub use silkenweb_dom::{ tag, Attribute, Builder, DomElement, Effect, Element, ElementBuilder, Text, }; pub use wasm_bindgen::JsCast; pub use web_sys as dom; } /// Define an html element. /// /// This will define a ...
use std::fs; fn main() { let contents = fs::read_to_string("input.txt").expect("error loading file"); let numbers = contents .lines() .filter_map(|s| s .parse::<i32>() .ok() ).collect::<Vec<_>>(); for (i, x) in numbers.iter().enumerate() { let iter2 = numbers.iter().ski...
// 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 futures::task; use futures::{Async, Future, Poll}; use std::io; use std::net::{self, SocketAddr}; use std::ops::Deref; use net::{set_nonblock, Evented...
//! Defines common interfaces for interacting with statistical distributions and provides //! concrete implementations for a variety of distributions. use rand::Rng; pub use self::bernoulli::Bernoulli; pub use self::beta::Beta; pub use self::binomial::Binomial; pub use self::chi::Chi; pub use self::chi_squared::ChiSq...
#[doc = "Register `RTSR1` reader"] pub type R = crate::R<RTSR1_SPEC>; #[doc = "Register `RTSR1` writer"] pub type W = crate::W<RTSR1_SPEC>; #[doc = "Field `RT0` reader - Rising trigger event configuration of line 0"] pub type RT0_R = crate::BitReader<RT0_A>; #[doc = "Rising trigger event configuration of line 0\n\nValu...
use crate::sk::*; use napi::*; #[js_function(1)] fn register(ctx: CallContext) -> Result<JsUndefined> { let this = ctx.this_unchecked::<JsObject>(); let font_collection = ctx.env.unwrap::<FontCollection>(&this)?; let path = ctx.get::<JsString>(0)?.into_utf8()?; font_collection.register(path.as_str()?); ctx.e...
use crate::history::types::HistoryEvent; pub trait EventProcessor { fn yield_next_event(&mut self) -> Option<HistoryEvent>; }
use structopt::clap::AppSettings; use structopt::StructOpt; mod claims; use claims::ClaimsCli; mod lattice; use lattice::LatticeCli; mod keys; use keys::KeysCli; mod par; use par::ParCli; /// This renders appropriately with escape characters const ASCII: &str = " __ ___ ___ __ _ _ _ __...
use super::traits::{Allocate, Update}; #[derive(Debug, Copy, Clone)] pub enum Attribute { Index, Position, Color, Texcoord, Normal, } impl Default for Attribute { fn default() -> Self { Attribute::Index } } #[derive(Default, Debug)] pub struct BufferObject { id: gl::t...
extern crate serde; extern crate serde_json; use uuid::Uuid; #[derive(Serialize, Deserialize, Default, Queryable)] pub struct UserGroup { group_id: Uuid, user_id: Uuid, organization_id: Uuid, role: String }
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Control register 1"] pub cr1: CR1, #[doc = "0x04 - Control register 2"] pub cr2: CR2, #[doc = "0x08 - Own address register 1"] pub oar1: OAR1, #[doc = "0x0c - Own address register 2"] pub oar2: OAR2, #[d...
extern crate serde; extern crate serde_derive; extern crate serde_json; /* https://query1.finance.yahoo.com/v7/finance/spark?symbols=%5EGSPC&range=1d https://query1.finance.yahoo.com/v7/finance/spark?symbols=BTCUSD%3DX&range=1d https://query1.finance.yahoo.com/v1/finance/screener/instrument/earnings/fields?lang=en-US...
#![allow(dead_code)] pub type FeatureSet<'a> = &'a [Ext]; #[repr(u8)] #[derive(Copy,Clone,Debug,PartialEq,Eq)] pub enum Ext { //Default things X86, X64, //Intel EDX values CPUID EAX=1 X87, TSC, CX8, SEP, CMOV, CLFSH, MMX, FXSR, SSE, SSE2, //Intel ECX values CPUID EAX=1 SSE3, PCLMULQDQ, MONITOR...
fn main() { //iterate over range for i in 0..5 { println!("{}", i); } //Iterate printing count and number of times loop has executed, "count" is the enumerate value for (count, variable) in (7..10).enumerate() { println!("count = {}, variable = {}", count, variable); } ...
use super::state::task_log::State; use crate::prelude::*; use delicate_utils_task_log::EventType; pub(crate) enum IdentityType { Mobile = 1, Email = 2, Username = 3, } impl From<EventType> for State { fn from(value: EventType) -> Self { match value { EventType::TaskPerform => State...
use proc_macro2::TokenStream; use quote::quote; use syn::parse::{ParseStream, Parser, Result}; use syn::{DeriveInput, Ident, LitStr, Token}; use crate::linker; pub fn expand(input: DeriveInput) -> TokenStream { let mut linkme_ident = None; let mut linkme_macro = None; for attr in input.attrs { if ...
/* * 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 */ /// CancelDowntimesByScopeRequest : Cancel downtimes according to scope. #[derive(Clone, Debug, Parti...
/// Command-line interface for managing the root certificate. pub mod certificate; /// Command-line interface for hosting a server. pub mod serve; use std::path::{Path, PathBuf}; use structopt::StructOpt; use crate::{server::Server, Configuration, CustomServer}; /// Command-line interface for `bonsaidb server`. #[d...
use x86_64::structures::gdt::*; use x86_64::structures::tss::*; use x86_64::VirtAddr; use x86_64::instructions::segmentation::set_cs; use x86_64::instructions::tables::load_tss; use lazy_static::lazy_static; use crate::kernel::InitResult; pub const DOUBLE_FAULT_IST_INDEX : u16 = 0; pub fn init() -> InitResult<()> { ...
use std::io::{Write}; use std::collections::HashMap; use parser::{Ast, Block}; use super::Generator; use super::ast::{Code, Param}; use super::ast::Statement::{Var, Expr}; use super::ast::Expression::{Call, Name, Str, Attr, Function, List}; use super::ast::Expression::{AssignAttr}; fn string_to_ident(src: &str) -> ...
#![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 OperationList { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub value: Vec<OperationResponse>,...