text
stringlengths
8
4.13M
use assert_cmd::Command; use std::fs::{read_to_string, File}; use std::io::Write; use tempfile::tempdir; #[cfg(feature = "llvm_backend")] const BACKEND_ARGS: &'static [&'static str] = &["-binterp", "-bllvm", "-bcranelift"]; #[cfg(not(feature = "llvm_backend"))] const BACKEND_ARGS: &'static [&'static str] = &["-binterp...
use std::io; fn main() { println!("here we go!"); loop { let mut s = String::new(); io::stdin().read_line(&mut s).expect("failed to read!"); let mut sp = s.split(" "); let vec: Vec<&str> = sp.collect(); for v in &vec { println!("{}", v); ...
pub mod collection; pub mod texture; pub use texture::{Material, Texture, TextureImage, TextureRaw}; use crate::{ linalg::{Ray, Vct}, Flt, }; #[derive(Copy, Clone, Debug)] pub struct HitResult { pub pos: Vct, pub norm: Vct, pub texture: TextureRaw, } pub type HitTemp = (Flt, Option<(usize, Flt, ...
use graphics::*; use renderer::*; use graphics_util::*; use math::*; use std::collections::HashMap; use std::error::Error; use std::hash::{Hash, Hasher}; use std::rc::*; use std::cell::{RefCell,Cell}; use std::borrow::BorrowMut; use std::cell::RefMut; use na::*; pub enum RenderLifetime{ Manual, OneDraw, } pu...
//! Main functions doing actual work. //! //! Use `guess_format()` to get teh image format from a path, //! then read the image using `load_image()`, //! resize it to terminal size with `resize_image()` //! and display it with `write_[no_]ansi()`. use self::super::util::{ANSI_BG_COLOUR_ESCAPES, ANSI_COLOURS, JPEG_MAGI...
use super::{ retries::{FixedRetryPolicy, RetryLogic}, sink::Response, Batch, BatchSink, }; use crate::buffers::Acker; use futures01::{Async, Future, Poll}; use serde::{Deserialize, Serialize}; use std::sync::Arc; use std::time::{Duration, Instant}; use std::{error, fmt}; use tokio01::timer::Delay; use tower...
// Copyright (c) 2017 Martijn Rijkeboer <mrr@sru-systems.com> // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or dis...
pub mod rpc; pub mod header;
#[doc = "Reader of register ISR"] pub type R = crate::R<u32, super::ISR>; #[doc = "Reader of field `GIF0`"] pub type GIF0_R = crate::R<bool, bool>; #[doc = "Reader of field `TCIF1`"] pub type TCIF1_R = crate::R<bool, bool>; #[doc = "Reader of field `HTIF2`"] pub type HTIF2_R = crate::R<bool, bool>; #[doc = "Reader of f...
use crate::unicode_tables::{general_category::GC, script_values::SCRIPT, GC_AND_BP}; /// Validate a `LoneUnicodePropertyNameOrValue` /// is a valid name or value /// /// ex: /// ```js /// let re = /\p{White_Space}\p{Alphabetic}/; /// ``` /// /// This function will first search the General_Category /// names and aliase...
//! Integrates tokio runtime stats into the IOx metric system. //! //! This is NOT called `tokio-metrics` since this name is already taken. #![deny(rustdoc::broken_intra_doc_links, rust_2018_idioms)] #![warn( missing_copy_implementations, missing_docs, clippy::explicit_iter_loop, // See https://github.c...
use std::collections::HashMap; use std::cmp::min; use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::collections::{LazyOption, LookupMap, UnorderedMap, UnorderedSet}; use near_sdk::json_types::{Base64VecU8, ValidAccountId, U64, U128}; use near_sdk::serde::{Deserialize, Serialize}; use near_sd...
pub fn demo_shadow() { let x = 5; let x = x + 1; let x = x * 2; println!("Nilai dari x adalah {}", x); } pub fn trans_shadow() { let spaces = " "; let spaces = spaces.len(); println!("Panjang spasi: {}", spaces); }
extern crate logmap; #[test] fn no_alts_include_num_no_cols_skipped() { let mut log_filters = logmap::logmap::LogFilters::new(); log_filters.max_allowed_new_alternatives = 0; log_filters.ignore_numeric_words = false; log_filters.ignore_first_columns = 0; log_filters.learn_line("Sep 26 09:13:15 ano...
#[doc = "Reader of register C14ISR"] pub type R = crate::R<u32, super::C14ISR>; #[doc = "Reader of field `TEIF14`"] pub type TEIF14_R = crate::R<bool, bool>; #[doc = "Reader of field `CTCIF14`"] pub type CTCIF14_R = crate::R<bool, bool>; #[doc = "Reader of field `BRTIF14`"] pub type BRTIF14_R = crate::R<bool, bool>; #[...
#[cfg(feature = "hts")] mod bam; #[cfg(feature = "hts")] pub use bam::{BAMRecord, BamFile}; #[cfg(feature = "hts")] mod vcf; #[cfg(feature = "hts")] pub use vcf::{VcfFile, VcfRecord}; mod bed3; pub use bed3::Bed3; mod bed4; pub use bed4::Bed4; mod bed5; pub use bed5::Bed5;
use std::marker::PhantomData; use std::{cmp, fmt, hash}; pub unsafe trait Index: Sized + Copy + Eq + Ord + hash::Hash { const ZERO: Self; fn from_usize(v: usize) -> Self; fn as_usize(self) -> usize; fn as_len(self) -> Length<Self> { unsafe { Length::new_unchecked(self.as_usize()) } } ...
use std::collections::LinkedList; use gat::*; use sugars::lkl; #[test] fn option_pure() { assert_eq!(Some(5), Option::pure(5)); assert_eq!(Some("Str"), Option::pure("Str")); } #[test] fn option_lift() { let case1 = Some(5); let expect2: Option<Box<dyn FnMut(u32) -> u32>> = None; assert_eq!(Some(...
extern crate entity_system; mod test_entity_manager { extern crate entity_system; use entity_system::EntityManager; #[test] fn new_entities_are_unique() { let mut em = EntityManager::new(); let entity = em.create(); let entity2 = em.create(); assert!(entity != entity2)...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type DesignerAppExitedEventArgs = *mut ::core::ffi::c_void; pub type DesignerAppManager = *mut ::core::ffi::c_void; pub type DesignerAppView = *mut ::core::...
#[doc = "Reader of register MPCBB1_LCKVTR2"] pub type R = crate::R<u32, super::MPCBB1_LCKVTR2>; #[doc = "Writer for register MPCBB1_LCKVTR2"] pub type W = crate::W<u32, super::MPCBB1_LCKVTR2>; #[doc = "Register MPCBB1_LCKVTR2 `reset()`'s with value 0"] impl crate::ResetValue for super::MPCBB1_LCKVTR2 { type Type = ...
use std::collections::HashSet; use std::iter::FromIterator; use std::sync::mpsc::channel; use std::time::Duration; use timely::dataflow::channels::pact::Pipeline; use timely::dataflow::operators::Operator; use declarative_dataflow::binding::Binding; use declarative_dataflow::plan::{Implementable, Join, Project}; use ...
use std::fmt::Debug; use std::ops::Range; use gfx_hal::Backend; use relevant::Relevant; /// Trait for types that represent a block (`Range`) of `Memory`. pub trait Block<B: Backend>: Send + Sync + Debug { /// `Memory` instance of the block. fn memory(&self) -> &B::Memory; /// `Range` of the memory this ...
use crate::dynamic::RawSlice; use std::slice; // Helper to forward slice-optimized iterator functions. macro_rules! forward { ($as:ident) => { #[inline] fn next(&mut self) -> Option<Self::Item> { let buf = self.iter.next()?; Some(unsafe { buf.$as(self.len) }) } ...
use super::*; #[test] fn without_boolean_value_errors_badarg() { run!( |arc_process| { ( Just(arc_process.clone()), strategy::term::is_not_boolean(arc_process.clone()), ) }, |(arc_process, value)| { prop_assert_is_not_boole...
pub fn factors(n: u64) -> Vec<u64> { // unimplemented!("This should calculate the prime factors of {}", n) let mut v: Vec<u64> = vec![]; let mut m = n; let mut c = 2; let mut done = false; while !done { if m >=2 { while m % c == 0 { v.push(c); ...
use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std::usize::MAX / 4; #[allow(unused)] const M: isize = 1000000007; fn...
use winapi::shared::minwindef::DWORD; use winapi::um::winnt::*; use crate::process::MemAccess; pub trait MemAccessExt { fn into_page_protect_loose(self) -> DWORD; } impl MemAccessExt for MemAccess { fn into_page_protect_loose(self) -> DWORD { match self { MemAccess::None => PAGE_NOACCESS,...
use serde::{Serialize, Serializer}; use std::fmt; // TODO: make Line, Col, ByteOffset types? #[derive(Copy, Clone, Default, Eq, PartialEq, Debug, Hash, Ord, PartialOrd)] pub struct Location { pub line: usize, pub col: usize, pub absolute: usize, } impl Location { pub fn shift(mut self, ch: char) -> Lo...
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
/*! This module just contains any big string literals I don't want cluttering up the rest of the code. */ /** When generating a package's unique ID, how many hex nibbles of the digest should be used *at most*? The largest meaningful value is `40`. */ pub const ID_DIGEST_LEN_MAX: usize = 16; /** How old can stuff in ...
pub struct AhcTrie { pub trie: Vec<[usize; 26]>, // a trie pub failure: Vec<usize>, // failure function (trie node -> trie node) pub output: Vec<Vec<usize>>, // output function (trie node -> Vec<query idx>) } fn as_idx(c: char) -> usize { return ((c as u8) - ('a' as u8)) as usize; } pub fn build_...
use std::collections::VecDeque; fn main() { let input = read_as_vec::<u32>(); let n = *input.get(0).unwrap(); let q = *input.get(1).unwrap(); let mut que: VecDeque<Proc> = (0..n) .fold(VecDeque::new(), |mut que, _| { let input: Vec<String> = read_as_vec(); let name = inpu...
// // Emulator //! The emulator program. // use jni::{JavaVM, Class}; use config::Config; use minion::{Minion, Action, Options}; use storage; /// The emulator class binding the JavaVM and terminal display. pub struct Emulator { _jvm: JavaVM, java_class: Class, minions: Vec<Minion>, last_id: i32, config: Con...
use test_win32::Windows::Win32::{ Foundation::{CloseHandle, BOOL, HANDLE, HWND, PSTR, PWSTR, RECT}, Gaming::HasExpandedResources, Graphics::{Direct2D::CLSID_D2D1Shadow, Direct3D11::D3DDisassemble11Trace, Direct3D12::D3D12_DEFAULT_BLEND_FACTOR_ALPHA, Dxgi::Common::*, Dxgi::*, Hlsl::D3DCOMPILER_DLL}, Netw...
#![allow(dead_code)] use std::marker::PhantomData; #[allow(unused_imports)] use abi_stable::{ external_types::{RMutex, ROnce, RRwLock}, std_types::*, }; pub(super) mod basic_enum { #[repr(C)] #[derive(abi_stable::StableAbi)] pub enum Enum { Variant0, Variant1 { a: u32 }, } } ...
// 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. // Separation character for an ACTS command pub const COMMAND_DELIMITER: &str = "."; // Number of clauses for an ACTS command pub const COMMAND_SIZE: usiz...
use anyhow::{Context, Result, anyhow}; use tokio::sync::{broadcast::self, mpsc}; use tokio_tungstenite::{ connect_async, tungstenite::protocol::Message, }; use futures_util::StreamExt; use rust_decimal::Decimal; use std::collections::HashMap; use std::str::FromStr; use actix::Addr; use crate::CONFIG; use crat...
use std::io; fn main() { let mut og_str = String::new(); let mut new_str = String::new(); let vowels = ['a', 'e', 'i', 'o', 'u']; io::stdin().read_line(&mut og_str).ok().expect("read error"); og_str = og_str.to_lowercase(); //https://stackoverflow.com/questions/30811107/getting-a-single-char...
use std::io; use std::io::Write; use std::mem; use std::sync::atomic::{AtomicUsize, Ordering}; use chrono::Local; use console::{style, Color}; use log; /// A simple logger pub struct Logger; lazy_static! { static ref MAX_LEVEL: AtomicUsize = AtomicUsize::new(unsafe { mem::transmute(log::LevelFilter::Warn...
//! An optimizer rule that transforms a plan //! to fill gaps in time series data. pub mod range_predicate; use crate::exec::gapfill::{FillStrategy, GapFill, GapFillParams}; use datafusion::{ common::tree_node::{RewriteRecursion, TreeNode, TreeNodeRewriter, VisitRecursion}, error::{DataFusionError, Result}, ...
pub mod percentages; pub mod tsa; mod util;
//! Place limit orders // TODO: is a sign that things need some restructuring pub(crate) mod blockchain; mod request; mod response; mod types; pub use types::{LimitOrderRequest, LimitOrderResponse};
use std::fs::File; use std::io::{BufRead, BufReader}; pub fn run_puzzle() { let file = File::open("input_day1.txt").expect("Failed to open input_day1.txt"); let br = BufReader::new(file); let vec: Vec<i64> = br.lines().map(|line| line.expect("Line parsing failed").parse::<i64>().expect("Line => i64 failed...
// Copyright 2022 Datafuse Labs. // // 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 agre...
use super::*; #[test] fn with_number_atom_reference_function_port_pid_or_tuple_second_returns_first() { run!( |arc_process| { ( strategy::term::map(arc_process.clone()), strategy::term::number_atom_reference_function_port_pid_or_tuple(arc_process), ) ...
table! { d_domain (id) { id -> Int4, user_id -> Int4, hash -> Varchar, domain -> Varchar, flag -> Int2, state -> Int2, notes -> Varchar, create_time -> Int4, } } table! { u_user (id) { id -> Int4, user -> Varchar, name ...
use crate::day_twenty::run_day_twenty; mod file_util; mod day_one; mod day_two; mod day_three; mod day_four; mod day_five; mod day_six; mod day_seven; mod day_eight; mod day_nine; mod day_ten; mod day_eleven; mod day_twelve; mod day_thirteen; mod day_fourteen; mod day_fifteen; mod day_sixteen; mod day_seventeen; mod d...
use crate::errors::ServiceError; use crate::models::msg::Msg; use crate::schema::fcm; use actix::Message; use chrono::NaiveDateTime; use serde::{Deserialize, Serialize}; #[derive( Clone, Debug, Serialize, Associations, Deserialize, PartialEq, Identifiable, Queryable, Insertable, )] ...
//! mraddr, machine reset address register read_csr!(0x7E0); /// Get machine reset address #[inline] pub fn read() -> usize { unsafe { _read() } }
use anyhow::{anyhow, Result}; use std::io::{stdin, Write}; use termion::event::Key; use termion::{clear, style}; use termion::{cursor, input::TermRead}; use crate::cmd::ValueType; /// Size of autocomplete window const AUTOCOMPLETE_ROWS: u16 = 8; pub trait Choice { /// Get a reference to the text fn text(&sel...
extern crate proconio; use proconio::input; use proconio::marker::Chars; fn main() { input! { (R, C): (usize, usize), (sy, sx): (usize, usize), (gy, gx): (usize, usize), a: [Chars; R], } let (sy, sx) = (sy - 1, sx - 1); let (gy, gx) = (gy - 1, gx - 1); let mut d = ve...
use super::*; pub fn gen_ntstatus() -> TokenStream { quote! { #[repr(transparent)] #[derive(::core::default::Default, ::core::clone::Clone, ::core::marker::Copy, ::core::cmp::PartialEq, ::core::cmp::Eq, ::core::fmt::Debug)] pub struct NTSTATUS(pub u32); impl NTSTATUS { ...
use std::{ cmp::min, fs::File, io::{BufReader, Read, Write}, }; use bstr::{ByteSlice, ByteVec}; pub struct PieceTable { pub pieces: Vec<Piece>, pub indent_width: usize, pub dirty: bool, original: Vec<u8>, add: Vec<u8>, } #[derive(Debug)] pub struct Line { pub ind...
use std::fs::*; use std::path::PathBuf; use environment::Environment; // TODO: check if executable pub fn resolve(thing: &str, env: &Environment) -> Option<String> { let thing = PathBuf::from(thing); if thing.is_absolute() { if metadata(thing.as_path()).ok().map_or(false, |path| path.is_file()) { ...
use actix_service::{Service, Transform}; use actix_web::{dev::ServiceRequest, dev::ServiceResponse}; use actix_web::{http::header, Error, HttpResponse}; use futures::future::{ok, Either, FutureResult}; use futures::Poll; use std::str::FromStr; use crate::utils::jwt::decode_token; pub struct CheckToken; impl<S, B> Tr...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] pub const CLSID_XMLGraphBuilder: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1bb05961_5fbf_11d2_a521_44df07c10000); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :...
extern crate regex; extern crate clang; #[macro_use] extern crate serde_derive; extern crate serde; extern crate serde_json; extern crate arguments; fn count_lines(range: clang::source::SourceRange) -> u32 { let (_file, line_s, _col) = range.get_start().get_presumed_location(); let (_file, line_e, _col) = r...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub const E_FDPAIRING_AUTHFAILURE: ::windows_sys::core::HRESULT = -1882193917i32; pub const E_FDPAIRING_AUTHNOTALLOWED: ::windows_sys::core::HRESULT = -18821939...
//! A general utility for retrying futures with a configurable backoff and error filter. use std::{ future::Future, num::{NonZeroU64, NonZeroUsize}, result::Result, time::Duration, }; use tokio_retry::{strategy::ExponentialBackoff, Retry as TokioRetry, RetryIf as TokioRetryIf}; pub struct Retry<T, E, F...
pub fn example8() { let rand_array = [1, 2, 3]; xprintln!("First element: {}", rand_array[0]); xprintln!("Array length: {}", rand_array.len()); xprintln!("Second 2 : {:?}", &rand_array[1..3]); }
#[doc = "Reader of register TIMINGR"] pub type R = crate::R<u32, super::TIMINGR>; #[doc = "Writer for register TIMINGR"] pub type W = crate::W<u32, super::TIMINGR>; #[doc = "Register TIMINGR `reset()`'s with value 0"] impl crate::ResetValue for super::TIMINGR { type Type = u32; #[inline(always)] fn reset_va...
use bincode::ErrorKind as BincodeError; pub type Result<T> = std::result::Result<T, Error>; #[derive(Debug)] pub enum Error { IOError(std::io::Error), BincodeError(BincodeError), } impl PartialEq for Error { fn eq(&self, other: &Self) -> bool { // note: only test the types matches!( ...
// We are at the root of the "crate" // First we define a module mod front_of_house { // We can have child modules pub mod hosting { pub fn add_to_waitlist() {} fn seat_at_table() {} } mod serving { fn take_order() {} fn serve_order() {} fn take_payment() {} } } // By default everything...
pub mod ebo; pub mod vao; pub mod vbo; pub use self::ebo::EBO; pub use self::vao::VAO; pub use self::vbo::VBO; use crate::camera::Camera; use crate::shader::Shader; use crate::texture::Texture; use cgmath::{Matrix4, Quaternion, Vector2, Vector3}; use glad_gl::gl; #[derive(Clone)] pub struct Vertex { pub position...
use yew::prelude::*; use yew::services::ConsoleService; const MATRIX_WIDTH: usize = 16; const MATRIX_HEIGHT: usize = 16; const PANEL_WIDTH: usize = 6; const PANEL_HEIGHT: usize = 2; const LED_COUNT: usize = MATRIX_WIDTH * MATRIX_HEIGHT * PANEL_WIDTH * PANEL_HEIGHT; enum Msg { CellClicked(u16), SwitchSegment(u...
// Copyright 2022 Datafuse Labs. // // 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 ...
#[doc = "Reader of register MPCBB1_VCTR25"] pub type R = crate::R<u32, super::MPCBB1_VCTR25>; #[doc = "Writer for register MPCBB1_VCTR25"] pub type W = crate::W<u32, super::MPCBB1_VCTR25>; #[doc = "Register MPCBB1_VCTR25 `reset()`'s with value 0xffff_ffff"] impl crate::ResetValue for super::MPCBB1_VCTR25 { type Typ...
// Copyright (c) 2018-2022 Ministerio de Fomento // Instituto de Ciencias de la Construcción Eduardo Torroja (IETcc-CSIC) // 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 ...
use std::io; use std::io::Read; fn main() { //! collect stdin and echo it, preceded by (num), where num = len of stdin println!("please type or pipe something here:"); let mut input = io::stdin(); let mut buf: String = String::new(); // even though we init buf as mutable, match input.read_line(&mut ...
use color_eyre::eyre::{Result}; use pahi_olin::*; use std::fs; use structopt::StructOpt; #[macro_use] extern crate log; #[derive(Debug, StructOpt)] #[structopt( name = "pa'i", about = "A WebAssembly runtime in Rust meeting the Olin ABI." )] struct Opt { /// Backend #[structopt(short, long, default_val...
use crate::blocks::BlockPosition; use eosio_cdt::eos::{Deserialize, Serialize}; #[derive(Serialize, Deserialize)] pub enum ShipRequests { GetStatus(GetStatusRequestV0), GetBlocks(GetBlocksRequestV0), } #[derive(Serialize, Deserialize)] pub struct GetStatusRequestV0; #[derive(Serialize, Deserialize)] pub stru...
use super::copysignf; use super::truncf; use core::f32; #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn roundf(x: f32) -> f32 { truncf(x + copysignf(0.5 - 0.25 * f32::EPSILON, x)) } // PowerPC tests are failing on LLVM 13: https://github.com/rust-lang/rust/issues/88520 #[cfg(not(target_arch = "...
use futures::StreamExt; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::{env, str}; use telegram_bot::*; #[derive(Deserialize, Debug)] struct SearchResult { id: i64, } #[derive(Deserialize, Debug)] struct SearchResults { data: Vec<SearchResult>, } #[derive(Deserialize, Debug)] str...
extern crate msgbox; use msgbox::IconType; const OPL_WRITEBUF_SIZE: usize = 1024; const OPL_WRITEBUF_DELAY: usize = 2; const OPL3_SLOT_CHAN_COUNT: usize = 2; const OPL3_OUT_SIZE: usize = 4; const OPL3_CHANNEL_COUNT: usize = 18; const OPL3_CHSLOT_COUNT: usize = 36; const OPL3_MIXBUF_SIZE: usize = 2; const OPL3_OLDSAMPLE...
use config::Config; use errors::BigNeonError; use lettre_email::EmailBuilder; pub struct Mailer { config: Config, to: (String, String), from: (String, String), subject: String, body: String, } impl Mailer { pub fn new( config: Config, to: (String, String), from: (String...
extern crate liquid; extern crate serde; extern crate structopt; use pulldown_cmark::{html, Parser}; use rouille::Response; use std::path::PathBuf; use serde::Serialize; use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher}; use structopt::StructOpt; const DEFAULT_STYLES: &str = include_str!("default.css")...
use anyhow::{bail, Result}; pub struct InputBuffer<'a> { pos: usize, len: usize, data: &'a [u8], } impl<'a> InputBuffer<'a> { pub fn new(buf: &'a [u8]) -> Self { InputBuffer { pos: 0, len: buf.len(), data: buf, } } pub fn set_data(&mut self,...
pub fn check_palindrome(input: &str) -> bool { if input.len() == 0 { return true; } let mut last = input.len() - 1; let mut first = 0; let my_vec = input.as_bytes().to_owned(); while first < last { if my_vec[fistt] != my_vec[last] { return false; } ...
use crate::model::Article; use derive_more::From; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Deserialize, Serialize)] pub struct ArticleSearchIndex { #[serde(default)] section: String, #[serde(default)] category: String, #[serde(default)] tags: Vec<String>, #[serde(default)]...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[cfg(feature = "ApplicationModel_Store_Preview_InstallControl")] pub mod InstallControl; #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct DeliveryOptimizationDownloadMode(pub i...
use crate::parser::parse_error::{IonError, IonResult}; use nom::error::ParseError; use nom::InputLength; use nom::{error::ErrorKind, Err}; /// A collection of parser combinators for building Ion parsers. Mostly forked from nom for various reasons. /// FIXME: Modifying code from nom like this is unfortunate, and hopefu...
//! Application Manager service. //! //! As the name implies, the AM service manages installed applications. It can: //! - Read the installed applications on the console and their information (depending on the install location). //! - Install compatible applications to the console. //! //! TODO: [`ctru-rs`](crate) does...
// Copyright 2022 Datafuse Labs. // // 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 ...
pub fn get_student_exam_queue_names( id_student: i32, id_student_exam: i32, ) -> (String, String, String) { let exchange_name = String::from("e_exam"); let queue_name = format!( "q_exam_{}_student_{}", id_student_exam.to_string(), id_student.to_string() ); let routing_key...
#[doc = "Reader of register ICSCR"] pub type R = crate::R<u32, super::ICSCR>; #[doc = "Writer for register ICSCR"] pub type W = crate::W<u32, super::ICSCR>; #[doc = "Register ICSCR `reset()`'s with value 0xb000"] impl crate::ResetValue for super::ICSCR { type Type = u32; #[inline(always)] fn reset_value() -...
use std::collections::hash_map::Entry; use std::ops::Deref; use bincode; use bytes::Bytes; use futures::Stream; use futures::sync::mpsc::unbounded; use proto::{MqttPacket, Payload, PacketId, QualityOfService, TopicName, TopicFilter}; use persistence::Persistence; use errors::{Result, Error, ErrorKind, ResultExt}; use...
use std::net::{TcpListener,TcpStream}; use std::io::Read; use std::io::prelude::*; fn handle_client(mut stream: TcpStream) { loop { //do the thing let mut packet= [0;512] ; stream.read(&mut packet).unwrap(); println!(" {}",String::from_utf8_lossy(&packet[..])); let respon...
//! Reset and Clock Control use crate::flash::ACR; use crate::time::Hertz; use stm32l0x3::{rcc, RCC}; /// Extension trait that constrains the `RCC` peripheral pub trait RccExt { /// Constrains the `RCC` peripheral so it plays nicely with the other abstractions fn constrain(self) -> Rcc; } impl RccExt for RCC...
#[doc = "Reader of register EESIZE"] pub type R = crate::R<u32, super::EESIZE>; #[doc = "Reader of field `WORDCNT`"] pub type WORDCNT_R = crate::R<u16, u16>; #[doc = "Reader of field `BLKCNT`"] pub type BLKCNT_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:15 - Number of 32-Bit Words"] #[inline(always)] p...
macro_rules! str_fixture { ($file_name:literal) => { include_str!(concat!("../fixtures/", $file_name)) }; } macro_rules! bytes_fixture { ($file_name:literal) => { include_bytes!(concat!("../fixtures/", $file_name)) }; } pub mod old { pub mod block { pub const NUMBER_192: &s...
#[macro_use] extern crate enum_primitive_derive; mod utils; pub mod structs; pub use structs::*;
use std::cmp::{max, min}; use winit::dpi::LogicalPosition; use crate::{ buffer::{Buffer, BufferMode}, cursor::{get_filtered_completions, CompletionRequest}, language_server_types::{CompletionItem, Diagnostic, SignatureHelp}, piece_table::PieceTable, renderer::RenderLayout, text_utils...
//! An "interner" is a data structure that associates values with usize tags and //! allows bidirectional lookup; i.e., given a value, one can easily find the //! type, and vice versa. #![allow(unused)] use std::cell::RefCell; use std::cmp::{Ord, Ordering, PartialEq, PartialOrd}; use std::fmt; use std::hash::{Hash, Ha...
use crate::window; use crate::KEYMAP_T; use std::unimplemented; use rustyline::completion::{Candidate, Completer, FilenameCompleter, Pair}; use rustyline::line_buffer; struct CompletionTracker { pub index: usize, pub pos: usize, pub original: String, pub candidates: Vec<Pair>, } impl CompletionTrack...
#![crate_name = "js"] #![crate_type = "lib"] #![doc( html_favicon_url = "http://tombebbington.github.io/favicon.png" )] #![feature(phase, macro_rules, globs)] #![deny(non_uppercase_statics, missing_doc, unnecessary_parens, unrecognized_lint, unreachable_code, unnecessary_allocation, unnecessary_typecast, unneces...
pub mod button; pub mod svgmap; pub mod style;
use pyo3::prelude::*; use pathfinder_geometry::{ vector::Vector2F, rect::RectF, transform2d::Transform2F }; wrap!(Vector, Vector2F); #[pymethods] impl Vector { #[new] pub fn new(x: f32, y: f32) -> Vector { Vector::from(Vector2F::new(x, y)) } } auto!(AutoVector(Vector2F) { (f32, f3...
#![allow(dead_code)] use crate::base::logic::bit; use crate::base::logic::bit::{I, O}; pub fn read_stdin<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } pub fn str_to_binary(str: &str) -> Vec<bit> { if str == "" { ...
use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let n: usize = rd.get(); let mut g = vec![vec![]; n]; for _ in 0..(n - 1) { let a: usize = rd.get(); let b: usize = rd.get(); g[a - 1].push(b - 1); ...