text
stringlengths
8
4.13M
//! Publish / subscribe. use super::util::json_as_object; use super::util::{build_uri, handle_json_response}; use super::{error, shared_parsers::parse_message, Hyper}; use crate::core::data::{message::Message, pubsub, request, response, timetoken::Timetoken}; use crate::core::json; use crate::core::TransportService; u...
fn main() { windows::build!( Windows::Win32::ProcessStatus::K32EnumProcesses, Windows::Win32::ProcessStatus::K32GetModuleFileNameExA, Windows::Win32::SystemServices::PROCESS_ACCESS_RIGHTS, Windows::Win32::SystemServices::OpenProcess, ); }
use std::env; use std::fs; mod symbol_table; mod code_translate; mod assembler; fn get_filename() -> String { let args : Vec<String> = env::args().collect(); if args.len() != 2 { panic!("The wrong number of arguments were given"); } String::from(&args[1]) } fn main() { let filename = get_...
//! This crate gives a generic way to add a callback to any dropping value //! //! You may use this for debugging values, see the [struct documentation](struct.DropGuard.html) or the [standalone examples](https://github.com/dns2utf8/drop_guard/tree/master/examples). //! //! # Example: //! //! ``` //! extern crate dr...
//! module rc4 implements RC4 encryption, as defined in Bruce Schneier's Applied Cryptography. //! //! RC4 is cryptographically broken and should not be used for secure applications. use crate::internal::subtle; /// Cipher is an instance of RC4 using a particular key. pub struct Cipher { states: [u8; 256], i:...
extern crate itertools_num; use std::os::raw::{c_double, c_int, c_char}; use std::sync::Mutex; mod input; mod render; mod game; #[path = "./entities/bullet.rs"] mod bullet; #[path = "./entities/particle.rs"] mod particle; #[path = "./entities/player.rs"] mod player; #[path = "./entities/swarm.rs"] mod swarm; #[pa...
/* Copyright 2018 Intel Corporation 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, ...
fn main() { println!("Hello, Rust world!"); }
use handlebars::Handlebars; use regex::Regex; use serde_json::Value; use shell_words::split; use std::collections::HashMap; use std::process::{Command, Stdio}; use std::vec::Vec; use crate::types::{Component, CustomError}; #[derive(Debug, Copy, Clone)] pub enum CommandConfig { ExecCommand { is_bool: bool }, S...
#![feature(unsize, coerce_unsized)] #[macro_use] extern crate lazy_static; #[macro_use] extern crate downcast_rs; mod utils; mod lib_interfaces; pub mod ctx; pub mod frame; pub mod canvas; #[no_mangle] pub extern "C" fn callback(callback_ptr: *mut lib_interfaces::Callback, ret_code: i32) { let mut callback: Box<...
#![cfg(test)] #![allow(clippy::print_with_newline)] use core::panic::PanicInfo; use core::sync::atomic::Ordering; use kerla_runtime::arch::{semihosting_halt, SemihostingExitStatus}; pub trait Testable { fn run(&self); } impl<T> Testable for T where T: Fn(), { fn run(&self) { print!("{} ... ", co...
/* * Copyright Stalwart Labs Ltd. See the COPYING * file at the top-level directory of this distribution. * * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or * https://www.apache.org/licenses/LICENSE-2.0> or the MIT license * <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your * optio...
use futures::Stream; use netlink_packet_core::{ header::flags::{NLM_F_DUMP, NLM_F_REQUEST}, NetlinkFlags, NetlinkMessage, NetlinkPayload, }; use netlink_packet_route::{address::AddressMessage, RtnlMessage}; use crate::{Error, ErrorKind, Handle}; lazy_static! { // Flags for `ip link get` static ref GE...
#![no_main] mod common; use highway::{HighwayHash, SseHash}; #[cfg(target_arch = "x86_64")] libfuzzer_sys::fuzz_target!(|input: common::FuzzKey| { let (key, data) = (input.key, &input.data); if !is_x86_feature_detected!("sse4.1") { panic!("sse4.1 is not supported"); } unsafe { let ha...
use bytes::Bytes; use quick_error::ResultExt; use reqwest::{ header::{self, HeaderValue}, Client, StatusCode, }; use crate::error::{Error, Result}; static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")); fn make_client() -> reqwest::Result<Client> { #[cfg(not(featur...
extern crate byteorder; # [ derive ( Debug ) ] struct packet_AcknowledgePacket { packets: (), } # [ derive ( Debug ) ] struct packet_advertise_system { pingID: i64, serverID: i64, magic: (), serverName: String, } # [ derive ( Debug ) ] struct packet_client_connect { clientID: i64, sendPing:...
// Copyright 2015 The GeoRust Developers // // 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...
mod api; mod app; mod pages; mod renders; mod route; mod types; use app::App; use spair::prelude::*; impl spair::Application for App { fn with_comp(_: spair::Comp<Self>) -> Self { Self { data: app::Data { cart_products: Vec::new(), all_products: Vec::new(), ...
use std::{ ops::{AddAssign, MulAssign}, collections::{BTreeMap, BTreeSet}, path::Path, fmt, error::Error, }; use crate::{DotId, ContextHandle}; pub trait ContentFormat: fmt::Debug { // Note: this can't be declared as an associated const due to // object safety constraints. fn expected_e...
#[doc = "Register `DDRCTRL_ZQCTL0` reader"] pub type R = crate::R<DDRCTRL_ZQCTL0_SPEC>; #[doc = "Register `DDRCTRL_ZQCTL0` writer"] pub type W = crate::W<DDRCTRL_ZQCTL0_SPEC>; #[doc = "Field `T_ZQ_SHORT_NOP` reader - T_ZQ_SHORT_NOP"] pub type T_ZQ_SHORT_NOP_R = crate::FieldReader<u16>; #[doc = "Field `T_ZQ_SHORT_NOP` w...
pub const HANKAKU_WIDTH: usize = 8; pub const HANKAKU_HEIGHT: usize = 16; type Font = [[bool; HANKAKU_WIDTH]; HANKAKU_HEIGHT]; pub const HANKAKU: [Font; 255] = [ [ [false, false, false, false, false, false, false, false], [false, false, false, false, false, false, false, false], [false, fa...
#[derive(serde::Deserialize)] #[allow(non_snake_case)] pub struct Keybindings<'a> { #[serde(borrow, default)] pub Right: Vec<&'a str>, #[serde(default)] pub Left: Vec<&'a str>, #[serde(default)] pub Up: Vec<&'a str>, #[serde(default)] pub Down: Vec<&'a str>, #[serde(default)] pub...
//! Some utility structures use error::Error; #[derive(Clone, Debug)] pub struct OffsetMessage { pub offset: i64, pub message: Vec<u8> } #[derive(Clone, Debug)] pub struct TopicMessage { pub topic: String, pub partition: i32, pub offset: i64, pub error: Option<Error>, pub message: Vec<u8>...
#[doc = "Register `ICR` writer"] pub type W = crate::W<ICR_SPEC>; #[doc = "Data buffer overrun/underrun interrupt status clear\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum OVR_ISC_AW { #[doc = "1: Writing this bit to 1 clears the OVR_RIS bit in PSSI_RIS"] Clear = 1, } impl From<O...
use lc_render::{BandScale, Chart, LineView, LinearScale, PointLabelPosition}; fn main() { let width = 1200; let height = 700; let margin_top = 20; let margin_bottom = 70; let margin_left = 40; let margin_right = 30; let x_scale = BandScale::new( vec![ "a1".to_string(),...
#![allow(dead_code)] #[macro_use] extern crate prettytable; use std::thread; use std::sync::Arc; use gouv_rs::discord::*; use gouv_rs::{hook, util}; use hyper::{Body, Response}; use prettytable::Table; type Resp<T> = Result<T, Box<dyn std::error::Error + Send + Sync>>; const PASSIVE_WAIT: u64 = 3600; const WEBHOOK_...
use math::Vector2; use platform::common::WindowId; use crate::{ eventpub::EventSub, platform::{PlatformEvent, Window}, *, }; use std::sync::Mutex; /// A standard Renderer WGPU device used with `riddle_platform_winit` windows. /// /// While this can be used directly, if using [`Renderer::new_from_window`], this //...
use crate::error::{NiaServerError, NiaServerResult}; use crate::protocol::{NiaConvertable, Serializable}; use nia_interpreter_core::Key; use nia_protocol_rust::Key_oneof_key::key_2; use std::fs::read; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum NiaKey { Key1(i32), Key2(i32, i32), } impl NiaKey { ...
#[cfg(feature = "include_glfw")] use glfw_window::GlfwWindow as AppWindow; #[cfg(feature = "include_glutin")] use glutin_window::GlutinWindow as AppWindow; use graphics::{ Context, Graphics }; use opengl_graphics::{ GlGraphics, OpenGL }; use piston::window::{ Window, WindowSettings }; use piston::input::*; use piston:...
use my_common::a; use my_common::b; use my_common::c; fn main() { dbg!(a::args_count()); for a in a::args() { dbg!(a); } let str1:String = b::to_String("String to &str"); dbg!(str1); let str2 = String::from("&str to String"); let strp: &str = str2.as_str(); dbg!(strp); let f...
use aperature::obd::ObjectDetection; use glib; use glib::prelude::*; use glib::subclass; use glib::subclass::prelude::*; use gst; use gst::prelude::*; use gst::subclass::prelude::*; struct SingleShotMultiBox { cat: gst::DebugCategory, srcpad: gst::Pad, sinkpad: gst::Pad, detector: ObjectDetection, } i...
/* * Copyright Stalwart Labs Ltd. See the COPYING * file at the top-level directory of this distribution. * * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or * https://www.apache.org/licenses/LICENSE-2.0> or the MIT license * <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your * optio...
//! State transition types use arrayref::{array_mut_ref, array_ref, array_refs, mut_array_refs}; use solana_program::{ program_error::ProgramError, program_pack::{IsInitialized, Pack, Sealed}, pubkey::Pubkey, }; /// Moebius data. #[repr(C)] #[derive(Clone, Copy, Debug, Default, PartialEq)] pub struct Moeb...
use std::alloc::AllocError; use std::mem::size_of; use std::ptr::{drop_in_place, NonNull}; use crate::linear::{aligned_size, LinearAllocator}; struct Finalizer { finna: unsafe fn(NonNull<u8>), next: Option<NonNull<Finalizer>>, } pub struct ScopeStack { allocator: NonNull<LinearAllocator>, rewind_poin...
use serde::{Deserialize, Serialize}; use crate::request::{FilterOptions, ModelRequest, RequestDetails, RequestParameters}; use crate::serializers::from_str; use std::collections::HashMap; use std::fmt; pub(crate) fn model_path(portal: impl std::fmt::Display) -> String { format!("portal/{}/users/", portal) } #[de...
use super::id::ObjID; use super::meta::FOTEntry; use crate::kso::view::ViewFlags; /* TODO: arch-dep */ pub const MAX_SIZE: u64 = 1 << 30; pub const NULLPAGE_SIZE: u64 = 0x1000; pub const METAPAGE_SIZE: u64 = 0x800; pub(super) const MAX_FOTE: u64 = ((1u64 << 20) - NULLPAGE_SIZE) / std::mem::size_of::<FOTEntry>() as u6...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; use starcoin_types::account_address::AccountAddress; use starcoin_types::transaction::RawUserTransaction; use starcoin_wallet_api::WalletAccount; pub struct MockTxnGenerator { receiver_address: AccountAddres...
#![feature(test)] #![allow(unused_variables)] extern crate exprtk_rs; extern crate exprtk_sys; extern crate test; use self::test::Bencher; use exprtk_rs::*; use exprtk_sys::*; use std::f64::consts::PI; // These benchmarks are equivalent to some of the ExprTk benchmarks const XMIN: c_double = -100.; const XMAX: c_do...
use crate::utils::clamp; use std::ops::{Add, Div, Mul, Neg, Sub}; use rand::Rng; #[derive(Copy, Clone)] pub struct Vec3 { pub x: f64, pub y: f64, pub z: f64, } impl Vec3 { pub fn random() -> Self { let mut rng = rand::thread_rng(); Self { x: rng.gen(), y: rng....
mod replica; mod webinar; pub use replica::create as create_webinar_replica; pub use webinar::create as create_webinar;
//! Tests whether you can starve the executor by running database queries. use bb8_diesel_test::sleep_using_db; use std::convert::TryFrom; use std::time::Duration; /// Number of "core" (worker) threads for the tokio executor static NTHREADS_CORE: usize = 4; /// Number of "blocking" threads for the tokio executor stat...
use std::io::{self, BufRead as _}; type BoxError = Box<dyn std::error::Error>; fn main() -> Result<(), BoxError> { let mut seats: Vec<_> = io::stdin() .lock() .lines() .map(|line| { let seat = line.expect("valid seat"); let (row, _) = seat[0..7].chars().fold((0, 127...
use lib_nomake::{args::*, compile::*}; use std::fs; #[test] fn binary() { let args = Args { lib: OutType::Binary, release: false, output: String::from("binary.out"), }; let sources = collect_source(); compile(sources, args); fs::remove_file("binary.out").unwrap(); } #[test]...
#[doc = "Register `HASH_CSR42` reader"] pub type R = crate::R<HASH_CSR42_SPEC>; #[doc = "Register `HASH_CSR42` writer"] pub type W = crate::W<HASH_CSR42_SPEC>; #[doc = "Field `CS42` reader - CS42"] pub type CS42_R = crate::FieldReader<u32>; #[doc = "Field `CS42` writer - CS42"] pub type CS42_W<'a, REG, const O: u8> = c...
// https://gist.github.com/aita/28fef7fa91fce3122b1005ae5d34a7ef // https://rust-sdl2.github.io/rust-sdl2/sdl2/ use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::pixels::Color; use std::time::Duration; fn main() { //sdlの初期化 let sdl_context = sdl2::init().unwrap(); //コンテキスト経由で必要な機能をもらう let v...
pub use self::fcmp::FCmpInst; pub use self::icmp::ICmpInst; pub mod fcmp; pub mod icmp; use ir::Instruction; pub struct CmpInst<'ctx>(Instruction<'ctx>); impl_subtype!(CmpInst => Instruction);
use pdb::{FallibleIterator, Rva, PDB}; #[test] fn test_module_lines() { let file = std::fs::File::open("fixtures/self/foo.pdb").expect("opening file"); let mut pdb = PDB::open(file).expect("parse pdb"); let address_map = pdb.address_map().expect("address map"); let string_table = pdb.string_table().ex...
use collections_fromstr::FromStr; #[derive(FromStr, PartialEq)] #[item_separator = ","] struct NewVec(Vec<i32>); impl From<Vec<i32>> for NewVec{ fn from(v: Vec<i32>) -> Self { NewVec(v) } } fn main(){ use assert2::assert; use std::str::FromStr; static VALUES: &str = "1,2,3,-3,-2,-1"; ...
use std::sync::mpsc::channel; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use crate::protocol::Protocol; pub struct Processor { protocol: Protocol } impl Processor { pub fn new(host: String, receiver_queue: String, map_queue: String, date_que...
/* Copyright 2016 Robert Lathrop 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, softwar...
use crate::errors::Error; use std::fmt::{self, Display}; use std::str::FromStr; #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct AclEntry<T> { /// Element pointer within HAProxy. Forcing u64 instead of usize to allow running haptik on /// 32-bit machines when HAProxy pointers are 64-bits. pub id: u6...
fn main() { proconio::input! { a: usize, b: usize, w: usize, } let w = w * 1000; let wa = w / a; let wb = w / b; if a * wa != w && b * wb != w && wa == wb { println!("UNSATISFIABLE"); } else { println!("{} {}", if wb * b == w {wb} else {wb + 1}, wa); ...
#![feature(extern_prelude)] #[macro_use] extern crate error_chain; extern crate clap; extern crate futures; extern crate grpcio; #[macro_use] extern crate log; extern crate num_cpus; extern crate protobuf; extern crate rand; extern crate serde; #[macro_use] pub mod codec; pub mod client; pub mod db; pub mod errors; p...
pub mod sqlite_tx;
use std::marker::PhantomData; struct App { services: Vec<Box<dyn Service>>, } impl App { pub fn new() -> Self { Self { services: vec![] } } pub fn handler<F, T>(mut self, f: F) -> Self where F: Handler<T>, T: FromRequest + 'static, { let f = FunctionWrapper::new...
fn main() { yew::start_app::<litentry_web_app::Model>(); }
mod connection; mod connection_id; mod errors; mod interfaces; mod tcp; mod types; pub use connection_id::ConnectionId; pub use errors::{TcpError, TcpResult}; pub use interfaces::{ReceiveResult, TcpListener, TcpStream}; pub use tcp::{IncomingPackets, Tcp}; pub(crate) use tcp::{TcpCommand, TcpPacket};
//! Provide a consistent way for hashing build files and strings. use sha2::{Digest, Sha256}; use std::{fs::File, io, path::Path}; /// Calculate the SHA256 hash of a file. pub fn file<P: AsRef<Path>>(path: P) -> String { let mut file = File::open(&path).expect("the benchmark to be a file that can be opened"); ...
#[no_mangle] pub extern fn physics_single_chain_ufjc_morse_thermodynamics_isotensional_end_to_end_length(number_of_links: u8, link_length: f64, link_stiffness: f64, link_energy: f64, force: f64, temperature: f64) -> f64 { super::end_to_end_length(&number_of_links, &link_length, &link_stiffness, &link_energy, &fo...
// chapter 2 "using variables and types" fn main() { let points = 10_i32; let mut saved_points: u32 = 0; println!("{}", saved_points); // this won't work because we try to assign // a value from a variable of a certain type // to another variable of a different type /* saved_points =...
pub use super::dvec2::*; pub use super::fvec2::*; pub use super::particle::*;
#[doc = "Register `FCR` writer"] pub type W = crate::W<FCR_SPEC>; #[doc = "Field `CB0OF` writer - Clear buffer 0 overflow flag"] pub type CB0OF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CB1OF` writer - Clear buffer 1 overflow flag"] pub type CB1OF_W<'a, REG, const O: u8> = crate::BitWriter...
use crate::new_id; use proc_macro::TokenStream; pub fn derive_abstract(input: syn::DeriveInput) -> TokenStream { let (impl_generics, type_generics, where_clause) = input.generics.split_for_impl(); let abstract_ident = &input.ident; let concrete_ident = new_id(format!("Concrete{}", abstract_ident)); quo...
use crate::sys::thread_sync; use crate::sys::ThreadSyncArgs; use std::cell::UnsafeCell; use std::ops::{Deref, DerefMut}; use std::sync::atomic::AtomicU64; use std::sync::atomic::Ordering; #[repr(C)] #[derive(Default)] pub struct TwzMutex<T> { sleep: AtomicU64, resetcode: AtomicU64, data: UnsafeCell<T>, } pub struc...
/// Representa un generador resumido de vecinos #[derive(Debug)] pub struct NeighbourGenerator{ /// El elemento que queremos mover de cluster // TODO -- deberia ser u32 element_index: i32, /// El nuevo cluster al que asignamos el elemento new_cluster: u32, } impl NeighbourGenerator{ pub fn ne...
use crate::schema::*; #[derive(Debug)] pub enum Slot { First, Second, Third } #[derive(Debug)] pub enum Pick { Left, Right, Undecided } impl Pick { pub fn to_pick(opt: Option<bool>) -> Pick { match opt { Some(true) => Pick::Left, Some(false) => Pick::Right,...
#![cfg(feature = "std")] #![allow(dead_code, unused_macros, unused_imports)] use std::collections::HashMap; use papergrid::{ colors::NoColors, config::spanned::SpannedConfig, config::{Borders, Position}, dimension::spanned::SpannedGridDimension, dimension::{Dimension, Estimate}, grid::iterable...
#[doc = "Register `EECR1` reader"] pub type R = crate::R<EECR1_SPEC>; #[doc = "Register `EECR1` writer"] pub type W = crate::W<EECR1_SPEC>; #[doc = "Field `EE1SRC` reader - External Event 1 Source"] pub type EE1SRC_R = crate::FieldReader; #[doc = "Field `EE1SRC` writer - External Event 1 Source"] pub type EE1SRC_W<'a, ...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - The Operating Mode register establishes the Transmit and Receive operating modes and commands."] pub eth_mtlomr: ETH_MTLOMR, _reserved1: [u8; 28usize], #[doc = "0x20 - The software driver (application) reads this register d...
/// 序列化变体类型数字 /// /// # Examples /// /// ``` /// use rawpb_core::utils::serialize_variant; /// /// assert_eq!(serialize_variant(0x3dd), hex::decode("dd07").unwrap().as_slice()); /// assert_eq!(serialize_variant(0x2e), hex::decode("2e").unwrap().as_slice()); /// assert_eq!(serialize_variant(0), hex::decode("00").unwrap(...
use std::env; use std::fs; fn main() { let args : Vec<String> = env::args().collect(); if args.len() < 2 { return; } let mut possible_triangles = 0; for line in fs::read_to_string(&args[1]).unwrap().split('\n') { if line == "" { continue; } let v = line...
use std::env; use std::fs::File; use std::io; use std::io::prelude::*; use std::io::{BufReader, BufWriter}; use std::process; fn main() { let args: Vec<String> = env::args().collect(); if args.len() < 2 { eprintln!("Usage: {:?} n [FILE...]", args[0]); process::exit(1); } let nlines: i...
use std::fs; use std::io::{BufWriter, Write}; use std::path::{Path, PathBuf}; use std::thread::JoinHandle; use reqwest::header; use url::Url; use crate::ext::PathExt; use crate::package_store::DownloadEvent; pub trait Download { fn download<F>( &self, tmp_dir: PathBuf, dir_path: &Path, ...
use diesel::BelongingToDsl; use diesel::{ pg::Pg, BoolExpressionMethods, ExpressionMethods, GroupedBy, PgConnection, QueryDsl, RunQueryDsl, }; use diesel_full_text_search::{plainto_tsquery, TsRumExtensions, TsVectorExtensions}; use juniper::FieldResult; use crate::models::price::PriceProductToUpdate; use crate...
use nix::net::if_::InterfaceFlags; use nix::sys::socket::{AddressFamily, InetAddr, SockAddr}; use std::fs; use std::io; use std::io::{Read, Write}; pub fn get_net_if_speed(device: &str) -> i32 { const DEFAULT_SPEED: i32 = 10000; let speed_path = format!("/sys/class/net/{}/speed", device); match fs::read_t...
use crate::{ regex::{Quantifier, Regex}, transition::Transition, }; use std::{collections::HashSet, fmt}; pub type NodeHandle = usize; #[derive(Debug)] pub struct NFA { starting_node: NodeHandle, nodes: Vec<NFANode>, } impl fmt::Display for NFA { fn fmt(&self, fmtr: &'_ mut fmt::Formatter<'_>) ->...
use std::io; use std::io::{BufReader, BufRead, BufWriter, Write}; use std::net::TcpStream; use std::thread; fn tx_th(socket: TcpStream) { let rd = BufReader::new(io::stdin()); let mut wr = BufWriter::new(socket); for line in rd.lines() { match line { Ok(line) => { match ...
use maud::{html, Markup}; use crate::{http_server::templates::posts::BlogPostList, posts::blog::BlogPost}; use super::base_constrained; pub(crate) fn newsletter_page(newsletters: Vec<&BlogPost>) -> Markup { base_constrained(html! { div class="max-w-prose" { h1 class="text-3xl mb-8" { "coreyja wee...
use std::{marker, mem, ops, pin::Pin}; #[repr(transparent)] pub struct Task<G, R>(G, marker::PhantomData<R>); impl<G: Unpin, R> marker::Unpin for Task<G, R> {} impl<G, R> Task<G, R> { pub fn inner(self) -> G { self.0 } } impl<G, R> Task<G, R> where G: ops::Generator<mem::MaybeUninit<R>, Yield = ...
//! IO operations for pattern and exception data provided by `hyph-UTF8` //! and stored in the `patterns` folder. use std::error; use std::fmt; use std::io; use bincode::serde as bin; use hyphenation_commons::{Exceptions, Patterns}; use language::{Corpus, Language, mins, tag}; use resources::ResourceId; pub fn ret...
extern crate rayon; #[macro_use] extern crate serde_derive; extern crate typed_arena; pub use coverage::*; pub use merge::*; mod coverage; mod merge; mod range_tree; #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }
#[derive(Debug)] pub enum XMLSimpToken { TagProlog, TagWpBeg, TagWpEnd, TagWtBeg, TagWtEnd, TagOtherBeg, TagOtherEnd, TagOtherBegEnd, Text, } #[derive(Debug)] pub struct TokenizedText { pub token: XMLSimpToken, pub text: String, }
use ckb_vm::{instructions::instruction_length, Bytes, Error, Memory, Register, Syscalls}; use ckb_vm::{machine::asm::AsmCoreMachine, CoreMachine, SupportMachine}; use ckb_vm::decoder::Decoder; use std::borrow::Cow; use std::cell::RefCell; use std::collections::HashMap; use std::io::Write; use std::path::Path; use std:...
#[doc = "Reader of register INTR_I2C_EC"] pub type R = crate::R<u32, super::INTR_I2C_EC>; #[doc = "Writer for register INTR_I2C_EC"] pub type W = crate::W<u32, super::INTR_I2C_EC>; #[doc = "Register INTR_I2C_EC `reset()`'s with value 0"] impl crate::ResetValue for super::INTR_I2C_EC { type Type = u32; #[inline(...
use std::collections::HashSet; use std::convert::TryFrom; use std::io::{self, BufRead}; #[derive(PartialEq, Eq, Debug, Clone, Copy)] enum Op { ACC, JMP, NOP, } impl TryFrom<&str> for Op { type Error = &'static str; fn try_from(c: &str) -> Result<Self, Self::Error> { match c.as_bytes() { ...
use anyhow::Result; use pasture_core::meta::Metadata; use pasture_core::{containers::PointBufferWriteable, layout::PointLayout}; use std::fs::File; use std::io::{BufRead, BufReader, Read}; use std::path::Path; use crate::ascii::RawAsciiReader; use crate::base::PointReader; /// `PointReader` implementation for ascii f...
use std::fmt::Debug; use std::any::Any; /// The basic scalar type for all structures of `nalgebra`. /// /// This does not make any assumption on the algebraic properties of `Self`. pub trait Scalar: Copy + PartialEq + Debug + Any { } impl<T: Copy + PartialEq + Debug + Any> Scalar for T { }
pub mod crl { pub mod mode0 { pub fn get() -> u32 { unsafe { core::ptr::read_volatile(0x40012000u32 as *const u32) & 0x3 } } pub fn set(val: u32) { unsafe { let mut reg = core::ptr::read_volatile(0x40012000u32 as *const u32...
// Enable some rust 2018 idioms. #![warn(bare_trait_objects)] #![warn(unused_extern_crates)] // Calm down clippy. #![allow(clippy::single_match)] // False positive. #![allow(clippy::ptr_arg)] #[cfg(feature = "system_alloc")] use std::alloc::System; #[cfg(feature = "system_alloc")] #[global_allocator] static A: System...
use std::iter::Peekable; use std::fmt; #[derive(PartialEq)] pub enum Token { Ident(String), NumConst(String), CharsConst(String), LParent, RParent, Less, LessEqual, Greater, GreaterEqual, EqualSign, NotEqualSign, Comma, SingleQuote, Semicolon, Plus, M...
use std::fmt; struct CompoundTime { w: usize, d: usize, h: usize, m: usize, s: usize, } macro_rules! reduce { ($s: ident, $(($from: ident, $to: ident, $factor: expr)),+) => {{ $( $s.$to += $s.$from / $factor; $s.$from %= $factor; )+ }} } impl C...
use super::CPU; impl CPU { pub(super) fn store_register_i(&mut self, addr: u16) { self.i = addr; } } #[cfg(test)] mod tests { use super::*; #[test] fn test_store_addr_to_i() { let mut chip8 = CPU::new(); let mut test = chip8.blank_program(); test[0] = 0xA2 as u8;...
#![warn(dead_code)] #![warn(unused_imports)] use crate::error_handling::unwrap_field; use core::borrow::Borrow; use core::hash::{Hash, Hasher}; use tokio::sync::{mpsc, mpsc::Receiver}; use std::fmt; use bytes::{Bytes, Buf}; extern crate async_trait; use async_trait::async_trait; use crate::pb::*; use internal_error...
use chrono::{DateTime, TimeZone, Utc}; use itertools::Itertools; use once_cell::sync::Lazy; use regex::Regex; use std::collections::{BTreeMap, HashMap}; use std::io; use std::ops::Deref; static HELP_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^#\s+HELP\s+(\w+)\s+(.+)$").unwrap()); static TYPE_RE: Lazy<Regex> = Lazy::...
//! Helper functions for maintaining the guild member list on disk, which is used by gefolge.org to verify logins. use { std::{ convert::identity, future::Future, pin::Pin, }, futures::future, serenity::{ model::prelude::*, prelude::*, }, sqlx::{ ...
use typed_index_collection::*; pub struct Animal { pub id: String, } impl_id!(Animal); pub struct Feline { pub id: String, pub animal_id: String, } impl_id!(Feline); impl_id!(Feline, Animal, animal_id); pub struct Cat { pub id: String, pub feline_id: String, } impl_id!(Cat); impl_id!(Cat, Feline,...
mod add_review; mod approve; mod create; mod delete; mod delete_review; mod get_by_id; mod like; mod publish; mod read; mod reject; mod reviews; mod search; mod unlike; mod update; mod update_pages; pub use add_review::*; pub use approve::*; pub use create::*; pub use delete::*; pub use delete_review::*; pub use get_by...
pub fn main() { println!("Implement me!"); }
#![allow(dead_code)] #![allow(unused_imports)] mod util; use std::io; use termion::event::Key; use termion::input::MouseTerminal; use termion::raw::IntoRawMode; use termion::screen::AlternateScreen; use tui::backend::TermionBackend; use tui::layout::{Constraint, Layout}; use tui::style::{Color, Modifier, Style}; use...
/// Module ProcessI /// This module contains the helper functions for the I format instructions. /// /// AUTHOR: Zach LeBlanc /// DATE: 2017-6-2014 use process; /// This function gets the name of the I format instructions from the op code. /// Parameters: /// *op_code: number of the op code (first six bits in instruc...