text
stringlengths
8
4.13M
pub mod hex; mod input_buffer; mod output_buffer; mod string_buffer; pub use self::input_buffer::InputBuffer; pub use self::output_buffer::OutputBuffer; pub use self::string_buffer::StringBuffer;
pub mod tracker; pub use tracker::ui as tracker; //mod insights; //pub use insights::ui as insights;
use std::cmp::{max, min}; use tuikit::prelude::*; use std::time::Duration; use std::env; use tuikit::attr::{Attr, Color}; //use rand::Rng; fn main() { //let term: Term<()> = Term::with_height(TermHeight::Percent(30)).unwrap(); let args: Vec<String> = env::args().collect(); let count: i32 = args[1].parse()....
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors. // // 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 ...
use crate::{ast, match_ast, AstNode, SyntaxError, SyntaxNode, T}; pub(crate) fn validate(root: &SyntaxNode) -> Vec<SyntaxError> { // FIXME: // * Add unescape validation of raw string literals and raw byte string literals // * Add validation of doc comments are being attached to nodes let mut errors = ...
use anyhow::*; use liblumen_alloc::erts::exception::{self, error}; use liblumen_alloc::erts::process::trace::Trace; use liblumen_alloc::erts::term::prelude::Term; #[native_implemented::function(erlang:error/1)] pub fn result(reason: Term) -> exception::Result<Term> { Err(error( reason, None, ...
use std::fmt; use titlecase::titlecase; use chrono::NaiveDate; use super::{db, Command, CommandArgs, Error, Result}; use super::formatter::format_currency; pub(super) struct Stats; struct _Stats { pub name: String, pub ticker: String, pub date: NaiveDate, pub min: f32, pub average: f32, pub ...
use std::fmt::Display; use data_types::{CompactionLevel, ParquetFile}; use observability_deps::tracing::info; use crate::{file_classification::FilesToSplitOrCompact, partition_info::PartitionInfo}; use super::SplitOrCompact; #[derive(Debug)] pub struct LoggingSplitOrCompactWrapper<T> where T: SplitOrCompact, { ...
use crate::io::BufMut; use crate::mysql::protocol::{Capabilities, Encode}; // https://dev.mysql.com/doc/dev/mysql-server/8.0.12/page_protocol_com_stmt_prepare.html #[derive(Debug)] pub struct ComStmtPrepare<'a> { pub query: &'a str, } impl Encode for ComStmtPrepare<'_> { fn encode(&self, buf: &mut Vec<u8>, _:...
use crate::ui; use crate::window::LllPanel; #[derive(Debug)] pub struct LllView { pub top_win: LllPanel, pub tab_win: LllPanel, pub left_win: LllPanel, pub mid_win: LllPanel, pub right_win: LllPanel, pub bot_win: LllPanel, pub win_ratio: (usize, usize, usize), } impl LllView { pub fn n...
use crate::controls::ControlHandle; use crate::win32::window::bind_raw_event_handler_inner; use crate::win32::window_helper as wh; use crate::NwgError; use winapi::shared::windef::{HWND}; use std::rc::Rc; use std::cell::RefCell; use std::ptr; /// A control item in a GridLayout #[derive(Debug)] pub struct GridLayoutIt...
// Copyright 2021 Chiral Ltd. // Licensed under the Apache-2.0 license (https://opensource.org/licenses/Apache-2.0) // This file may not be copied, modified, or distributed // except according to those terms. use crate::core; use super::mapping_ops; use super::case_breakable; use super::case_cyclic; const MAX_REDUCIB...
#[doc = "Reader of register EXTILEVEL"] pub type R = crate::R<u32, super::EXTILEVEL>; #[doc = "Writer for register EXTILEVEL"] pub type W = crate::W<u32, super::EXTILEVEL>; #[doc = "Register EXTILEVEL `reset()`'s with value 0"] impl crate::ResetValue for super::EXTILEVEL { type Type = u32; #[inline(always)] ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type CONDITION_OPERATION = i32; pub const COP_IMPLICIT: CONDITION_OPERATION = 0i32; pub const COP_EQUAL: CONDITION_OPERATION = 1i32; pub const COP_NOTEQUAL:...
pub mod bytecode; pub mod classpath; pub mod cmd; mod classfile;
use std::collections::HashMap; use crate::{ utils::log::Log, scene::{ node::Node, base::AsBase, }, core::{ pool::{ Handle, Pool, PoolIterator, PoolIteratorMut, PoolPairIterator, PoolPairIteratorMut, }...
fn main() { let some_u8_value: Option<u32> = Some(3); // Using match match some_u8_value { Some(3) => println!("Oh, this is three."), _ => println!("Can't read this value.") } // Using if let syntax if let Some(3) = some_u8_value { println!("Oh, this is three."); ...
use std::iter::IntoIterator; use std::iter::Iterator; #[derive(Copy,Clone)] pub struct NewStruct { field1: i32, field2: i32, field3: i32, field4: i32, field5: i32, } pub struct NewStructIntoIter { count: usize, new_struct: NewStruct, } impl IntoIterator for NewStruct { type Item = i3...
// Definition for a binary tree node. use std::mem; use std::rc::Rc; use std::cell::RefCell; use std::collections::VecDeque; #[derive(Debug, PartialEq, Eq)] pub struct TreeNode { pub val: i32, pub left: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode>>>, } impl TreeNode { #[inline] pub fn ne...
// 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 ...
// Copyright 2019 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 { super::typeface::{Collection as TypefaceCollection, TypefaceInfoAndCharSet}, fidl_fuchsia_fonts::GenericFontFamily, unicase::UniCase, }; ...
use std::env; use regex::{Regex,Captures}; use std::iter::Iterator; use std::fs; use std::io::{self,Read}; use std::process::exit; fn envsubst(s: &String) -> String { let re = Regex::new("\\$(\\w+)").unwrap(); re.replace_all(s, |caps: &Captures| { let var = &caps[1]; env::var(var) ....
use minifb::{Key, Window, WindowOptions, MouseMode, MouseButton}; use image::RgbaImage; pub trait ViewerStrategy { fn mouse_move(&self, x: f32, y: f32); fn mouse_pressed(&mut self, x: f32, y: f32, button: MouseButton); fn mouse_wheel(dx: u32, dy: u32, is_direction_normal: bool); fn key_pressed(&self, k...
#[doc = "Reader of register CSR"] pub type R = crate::R<u32, super::CSR>; #[doc = "Reader of field `AWD1`"] pub type AWD1_R = crate::R<bool, bool>; #[doc = "Reader of field `EOC1`"] pub type EOC1_R = crate::R<bool, bool>; #[doc = "Reader of field `JEOC1`"] pub type JEOC1_R = crate::R<bool, bool>; #[doc = "Reader of fie...
/// HTTP request message pub mod request; /// HTTP response message pub mod response; /// HTTP header fields pub mod headers; /// HTTP server pub mod server; /// HTTP server handlers pub mod handlers; pub use http::server::Server; pub use http::request::Request; pub use http::response::Response;
use proc_macro::TokenStream; use quote::quote; use syn::{ parse::{Parse, ParseStream}, parse_macro_input, spanned::Spanned, FnArg, Ident, ImplItemMethod, Pat, Type, }; type Res<T> = syn::parse::Result<T>; pub fn wrapped_tramp(attr: TokenStream, item: TokenStream) -> TokenStream { let TrampArgs { w...
//! Styling legacy Windows terminals //! //! See [`Console`] //! //! This fills a similar role as [`winapi-util`](https://crates.io/crates/winapi-util) does for //! [`termcolor`](https://crates.io/crates/termcolor) with the differences //! - Uses `windows-sys` rather than `winapi` //! - Uses [`anstyle`](https://crates....
// This file is part of linux-epoll. 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/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
/// The Olin ABI implemented for pa'i. This mostly contains rigging and other /// internal implementation details. /// Environment variables pub mod env; /// Input/Output pub mod io; /// Logging support pub mod log; /// Simple entropy pub mod random; /// Resources pub mod resource; /// Runtime interop pub mod run...
//! An arbitrary precision unsigned integer. use core::cmp::Ordering::{Equal, Greater, Less}; use std::{ fmt, ops::{Add, AddAssign, Sub}, }; use num_bigint::BigUint; use num_traits::{Num, Zero}; use serde; /// An arbitrary precision unsigned integer. #[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, ...
use std::{env, fs, io::{stdin, Read}}; mod lexer; mod parser; mod runtime; mod types; fn lexemes(text: String) { match lexer::lex(&mut text.chars()) { Ok(lx) => lx .iter() .enumerate() .for_each(|(i, l)| println!("{}:\n{:#?}", i, l)), Err(err) => eprintln!("{}",...
//! Generating identicons. extern crate rand; mod data; mod shields; mod shapes; pub use self::shields::{ShieldIconData, ShieldIconTreatment}; pub use self::shapes::{ShapeIconData, ShapeType}; trait RngExt { /// Choose a random item from a collection by weight. fn weighted_choice<T>(&mut self, choices: Vec<...
use super::super::grouped::{GroupedOperation, GroupedOperator}; use nom_sql::SqlType; use serde::Deserialize; use std::collections::HashMap; use std::convert::{TryFrom, TryInto}; use prelude::*; use super::att3::TestCount; #[derive(Serialize, Deserialize, Clone)] pub enum GroupingFuncType { TestCount(TestCount)...
use super::*; impl Image { pub(crate) fn build_parts(&self) -> Vec<String> { let mut out = self.prefixes.clone(); let mut info = vec![ self.identifier.clone(), self.region.to_string(), self.size.to_string(), self.rotation.to_string(), format!("{}.{}", self.quality.to_string(), s...
use af; use af::{Array, MatProp}; use std::sync::{Arc, Mutex}; use activations; use params::Params; use layer::Layer; pub struct Dense { pub input_size: usize, pub output_size: usize, } impl Layer for Dense { fn forward(&self, params: Arc<Mutex<Params>>, inputs: &Array)-> Array { // get a handle to the u...
fn main() { let tweet = Tweet { username: String::from("ebooks"), content: String::from("you don't know everything - read them"), reply: false, retweet: false, }; println!("1 new tweet: {}", tweet.summarize()); let news = NewsArticle { headline: String::from("Mar...
#[doc = "Reader of register TSCC"] pub type R = crate::R<u32, super::TSCC>; #[doc = "Writer for register TSCC"] pub type W = crate::W<u32, super::TSCC>; #[doc = "Register TSCC `reset()`'s with value 0"] impl crate::ResetValue for super::TSCC { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
use std::cell::RefCell; use wayland_client::protocol::wl_display::WlDisplay; use wayland_client::protocol::{wl_compositor, wl_surface}; use wayland_client::Main; use wayland_client::{Attached, Display, EventQueue, GlobalManager}; use wayland_protocols::wlr::unstable::layer_shell::v1::client::zwlr_layer_shell_v1::{ ...
//! This module contains the main source code for the circuit simulation. //! The code for the menu, circuit solver, side panel parser are here. //! The following is a breif overview of code flow. //! //! `circuit_sim` is the most important function in this module. //! Everything happens here. `circuit_sim` requires ke...
//! Functions for splitting sequences into fixed-width moving windows (kmers) //! and utilities for dealing with these kmers. /// Returns true if the base is a unambiguous nucleic acid base (e.g. ACGT) and /// false otherwise. fn is_good_base(chr: u8) -> bool { matches!(chr as char, 'a' | 'c' | 'g' | 't' | 'A' | '...
#[macro_use] extern crate lazy_static; use std::env; mod common; mod day1; mod day2; mod day3; mod day4; mod day5; mod day6; mod day7; mod day8; mod day9; mod day10; mod day11; mod day12; mod day13; mod day14; mod day15; mod day16; mod day17; mod day18; mod day19; mod day20; fn main() { let args: Vec<String> = e...
use chrono::{DateTime, Utc}; // Returns a Utc DateTime one billion seconds after start. pub fn after(start: DateTime<Utc>) -> DateTime<Utc> { let one_billion = 1_000_000_000; let one_billion_seconds = chrono::Duration::seconds(one_billion); return start + one_billion_seconds; }
#[cfg(feature="ncollide2d")] use ncollide2d::{ bounding_volume::AABB, shape::Cuboid }; use crate::geom::{about_equal, Vector}; use std::cmp::{Eq, PartialEq}; #[derive(Clone, Copy, Default, Debug, Deserialize, Serialize)] ///A rectangle with a top-left position and a size pub struct Rectangle { ///The top-l...
extern crate serial_unix; extern crate libc; use std::io; use std::path::Path; use std::io::prelude::*; use std::os::unix::prelude::*; fn main() { let mut port = serial_unix::TTYPort::open(Path::new("/dev/ttyUSB0")).unwrap(); let mut fds = vec![libc::pollfd { fd: port.as_raw_fd(), events: li...
// revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir enum Ast<'a> { Num(usize), Add(&'a Ast<'a>, &'a Ast<'a>) } fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { Ast::Add(x, y) //[base]~^ ERROR lifetime mismatch [E0623] //[nll]~^^ ERROR lifetime...
use serde::{Serialize, Deserialize}; use std::convert::From; use domain_patterns::models::{Entity, AggregateRoot}; use crate::survey::{Choice, Survey, Question}; #[derive(Serialize, Deserialize)] pub struct SurveyDTOs { pub surveys: Vec<ListViewSurveyDTO> } #[derive(Serialize, Deserialize)] pub struct ListViewSur...
// Copyright 2019 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 {fidl_fuchsia_io::DirectoryMarker, fidl_fuchsia_sys2 as fsys}; /// Creates a child in the specified `Realm`. /// /// # Parameters /// - `child_name`: ...
use super::task_data::TaskData; #[derive(Debug)] pub struct Task { pub id: i64, pub data: TaskData, }
use super::*; use crate::utils::distance_from; use std::slice; pub(super) struct RawValIter<T> { pub(super) start: *const T, pub(super) end: *const T, } unsafe impl<T: Send> Send for RawValIter<T> {} unsafe impl<T: Sync> Sync for RawValIter<T> {} impl<T> RawValIter<T> { /// # Safety /// /// Mus...
use super::path2::*; use crate::snapshot::rand::Rand; pub type Paths = Vec<Path2>; pub trait PathsExtension { fn smooth(&self, tightness: f32, repeats: u8) -> Paths; fn jitter(&self, rand: &mut Rand, x_jitter: f32, y_jitter: f32) -> Paths; fn gaussian_jitter(&self, rand: &mut Rand, x_jitter: f32, y_jitter...
#![warn(clippy::many_single_char_names)] fn bla() { let a: i32; let (b, c, d): (i32, i64, i16); { { let cdefg: i32; let blar: i32; } { let e: i32; } { let e: i32; let f: i32; } match 5 { ...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use anyhow::*; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::term::prelude::*; use crate::runtime::registry; #[native_implemented::function(erlang:unregister/1)] pub fn result(name: Term) -> exception::Result<Term> { let atom = term_try_i...
//! Throttle partions that receive no commits. use std::{collections::HashMap, fmt::Display, sync::Arc, time::Duration}; use async_trait::async_trait; use data_types::{CompactionLevel, ParquetFile, ParquetFileId, ParquetFileParams, PartitionId}; use futures::{StreamExt, TryStreamExt}; use iox_time::{Time, TimeProvide...
use std::fmt; use std::io::{self, Write}; use super::{Block, DataFlowGraph, Function, Immediate, Inst, Value}; pub fn write_function(w: &mut dyn Write, func: &Function) -> io::Result<()> { let is_public = func.signature.visibility.is_public(); if is_public { write!(w, "pub ")?; } write!(w, "fu...
use signal::Signal; use order::OrderBuilder; mod market_order_policy; pub use order::policy::market_order_policy::MarketOrderPolicy; mod simple_order_policy; pub use order::policy::simple_order_policy::SimpleOrderPolicy; #[derive(Clone, Eq, PartialEq, Hash, Debug)] pub enum OrderPolicyError { IndicatorError } pu...
extern crate dashpipe; extern crate testcontainers; use futures::{ prelude::*, Stream, sync::{oneshot}, }; use std::collections::HashMap; use dashpipe::{OutputChannel, InputChannel, NatsInput, NatsOutput}; use testcontainers::*; use testcontainers::images::generic::{GenericImage, WaitFor}; use nitox::comma...
use std::sync::Arc; use clap_blocks::{run_config::RunConfig, socket_addr::SocketAddr}; use crate::server_type::ServerType; /// A service that will start on the specified addresses #[derive(Debug)] pub struct Service { pub http_bind_address: Option<SocketAddr>, pub grpc_bind_address: SocketAddr, pub serve...
//! Tree module that only preserves nodes to predetermined depth. //! This tree always chooses the branch with the longest available "lineage". //! When a new node is inserted and the current root is "too old", the root //! is replaced with its child that leads to the longest branch, while //! all other children are ab...
#[macro_use] extern crate serde_derive; pub mod toml_pares; pub mod lmdb_use; pub mod uuid_std; pub mod serde_json_std; pub mod scrypt_std; #[cfg(test)] mod tests { use super::uuid_std; use super::toml_pares; use super::serde_json_std; use super::scrypt_std; #[test] fn uuid_test(){ uui...
use std::alloc::Layout; use std::backtrace::Backtrace; use std::fmt::{self, Debug}; use std::marker::PhantomData; use std::mem; use std::ptr::NonNull; use std::sync::Arc; use hashbrown::HashMap; use thiserror::Error; use liblumen_term::{Encoding as TermEncoding, Tag}; use crate::borrow::CloneToProcess; use crate::er...
use anyhow::{anyhow, Context, Result}; use std::{ fs::File, io::Write, path::{Path, PathBuf}, }; pub fn file_name(path: &Path) -> Result<&str> { path.file_stem() .ok_or_else(|| anyhow!("No file stem found"))? .to_str() .ok_or_else(|| anyhow!("Can't convert file stem to string"))...
use async_trait::async_trait; use serde::de::DeserializeOwned; use serde::export::fmt::Display; use serde::Serialize; use serde_json::{Map, Value}; use rbatis_core::convert::StmtConvert; use rbatis_core::db::DriverType; use rbatis_core::Error; use rbatis_core::Result; use crate::plugin::page::{IPageRequest, Page}; us...
/*! RDB中各项Redis数据相关的结构体定义,以及RDB解析相关的代码在此模块下 */ use core::result; use std::any::Any; use std::cmp; use std::collections::BTreeMap; use std::fmt::{Debug, Error, Formatter}; use std::io::{Cursor, Read, Result}; use std::sync::atomic::{AtomicBool, Ordering}; use byteorder::{BigEndian, LittleEndian, ReadBytesExt}; use log:...
pub struct Solution; impl Solution { pub fn is_scramble(s1: String, s2: String) -> bool { let s1 = &s1.chars().collect::<Vec<char>>(); let s2 = &s2.chars().collect::<Vec<char>>(); if !is_anagram(s1, s2) { return false; } rec(s1, s2) } } fn rec(s1: &[char], s...
use nalgebra::Vector2; #[derive(Clone)] pub struct Topography { pub height: Vec<f32>, pub dimensions: Vector2<u32>, } impl Topography { pub fn iter(&self) -> std::slice::Iter<'_, f32> { self.height.iter() } pub fn flat(dimensions: Vector2<u32>) -> Self { Self { height: (...
::windows_sys::core::link ! ( "deviceaccess.dll""system" #[doc = "*Required features: `\"Win32_Devices_DeviceAccess\"`*"] fn CreateDeviceAccessInstance ( deviceinterfacepath : :: windows_sys::core::PCWSTR , desiredaccess : u32 , createasync : *mut ICreateDeviceAccessAsync ) -> :: windows_sys::core::HRESULT ); pub type ...
extern crate prs_util; use std::fs::File; use std::io::{Write, BufReader, BufWriter}; use std::env; use prs_util::decoder::Decoder; fn main() { let mut args = env::args().skip(1); let filename = args.next().unwrap(); let out_filename = args.next().unwrap(); let file = BufReader::new(File::open(filen...
use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::punctuated::Punctuated; use syn::spanned::Spanned; use syn::{Error, Field, Generics, Ident, Type}; use crate::{serde_replace, Attr, GenericsStreams, MULTIPLE_FLATTEN_ERROR}; /// Use this crate's name ...
//! Pretty Capture codeframes //! //! Ex: //! let raw_lines = "let a: i64 = 12;"; //! let codeframe = Codeframe::new(raw_lines, 1).set_color("red").capture(); //! //! //! Colors Supported //! Black //! Red //! Green //! Yellow //! Blue //! Magenta or (Purple) //! Cyan //! White use crate::capture; use crate::Color; p...
use crate::{DocBase, VarType}; const REMARKS: &'static str = r#" Two args version: x is a series and y is a length. One arg version: x is a length. Algorithm uses high as a source series. "#; pub fn gen_doc() -> Vec<DocBase> { let fn_doc = DocBase { var_type: VarType::Function, name: "highestbars"...
//! Generated file, do not edit by hand, see `xtask/src/codegen` use crate::{ ast::{self, support, AstChildren, AstNode}, SyntaxKind::{self, *}, SyntaxNode, SyntaxToken, T, }; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct VarName { pub(crate) syntax: SyntaxNode, } impl VarName { pub fn lo...
use pest::iterators::{Pair, Pairs}; use pest::Parser; use crate::errors::{Error, Result as GuardingResult}; use crate::ast::{Expr, GuardRule, Operator, RuleAssert, RuleLevel, RuleScope}; use crate::support::str_support; #[derive(Parser)] #[grammar = "guarding.pest"] struct IdentParser; pub fn parse(code: &str) -> Gu...
use simple_gl::storage::buffer::*; use crate::{Vector2, clamp}; use anyhow::Result; pub struct World { pub vbo: VboBuffer<[f32; 2], DynamicBuffer>, pub avbo: VboBuffer<f32, DynamicBuffer>, pub vao: Vao, pub ebo: EboBuffer<u32, StaticBuffer>, vert_count: u32, xcount: usize, ycount: usize } ...
use ctor::ctor; use libc::{c_char, c_int}; use std::ffi::CStr; #[ctor] unsafe fn ctor() { kernaux_sys::assert_cb = Some(assert_cb); } unsafe extern "C" fn assert_cb( file: *const c_char, line: c_int, msg: *const c_char, ) { let file = CStr::from_ptr(file).to_str().unwrap(); let msg = CStr::fro...
use parity_wasm::builder::*; use parity_wasm::elements::{ ExportEntry, External, GlobalEntry, ImportEntry, Instruction, Instructions, Internal, MemoryType, Module, }; use std::cell::Cell; use parity_wasm::{builder, elements, serialize}; use wasmer_runtime::memory::Atomic; use wasmer_runtime::{ func, impo...
pub use super::rasterizationorderamd::*;
// Copyright 2020 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 ...
use std::cmp::max; use std::borrow::Cow; static DFA: [u16; 33840] = include!("EN_dfa.in"); static RAW: [u8; 1964] = include!("EN_raw.in"); pub fn detect(content: &str) -> Vec<u8> { let mut result: Vec<u8> = vec![0; content.len() + 1]; let mut cursor: usize = 184; let content = content .as_bytes() ...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors. // // 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...
//! Module for custom CBC solver based on the one from `lp_modeler`. use uuid::Uuid; use std::collections::HashMap; use std::fs; use std::fs::File; use std::io::{self, BufRead, BufReader}; use std::path::PathBuf; use std::process::Command; use std::sync; use std::time::Duration; use lp_modeler::dsl::LpProblem; use l...
pub fn find_matches(content: &str, pattern: &str, mut writter: impl std::io::Write) { for line in content.lines() { if line.contains(pattern) { writeln!(writter, "{}", line); } } }
// Copyright 2019 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 failure::Error; use serde_json::Value; use std::sync::Arc; use crate::factory_store::facade::FactoryStoreFacade; use crate::factory_store::types::Fac...
#![feature(test)] extern crate test; extern crate rfc3986; use test::Bencher; use rfc3986::uri::Uri; #[bench] fn benchmark_url_parsing(b: &mut Bencher) { b.iter(|| { Uri::from_str( "https://username:password@github.com/path/to?query=foo#fragment" ) }); }
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // // Portions Copyright 2017 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the THIRD-PARTY file. mod csm; mod device; ...
/** * Ownership Rules: * * 1) Each value has a variable which is its owner * 2) There can only be one owner at any given time * 3) When the owner goes out of scope, the value will be dropped * * Borrowing Rules: * * 1) Allowed infinite borrows for read-only access and borrowing will last until the end of scope...
use crate::{ error::AppError, models::{entry, tag}, state::AppState, views::entry::view, }; use axum::{ extract::{Path, State}, response::Response, }; use sea_orm::{entity::prelude::*, query::*}; use std::sync::Arc; pub async fn entry( State(app_state): State<Arc<AppState>>, Path((category, slug)): Path<(Strin...
use super::downcast::downcast_pf; use super::error::RuntimeErr; use super::pine_ref::PineRef; use super::primitive::{Bool, Color, Float, Int, NA}; use super::ref_data::RefData; use super::traits::{ Arithmetic, Category, ComplexType, DataType, Negative, PineFrom, PineStaticType, PineType, SecondType, }; use std:...
pub struct Solution; impl Solution { pub fn can_construct(ransom_note: String, magazine: String) -> bool { let mut count = [0; 26]; for b in magazine.bytes() { count[(b - b'a') as usize] += 1; } for b in ransom_note.bytes() { count[(b - b'a') as usize] -= 1; ...
mod lb110; mod lighting; pub use self::lb110::LB110; use crate::bulb::lighting::HSV; use crate::cloud::{Cloud, CloudInfo}; use crate::config::Config; use crate::device::Device; use crate::emeter::{DayStats, Emeter, MonthStats, RealtimeStats}; use crate::error::Result; use crate::sys::Sys; use crate::sysinfo::SysInfo; ...
use crate::id; use crate::stake_state::{StakeAccount, StakeState}; use bincode::deserialize; use log::*; use serde_derive::{Deserialize, Serialize}; use morgan_interface::account::KeyedAccount; use morgan_interface::instruction::{AccountMeta, Instruction, InstructionError}; use morgan_interface::pubkey::Pubkey; use mor...
#[doc = "Reader of register SMPR1"] pub type R = crate::R<u32, super::SMPR1>; #[doc = "Writer for register SMPR1"] pub type W = crate::W<u32, super::SMPR1>; #[doc = "Register SMPR1 `reset()`'s with value 0"] impl crate::ResetValue for super::SMPR1 { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
#![deny(rustdoc::broken_intra_doc_links, rustdoc::bare_urls, rust_2018_idioms)] // `clippy::use_self` is deliberately excluded from the lints this crate uses. // See <https://github.com/rust-lang/rust-clippy/issues/6902>. #![warn( missing_copy_implementations, missing_debug_implementations, missing_docs, ...
// Copyright (c) 2020 Sam Blenny // SPDX-License-Identifier: Apache-2.0 OR MIT // #![no_std] extern crate blitstr; use blitstr::FrBuf; static mut FB: FrBuf = blitstr::new_fr_buf(); /// For building wasm32 no_std, add panic handler and functions to let /// javascript check shared buffer pointers. This panic handler c...
#[doc = "Reader of register MPCBB2_LCKVTR1"] pub type R = crate::R<u32, super::MPCBB2_LCKVTR1>; #[doc = "Writer for register MPCBB2_LCKVTR1"] pub type W = crate::W<u32, super::MPCBB2_LCKVTR1>; #[doc = "Register MPCBB2_LCKVTR1 `reset()`'s with value 0"] impl crate::ResetValue for super::MPCBB2_LCKVTR1 { type Type = ...
extern crate jlib; use jlib::api::ledger_closed::api::request; use jlib::api::ledger_closed::data::{LedgerClosedResponse, LedgerClosedSideKick}; use jlib::api::config::Config; pub static TEST_SERVER: &'static str = "ws://101.200.176.249:5040"; fn main() { let config = Config::new(TEST_SERVER, true); request(c...
use crate::mastermind::*; use std::{ convert::TryInto, io::{self, Write}, }; pub fn run(len: u32) -> Result<(), io::Error> { let len_usize: usize = len.try_into().unwrap(); let mut game = MasterMind::new(len_usize); game.print_welcome(); loop { println!(); print!("Enter your g...
use fraction::ToPrimitive; use crate::{io::*, gp::*, enums::*, track::*}; /// Equalizer found in master effect and track effect. /// /// Attribute :attr:`RSEEqualizer.knobs` is a list of values in range from -6.0 to 5.9. Master effect has 10 knobs, track effect has 3 /// knobs. Gain is a value in range from -6.0 to ...
use std::convert::From; use clap::ArgMatches; impl Default for Diff2HtmlConfig { fn default() -> Diff2HtmlConfig { Diff2HtmlConfig { input: "command".to_owned(), output: "stdout".to_owned(), diff: "smartword".to_owned(), style: "line".to_owned(), ...
use { crate::{ app::AppContext, }, std::path::Path, syntect::{ easy::HighlightLines, parsing::SyntaxSet, highlighting::ThemeSet, }, }; /// wrap heavy to initialize syntect things pub struct Syntaxer { pub syntax_set: SyntaxSet, pub theme_set: ThemeSet, } impl...
//! This module contains structs and functions that handle event input. //! //! There are three basic structs defined by this module //! they are `KeyboardInfo`, `MouseInfo`, and `TextInfo`. //! `KeyboardInfo` holds current keyboard events. //! `MouseInfo` holds current mouse events. //! `TextInfo` holds the most rece...