text
stringlengths
8
4.13M
table! { keyword (id) { id -> BigInt, #[sql_name = "keyword"] keyword_str -> Text, } }
#[derive(Debug, serde::Deserialize)] struct Data { name: String, value: i32, } fn sum(input: &str) -> i32 { let parsed: Data = serde_json::from_str(input).unwrap(); parsed.name.len() as i32 + parsed.value }
pub trait CtxTypeInfo { const NAME: &'static str; }
use dotenv::dotenv; use http::{uri::Uri, StatusCode}; use std::convert::Infallible; use tokio::{ fs, io, io::AsyncReadExt, stream::{Stream, StreamExt}, sync::mpsc, }; use warp::{redirect, reject, Buf, Filter, Reply}; use sqlx::postgres::PgPool; use std::env; use rand::Rng; use std::path; mod api_str...
#[doc = "Register `AHB2ENR` reader"] pub type R = crate::R<AHB2ENR_SPEC>; #[doc = "Register `AHB2ENR` writer"] pub type W = crate::W<AHB2ENR_SPEC>; #[doc = "Field `GPIOAEN` reader - CPU1 IO port A clock enable"] pub type GPIOAEN_R = crate::BitReader<GPIOAEN_A>; #[doc = "CPU1 IO port A clock enable\n\nValue on reset: 0"...
use anyhow::anyhow; use anyhow::Result; use mdbook::book::Book; use mdbook::preprocess::{Preprocessor, PreprocessorContext}; use mdbook::BookItem; use pulldown_cmark::{Event, Options, Parser}; use pulldown_cmark_to_cmark::cmark; /// A no-op preprocessor. pub struct FixCJKSpacing; impl FixCJKSpacing { pub fn new(...
pub struct RMQ<T> { index: Vec<Vec<usize>>, value: Vec<T>, } impl<T: Ord> RMQ<T> { fn min(v: &Vec<T>, i: usize, j: usize) -> usize { if v[i].cmp(&v[j]).is_le() { i } else { j } } pub fn new(value: Vec<T>) -> Self { let mut index = vec![]; ...
use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; /// Settings for the game #[derive(Debug, Clone)] pub struct SharmatSettings(Rc<RefCell<HashMap<String, SharmatSettingType>>>); /// Values for sharmat settings #[derive(Debug, Copy, Clone)] pub enum SharmatSettingType { Bool(bool), USize(...
struct User { username: String, email: String, sign_in_count: u64, active: bool, } fn main() { let mut kuba = User { username: String::from("Jakub Krochmalski"), email: String::from("kuba.krochmalski@gmail.com"), sign_in_count: 1, active: true, }; kuba.usern...
use crate::{ iterator_utils::empty_iterator::EmptyIterator, types::{ keyword_type::KeywordType, schema::Schema, schema_error::SchemaError, scope_builder::ScopeBuilder, validator::Validator, validator_error_iterator::ValidationErrorIterator, }, }; use json_trait_rs::{JsonMapTrait, JsonType, Primitive...
extern crate byteorder; mod assembler; mod disassembler; mod cpu; mod opcodes; pub use assembler::{Assembler, CodeSegment}; pub use cpu::{Cpu, CpuError, CpuStepResult}; pub use disassembler::Disassembler; pub use opcodes::OpCode;
use mint::IntoMint; use crate::{ DMat2, DMat3, DMat4, DQuat, DVec2, DVec3, DVec4, I64Vec2, I64Vec3, I64Vec4, IVec2, IVec3, IVec4, Mat2, Mat3, Mat3A, Mat4, Quat, U64Vec2, U64Vec3, U64Vec4, UVec2, UVec3, UVec4, Vec2, Vec3, Vec3A, Vec4, }; macro_rules! impl_vec_types { ($t:ty, $vec2:ty, $vec3:ty, $vec4:t...
use core::cmp; use core::fmt; use core::ptr::NonNull; use crate::traits::ReclaimBase; // ************************************************************************************************* // Retired // ************************************************************************************************* pub struct Retired...
use super::{ MessageHandlerWrapper }; use ls_service::service::{ ResponseOutput, ServiceHandle }; use lsp_rs::{ ServerNotification, ServerRequest }; pub struct ActionHandler { } impl ActionHandler { pub fn new( ) -> Self { ActionHandler { } } pub fn handle_request(...
// name string The name of the domain itself. This should follow the // standard domain format of domain.TLD. For instance, example.com is a valid // domain name. // ttl number This value is the time to live for the records on this // domain, in seconds. This defines the time frame that clients can cache // qu...
extern crate etherparse; extern crate num_complex; extern crate pnet; extern crate serde_yaml; pub mod ant_pos; pub mod board_cfg; pub mod msg; pub mod net; pub mod utils;
use amethyst::{ core::nalgebra::Vector2, ecs::prelude::{Component, VecStorage}, }; /// The ship's engine component. /// Holds `max_force` providing maximum movement force in a given direction. /// Holds `efficiency` at which consumed fuel is turned into force. /// Holds `consumption`, which represents the fuel...
use cursive::{Cursive, views::*}; pub fn show(siv: &mut Cursive) { let help_text = LinearLayout::vertical() .child(TextView::new("?: Show this help")); let dialog = Dialog::around(help_text) .title("Help") .button("Ok", |s| { s.pop_layer(); }); siv.add_layer(dialog); }
/// checks day, month and year values are whether valid or not. pub(crate) fn is_each_value_valid(date: &str) -> bool { let max_day_number = 31; let max_month_number = 12; let min_year_number = 1000; let max_year_number = 9999; let string_parts = date.split('-'); if string_parts.count() != 3...
//! # The Rust Standard Library //! //! The Rust Standard Library provides the essential runtime //! functionality for building portable Rust software. #![allow(dead_code)] #![allow(unused_variables)] #[allow(unused_imports)] #[macro_use] extern crate pipeline; mod basics; mod primitives; mod control_flow; mod muta...
use proconio::{fastout, input}; fn gcd(x: i64, y: i64) -> i64 { let mut x = x; let mut y = y; if x == 0 { return y; } else if y == 0 { return x; } if x < y { let temp = x; x = y; y = temp; } let m = x % y; if m == 0 { y } else { ...
//! Capture and record lading's internal metrics //! //! The manner in which lading instruments its target is pretty simple: we use //! the [`metrics`] library to record factual things about interaction with the //! target and then write all that out to disk for later analysis. This means //! that the generator, blackh...
extern crate more_asserts; use serde_json::Value; use veloci::{ search::{RequestSearchPart, SearchRequest}, *, }; use super::common; static TEST_FOLDER: &str = "codeTest"; lazy_static! { static ref TEST_PERSISTENCE: persistence::Persistence = { let indices = r#" ["*GLOBAL*"] f...
// 3rd party imports {{{ use clap::Clap; // }}} // Own imports {{{ use crate::aur; use crate::config::Config; use crate::error::Error; // }}} #[derive(Clap)] pub struct CliArgs { package: String, } pub async fn handler(args: CliArgs, config: Config) -> Result<(), Error> { let aur = aur::Handle::from(&config)...
//! # Placeholder module for various types I'm not sure how to sort yet. // Not too sure what to do with these. This is the best option to keep them all seperate. // TODO unsure of how to manage this as a generic concept. // They are both transport-specific types, and I would like to make them // work nicel...
use super::super::prelude::{ LPCTSTR , HMODULE , DWORD , BOOL }; #[link(name = "WinMM")] extern "stdcall" { pub fn PlaySoundW( pszSound : LPCTSTR , hmod : HMODULE , fdwSound : DWORD ) -> BOOL; }
use ash::version::DeviceV1_0; use ash::vk; use crate::map_vk_error; use crate::vulkan::{Device, Queue, VkError}; pub struct CommandPool { handle: vk::CommandPool, } pub struct CommandBuffer { handle: vk::CommandBuffer, } impl CommandPool { pub fn resetable(device: &Device, queue: &Queue) -> Result<Self,...
extern crate testing_diesel; extern crate diesel; use self::diesel::prelude::*; use self::testing_diesel::*; use self::testing_diesel::models::*; use std::io::{stdin , Read}; use std::env::args; fn main() { use testing_diesel::schema::posts::dsl::{posts}; let id = args().nth(1).expect("update_posts require...
use std::cmp::Ordering; use std::collections::{HashMap, HashSet, BinaryHeap}; use std::io; /////////////////////////////////////////////////////////////////////////////// #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] struct Vec2 (isize, isize); impl Vec2 { fn distance(&self) -> isize { self.0.abs() ...
use std::borrow::Cow; use rand::thread_rng; use rand::seq::SliceRandom; use regex::{Regex, RegexSet}; struct Rule { pattern: Regex, replace: String, } pub struct Rules(RegexSet, Vec<Rule>); impl Rules { pub fn parse(s: &str) -> Result<Rules, regex::Error> { let mut rules = Vec::new(); let mut prevpattern: Opt...
use super::expression::Expression; use super::variable::LocalVariable; use crate::ast_transform::Transformer; use crate::source::SourceLocation; use crate::syntax::Reference; use std::convert::TryInto; #[derive(Debug, Clone)] pub struct BoxRead { pub reference: Reference, span: SourceLocation, } #[derive(Debu...
use super::container::ServiceContainer; use crate::cmds::http::HttpServiceInfo; use crate::utils::http::*; use futures::lock::Mutex; use hyper::{Body, Method, Request, Response, StatusCode}; use serde_json::Result as SerdeResult; use std::sync::Arc; use tokio::sync::oneshot::Sender; pub struct InternalService { sh...
#![warn(rust_2018_idioms)] pub mod worker; use async_channel::TrySendError; use cross_domain_message_gossip::Message as GossipMessage; use parity_scale_codec::{Decode, Encode}; use sc_client_api::{AuxStore, HeaderBackend, ProofProvider}; use sc_utils::mpsc::TracingUnboundedSender; use sp_api::ProvideRuntimeApi; use s...
//! This crate is small and nearly dependency-less crate that implements a simple aggregating //! event-loop and a cheap actor implementation with a global actor-pool. //! //! ## Why should I use this crate? //! You probably shouldn't. There are other solutions like [actix](https://crates.io/crates/actix) //! out there...
use anyhow::anyhow; use ethers::{middleware::nonce_manager::NonceManagerMiddleware, prelude::*, signers::LocalWallet}; use gumdrop::Options; use moebius::{Broadcaster, MoebiusWatcher}; use serde::Deserialize; use solana_sdk::{pubkey::Pubkey, signature::read_keypair_file}; use std::{convert::TryFrom, fs::File, path::Pat...
//! Performs autodetection of the host for the purposes of running //! Cretonne to generate code to run on the same machine. #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces, unstable_features)] #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml...
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1550" #[allow(unused)] use super::rsass; // From "sass-spec/spec/libsass-closed-issues/issue_1550/each_embedded.hrx" // Ignoring "each_embedded", error tests are not supported yet. // From "sass-spec/spec/libsass-closed-issues/issue_1550/for_e...
use crate::{ gui::{BuildContext, Ui, UiMessage, UiNode}, physics::Joint, scene::commands::{ physics::{ SetRevoluteJointAnchor1Command, SetRevoluteJointAnchor2Command, SetRevoluteJointAxis1Command, SetRevoluteJointAxis2Command, }, SceneCommand, }, send_...
#![feature(nll)] #![recursion_limit="256"] extern crate codecophony_editor_shared as shared; #[macro_use] extern crate stdweb; extern crate serde_json; extern crate serde; extern crate nalgebra; extern crate rand; #[macro_use] extern crate maplit; #[macro_use] extern crate derivative; use serde::Serialize; use stdweb...
#[doc = "Reader of register IC_DMA_CR"] pub type R = crate::R<u32, super::IC_DMA_CR>; #[doc = "Writer for register IC_DMA_CR"] pub type W = crate::W<u32, super::IC_DMA_CR>; #[doc = "Register IC_DMA_CR `reset()`'s with value 0"] impl crate::ResetValue for super::IC_DMA_CR { type Type = u32; #[inline(always)] ...
//! CUDA manager module. use std::prelude::v1::*; use std::thread_local; use std::rc::Rc; use num_traits::Zero; use rustacuda::prelude::*; use rustacuda::memory::{DeviceBuffer, DeviceCopy}; use cublas_sys::*; use super::cusolver_sys_partial::*; struct CudaManager { cuda_ctx: Rc<Context>, cublas_...
use std::io::{self, BufRead}; fn count(vec: &[String], a: usize, b: usize) -> usize { // Loop over the vector vec.iter() // Use b as a step to ignore some lines .step_by(b) // Use enumerate to get the index .enumerate() // Keep the encounters with a tree .filter(...
use crate::math::{dot, Matrix, Vector}; /// Base linear regressor interface. /// Inspired by `Pipeline` class from `scikit-learn` library. /// /// Only `fit` and `weights` methods are needed to be implemented. /// Other methods have standard implementation and are auto-inherited. pub trait Regressor { /// Assess t...
use cidr::{Ipv4Cidr, Ipv6Cidr}; use std::borrow::Cow; use std::net::{Ipv4Addr, Ipv6Addr}; use std::ops::RangeInclusive; #[derive(Debug, PartialEq)] pub struct Var<'i>(pub Cow<'i, str>); #[derive(Debug, PartialEq)] pub enum Rhs<'i> { Int(i32), IntRange(RangeInclusive<i32>), String(Cow<'i, [u8]>), Ipv4(...
//! Variable length records are used to store additional metadata not defined in the header. //! //! Variable length records (VLRs) can be "regular" or "extended". "Regular" vlrs are stored right //! after the header, before the point records. "Extended" vlrs (EVLRs) are stored at the end of //! the file, after the poi...
// Copyright (c) 2018-2020 Jeron Aldaron Lau // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0>, the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, or the ZLib // license <LICENSE-ZLIB or https://www.zlib.net/zlib_license.html> at ...
// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) a...
use libc::{c_char, c_int, c_uint, c_void, size_t}; use H5Ipublic::hid_t; use H5public::{herr_t, hsize_t, htri_t, hbool_t}; #[derive(Clone, Copy, Debug)] #[repr(C)] pub enum H5T_class_t { H5T_NO_CLASS = -1, H5T_INTEGER = 0, H5T_FLOAT = 1, H5T_TIME = 2, H5T_STRING = 3, H5T_BITFIELD = 4, H5T_...
use whiteread as w; use w::prelude::*; // From https://github.com/krdln/whiteread on MIT license #[allow(dead_code)] mod whiteread { use std::path::Path; use std::io; pub mod stream { use std::str::SplitWhitespace; use std::io; pub trait StrStream { fn next(&mut self) ->...
//! The [SQS](https://aws.amazon.com/sqs/) protocol speaking blackhole. use std::{fmt::Write, net::SocketAddr}; use hyper::{ body, server::conn::{AddrIncoming, AddrStream}, service::{make_service_fn, service_fn}, Body, Request, Response, Server, StatusCode, }; use metrics::{register_counter, Counter};...
use std::{os::raw::c_char, ffi::CStr}; use libc::{c_uchar, c_ulong}; use super::error_handling::ReturnErrorC; use crate::traits::{converting_to_rust_enum::ConvertingToRustEnum, enum_specific::EnumSpecific}; use crate::common::ReturnFormat; /// contains the text of the response to the submitted request or information...
#[macro_use] extern crate dotenv_codegen; pub fn main() { dotenv_or_default!(); }
use nu_engine::{eval_block, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{CaptureBlock, Command, EngineState, Stack}; use nu_protocol::{ Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, Span, SyntaxShape, Value, }; use rayon::prelude::*; use super::...
use serde::de::DeserializeOwned; use std::error::Error; use std::path::Path; pub fn parse<T: DeserializeOwned>(path: &Path) -> Result<T, Box<dyn Error>> { let json_str = std::fs::read_to_string(path)?; let content: T = serde_json::from_str(&json_str)?; Ok(content) }
#[cfg(target_os = "linux")] fn build() { // do nothing! } fn main() { build(); }
#![doc = include_str!("./README.md")] pub mod ffi; mod util; #[cfg(unix)] use std::os::unix::io::AsRawFd; use std::{ char, error, ffi::CStr, fmt, hash, iter, marker::PhantomData, mem::MaybeUninit, num::NonZeroU16, ops, os::raw::{c_char, c_void}, ptr::{self, NonNull}, slice, st...
mod format; mod models; mod shader; mod animator; mod interpolate; pub use self::animator::LightAnimator; pub use self::shader::LightEnvironment; pub use self::shader::WinchLighting;
use std::collections::HashMap; #[derive(Hash, PartialEq, Eq)] pub enum HlGroup { Pmenu, PmenuSel, Tabline, TablineSel, TablineFill, Cmdline, CmdlineBorder, Wildmenu, WildmenuSel, MsgSeparator, } #[derive(Default)] pub struct HlDefs { hl_defs: HashMap<u64, Highlight>, ...
use crate::rtb_type; rtb_type! { EventTrackingMethod, 500, ImagePixel=1; JavaScript=2 }
/* NOTE: code was initially copied from first.rs */ /* Adding generics. */ pub struct List<T> { head: Link<T>, } // type alias Link // the old version of Link is now reimplemented using Option type Link<T> = Option<Box<Node<T>>>; struct Node<T> { elem: T, next: Link<T>, } impl<T> List<T> { pub fn n...
#[allow(dead_code)] pub fn is_prime(n: i64) -> bool { if n <= 1 { return false; } else if n <= 3 { return true; } else if n % 2 == 0 || n % 3 == 0 { return false; } let mut i = 5; while i * i <= n { if n % i == 0 || n % (i + 2) == 0 { return false; ...
use crate::align; use crate::reference_library; use crate::utils; use reference_library::ReferenceMetadata; use std::io::Error; use debruijn::dna_string::DnaString; use debruijn_mapping::pseudoaligner::Pseudoaligner; /* Takes a list of sequences and optionally reverse sequences, a reference library index, reference l...
fn main(){ let x = 6; let c = 5+3; }
// Copyright 2018 Future Science Research Inc. // // 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 Software without restriction, including without limitation the rights // to use, copy, modify, merg...
use std::process::{Command, ExitStatus, Output}; pub fn exec_shell(arg: &str) -> Output { Command::new("sh") .arg("-c") .arg(arg) .output() .expect("failed to execute process") } pub fn exec_shell_with_output(arg: &str) -> ExitStatus { Command::new("sh") .arg("-c") ...
use sudo_test::{Command, Env, TextFile, User}; use crate::{Result, PANIC_EXIT_CODE, PASSWORD, SUDOERS_ALL_ALL_NOPASSWD, USERNAME}; mod credential_caching; mod flag_other_user; mod long_format; mod needs_auth; mod nopasswd; mod not_allowed; mod short_format; mod sudoers_list; #[test] fn root_cannot_use_list_when_empt...
#![macro_use] macro_rules! foreach_exti_irq { ($action:ident) => { crate::pac::interrupts!( (EXTI0) => { $action!(EXTI0); }; (EXTI1) => { $action!(EXTI1); }; (EXTI2) => { $action!(EXTI2); }; (EXTI3) => { $action!(EXTI3); }; (EXTI4) => { $acti...
#[macro_use] extern crate log; extern crate env_logger; mod cpu; mod event_signal; pub use cpu::*; pub use event_signal::*;
#[doc = "Register `FLTINR4` reader"] pub type R = crate::R<FLTINR4_SPEC>; #[doc = "Register `FLTINR4` writer"] pub type W = crate::W<FLTINR4_SPEC>; #[doc = "Field `FLT5BLKE` reader - FLT5BLKE"] pub type FLT5BLKE_R = crate::BitReader; #[doc = "Field `FLT5BLKE` writer - FLT5BLKE"] pub type FLT5BLKE_W<'a, REG, const O: u8...
/* Tuples group together values of different types Max 12 elements */ pub fn run() { let person: (&str, &str, i8) = ("Hello", "world", 11); println!("Message is {} to {}, {} times", person.0, person.1, person.2); }
use crate::transliterate::{TextTransliterate, TransliterationError}; use async_std::sync::{channel as async_channel, Receiver as AsyncReceiver, Sender as AsyncSender}; use async_std::task::block_on; use crossbeam::{crossbeam_channel::bounded, crossbeam_channel::unbounded, Receiver, Sender}; use std::thread; #[derive(D...
use ctru::Handle; #[inline] pub fn GPUCMD_HEADER(incremental: i32, mask: i32, reg: i32) { (((incremental)<<31)|(((mask)&0xF)<<16)|((reg)&0x3FF)); } #[inline] pub fn GPU_TEXTURE_MAG_FILTER(v: i32) { (((v)&0x1)<<1); //takes a GPU_TEXTURE_FILTER_PARAM } #[inline] pub fn GPU_TEXTURE_MIN_FILTER(v: i32) { (((v...
use crate::config::{Config, SocketType}; use clap::ArgMatches; pub mod init; pub mod run; pub(crate) fn override_config(mut config: Config, matches: &ArgMatches) -> Config { if let Some(directory) = matches.value_of("directory") { config = config.with_custom_directory(directory); } if let Some(pr...
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // 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>,...
use crate::platform::Sub; pub use std::time::Duration; use wasm_bindgen::prelude::JsValue; #[derive(Default, Debug, Clone)] pub struct Time(f64); impl Time { pub fn now() -> Self { Time(js_sys::Date::now()) } } impl ToString for Time { fn to_string(&self) -> String { js_sys::Date::new(&Js...
// Some constants pub const PUBLIC_FOLDER: &str = "./static/public"; pub const HTML_CONTENT_TYPE: &str = "text/html; charset=utf-8"; pub const JSON_CONTENT_TYPE: &str = "application/json"; pub const DEFAULT_CONFIG_FILE: &str = "./config.json";
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under both the MIT license found in the * LICENSE-MIT file in the root directory of this source tree and the Apache * License, Version 2.0 found in the LICENSE-APACHE file in the root directory * of this source tree. */ use f...
use crate::auth::create_jwt; use crate::model::{LoginRequest, LoginResponse, RegisterRequest}; use crate::service::UserService; use rocket::response::content; use rocket::response::status::Unauthorized; #[post("/login", format = "json", data = "<input>")] pub fn login( input: rocket_contrib::json::Json<LoginReques...
mod event; mod failpoint; mod matchable; mod subscriber; #[cfg(feature = "tracing-unstable")] mod trace; pub(crate) use self::{ event::{Event, EventClient, EventHandler, SdamEvent}, failpoint::{FailCommandOptions, FailPoint, FailPointGuard, FailPointMode}, matchable::{assert_matches, eq_matches, is_expecte...
use std::marker::PhantomData; // Phantom tuple struct which is a generic over A with // hidden parameter B // Allow equality test for this type #[derive(PartialEq)] struct PhantomTuple<A, B>(A, PhantomData<B>); // phantom struct which is generic over A with hidden param B #[derive(PartialEq)] struct PhantomStruct<A...
use crate::{Error, SipManager, ReqProcessor}; use common::{ async_trait::async_trait, rsip::{self, prelude::*}, }; use models::transport::{RequestMsg, ResponseMsg}; use std::{ any::Any, sync::{Arc, Weak}, }; #[derive(Debug)] pub struct Registrar { sip_manager: Weak<SipManager>, } #[async_trait] im...
use libc::c_int; use std::ffi::{CStr}; use ffi::mdb_strerror; pub fn error_msg(code: c_int) -> String { unsafe { String::from_utf8(CStr::from_ptr(mdb_strerror(code)).to_bytes().to_vec()).unwrap() } }
use handlebars::{ BlockContext, Context, Handlebars, Helper, HelperDef, HelperResult, Output, RenderContext, RenderError, Renderable, }; use serde_json::Value; /// Switch Helper /// /// Provides the `{{#switch}}` helper to a Handlebars template. /// /// # Examples /// /// ``` /// # extern crate handlebars_swi...
//! `graphific` is a graph data structure library. mod algo; mod any_graph; mod basic_directed_graph; mod basic_undirected_graph; mod kinship; mod types; pub use self::algo::Algorithms; pub use self::any_graph::AnyGraph; pub use self::kinship::Kinship; pub use self::types::Edge; pub use self::types::Key; pub use s...
// Copyright 2020 IOTA Stiftung // // 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 w...
mod primitives; mod simple; mod storage;
use rand::{ distributions::{Distribution, Standard}, Rng, }; use std::fmt; #[derive(Debug, Copy, Clone)] pub enum Cell { Live, Dead, } impl fmt::Display for Cell { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", if let Cell::Live = self { 'O' } else { ' ' }) ...
//! This file contains the main function #![warn( missing_docs, absolute_paths_not_starting_with_crate, anonymous_parameters, box_pointers, clashing_extern_declarations, deprecated_in_future, elided_lifetimes_in_paths, explicit_outlives_requirements, indirect_structural_match, k...
use crate::{Cycle, Header, ProposalShortId, Transaction, Version}; use ckb_core::transaction::Transaction as CoreTransaction; use ckb_core::uncle::UncleBlock as CoreUncleBlock; use failure::Error as FailureError; use numext_fixed_hash::H256; use numext_fixed_uint::U256; use serde_derive::{Deserialize, Serialize}; use s...
use std::sync::MutexGuard; use nia_interpreter_core::Interpreter; use nia_interpreter_core::NiaInterpreterCommand; use nia_interpreter_core::NiaInterpreterCommandResult; use nia_interpreter_core::{EventLoopHandle, NiaStopListeningCommandResult}; use crate::error::{NiaServerError, NiaServerResult}; use crate::protoco...
use sdl2::pixels::PixelFormatEnum::RGB24; use sdl2::render::{Canvas, RenderTarget, Texture, TextureCreator}; use std::sync::RwLock; #[derive(Debug, Clone, Copy)] pub struct Point { pub x: u16, pub y: u16, } #[derive(Debug, Clone, Copy)] pub struct Color { pub r: u8, pub g: u8, pub b: u8, } pub tr...
#[doc = "Reader of register TIMER1"] pub type R = crate::R<u32, super::TIMER1>; #[doc = "Writer for register TIMER1"] pub type W = crate::W<u32, super::TIMER1>; #[doc = "Register TIMER1 `reset()`'s with value 0"] impl crate::ResetValue for super::TIMER1 { type Type = u32; #[inline(always)] fn reset_value() ...
pub use self::alchemical_bonus::{ AlchemicalBonus }; pub use self::armor_bonus::{ ArmorBonus }; pub use self::circumstance_bonus::{ CircumstanceBonus }; pub use self::competence_bonus::{ CompetenceBonus }; pub use self::deflection_bonus::{ DeflectionBonus }; pub use self::dodge_bonus::{ DodgeBonus }; pub use self::enha...
pub mod http; pub mod resource; pub mod fast;
// AST Definiton // Author: Sebastian Schüller <schueller@ti.uni-bonn.de> use std; use token::{Token, TokenKind, TokenKind::*}; use SrcPos; #[derive(Debug, Clone, Default)] pub struct NodeId(u32); #[derive(Debug, Clone, Copy, PartialEq)] pub enum Assoc { Left, Right, } #[derive(Debug, Clone, PartialEq, E...
use crate::{Error, Random, Result}; pub(crate) fn verify_chain(pk: &[u8], previous_signature: &[u8], curr: &Random) -> Result<bool> { if previous_signature != curr.previous_signature.as_slice() { let s = hex::encode(previous_signature); let p = hex::encode(&curr.previous_signature); err_at!...
use super::record_header::RecordHeader; pub trait RecordData { fn get_header(&self) -> RecordHeader; } pub struct RecordContent { records: Vec<Box<RecordData>> } impl RecordContent { pub fn new() -> RecordContent { return RecordContent { records: Vec::new() } } }
use core::fmt; use drivers::io::{Io, Pio}; pub struct SerialConsole { status: Pio<u8>, data: Pio<u8> } impl SerialConsole { pub fn new() -> SerialConsole { SerialConsole { status: Pio::new(0x3F8 + 5), data: Pio::new(0x3F8) } } pub fn write(&mut self, bytes:...
// This solution turned into a bear. Use of recursive functions to dig through Bags... However bag storage was initialized outside of class. Ended up passing in outside storage to member functions, eck! // Used a hash map to speed up searching. Solution is much faster than digging through a Vector, and uses a small amo...
/* MIT License Copyright (c) 2017 Frederik Delaere 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 Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...