text
stringlengths
8
4.13M
// This file is part of Substrate. // Copyright (C) 2018-2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the F...
use SafeWrapper; use ir::{User, Instruction, Value, BinaryOpCode}; use sys; /// An binary operator instruction. pub struct BinaryOperatorInst<'ctx>(Instruction<'ctx>); impl<'ctx> BinaryOperatorInst<'ctx> { /// Creates a new extract element instruction. pub fn new(opcode: BinaryOpCode, lhs: &Val...
// This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the F...
use error::{Error, Result}; use gssapi_sys; use name::Name; use oid::OID; use oid_set::OIDSet; use std::ptr; #[cfg(feature = "services4user")] use std::ffi::CString; #[derive(Debug)] pub struct Credentials { cred_handle: gssapi_sys::gss_cred_id_t, mechs: OIDSet, time_rec: u32, } impl Credentials { pu...
/* * 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 */ use reqwest; use crate::apis::ResponseContent; use super::{Error, configuration}; /// struct for typ...
pub mod envpath; pub mod hash; pub mod name;
#[doc = "Register `RCC_MC_RSTSCLRR` reader"] pub type R = crate::R<RCC_MC_RSTSCLRR_SPEC>; #[doc = "Register `RCC_MC_RSTSCLRR` writer"] pub type W = crate::W<RCC_MC_RSTSCLRR_SPEC>; #[doc = "Field `PORRSTF` reader - PORRSTF"] pub type PORRSTF_R = crate::BitReader; #[doc = "Field `PORRSTF` writer - PORRSTF"] pub type PORR...
use std::collections::HashSet; use std::convert::TryFrom; const INPUT: &str = include_str!("../input.txt"); fn part1() -> u64 { INPUT .split("\n\n") .map(|answers| { u64::try_from( answers .lines() .flat_map(str::chars) ...
use crate::connection::{BrokersPool, SelectionStategy, StaticPool}; use crate::query::response::GroupByResponse; use crate::query::response::MetadataResponse; use crate::query::response::ScanResponse; use crate::query::response::SearchResponse; use crate::query::response::SegmentMetadataResponse; use crate::query::resp...
extern crate libc; extern crate hoedown; use std::ffi::{CString,CStr}; use hoedown::{Markdown,Html,Render}; #[no_mangle] pub fn libi18nrs_convert(input: *const libc::c_char) -> *const libc::c_char { let slice = unsafe { CStr::from_ptr(input)}; let ins = std::str::from_utf8(slice.to_bytes()).unwrap(); let doc ...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. use crate::{ lamport::signature::PublicKey, utils::rescue::{Hash, Rescue128}, }; use winterfell::{ crypto::MerkleTree, mat...
use std::collections::LinkedList; use std::convert::TryFrom; use std::result::Result; use bytes::{Buf, BufMut, Bytes, BytesMut}; use super::mime::MimeType; use crate::error::RSocketError; use crate::utils::{u24, Writeable}; const MAX_MIME_LEN: usize = 0x7F + 1; #[derive(Debug, Clone, Eq, PartialEq, Default)] pub st...
use crate::ui::components::{ app::{AppMessage, AppSharedProps}, inventory::InventoryMessage, }; use raui_core::prelude::*; use raui_material::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct ItemCellProps { #[serde(default)] pub image:...
pub mod cmd; pub mod server; pub mod tokenizer; pub mod util;
use super::{field, op, stm, suffix::ASTExpSuffixList, var::Var}; pub type ASTExp = Box<ASTExp_>; pub type ASTExpList = Vec<ASTExp>; #[derive(Clone, Debug, PartialEq)] pub struct ASTExp_ { pub pos: (usize, usize), pub data: ASTExpData, } #[derive(Clone, Debug, PartialEq)] pub enum ASTExpData { Int(String)...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use Error; use glib::translate::*; use std::ptr; use vte_sys; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Regex(Shared<vte_sys::VteRege...
use std::fmt::{Display, Formatter, Result}; #[derive(Debug, PartialEq, Eq)] pub struct Clock { hours: i32, minutes: i32, } impl Display for Clock { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, "{:02}:{:02}", self.hours, self.minutes) } } impl Clock { pub fn new(hours: i32, minut...
/// Values that indicate specific hardware feature sets that are available. /// Each GPU family provides a different set of features andhardware limits. /// For more information, see [Metal Programming Guide]( /// https://developer.apple.com/library/prerelease/ios/documentation/ /// Miscellaneous/Conceptual/MetalPr...
use crate::access_control; use fund::{ accounts::Fund, error::{FundError, FundErrorCode}, }; use serum_common::pack::Pack; use solana_program::{ account_info::{next_account_info, AccountInfo}, msg, pubkey::Pubkey, }; use std::convert::Into; pub fn handler( program_id: &Pubkey, accounts: &[A...
/// An enum to represent all characters in the Lao block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Lao { /// \u{e81}: 'ກ' LetterKo, /// \u{e82}: 'ຂ' LetterKhoSung, /// \u{e84}: 'ຄ' LetterKhoTam, /// \u{e86}: 'ຆ' LetterPaliGha, /// \u{e87}: 'ງ' LetterNgo, /...
use bevy::prelude::*; use crate::position::Position; use crate::{ARENA_HEIGHT, ARENA_WIDTH}; use crate::size::Size; pub fn position_translation(windows: Res<Windows>, mut q: Query<(&Position, &mut Transform)>) { let window = windows.get_primary().unwrap(); for (pos, mut transform) in q.iter_mut() { tr...
use std::env; use std::io::{self, BufRead}; use std::process::{self, Command}; use regex::Regex; fn process_arguments(mut args: Vec<String>)->(String, String){ let help_command = args.iter().find(|a|["help", "-h", "--help"].contains(&&a[..])); if help_command.is_some() || args.len() < 3 { println!(...
use std::{io::SeekFrom, sync::Mutex}; use crate::{chunk_map::ChunkMap, oid, superblock::Superblock, tree::Tree, DiskKey, DiskKeyType}; const FIRST_CHUNK_TREE_OBJECTID: u64 = 256; pub fn read_node_phys<D: fal::Device>( device: &mut D, superblock: &Superblock, offset: u64, ) -> Box<[u8]> { let mut byte...
use alloc::vec::Vec; use keccak::KeccakF1600; use util::Hash; pub struct Sha3_256(KeccakF1600); impl Sha3_256 { pub fn new() -> Self { Self::default() } } impl Default for Sha3_256 { fn default() -> Self { Self(KeccakF1600::new(1088, 512, 256 / 8)) } } impl Hash for Sha3_256 { f...
#[macro_use] extern crate nom; #[macro_use] extern crate failure; extern crate bitvec; mod errors; mod huffman; mod parser; pub use parser::decode;
extern crate wordcrab; use wordcrab::*; mod analysis_options; use analysis_options::*; #[test] fn empty_string() { let stats = analyse_string("", ANALYSIS_OPTIONS_LWC); assert_eq!(stats.lines, Some(0)); assert_eq!(stats.words, Some(0)); assert_eq!(stats.chars, Some(0)); } #[test] fn empty_line() { ...
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. pub mod naming_table; #[cfg(test)] mod test_naming_table; use std::path::PathBuf; use std::sync::Arc; use anyhow::Result; use datas...
//! Integer types used by SNASM. //! //! SNASM needs to work with a number of different integer types, including //! the oddball 24-bit 65816 addresses. This module provides types for handling //! integer values and types cleanly. use std::fmt; use std::fmt::Display; use std::io; use std::ops::Add; use std::ops::AddAs...
pub fn test() { ex_mutable_string(); ex_object_reference(); ex_ownership_on_heap_data(); } fn ex_mutable_string() { let mut s = String::from("hello"); println!("{}", s); s.push_str(", world!"); println!("{}", s); } fn ex_object_reference() { let mut a = 5; let b = a; a = 6; ...
use task_queue::TaskQueue; use std::io::BufRead; use structopt::StructOpt; #[derive(StructOpt, Debug)] #[structopt(name = "tq", about = "Interact with your local task queue.")] struct Opts { #[structopt(long = "verbose", help = "Add extra logging")] verbose: bool, #[structopt(subcommand)] op: Operati...
// Copyright (c) 2021 Thomas J. Otterson // // This software is released under the MIT License. // https://opensource.org/licenses/MIT use std::ops::{Deref, DerefMut}; use std::{cell::RefCell, rc::Rc}; /// A vector with three extra operations on it dealing with shared, internally mutable /// references. /// /// The u...
// Copyright (c) 2021, Roel Schut. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. use gdnative::api::ParallaxBackground; use gdnative::prelude::*; #[derive(NativeClass)] #[inherit(ParallaxBackground)] pub struct ParallaxStarBackground { ...
use std::ffi::CString; use anyhow::Result; use pasture_core::containers::{PointBufferWriteable, PointBufferWriteableExt}; use pasture_core::nalgebra::Vector3; use pasture_core::containers::{PointBuffer, PointBufferExt}; use pasture_core::layout::attributes::POSITION_3D; /// Wrapper around the proj types from the proj...
pub use netlink_packet_core::{DecodeError, EncodeError}; use core::ops::Range; /// Represent a multi-bytes field with a fixed size in a packet pub(crate) type Field = Range<usize>; pub mod status; pub use self::status::*; // 1000 - 1099 are for commanding the audit system // 1100 - 1199 user space trusted applicatio...
/// An enum to represent all characters in the Khojki block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Khojki { /// \u{11200}: '𑈀' LetterA, /// \u{11201}: '𑈁' LetterAa, /// \u{11202}: '𑈂' LetterI, /// \u{11203}: '𑈃' LetterU, /// \u{11204}: '𑈄' LetterE, ...
use crate::echoinfo::{DeviceInfo, DeviceProtocolInfo}; use crate::hex; use crate::line_driver::LineDriver; use std::collections::{HashMap, HashSet}; use std::convert::TryFrom; #[derive(PartialEq, Eq, Debug)] pub enum LineResult { OK, NG, } #[derive(Debug)] pub(crate) struct LineResponse<'a> { pub result: ...
use super::worker::*; use super::*; use crate::mmtk::MMTK; use crate::vm::VMBinding; use std::any::{type_name, TypeId}; pub trait Work<C: Context>: 'static + Send + Sync { fn do_work(&mut self, worker: &mut Worker<C>, context: &'static C); #[inline] fn do_work_with_stat(&mut self, worker: &mut Worker<C>, c...
extern crate permutohedron; use permutohedron::heap_recursive; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::BufReader; use std::io::prelude::*; fn get_total_distance(distances: &HashMap<String, i32>, path: &Vec<String>) -> i32 { path.iter() .take(path.len() - 1) .zip(p...
use std::ptr; pub fn replace_with<T, F: FnOnce(T) -> T>(t: &mut T, f: F) { let p = t as *mut T; unsafe { ptr::write(p, f(ptr::read(p))) } }
use std::collections::HashMap; #[derive(Debug, Clone)] enum Operand { Value(u16), Name(String), } impl Operand { fn eval(&self, connections: &[Connection], wires: &mut HashMap<String, u16>) -> u16 { match self { Self::Value(n) => *n, Self::Name(x) => signal(connections, fin...
use std::time::Duration; const WIDTH: usize = 100; #[derive(Debug, Clone, Copy)] enum Cell { Allive, Dead, } fn main() { let mut grid = vec![Cell::Dead; WIDTH]; grid[WIDTH - 1] = Cell::Allive; loop { display(&grid); grid = update(grid); std::thread::sleep(Duration::from_mil...
use enet::*; #[path = "./gamepacket.rs"] mod gamepacket; pub struct Actions { pub items_dat: Option<Vec<u8>>, } impl Actions { fn refresh_item_data(self, peer: &mut Peer<()>, channel: &u8) { gamepacket::raw(&self.items_dat.unwrap()) .send(peer, channel); } fn enter_game(self, peer: &mut Peer<()>, ...
use anyhow::Result; use rusoto_core::Region; use rusoto_s3::{S3Client, S3}; use tokio; #[tokio::main] async fn main() -> Result<()> { let region = Region::default(); let client = S3Client::new(region); let results = client.list_buckets().await?; print!("{:?}", results); Ok(()) }
#![allow(unused_parens)] #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; /// Weight functions for pallet_collator_selection. pub struct WeightInfo<T>(PhantomData<T>); impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> { ...
use eval::LuaResult; use eval::LV; use eval::LV::*; use lua_stdlib::math::lfloat; use lua_stdlib::math::{lua_coerce_float, lua_coerce_int}; use natives::lua_coerce_lnum; use natives::lua_fmt_for_print; use natives::lua_truthy; pub fn lua_binop_eq<'a>(l: &LV, r: &LV) -> LV { if lua_binop_eq_impl(l, r) { ret...
#![deny(clippy::pedantic)] #![allow(clippy::useless_attribute)] #![no_std] #![feature(core_intrinsics)] #![feature(stmt_expr_attributes)] #![allow(incomplete_features)] #![feature(generic_associated_types)] #![feature(total_cmp)] #![feature(specialization)] #![feature(option_result_unwrap_unchecked)] #[doc(hidden)] pu...
extern crate rand; use serde_yaml; // 0.8.7 use std::convert::TryFrom; use rand::prelude::*; use rand_pcg::Pcg64; use regex::Regex; use std::collections::BTreeMap; use std::fs::File; macro_rules! puts{ ($($a:expr),*) => { println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*); } } static ASCI...
mod assembler; use std::env; use assembler::assemble; fn main() { let args: Vec<_> = env::args().collect(); if args.len() < 3 { println!( "Please provide an input assembly file as well as an output file. Eg: ./mu0_arm_assembler asm.s out.txt" ); } else { assemble:...
// (C)opyleft 2013,2014 Frank Denis /*! * Bindings for the GeoIP library */ #![desc = "Bindings for the GeoIP library."] #![license = "BSD"] #![crate_name = "geoip"] #![crate_type = "rlib"] #![warn(non_camel_case_types, non_upper_case_globals, unused_qualifications)] extern crate libc; extern crate...
// Copyright 2018-2019 Mozilla // // 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 writing, sof...
use super::Opt; use crate::advisory::Advisory; use crate::package::Package; use colored::*; use git2::Repository; use regex::Regex; use smallstr::SmallString; use snafu::{ensure, ResultExt, Snafu}; use std::collections::HashMap; use std::fmt; use std::fs::{create_dir, File}; use std::io::{self, Write}; use std::ops::De...
pub use self::matrix::*; pub use self::matrix_4x4::*; pub use self::matrix_result::*; pub use self::matrix_support::*; pub use self::quaternion::*; pub use self::support::*; pub use self::vector::*; mod matrix; mod matrix_result; mod matrix_4x4; mod matrix_support; mod quaternion; mod support; mod vector; /// Inverse...
use std::io::{self, BufRead}; use std::slice::Iter; #[derive(Debug, Clone, Copy)] enum Token { Plus, Times, OpenParen, CloseParen, Num(u64) } #[derive(Debug)] enum Expr { Add(Box<Expr>, Box<Expr>), Multiply(Box<Expr>, Box<Expr>), Bracketed(Box<Expr>), Num(u64) } fn lex(line : String) -> Vec<Token> { let mut next...
extern crate utils; use std::env; use std::collections::HashSet; use std::str::FromStr; use std::num::ParseIntError; use std::io::{self, BufReader}; use std::io::prelude::*; use std::fs::File; use utils::*; type Input = Vec<Instruction>; #[derive(Eq, PartialEq, Copy, Clone, Debug)] enum OpCode { Nop, Acc, Jmp } ...
use std::collections::HashSet; use std::iter::FromIterator; use general::TryReader; use sourcecode::Code; use sourcecode::Span; use token::Operator; use token::Token; use parse::SyntaxTree; use parse::BinaryOperation; use parse::Add; pub struct Relational { binary_operation: BinaryOperation<Add>, } impl Relat...
pub mod client; pub mod cmd; pub mod ftpio; pub mod util;
#[doc = "Reader of register WAIT_CTL"] pub type R = crate::R<u32, super::WAIT_CTL>; #[doc = "Writer for register WAIT_CTL"] pub type W = crate::W<u32, super::WAIT_CTL>; #[doc = "Register WAIT_CTL `reset()`'s with value 0x0003_0b09"] impl crate::ResetValue for super::WAIT_CTL { type Type = u32; #[inline(always)]...
extern crate docker_rs; use docker_rs::api::containers::Containers; use docker_rs::api::version::Version; use docker_rs::client::DockerClient; use std::process::exit; #[test] fn test() { let client = match DockerClient::new("unix:///var/run/docker.sock") { Ok(a) => a, Err(err) => { pr...
// order of operations defined at // https://www.lua.org/manual/5.3/manual.html#3.4.8 // ^ (exponent) // % // / * (multop) // - + (plusop) // .. (concat) // >> << (bitshift) // & (bitand) // ~ (bitnot) // | (bitor) // == ~= >= <= > < (compareop) // and (logicand) // or (logicor) use super::ast; use lex::IStream; use...
extern crate crossbeam; use std::cell::{Cell, RefCell}; use std::sync::Mutex; use std::sync::{Arc, RwLock}; use std::thread; use std::borrow::BorrowMut; /// An example implementation of the type notsync. /// The std::cell::Cell type does not provide data security when shared across /// multiple threads, because it al...
use std::cmp; use vec::{ToVec2, Vec2}; use super::{View, ViewWrapper}; /// `BoxView` is a wrapper around an other view, with a given minimum size. pub struct BoxView<T: View> { size: Vec2, view: T, } impl<T: View> BoxView<T> { /// Creates a new `BoxView` with the given minimum size and content /// ...
use std::iter::successors; use std::time::Instant; use itertools::Itertools; const INPUT: &str = include_str!("../input.txt"); fn look_and_say(input: &str) -> String { let mut s = String::new(); for (key, group) in &input.chars().group_by(|&c| c) { s.push_str(&group.count().to_string()); s.p...
pub trait Marshal { fn marshal(&self, scratch: &mut [u8]); } impl Marshal for u8 { fn marshal(&self, scratch: &mut [u8]) { scratch[0] = *self; } } impl Marshal for u16 { fn marshal(&self, scratch: &mut [u8]) { scratch[0] = *self as u8; scratch[1] = (self >> 8) as u8; } } i...
#![deny(warnings)] extern crate orbclient; use std::fs::File; use std::env; use std::io::{Read, Write}; use wav::WavFile; use orbclient::{EventOption, Window, K_ESC}; mod wav; fn main() { let url = match env::args().nth(1) { Some(arg) => arg, None => "none:".to_string(), }; let mut ve...
use std::str::FromStr; use std::fmt; /// Store roll parameters /// /// ** Parameters: ** /// - Count: number of dice you want to roll /// - Sides: number of sides to each dice #[derive(Eq, PartialEq)] pub struct RollCmd { count: u32, sides: u32, } impl RollCmd { // Construct a new RollCmd. Count, then Sid...
use crate::provider::storage::{ClientStorage, StoreError}; use crate::provider::ClientLedger; use crypto::identity::{DummyMixIdentityPrivateKey, MixnetIdentityPrivateKey}; use futures::lock::Mutex as FMutex; use hmac::{Hmac, Mac}; use sfw_provider_requests::requests::{ ProviderRequestError, ProviderRequests, PullRe...
use crate::color::{color, Color}; use crate::hittable::HitRecord; use crate::material::{ dielectric::Dielectric, diffuse::Diffuse, isotropic::Isotropic, lambertian::Lambertian, metal::Metal, }; use crate::pdf::PdfType; use crate::ray::Ray; use crate::texture::{solidcolor::SolidColor, Texture}; use crate::vec::V...
use guion::{EventResp, render::link::RenderLink, event::compound::EventCompound}; use super::*; impl<S,E> GHandler<E> for Handler<S,E> where S: GHandler<E>, E: Env + Sync { #[inline] fn _render(l: Link<E>, r: &mut RenderLink<E>) { S::_render(l,r) //todo!() //TODO impl everything } #[in...
use crate::consts::*; use std::io; // todo: we should use overlapped api (async await) pub(crate) fn command(handle: &nihao_usb::Handle, cmd0: u8, cmd1: u8, resp_len: usize) -> io::Result<Vec<u8>> { let mut s = vec![0u8; STLINK_CMD_SIZE_V2]; s[0] = cmd0; s[1] = cmd1; let mut r = vec![0u8; resp_len]; ...
use arrayvec::ArrayString; #[derive(Clone)] pub struct Cmdline { cmdline: ArrayString<128>, argv0: ArrayString<128>, } impl Cmdline { pub fn new() -> Cmdline { Cmdline { cmdline: ArrayString::new(), argv0: ArrayString::new(), } } pub fn from_argv(argv: &[&[...
use chrono::{NaiveDate, NaiveTime, Utc}; use serde::{Serialize, Deserialize, Deserializer, Serializer, de::{Error, Unexpected, Visitor}}; use uuid::Uuid; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct FrontMatter { #[serde(default = "default_id")] pub id: String, pub title: Option<String>, ...
use std::collections::hash_map::Entry; use std::collections::HashMap; use std::time::Instant; const INPUT: &str = include_str!("../input.txt"); fn is_vowel(c: u8) -> bool { matches!(c, b'a' | b'e' | b'i' | b'o' | b'u') } fn is_nice_part_1(s: &str) -> bool { let mut vowel_count = 0; let mut has_double_let...
#[doc = "Reader of register PIDR0"] pub type R = crate::R<u32, super::PIDR0>; #[doc = "Reader of field `PIDR0`"] pub type PIDR0_R = crate::R<u32, u32>; impl R { #[doc = "Bits 0:31 - peripheral ID0"] #[inline(always)] pub fn pidr0(&self) -> PIDR0_R { PIDR0_R::new((self.bits & 0xffff_ffff) as u32) ...
use alquitran::issues::Hint; use alquitran::issues::Issue; use alquitran::lint::lint_string_field; #[test] fn conforming_string_field() { let bytes = b"Portable_String.123\0\0"; let result = lint_string_field(&bytes[..]); assert!(result.hints.is_empty()); assert!(result.issues.is_empty()); assert_e...
use std::fs; use sdl2::{event::Event, rect::Rect, pixels::Color, render::{Canvas, Texture}, video::{self}}; mod sdl; #[derive(Debug, Clone, Copy)] struct Window { width: i32, height: i32, } fn draw_word(canvas: &mut Canvas<video::Window>, word: &str) { let fonts = word.lines() .map(|line| line....
#[doc = "Register `ISR` reader"] pub type R = crate::R<ISR_SPEC>; #[doc = "Field `JEOCF` reader - End of injected conversion flag"] pub type JEOCF_R = crate::BitReader<JEOCF_A>; #[doc = "End of injected conversion flag\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum JEOCF_A { #[doc = "0...
use crossbeam; use petgraph; use rayon::prelude::*; use std::io; use wasm_bindgen::prelude::*; mod builder; mod model; mod parser; mod scanner; #[wasm_bindgen] extern "C" { #[wasm_bindgen(js_namespace = console)] fn log(s: &str); } #[wasm_bindgen] pub async fn graph() -> String { let graph = run( ...
use sp_ipld::Ipld; use std::fmt; use crate::{ ipld_error::IpldError, literal::Literal, term::Term, yatima, }; #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub enum BoolOp { Eql, Lte, Lth, Gte, Gth, And, Or, Xor, Not, } impl BoolOp { pub fn symbol(self) -> String { match self { ...
#![no_std] #![feature(abi_x86_interrupt)] use lazy_static::lazy_static; use core::ffi::c_void; use core::mem; use game::{Direction, Game}; use spin::Mutex; use pic8259_simple::ChainedPics; mod game; mod screens; const WHITE: u16 = 0x0F00; const BLUE: u16 = 0x0100; const RED: u16 = 0x0400; lazy_static! { static ...
use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct Metadata { pub name: String, } impl Default for Metadata { fn default() -> Self { Self { name: "Untitled scene".to_owned(), } } }
// -------------------------------------------------------------------------------// // Cryptopals, Set 2, Challenge 9: https://cryptopals.com/sets/2/challenges/9 // Impl by Frodo45127 // -------------------------------------------------------------------------------// use crate::utils::padd_to_end; pub fn challenge(...
use core::ops::{Bound, RangeBounds}; /// Represents a `value` at a given `span` of an input. #[derive(Clone, Debug, PartialEq)] pub struct Span<T> { start: usize, end: usize, value: T, } impl<T> Span<T> { /// Construct a new `Span` from a range and a value. pub fn new<R: RangeBounds<usize>>(range:...
use std::{fmt, hash}; use crate::{ Context, ContextHandle, ExclusivelyContextual, Polarity, AtomId, ForkId, JoinId, AcesError, AcesErrorKind, domain::{Dotset, DotId, DotsetId}, }; /// A common type of one-to-many and many-to-one elements of the fuset /// representation of c-e structures. /// /// A wide edg...
use std::convert::TryFrom; use anyhow::{anyhow, Result}; use crate::day12::InstructionType::Rotate; use crate::Challenge; pub struct Day12; impl Challenge for Day12 { const DAY_NUMBER: u32 = 12; type InputType = Vec<Instruction>; type OutputType = u32; fn part1(input: &Self::InputType) -> Result<S...
/*! this crate serves as the installer for the artifice network, however it can also be used as a simple task scheduler # Example ``` use manager::{ArtificeDB, Database}; use installer::installation::*; use std::time::Duration; use manager::database::ArtificePeers; use std::io::{Read, Write}; use networking::Artific...
use std::cmp; use rand::Rng; use rand::distributions::{Weighted, WeightedChoice, IndependentSample}; use super::data::{ Object, Tile, Map, Rect, Transition, Fighter, DeathCallback, Ai, Item, Game, Tcod, MessageLog, }; use super::util; use crate::{PLAYER, MAP_HEIGHT, MAP_W...
#[path = "lib/block.rs"] pub mod block; #[path = "lib/transaction.rs"] pub mod transaction; #[path = "lib/network.rs"] pub mod network; use sha2::{ Sha256, Digest }; fn main() { let mut hasher = Sha256::default(); hasher.update("SIMPLE DUMB BLOCK CHAIN"); let first_hash = Digest::finalize(hasher); let ...
use super::*; #[test] fn STX_test() { let mut registers = Registers::new(); let mut bus = BusMock::new(); let opeland = 0x90; registers.X = 0x89; Calculator::STX(&registers, &mut bus, opeland); let actual = bus.read(opeland as u16); assert_eq!(actual, registers.X); }
fn bare() {} fn likes_block(f: fn()) { f() } fn main() { likes_block(bare); }
use serde::Deserialize; #[derive(Deserialize)] pub struct UserAgent { pub user_agent: String, }
mod query; mod search_term; mod source_item; pub use self::query::Query; pub use self::search_term::{ ExactTerm, ExactTermType, FuzzyTerm, FuzzyTermType, InverseTerm, InverseTermType, SearchTerm, TermType, }; pub use self::source_item::{FilteredItem, FuzzyText, MatchType, MatchingText, SourceItem};
use error::RunningResult; pub mod converter; pub(crate) mod error; pub mod parser; pub mod pb_item; pub mod utils; pub fn parse_to_pretty(data: &[u8], sif: bool) -> RunningResult<String> { let pb_items = self::parser::parse_pb_data(data, sif)?; let obj = self::converter::build_json(pb_items)?; let mut res...
//! TODO: mod-level docs use core::marker::PhantomData; use core::sync::atomic::Ordering; use conquer_pointer::MarkedPtr; use crate::retired::Retired; use crate::traits::{Protect, Reclaim, ReclaimBase, ReclaimRef, ReclaimThreadState}; use crate::NotEqual; /// A specialization of the [`Atomic`](crate::atomic::Atomic...
#[doc = "Register `PIDR4` reader"] pub type R = crate::R<PIDR4_SPEC>; #[doc = "Field `JEP106CON` reader - JEP106 continuation code"] pub type JEP106CON_R = crate::FieldReader; #[doc = "Field `SIZE` reader - register file size"] pub type SIZE_R = crate::FieldReader; impl R { #[doc = "Bits 0:3 - JEP106 continuation c...
//! CPUID use volatile_register::RO; #[cfg(not(armv6m))] use volatile_register::RW; #[cfg(not(armv6m))] use crate::peripheral::CPUID; /// Register block #[repr(C)] pub struct RegisterBlock { /// CPUID base pub base: RO<u32>, _reserved0: [u32; 15], /// Processor Feature (not present on Cortex-M0 var...
use conrod::{Ui, color, Scalar, widget, Colorable, Positionable, Widget}; use conrod::widget::{Common, CommonBuilder, UpdateArgs, PointPath}; use conrod::widget::id::{Id, Generator}; use conrod::widget::line::Cap; use conrod::widget::line::Style as LineStyle; use conrod::position::Point; use conrod::event; use conrod::...
use nalgebra::{Point2, Vector2}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] pub enum Message { Ping, ClientMessage(ClientMessage), ServerMessage(ServerMessage), } #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] pub enum ClientMessage { En...
use std::collections::HashMap; #[derive(Debug)] struct MemoryGame { index: usize, last_number: usize, last_indeces: HashMap<usize, usize> } impl MemoryGame { fn new(starters: &[usize]) -> Self { let mut last_indeces = HashMap::new(); for (i, &n) in starters[..starters.len() - 1].iter()...
use super::record_content::RecordData; use super::record_header::RecordHeader; use super::record_datum::RecordDatum; #[derive(Debug)] pub struct DataMessage { header: RecordHeader, data: Vec<RecordDatum> } impl DataMessage { pub fn new(raw_header: RecordHeader) -> DataMessage { DataMessage { ...
#![cfg_attr(feature = "cargo-clippy", allow(clippy::boxed_local))] use crate::{ error::VelociError, persistence::*, search::{sort::check_apply_top_n_sort, *}, util::{self, StringAdd}, }; use fnv::FnvHashMap; use itertools::Itertools; use num::{self, ToPrimitive}; use std::{self, cmp::Ordering}; fn get...