text
stringlengths
8
4.13M
use crate::utils::is_all_same; use fonttools::glyf; use fonttools::glyf::contourutils::{kurbo_contour_to_glyf_contour, remove_implied_oncurves}; use fonttools::gvar::DeltaSet; use fonttools::gvar::GlyphVariationData; use fonttools::otvar::VariationModel; use kurbo::{BezPath, PathEl, PathSeg}; use std::collections::BTre...
mod flag_pty; mod signal_handling;
#[doc = "Register `MMCTIMR` reader"] pub type R = crate::R<MMCTIMR_SPEC>; #[doc = "Register `MMCTIMR` writer"] pub type W = crate::W<MMCTIMR_SPEC>; #[doc = "Field `TGFSCM` reader - Transmitted good frames single collision mask"] pub type TGFSCM_R = crate::BitReader; #[doc = "Field `TGFSCM` writer - Transmitted good fra...
pub mod value; pub use value::*; mod rvalue; pub use rvalue::*; mod array; pub use array::*; mod hash; pub use hash::*;
use std::fs; pub fn run(filename: &str) { let input = fs::read_to_string(filename).expect("Something went wrong reading the file"); let k: f32 = parse_number(&input, 0); let m: f32 = parse_number(&input, 1); let n: f32 = parse_number(&input, 2); let x = k + m + n; let p_dominant = 1.0 -...
use askama::Template; use diesel::SqliteConnection; use rocket::response::content; use crate::{ForumError, storage::{crud, db::{establish_connection, models::{Board, JoinedPost, Post, Thread}}}}; #[derive(Debug)] pub struct ThreadRow { id: i32, thread: Thread, first_post: JoinedPost, } #[get("/board/<boa...
use std::fs; use std::env; use std::io::Read; use anyhow::{Result, anyhow}; use feather_protocol_spec::Protocol; fn main() -> Result<()> { verify()?; Ok(()) } fn verify() -> Result<()> { let path = env::args() .skip(1) .next() .ok_or(anyhow!("Specify a file path to verify."))?; ...
/* * 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 restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * s...
use reqwest::{ header::{HeaderMap, HeaderValue}, Client, Error, Method, Response, }; /// QueryBuilder struct #[derive(Clone)] pub struct Builder { method: Method, url: String, schema: Option<String>, // Need this to allow access from `filter.rs` pub(crate) queries: Vec<(String, String)>, ...
// 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 ...
// q0105_construct_binary_tree_from_preorder_and_inorder_traversal struct Solution; use crate::util::TreeNode; use std::cell::RefCell; use std::rc::Rc; impl Solution { pub fn build_tree(preorder: Vec<i32>, inorder: Vec<i32>) -> Option<Rc<RefCell<TreeNode>>> { Solution::build_tree1(&preorder, &inorder) ...
use std::{ collections::HashMap, fs, hash::{Hash, Hasher}, ops::{Deref, DerefMut}, }; use anyhow::{bail, Context as _, Result}; use dotenv::dotenv; use futures::prelude::*; use rspotify::{ model::{ idtypes::{Playlist, User}, FullTrack, Id, IdBuf, PlayableItem, }, prelude::*,...
use serde::Deserialize; use serde::Serialize; use std::collections::HashMap; #[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Bridgechain { pub public_key: String, pub name: String, pub seed_nodes: Vec<String>, pub genesis_hash: String, ...
use std::env; use std::path::PathBuf; use std::process::Command; use std::str::from_utf8; use bindgen; const PROS_OMNIBUS: &str = "pros_omnibus.h"; const RS_FILE_OUT: &str = "pros_raw_gen.rs"; fn main() { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let cc = Command::new("make") .arg(...
#[derive(Eq, PartialEq, Clone, Debug)] struct FactInv { fact: Vec<usize>, inv: Vec<usize>, factinv: Vec<usize>, m: usize, } #[allow(dead_code)] impl FactInv { fn new(n: usize, m: usize) -> Self { let mut fact: Vec<usize> = vec![0; n + 1]; fact[0] = 1; for i in 1..n+1 { ...
use sudo_test::{Command, Env}; use crate::{Result, USERNAME}; #[test] fn other_user_does_not_exist() -> Result<()> { let env = Env("").build()?; let output = Command::new("sudo") .args(["-l", "-U", USERNAME]) .output(&env)?; eprintln!("{}", output.stderr()); assert!(!output.status()...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - EXTI rising trigger selection register"] pub rtsr1: RTSR1, #[doc = "0x04 - EXTI falling trigger selection register 1"] pub ftsr1: FTSR1, #[doc = "0x08 - EXTI software interrupt event register 1"] pub swier1: SWIER1,...
use anyhow::{anyhow, Context, Error}; use std::fs::File; use std::io::Read; pub mod key_map; #[derive(Debug)] pub struct PublicKey { path: String, data: Vec<u8>, name: String, } #[derive(Debug)] pub struct PrivateKey { path: String, data: Vec<u8>, name: String, } #[derive(Debug)] pub struct ...
extern crate arboard; use arboard::Clipboard; fn main() { let mut ctx = Clipboard::new().unwrap(); let img = ctx.get_image().unwrap(); println!("Image data is:\n{:?}", img.bytes); }
#![allow(unused_mut)] #![allow(unreachable_code)] #![allow(unused_variables)] #![feature(arbitrary_self_types)] use arc_runtime::data::channels::local::multicast::*; use arc_runtime::prelude::*; #[derive(ComponentDefinition)] struct DoThing { ctx: ComponentContext<Self>, a: Pullable<i32>, b: Pullable<i32>,...
pub mod api; pub mod builder; pub mod constants; pub mod data; pub mod drawwable;
// Copyright © 2019 Cormac O'Brien. // // 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 restriction, including without limitation the rights // to use, copy, modify, merge, publish,...
// (C) Copyright 2019-2020 Hewlett Packard Enterprise Development LP use std::collections::{HashMap, HashSet}; use std::fmt; use std::iter::FromIterator; use lazy_static::lazy_static; use regex::Regex; use crate::{Dockerfile, Span, Splicer}; /// A parsed docker image reference /// /// The `Display` impl may be used...
#[macro_use] extern crate lazy_static; extern crate itertools; extern crate regex; extern crate chrono; pub type Error = Box<std::error::Error>; mod util; pub use util::*; mod constants; mod day01; mod day02; mod day03; mod day04; mod day05; fn main() { run_all(); } pub fn run_all() { let runners: Vec<(us...
#[macro_use] extern crate nom; use nom::{line_ending,space,digit}; use nom::types::CompleteStr; const INPUT: &'static str = include_str!("day3.txt"); named!(integer<CompleteStr, u64>, map!(digit, |s| s.parse::<u64>().unwrap()) ); named!(three_triangles<CompleteStr, Vec<(u64, u64, u64)>>, do_parse!( ...
pub mod cert; pub mod error; pub use error::RefreshError; pub use cert::{ CertificateConfig, RusticaCert, RusticaServer, Signatory, };
const GSI_DEM_PNG_SCALING_FACTOR: f64 = 1.0e-2; #[test] fn decode() { let from_png = load_png(); let from_txt = load_txt(); let pairs = from_png.iter().zip(from_txt.iter()); for (actual, expected) in pairs { assert_eq!(actual.is_nan(), expected.is_nan()); if !actual.is_nan() { assert_eq!(actual.round(),...
#[doc = "Register `MACCR` reader"] pub type R = crate::R<MACCR_SPEC>; #[doc = "Register `MACCR` writer"] pub type W = crate::W<MACCR_SPEC>; #[doc = "Field `RE` reader - Receiver enable"] pub type RE_R = crate::BitReader<RE_A>; #[doc = "Receiver enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] ...
// 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 eapol; use failure; use key::exchange::Key; pub mod esssa; #[cfg(test)] pub mod test_util; #[derive(Debug)] pub enum Role { Authenticator, Su...
//! Run Sudoku solver //! Usage: //! //! ```bash //! cargo run --release --example sudoku 300080900000340000008005600500104070002009010003000040005001200000000000070008090 //! ``` use dancing_links::{ latin_square, sudoku::{Possibility, Sudoku}, ExactCover, }; fn print_solution(problem: &str, solution: &V...
use std::collections::HashSet; use std::fmt; #[cfg(test)] mod lib_test; #[derive(Clone, PartialEq)] pub enum Orientation { Up, Front, Right, } // Direction = Orientation + coef (+1 or -1) #[derive(Clone)] pub struct Direction(Orientation, isize); impl Direction { fn to_string(&self) -> &str { ...
use core::ptr::{read_volatile, write_volatile}; const UARTDR:u32 = 0x000; // const UARTRSR:u32 = 0x004; // const UARTECR:u32 = 0x004; const UARTFR:u32 = 0x018; pub struct PL011 { pub base: u32 } bitflags! { flags PL011Flags: u32 { const RING_INDICATOR = 0b10000000, // RI const TRANSMIT_FIFO_EMPTY = 0b010...
use crate::log_core::LogShape; use std::io::Write; use std::fmt::Arguments; use std::io; use clucolor::colors::*; use clucolor::cluColor; type PanicColor = BrightRed; type ErrColor = BrightRed; type WarningColor = BrightYellow; type InfoColor = BrightCyan; //type TraceColor = BrightYellow; type UnkColor = Bri...
use crate::{ account::model::{AccountType, CompactAccount}, post::model::CompactPost, }; pub fn get_post_url(post: &CompactPost, poster: &CompactAccount) -> String { let where_is = match poster.r#type { AccountType::Company { .. } => "at", _ => "by", }; format!( "/jobs/{}_{}_{}_{}", post.slug...
use std::vec::Vec; pub fn run() { let mut numbers:Vec<i32>=vec![10,7,100,87,99,65,2,1,34,0]; numbers.sort(); println!("Assending order sort: {:?}", numbers); numbers.reverse(); println!("Desending order sort: {:?}", numbers); }
#![doc(hidden)] pub(crate) fn to_hex(input: &[u8]) -> String { const CHARS: &[u8] = b"0123456789abcdef"; let mut result = String::with_capacity(input.len() * 2); for &byte in input { result.push(CHARS[(byte >> 4) as usize] as char); result.push(CHARS[(byte & 0xf) as usize] as char); } ...
//! Traits for MIPS CP0 registers macro_rules! register_r { ($reg_id: expr, $reg_sel: expr) => { #[inline] unsafe fn __read() -> u32 { let reg: u32; llvm_asm!("mfc0 $0, $$$1, $2" : "=r"(reg) : "i"($reg_id), "i"($reg_sel) ); ...
//! Brute forcing simple passwords extern crate crypto; use self::crypto::md5::Md5; use self::crypto::digest::Digest; pub fn hash_for_suffix(door: &str, hasher: &mut Md5, suffix: i64) -> String { hasher.reset(); hasher.input_str(door); hasher.input_str(&suffix.to_string()); hasher.result_str() } pub...
mod discovery; mod model; mod prometheus_scrape; mod scraper; use std::collections::{HashMap, HashSet, VecDeque}; use clickhouse_rs::{row, types::Value, Block, Client, Options, Pool}; use structopt::StructOpt; use tokio::sync::broadcast; use tracing_subscriber; use discovery::kube::KubeDiscovery; #[macro_use] exter...
// Copyright 2018 Future Science Research Inc. // // 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 restriction, including without limitation the rights // to use, copy, modify, merg...
#[doc = "Register `GCR` reader"] pub type R = crate::R<GCR_SPEC>; #[doc = "Register `GCR` writer"] pub type W = crate::W<GCR_SPEC>; #[doc = "Field `LTDCEN` reader - LCD-TFT controller enable bit"] pub type LTDCEN_R = crate::BitReader<LTDCEN_A>; #[doc = "LCD-TFT controller enable bit\n\nValue on reset: 0"] #[derive(Clon...
extern crate clap; use clap::{App, Arg, SubCommand, AppSettings, ErrorKind}; #[test] fn sub_command_negate_required() { App::new("sub_command_negate") .setting(AppSettings::SubcommandsNegateReqs) .arg(Arg::with_name("test") .required(true) .index(1)) .subcomma...
use std::fs; use std::path::{Path, PathBuf}; use std::sync::{ Arc, Weak, atomic::{ AtomicU32, Ordering }, }; use std::collections::BTreeMap; use parking_lot::{ Mutex, RwLock }; use libloading::{ Library, Symbol, }; use serenity::prelude::TypeMapKey...
fn repr(num: u32) -> char { let ascii = if num < 26 { 'A' as u32 + num } else if num < 52 { 'a' as u32 + num - 26 } else if num < 62 { '0' as u32 + num - 52 } else if num == 62 { '+' as u32 } else if num == 63 { '/' as u32 } else { unreachable!("Ca...
/* * 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 */ /// SyntheticsTestMonitorStatus : The status of your Synthetic monitor. * `O` for not triggered * `1` fo...
//! The blocking implementation of the client. use crate::client::Client as AsyncClient; use crate::client::ClientMode; use tokio::runtime::Runtime; /// A wrapper over the async client. pub struct Client { inner_client: AsyncClient, runtime: Runtime, } impl Client { /// Set the mode for the client. pu...
#[doc = "Reader of register IC_TX_TL"] pub type R = crate::R<u32, super::IC_TX_TL>; #[doc = "Writer for register IC_TX_TL"] pub type W = crate::W<u32, super::IC_TX_TL>; #[doc = "Register IC_TX_TL `reset()`'s with value 0"] impl crate::ResetValue for super::IC_TX_TL { type Type = u32; #[inline(always)] fn re...
use std::fs; use std::error::Error; use std::io; use std::io::stdin; use std::collections::VecDeque; use std::fmt; #[derive(Debug)] struct ExecError {} impl fmt::Display for ExecError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", "Execution error") } } impl Error for ExecErr...
#[derive(Debug, Clone)] struct Point { x: f64, y: f64, } #[derive(Debug, Clone)] struct Polygon(Vec<Point>); fn is_inside(p: &Point, cp1: &Point, cp2: &Point) -> bool { (cp2.x - cp1.x) * (p.y - cp1.y) > (cp2.y - cp1.y) * (p.x - cp1.x) } fn compute_intersection(cp1: &Point, cp2: &Point, s: &Point, e: &...
extern crate mynumber; use mynumber::individual; #[test] fn verify_with_shorter_individual_number_returns_error() { let number = "12345"; assert!(individual::verify(number).is_err()); } #[test] fn verify_with_longer_individual_number_returns_error() { let number = "12345678901234567890"; assert!(indi...
extern crate cascading_ui; extern crate wasm_bindgen_test; use self::{ cascading_ui::{test_header, test_setup}, wasm_bindgen_test::wasm_bindgen_test, }; test_header!(); #[wasm_bindgen_test] fn empty() { test_setup! {} assert_eq!(root.inner_html(), ""); } #[wasm_bindgen_test] fn element() { test_setup! { thing...
//! Board-specific clock configuration use e310x_hal::{ e310x::{PRCI, AONCLK}, clock::{Clocks, PrciExt, AonExt}, time::Hertz, }; #[cfg(any(feature = "board-hifive1", feature = "board-hifive1-revb"))] /// Configures clock generation system. /// /// For HiFive1 and HiFive1 Rev B boards external oscillators ...
use chrono::Local; use std::io; use std::io::Write; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; /// **Colors:** /// `Warning` -> *Yellow* /// `Error` -> *Red* /// `Info` -> *Blue* pub enum Loggers { Warning, Error, Info, } fn format_date_time() -> String { let date_time...
use std::io; use std::sync::Arc; use futures::{future, Future}; use futures::future::BoxFuture; use hyper::Error as HyperError; use hyper::{Method, StatusCode}; use hyper::server::{Http, Service, NewService, Response}; use hyper::server::Request; use typemap::{TypeMap, Key}; use unsafe_any::UnsafeAny; use context::Co...
use crate::frontend::located::Located; use super::internal_ast::{ASTBinOp, ASTExpression}; impl Located<ASTExpression> { pub fn add_using_precedence(self, op2: ASTBinOp, other: Located<ASTExpression>) -> Located<ASTExpression> { let loc1 = self.location(); let loc2 = other.location(); let ...
use std::time::Duration; use super::options::*; pub fn do_command<T, I, E>(radio: T, operation: Operation) -> Result<(), E> where T: radio::Transmit<Error = E> + radio::Power<Error = E> + radio::Receive<Info = I, Error = E> + radio::Rssi<Error = E> + radio::Power<Error = E>, I:...
#[aoc_generator(day13)] pub fn input_generator(input: &str) -> (usize, Vec<i64>) { let min_timestamp = input.lines().nth(0).unwrap().parse::<usize>().unwrap(); let mut bus_lines = Vec::new(); for l in input.lines().nth(1).unwrap().split(",") { match l { "x" => bus_lines.push(0), ...
use super::*; use crate::helpers::generate::create_test_vehicle_type; use vrp_pragmatic::format::problem::{MatrixProfile, Plan}; #[test] fn can_generate_fleet_of_specific_size() { let prototype = Problem { plan: Plan { jobs: vec![], relations: None }, fleet: Fleet { vehicles: vec![creat...
use quote::ToTokens; use syn::{ bracketed, parse::{Parse, ParseStream}, punctuated::Punctuated, token::{self}, ExprLit, Ident, Lit, LitInt, LitStr, Result, Token, }; use tabled::{ settings::{Alignment, Margin, Padding, Style}, tables::{PoolTable, TableValue}, }; struct MatrixRow { #[all...
pub fn is_valid(id_string: &str) -> bool { let cleaned = id_string.replace(" ", ""); if cleaned.len() <= 1 || cleaned.chars().any(|ch| !ch.is_digit(10)) { return false; } let digits = cleaned.chars() .rev() .map(|ch| ch.to_digit(10).unwrap()) ...
use crate::{NormalizedString, OffsetReferential, Offsets, Result}; /// Wrapper for a subpart of a `NormalizedString`. /// /// This SubString contains the underlying `NormalizedString` as well as its offsets /// in the original string. These offsets are in the `original` referential #[derive(Debug)] pub struct SubStrin...
use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn calc(data: Vec<i32>) -> i32{ let mut sum: i32 = 0; for i in 0.. data.len() { sum=sum+data[i] } return sum; }
pub mod config; mod graphql; pub mod http; pub mod repositories; mod security;
#[derive(Debug, PartialEq, PartialOrd)] pub enum Comparison { Equal, Sublist, Superlist, Unequal, } pub fn sublist<T: std::fmt::Debug + std::clone::Clone + PartialEq>(_first_list: &[T], _second_list: &[T]) -> Comparison { let mut output: Comparison = Comparison::Unequal; if _first_list == _s...
use std::fmt; use rand::distributions::{Normal, IndependentSample}; use rand::{ThreadRng, Rng}; use ndarray::Array2; lazy_static! { static ref NORMAL: Normal = Normal::new(0.0, 1.0); } pub trait Consideration: fmt::Debug { fn gen_scores(&self, scores: &mut Array2<f64>, &mut ThreadRng, verbose: bool); } /////...
use proc_macro2::Span; use quote::quote_spanned; use syn::{self, Path}; /// The path to the `Default` trait to use in generated code. This should point to /// an export from the `serde_default` crate to work in both std and no_std cases. pub fn trait_path(span: Span) -> Path { syn::parse2(quote_spanned!(span=> ::s...
#[doc = "Reader of register CTLR"] pub type R = crate::R<u32, super::CTLR>; #[doc = "Writer for register CTLR"] pub type W = crate::W<u32, super::CTLR>; #[doc = "Register CTLR `reset()`'s with value 0"] impl crate::ResetValue for super::CTLR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
extern crate docopt; #[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_json; use std::env; use std::process::Command; use std::path::Path; use std::error::Error; use docopt::Docopt; use std::os::unix::net::UnixStream; use serde_json::value::Value; use std::io::Write; const USAGE: &'static 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 LedgerIdentityInformation { #[serde(rename = "ledgerId", default, skip_serializing_if = "Option::is_none")] ...
#[macro_use] extern crate quote; extern crate proc_macro; use proc_macro::TokenStream; use quote::ToTokens; use syn::{Data, DataEnum, DataStruct, Field, Fields, Ident, WhereClause}; #[proc_macro_derive(Random)] pub fn random(input: TokenStream) -> TokenStream { let input = proc_macro2::TokenStream::from(input); ...
pub fn raindrops(n: usize) -> String { let mut str_vec = vec![]; if n % 3 == 0 { str_vec.push("Pling"); } if n % 5 == 0 { str_vec.push("Plang"); } if n % 7 == 0 { str_vec.push("Plong"); } if str_vec.len() <= 0 { return n.to_string(); ...
use protoc_rust::{self, Args, Customize}; // When the project is built, this file will generate Rust files from // TensorFlow's ProtoBuf definitions. // Generated files are NOT commited, and written to src/tensorflow_protos. fn main() { protoc_rust::run(Args { out_dir: "src/tensorflow_protos", inp...
// Resource Records for the DNS Security Extensions // // defines the public key (DNSKEY), delegation signer (DS), resource record digital // signature (RRSIG), and authenticated denial of existence (NSEC) resource records. // // 2.1. DNSKEY RDATA Wire Format // https://tools.ietf.org/html/rfc4034#section-2.1 // //...
#[macro_use] extern crate serde_derive; extern crate helm_api; extern crate serde_json; mod concourse_api; use std::env::args; use std::collections::{ HashMap, }; use serde_json::Value; use concourse_api::{ CheckRequest, InRequest, InResponse, OutRequest, OutResponse, Version, }; use helm_...
//! **Spherical Cow**: *A high volume fraction sphere packing library*. //! //! # Usage //! //! First, add `spherical-cow` to the dependencies in your project's `Cargo.toml`. //! //! ```toml //! [dependencies] //! spherical-cow = "0.1" //! ``` //! //! If you'd like to enable serialization through `serde` add this line ...
use std::io; use futures::task::Context; use futures::task::Poll; use futures::AsyncRead; use pin_project_lite::pin_project; use std::pin::Pin; pin_project! { /// Intentionally return short reads, to test `AsyncRead` code. /// /// The `decider` iterator gets to decide how short a read should be. /// A...
use elasticsearch::auth::Credentials; use elasticsearch::http::request::JsonBody; use elasticsearch::http::transport::{SingleNodeConnectionPool, Transport, TransportBuilder}; use elasticsearch::http::StatusCode; use elasticsearch::indices::{IndicesCreateParts, IndicesExistsParts}; use elasticsearch::{BulkParts, Elastic...
fn eat_box_i32(boxed_i32: Box<i32>) { println!("Destroying box that contains {}", boxed_i32); } fn borrow_i32(borrowed_i32: &i32) { println!("This is is: {}", borrowed_i32) } fn main() { let boxed_i32 = Box::new(5_i32); let stacked_i32 = 6_i32; borrow_i32(&boxed_i32); borrow_i32(&stacked_i32)...
// reexport core macros. pub use oxygengine_core::{debug, error, info, log, profile_scope, warn}; #[cfg(feature = "user-interface")] pub use oxygengine_user_interface::{post_hooks, pre_hooks, unpack_named_slots, widget}; pub mod core { pub use oxygengine_core::*; } pub mod utils { pub use oxygengine_utils::*; ...
use crate::intcode::*; use image::ImageBuffer; use itertools::Itertools; use std::collections::HashMap; type Coordinate = (isize, isize); #[derive(Debug, PartialEq, Copy, Clone)] enum Color { Black, White, } impl Into<isize> for Color { fn into(self) -> isize { match self { Color::Black => 0, C...
// TODO use crate::pcs::{end_points_by_space, lab_to_xyz, xyz_to_lab}; use crate::profile::{Profile, USED_AS_INPUT, USED_AS_OUTPUT}; use crate::transform::Transform; use crate::virtuals::{create_lab2_profile_opt, create_lab4_profile_opt}; use crate::white_point::solve_matrix; use crate::{CIELab, ColorSpace, Intent, Pr...
/// Hook a hook is a web hook when one repository changed #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct Hook { pub active: Option<bool>, pub config: Option<std::collections::BTreeMap<String, String>>, pub created_at: Option<String>, pub events: Option<Vec<String>>, pub id: Opt...
use crate::{Block, Runtime, RuntimeCall}; use codec::{Compact, CompactLen, Encode}; use sp_api::HashT; use sp_runtime::traits::BlakeTwo256; use sp_std::iter::Peekable; use sp_std::prelude::*; use subspace_core_primitives::objects::{BlockObject, BlockObjectMapping}; use subspace_runtime_primitives::Hash; const MAX_OBJE...
#[test] fn test_all() { let t = trybuild::TestCases::new(); t.compile_fail("tests/compile-fail/datalog_*.rs"); }
use std::collections::LinkedList; fn replace(text: Vec<char>) -> LinkedList<char> { let mut new_text: LinkedList<char> = LinkedList::new(); let mut i = 0; //let mut location = i; //let mut offset = 0; let length = text.len(); //Initialize to not get garbage while i < length { //location = i + offset...
#![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] #[repr(C)] struct Struct_tm; #[repr(C)] struct Struct_stat; #[repr(C)] struct Struct_dirent; #[repr(C)] struct Struct_sockaddr; #[repr(C)] struct Struct_sockaddr_in; #[repr(C)] struct Struct_sockaddr_un; #[repr(C)] struct Str...
//! The default matrix data storage allocator. //! //! This will use stack-allocated buffers for matrices with dimensions known at compile-time, and //! heap-allocated buffers for matrices with at least one dimension unknown at compile-time. use std::mem; use std::ops::Mul; use typenum::Prod; use generic_array::Array...
use std::{fmt::Display}; #[derive(Eq, PartialEq, Copy, Clone)] enum Seat { Vacant, Occupied, Floor } #[derive(Copy, Clone)] enum AdjacencyMethod { Proximity, Sight } impl Display for Seat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let out = match self { ...
use super::super::{ program::TableTextureProgram, webgl::{WebGlF32Vbo, WebGlI16Ibo, WebGlRenderingContext}, ModelMatrix, }; use crate::{ block, random_id::U128Id, resource::{self, Data}, Color, }; use ndarray::Array2; pub struct TableTextureRenderer { polygon_vertexis_buffer: WebGlF32Vb...
#![no_main] #![no_std] use panic_halt as _; mod dht11; // extern crate cortex_m; extern crate cortex_m_rt as rt; use cortex_m_semihosting::hprintln; // extern crate panic_semihosting; extern crate stm32f1xx_hal as hal; #[macro_use(block)] extern crate nb; use hal::delay::Delay; use hal::prelude::*; use hal::stm32;...
//! Docker #![doc(html_root_url="https://ghmlee.github.io/rust-docker/doc")] // Increase the compiler's recursion limit for the `error_chain` crate. #![recursion_limit = "1024"] // import external libraries #[macro_use] extern crate error_chain; extern crate hyper; #[cfg(feature="openssl")] extern crate openssl; #[cf...
use crate::model::{Block, Board}; use crate::Result; use std::io::Write; pub fn clear(stdout: &mut impl Write) -> Result<()> { write!( stdout, "{}{}{}", termion::clear::All, termion::cursor::Goto(1, 1), termion::cursor::Hide ) .map_err(|err| err.into()) } pub fn cle...
use crate::support::*; pub fn test() { let mut server = server::builder().udp_max_chunks(3).udp(); let mut sock = udp::sock(); // Split a message into 5 chunks let msg_chunks = net_chunks!(5, { "host": "foo", "short_message": "this is a short message but long enough for 5 chunks" }...
use std::borrow::Cow; use std::collections::HashSet; use std::sync::Arc; use itertools::Itertools; use command_data_derive::CommandData; use discorsd::{BotState, http::ClientResult}; use discorsd::commands::*; use discorsd::errors::BotError; use discorsd::http::channel::embed; use discorsd::model::ids::*; use discors...
use crate::prelude::*; const FORTRESS: (&str, i32, i32) = ( " ------------ ---######--- ---#----#--- ---#-M--#--- -###----###- --M------M-- -###----###- ---#----#--- ---#----#--- ---######--- ------------", 12, 11, ); pub fn apply_prefab(mb: &mut MapBuilder, rng: &mut RandomNumberGenerator) { let dijs...
// 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...
/// Describes how to generate the elliptic curve operations for /// - `Scalar` /// - `Fp` /// - `Fp2` /// - `G1` /// - `G2` pub trait GpuEngine { type Scalar: GpuField; type Fp: GpuField; } /// Describes how to generate the gpu sources for a Field. pub trait GpuField { /// Returns `1` as a vector of 32bit ...
use std::collections::HashMap; fn main() { use std::io::{self, BufRead}; let stdin = io::stdin(); let pn = stdin.lock().lines().next().unwrap().unwrap().split(" ") .map(|s| s.parse::<usize>()).filter_map(Result::ok) .collect::<Vec<usize>>(); let (p, n) = (pn[0], pn[1]); let mut ...
use std::io::{self, BufRead as _}; type BoxError = Box<dyn std::error::Error>; fn main() -> Result<(), BoxError> { let map: Vec<Vec<_>> = io::stdin() .lock() .lines() .map(|line| { line.unwrap() .chars() .map(|c| if c == '.' { 0 } else { 1 }) ...
use std::io; fn main() { let months: Vec<String> = vec![ "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"] .into_iter() .map(String...