text
stringlengths
8
4.13M
use console::Style; use rustyline::error::ReadlineError; use rustyline::Editor; use simpledb::SimpleDbConfig; use std::fmt; use std::process; struct REPLCommand<'a> { pub cmd: &'a str, pub help: &'a str, pub is_match: &'a Fn(&str) -> bool, pub execute: &'a Fn((&SimpleDbConfig, &str)) -> (), } impl<'a>...
use std::error; use std::ffi::CStr; use std::fmt; use std::io; use std::str; use glib_sys; pub struct Error { inner: *mut glib_sys::GError, } unsafe impl Send for Error {} // TODO: check this is true unsafe impl Sync for Error {} // TODO: check this is true pub unsafe fn new(inner: *mut glib_sys::GError) -> Err...
use winapi::um::tlhelp32::{CreateToolhelp32Snapshot, TH32CS_SNAPALL, PROCESSENTRY32, Process32First, Process32Next}; use winapi::shared::minwindef::DWORD; use crate::process::process::Process; use crate::process::get_process_mem::get_process_mem; use crate::process::get_process_name::get_process_name; use crate::proces...
//! This module provides a modal UI implementation. use cursive::{ views::{Dialog, TextView}, Cursive, }; pub fn alert(s: &mut Cursive, title: String, content: String) { s.add_layer( Dialog::around(TextView::new(content)) .title(title) .button("Quit", |s| { ...
use hdk::holochain_json_api::{ error::JsonError, json::JsonString, }; use crate::your_game::state::LineDirection; /** * * The MoveType enum defines all the types of moves that are valid in your game and the * data they carry. The gameboard is a grid of N x N. Grid points are labeled from a lower * left origi...
/// Renderer `Coord`-inate /// /// This is logically different from the text `Coord`-inate, #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] pub struct Style { pub fg: Option<u32>, pub bg: Option<u32>, pub style: Option<u32>, } impl Style { pub fn paintover(mut self, other: Self) -> Self { ...
/// Parser /// /// # Description /// There are multiple markdown format. For the sake of simplicity we're going to follow the markdown cheatset /// from github https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet /// /// # Parser /// First we need to define the main token that we need to use in order to get...
struct Solution; impl Solution { fn unique_paths_with_obstacles(obstacle_grid: Vec<Vec<i32>>) -> i32 { let n = obstacle_grid.len(); let m = obstacle_grid[0].len(); let mut dp = vec![vec![0; m]; n]; dp[0][0] = 1; for i in 0..n { for j in 0..m { if ...
mod common; extern crate kernel_density; extern crate rand; extern crate quickcheck; use kernel_density::density; use common::{check, PositiveF64}; use std::f64; #[test] #[should_panic(expected="assertion failed: variance > 0.0")] fn new_normal_density_panics_on_zero_variance() { density::normal(0.0, 0.0); } #[...
// //! Copyright 2020 Alibaba Group Holding Limited. //! //! 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 ...
use std::mem::size_of; #[cfg(feature = "half")] use half::{bf16, f16}; use ndarray::{array, s, Array1, Dim}; use numpy::{ dtype, get_array_module, npyffi::NPY_ORDER, pyarray, PyArray, PyArray1, PyArray2, PyArrayDescr, PyArrayDyn, PyFixedString, PyFixedUnicode, ToPyArray, }; use pyo3::{ py_run, pyclass, pym...
uucore_procs::main!(uu_printenv); // spell-checker:ignore procs uucore printenv
mod automaton; mod dfa; mod nfa; mod convert_nfa_to_dfa; mod nfa_regexp; mod dfa_regexp; mod regop; mod escape_chars;
struct Solution; use util::*; trait Preorder { fn preorder(&self, l: i32, r: i32, sum: &mut i32); } impl Preorder for TreeLink { fn preorder(&self, l: i32, r: i32, sum: &mut i32) { if let Some(node) = self { let node = node.borrow(); let left = &node.left; let right...
#[doc = "Register `TAxCCR[%s]` reader"] pub struct R(crate::R<TAXCCR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<TAXCCR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<TAXCCR_SPEC>> for R { #[inline(always)] fn from(reader: crat...
//! `s3d` is an S3 daemon for the Edge written in Rust //! - https://s3d.rs //! - https://github.com/s3d-rs/s3d use clap::{AppSettings, Clap}; use std::error::Error; type AnyError = Box<dyn Error + Send + Sync>; type ResultOrAnyErr<T> = Result<T, AnyError>; #[derive(Clap, Debug)] #[clap(about = "s3d is an S3 daemon ...
// Copyright (c) 2015, David Wood //! A Compound File is made up of a number of virtual streams. These are collections of data that //! behave as a linear stream, although their on-disk format may be fragmented. Virtual streams can //! be user data, or they can be control structures used to maintain the file. Note tha...
// (c) Copyright 2018 Palantir Technologies Inc. All rights reserved. // // 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 req...
use crate::geom::{Triangle, Vertex}; use crate::{Vec2, Vec3}; use std::fs; use std::path::Path; use nalgebra_glm as glm; pub fn load<P: AsRef<Path>>(path: P) -> std::io::Result<Vec<Triangle>> { let mut verts = Vec::new(); let mut coords = Vec::new(); let mut norms = Vec::new(); let mut tris = Vec::ne...
mod runner; #[test] fn mbt() { // we should be able to just return the `Result` once the following // issue is fixed: https://github.com/rust-lang/rust/issues/43301 if let Err(e) = run_tests() { panic!("{}", e); } } fn run_tests() -> Result<(), Box<dyn std::error::Error>> { // run the test...
use std::collections::{HashMap, HashSet}; use std::convert::TryInto; use std::io; use std::io::Read; use crate::parsers::*; fn line_p(s: &[u8]) -> ParseResult<&[u8]> { take_while1_p(|c| c == b'#' || c == b'.')(s) } fn arena_p(s: &[u8]) -> ParseResult<Arena> { map(sep_by(line_p, byte(b'\n')), Arena)(s) } fn ...
use crate::ast::{Expr, lambda}; use std::collections::HashMap; pub struct Env { builtins: HashMap<String, Expr> } impl Env { pub fn new() -> Env { let mut e = Env { builtins: HashMap::new() }; e.add_builtin("PACK", 2, |args| { if args.len() != 2 { ...
// Provides macros for general output use core::fmt; use crate::sbi::*; struct Stdout; impl Stdout { pub fn new() ->Self { Self } } impl fmt::Write for Stdout { fn write_str(&mut self, fmt: &str) ->fmt::Result { let mut buffer = [0u8; 4]; for c in fmt.chars() { for code_point in c.encode_utf8(&mut buffe...
fn main() { let str = "stressed"; println!("{}", str.chars().rev().collect::<String>()); }
//! An abstraction of an edge. The edge can be unidirectional or bidirectional, depending on who its //! neighbors are (an edge can only send RPCs to its neighbors). An edge is a sim_element. extern crate test; use crate::sim_element::SimElement; use core::any::Any; use queues::*; use rpc_lib::rpc::Rpc; use std::fmt...
use crate::parser::get_deps_and_transpile; use anyhow::anyhow; use anyhow::Error; use futures::stream::FuturesUnordered; use futures::task::Poll; use futures::Stream; use futures::StreamExt; use futures::TryFutureExt; use serde::Deserialize; use serde::Serialize; use std::collections::HashMap; use std::collections::Has...
pub trait Clamp { fn clamp(self, min: Self, max: Self) -> Self; } impl Clamp for f32 { fn clamp(self, min: f32, max: f32) -> f32 { if self < min { return min; } if self > max { return max; } self } } pub trait Clamp01 { fn clamp01(self...
use std::process::Command; use crate::app::AppError; pub fn run_script() -> Result<(), AppError> { if cfg!(target_os = "windows") { Command::new("cmd") .args(&["/C", "adaptor.exe"]) .spawn()? } else { Command::new("sh") .arg("-c") .arg("./adaptor...
use std::fmt; #[macro_use] extern crate prettytable; use prettytable::{Table, Row, Cell}; pub struct Output { data: Vec<Vec<String>>, headers: Vec<String>, } const JOIN_SPACE: &str = " "; impl Output { fn new() -> Output { return Output { data: Vec::new(), headers: Vec...
#![warn(clippy::all)] use j4rs::{ClasspathEntry, Instance, InvocationArg, Jvm, JvmBuilder}; use std::error::Error; use std::fmt::{self, Display}; use structopt::StructOpt; #[derive(StructOpt)] struct Opt { #[structopt(short = "f", long = "file")] filename: String, } static CP_ENTRIES: &[&str] = &[ "/home...
#![feature(test)] extern crate bip_bencode; extern crate test; #[cfg(test)] mod benches { use bip_bencode::{BencodeRef, BDecodeOpt}; use test::Bencher; #[bench] fn bench_nested_lists(b: &mut Bencher) { let bencode = b"lllllllllllllllllllllllllllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeee...
// (c) Copyright 2019-2020 OLX use actix_web::web::Bytes; use actix_web::Error; use hyper::body::to_bytes; use hyper::Uri; use log::*; use std::str::FromStr; pub type HyperClient = hyper::Client< hyper_timeout::TimeoutConnector< hyper::client::HttpConnector<hyper::client::connect::dns::GaiResolver>, >...
pub mod clients_protocol;
/* * Copyright 2020 Skyscanner Limited. * * 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...
use super::error::Error; use super::model; use std::result::Result; use std::vec::Vec; pub mod sqlite; pub trait Persistence { fn create_note(&mut self, _: &str, _: Vec<&str>) -> Result<(), Error>; fn query_notes(&self, _: &Vec<&str>, _: &Vec<&str>) -> Result<Vec<model::Note>, Error>; fn update_note_by_ha...
#[doc = "Register `B5` reader"] pub struct R(crate::R<B5_SPEC>); impl core::ops::Deref for R { type Target = crate::R<B5_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<B5_SPEC>> for R { #[inline(always)] fn from(reader: crate::R<B5_SPEC>) -> Se...
//@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows fn main() { vec![()].into_iter(); }
use crate::resource::{ErrorResponse, OAuth2ErrorResponse}; use reqwest::StatusCode; use thiserror::Error; /// An alias to `Result` of [`Error`][error]. /// /// [error]: ./struct.Error.html pub type Result<T> = std::result::Result<T, Error>; /// Error of API request #[derive(Debug, Error)] #[error(transparent)] pub st...
pub mod ast; pub mod parser; pub mod result; pub mod types; use std::{path::Path, path::PathBuf}; use crate::{matrix::transform as tr, Drawer, PPMImg}; use self::{ ast::Command, parser::{parse_file, SymTable}, result::EngineError, result::EngineResult, types::Type, }; pub(crate) fn exec_cmds(com...
#![allow(unused_imports)] extern crate rand; extern crate rand_distr; extern crate scorus; //use std; use rand::thread_rng; use rand::{distributions::Distribution, Rng}; use rand_distr::Normal; use scorus::mcmc::ensemble_sample::{sample, UpdateFlagSpec}; use scorus::mcmc::graph::graph::Graph; use scorus::mcmc::graph::g...
use crate::common::*; use crate::erc20::erc20_contract::ERC20Contract; use crate::erc20::ierc20::IERC20; pub struct BondingCurvedToken{ pub (super) erc20_contract: ERC20Contract, pub pool_balance: Amount } impl BondingCurvedToken{ pub fn constructor(name: Name, symbol: Symbol, _: u8) -> Self { l...
fn main() -> Result<(), Box<dyn std::error::Error>> { let data = std::fs::read_to_string("input.txt")?; let input: Vec<Vec<u32>> = data.lines() .map(|x| x.chars() .map(|y| y as u32 - '0' as u32) ...
//! Creates new random vectors and u8s from given charsets. Charsets can be a bioutils charset or a u8 slice //! ``` //! use bioutils::utils::new::RandomBioVec; //! use bioutils::charsets::bioutils::*; //! let new_vec = Vec::<u8>::random_vec(&12, BioUtilsCharSet::Dna); //! let new_vec_2 = Vec::<u8>::random_vec_with(&12...
use crate::types::key::{virtual_keycode_to_key, Key}; use glium::glutin; use std::fmt; const CODE_KINDS: usize = 161; #[derive(Default, Copy, Clone, Debug)] pub struct KeyEntry { pressed: bool, up_times: usize, down_times: usize, } impl KeyEntry { pub fn new() -> Self { KeyEntry { ...
use chrono::{DateTime, Utc}; use sqlx::postgres::PgPool; use std::convert::Infallible; use warp::filters::BoxedFilter; use warp::reply::Json; use warp::{Filter, Rejection, Reply}; pub mod anode; pub mod token; pub mod ws; use uuid::Uuid; pub struct StreakerApp { pub pool: PgPool, pub sessions: ws::Sessions, ...
extern crate test; mod adapter; mod storage; use rand::random; use protocol::traits::ServiceResponse; use protocol::types::{ Block, BlockHeader, Hash, Proof, RawTransaction, Receipt, ReceiptResponse, SignedTransaction, TransactionRequest, }; use protocol::Bytes; const ADDRESS_STR: &str = "muta14e0lmgck835vm...
#[doc = "Register `DIFCTL` reader"] pub struct R(crate::R<DIFCTL_SPEC>); impl core::ops::Deref for R { type Target = crate::R<DIFCTL_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<DIFCTL_SPEC>> for R { #[inline(always)] fn from(reader: crate::R...
use crate::class_loader::app_class_loader::ClassLoader; use crate::instructions::base::method_invoke_logic::invoke_method; use crate::invoke_support::parameter::{Parameter, Parameters}; use crate::invoke_support::{invoke, ReturnType}; use crate::native::registry::Registry; use crate::runtime::frame::Frame; use crate::o...
use std::io::Write; use std::str::FromStr; use std::fmt::{Display, Formatter, Error}; use crate::utils::*; use crate::traits::*; use crate::{CryptoboxGenerator, TestcaseEnum}; use microsalt::boxy::*; use rand::prelude::*; use crate::generators::crypto_box::curve25519xsalsa20poly1305::*; #[allow(non_snake_case)] pub s...
use super::fake_sqlx as sqlx; // f32 is not included below as REAL represents a floating point value // stored as an 8-byte IEEE floating point number // For more info see: https://www.sqlite.org/datatype3.html#storage_classes_and_datatypes impl_database_ext! { sqlx::sqlite::Sqlite { bool, i32, ...
/** * [289] Game of Life * * According to Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." The board is made up of an m x n grid of cells, where each cell has an initial state: live (represented by a 1) or dea...
use std::io; use std::io::BufRead; fn main() { let mut paper = 0; let mut ribbon = 0; let stdin = io::stdin(); for l in stdin.lock().lines() { let line = l.unwrap(); let mut fields : Vec<u32> = line.split('x') .map(|s| s.parse::<u32>().unwrap()) ...
pub mod mock_stream; pub mod mock_time;
mod coords; pub mod decimal; pub mod generator; pub mod mv; pub mod piece; pub mod position; pub mod stars; pub mod stats; mod steps;
use serde::{Deserialize, Serialize}; use crate::proxy::base::SupportedProtocols; #[derive(Serialize, Deserialize, Clone)] pub struct InboundConfig { pub protocol: SupportedProtocols, pub address: String, pub port: u16, pub tls: Option<TlsConfig>, } #[derive(Serialize, Deserialize, Clone)] pub struct...
//! An add-on to [`std::future::Future`] that makes it easy to introduce a retry mechanism //! with a backoff for functions that produce failible futures, //! i.e. futures where the `Output` type is some `Result<T, backoff::Error<E>>`. //! The `backoff::Error` wrapper is necessary so as to distinguish errors that are c...
use crate::music_theory::*; use crate::schema::*; use diesel::prelude::*; use diesel::sqlite::SqliteConnection; use diesel_migrations::*; embed_migrations!("migrations/"); #[derive(Debug, PartialEq, Eq, Queryable, Insertable)] #[table_name = "notes"] pub struct ChordNote { pub chord: String, pub degree: Degre...
use crate::{ Sqlite, SqliteConnection, SqliteQueryResult, SqliteRow, SqliteStatement, SqliteTypeInfo, }; use futures_core::future::BoxFuture; use futures_core::stream::BoxStream; use futures_util::{TryFutureExt, TryStreamExt}; use sqlx_core::describe::Describe; use sqlx_core::error::Error; use sqlx_core::executor::...
trait Foo {} fn give_foo() -> Result<Box<dyn Foo>, ()> { unimplemented!() } fn main() -> Result<(), ()> { let _foo = give_foo(); let _foo = give_foo().unwrap(); let _foo = give_foo()?; Ok(()) }
fn thunk_function_types(typ: UnrefinedType) -> UnrefinedType { match typ { UnrefinedType::One => UnrefinedType::One, UnrefinedType::Bool => UnrefinedType::Bool, UnrefinedType::U8 => UnrefinedType::U8, UnrefinedType::Product(contents) => { UnrefinedType::Product(Box::new(( thunk_function_...
use std::collections::VecDeque; pub fn count(lines: &[&str]) -> usize { let field: Vec<Vec<Cell>> = lines.iter() .map(|line| line.chars().map(|c| c.into()).collect()) .collect(); if field.is_empty() || field[0].is_empty() { return 0; } let mut total = 0; for (y, row) in f...
#![feature(test)] #![deny(warnings)] extern crate test; use bytes::Buf; use futures_util::stream; use futures_util::StreamExt; use http_body::Frame; use http_body_util::{BodyExt, StreamBody}; macro_rules! bench_stream { ($bencher:ident, bytes: $bytes:expr, count: $count:expr, $total_ident:ident, $body_pat:pat, $...
use std::process; use std::net::Ipv4Addr; mod subnetter { pub enum IpErrors { InvalidInput(u8), InvalidCidr(u8), } struct IpSubnet { ip: std::net::Ipv4Addr, mask: (u8,u8,u8,u8), cidr: u8, } fn new(ip_string: String) -> IpSubnet { IpSubnet { ip: std::net::Ipv4Addr::new(127,0,0,1), mask: (255...
use solana_program::{ account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey, }; entrypoint!(process_instruction); // uses macro entrypoint! to declare something as the entrypoint of the program, only way to call the program fn process_instruction( program_id: &Pubkey, //name of...
use crate::value::{ToValue, Value}; use core::{fmt, str::FromStr}; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub enum Level { Debug, Info, Warn, Error, } impl fmt::Debug for Level { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "\"{}\"", self) } } i...
#[macro_use] extern crate serde_derive; use std::fs::File; use std::io::{BufRead, BufReader, Write}; use std::path::Path; use std::{fs, io}; use chrono::{Local, TimeZone}; use chrono_english::{parse_date_string, Dialect}; use clap::{App, Arg, ArgGroup}; use colored::*; use crypto::digest::Digest; use crypto::sha1::Sh...
use crate::decode::Decode; use crate::encode::{Encode, IsNull}; use crate::error::BoxDynError; use crate::types::Type; use crate::{PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueFormat, PgValueRef, Postgres}; use chrono::{Duration, NaiveDate}; use std::mem; impl Type<Postgres> for NaiveDate { fn type_info() ...
use petgraph::visit::{GraphRef, IntoNeighbors, Visitable, VisitMap}; use fnv::FnvHashSet; use std::hash::Hash; /// THE FOLLOWING CODE IS COPIED FROM: https://docs.rs/petgraph/0.4.13/src/petgraph/visit/traversal.rs.html#38-43 /// so that DFS also yield the parent node /// /// Visit nodes of a graph in a depth-first-sea...
use crate::{ brush::Brush, core::{algebra::Vector2, math::Rect, pool::Handle}, define_constructor, message::{CursorIcon, KeyCode, MessageDirection, UiMessage}, HorizontalAlignment, LayoutEvent, MouseButton, MouseState, Thickness, UiNode, UserInterface, VerticalAlignment, BRUSH_FOREGROUND, BRUSH_...
/** * [0033] Search in Rotated Sorted Array * * Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. * * (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). * * You are given a target value to search. If found in the array return its index, otherwise return -1. * * Y...
// Copyright 2020 Yevhenii Reizner // // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Based on https://github.com/Lokathor/wide (Zlib) use bytemuck::cast; #[cfg(all(not(feature = "std"), feature = "no-std-float"))] use tiny_skia_path::NoStdFloat; use super:...
mod fast_input; use fast_input::FastInput; use std::{ cmp::Reverse, collections::{HashMap, HashSet}, }; use std::io::{stdout, BufWriter, Write}; fn main() { let inp = FastInput::new(); let stdout = stdout(); let mut writer = BufWriter::new(stdout.lock()); let n = inp.next(); let mut word...
// dejando a los tipos disponibles en el alcance use std::io; use rand::Rng; use std::cmp::Ordering; /* A few number types can have a value between 1 and 100: i32, a 32-bit number; u32, an unsigned 32-bit number; i64, a 64-bit num- ber; as well as others. Rust defaults to an i32 */ // cargo doc --open fn main() { le...
//! This crate implements SDK for SVM. //! Using this crate when writing SVM Templates in Rust isn't mandatory but should be very useful. //! //! The crate is compiled with `![no_std]` (no Rust standard-library) annotation in order to reduce the compiled WASM size. #![no_std] #![allow(missing_docs)] #![allow(missing_d...
use std::fs; use std::vec::Vec; extern crate lib; use lib::q02::Item; use std::str::FromStr; const FILENAME: &str = "files/02/input.txt"; /* --- Day 2: Password Philosophy --- Your flight departs in a few days from the coastal airport; the easiest way down to the coast from here is via toboggan. The shopkeeper at th...
use crate::*; use std::marker::PhantomData; #[derive(Debug)] pub struct Amp<S, F, V = Voltage, R = Hz44100> where R: Rate, S: Signal<R, Sample = Voltage>, F: Signal<R, Sample = V>, V: Factor, { rate: PhantomData<*const R>, signal: S, factor: F, } impl<S, F, V, R> Amp<S, F, V, R> where ...
pub use luminance::pixel::{Depth32F, R32F, RGBA32F}; pub use luminance::texture::{Dim2, Flat, MagFilter, MinFilter, Sampler, Texture, Unit, Wrap}; use image; use std::ops::Deref; use std::path::Path; use resource::{Load, LoadError, Reload, ResCache, Result}; // Common texture aliases. pub type TextureRGBA32F = Textur...
use crate::data_structures::tree::{Debug, Node, RefCell, Rc}; use crate::data_structures::tree::treenode::TreeNode; pub struct NodeBuilder<T> where T: Copy + Clone + Debug + PartialEq { node: TreeNode<T> } impl<T> NodeBuilder<T> where T: Copy + Clone + Debug + PartialEq { pub fn new(val: T) -> Self { NodeBuild...
use super::array::{QuantizedMatrix, Matrix}; use super::module::{Module, ModuleT}; use super::quantize::{Quantization, Dequantization}; use super::variables::VarStore; #[derive(Debug)] pub struct Linear { pub name: usize, pub end: bool, } impl Linear { pub fn new(name: usize, end: bool) -> Self { ...
pub mod auth; pub mod camera; pub mod config; pub mod cpuinfo; pub mod device; pub mod prompt;
//Copyright 2020 EinsteinDB Project Authors & WHTCORPS Inc. Licensed under Apache-2.0. mod test_violetabft_causet_storage; mod test_violetabftkv; mod test_seek_brane; mod test_causet_storage; mod test_titan;
extern crate dconf_rs; static DCONF_KEY: &'static str = "/org/gnome/shell/extensions/kylecorry31-do-not-disturb/do-not-disturb"; pub struct DoNotDisturb; impl DoNotDisturb { pub fn new() -> Result<Self, String> { let dconf_str = dconf_rs::get_string(DCONF_KEY); match dconf_str { Ok(val) => { if val.is...
use amethyst::{ assets::{Handle, Prefab}, core::Transform, ecs::prelude::{Entity, LazyUpdate, Read, World}, prelude::{Builder, WorldExt}, renderer::transparent::Transparent, utils::removal::Removal, }; use crate::{ components::{ animation::{Animation, AnimationId, AnimationPrefabDat...
pub mod aws; pub mod configs; pub mod creds; pub mod ctx; pub mod view; #[macro_use] extern crate simplelog;
// Copyright 2019 WHTCORPS INC Project Authors. Licensed under Apache-2.0. use crate::edb::CausetEngine; use crate::errors::Result; use crate::options::WriteOptions; use crate::violetabft_engine::VioletaBftEngine; #[derive(Clone, Debug)] pub struct Engines<K, R> { pub kv: K, pub violetabft: R, } impl<K: Caus...
use super::node::Node; use super::stmt::Stmt; use super::structs::{ AssignTarget, FnArg, Ident, ObjLitField, TypeAnnotation, }; use super::types::Type; use crate::source::Pos; use crate::token::TokenType; use std::fmt::{ Display, Formatter, Result as FmtResult, }; #[derive(Debug, Clon...
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::CFGR { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut ...
// Copyright 2016-2020 the Tectonic Project // Licensed under the MIT License. //! Tectonic’s pluggable I/O backend. use std::{io::Read, str::FromStr}; use tectonic_errors::{anyhow::bail, atry, Result}; use tectonic_status_base::StatusBackend; pub mod cached_itarbundle; pub mod dirbundle; pub mod format_cache; pub m...
#![no_std] #![no_main] #![feature(start, no_std, alloc)] // for lang_items, memmove and memalign extern crate emlib; extern crate alloc; use alloc::boxed::Box; #[no_mangle] pub extern fn main() { let _a = 1; let _b = &2; let _c = &3; let _x = Box::new(1); { let _y = Box::new(2); } ...
use core::f64; use bvh::aabb::{Bounded, AABB}; use bvh::bounding_hierarchy::BHShape; use nalgebra::{Point3, Vector2, Vector3}; use crate::materials::Material; use crate::renderer; use crate::surface_interaction::SurfaceInteraction; // SPHERE #[derive(Debug)] pub struct Sphere { pub position: Point3<f64>, pub...
use std::fmt; use bytes::Bytes; use chrono::NaiveTime; use crate::{ errors::CIFParseError, helpers::{string_of_slice, string_of_slice_opt, time_from_slice, time_half_from_slice}, Tiploc, }; #[derive(Clone, Eq, PartialEq)] pub struct LocationOrigin { record: Bytes, } impl LocationOrigin { pub(cra...
extern crate getopts; use getopts::Options; use std::env; extern crate forestfire; fn print_usage(program: &str, opts: Options) { let brief = format!("Usage: {} [options]", program); print!("{}", opts.usage(&brief)); } pub fn main() { let args: Vec<String> = env::args().collect(); let program = args[...
mod error; #[cfg(test)] mod tests; use std::fs; use std::ops::RangeInclusive; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::sync::Arc; use clap::ArgMatches; use common_config_parser::types::Config; use core_consensus::wal::ConsensusWal; use core_consensus::SignedTxsWAL; use core_storage::adapter::r...
// Copyright 2020 Parity Technologies // // 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 distributed // except accor...
pub const ANCHO_PANTALLA: usize = 160 * 2; pub const ALTO_PANTALLA: usize = 144 * 2; //Colores ALPHA,R,G,B pub const VERDE_MUY_OSCURO: u32 = 0xFF0F380F; pub const VERDE_OSCURO: u32 = 0xFF306230; pub const VERDE_ILUMINADO: u32 = 0xFF8BAC0F; pub const VERDE_MUY_ILUMINADO: u32 = 0xFF9BBC0F; // FLAGS EN Z80 ***********...
// Copyright 2020 Conflux Foundation. All rights reserved. // Conflux is free software and distributed under GNU General Public License. // See http://www.gnu.org/licenses/ use super::{ utils::{ padded_big_endian, pull_slice, read_abi_list, ABIListWriter, LinkedBytes, }, ABIDecodeError, ABI...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Activate NFCT peripheral for incoming and outgoing frames, change state to activated"] pub tasks_activate: TASKS_ACTIVATE, #[doc = "0x04 - Disable NFCT peripheral"] pub tasks_disable: TASKS_DISABLE, #[doc = "0x08 - Enab...
use actix_web::{test}; use age_bot::api::handlers::healthcheck; use age_bot::config::get_config_from_env; #[test] fn test_healthcheck() { let req = test::TestRequest::with_state(get_config_from_env().unwrap()).finish(); let resp = healthcheck(&req); assert_eq!(resp, "ok"); }
#[doc = "Register `CONFIG1` reader"] pub struct R(crate::R<CONFIG1_SPEC>); impl core::ops::Deref for R { type Target = crate::R<CONFIG1_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<CONFIG1_SPEC>> for R { #[inline(always)] fn from(reader: crat...
pub mod error; pub mod log; pub mod trace; pub use error::{Error, Result};