text stringlengths 8 4.13M |
|---|
use super::super::{btn, text};
use crate::{
block::{self, BlockId},
idb, model,
random_id::U128Id,
resource::Data,
JsObject, Promise, Timestamp,
};
use kagura::prelude::*;
use std::{collections::HashMap, rc::Rc};
use wasm_bindgen::{prelude::*, JsCast};
pub type LoadTable = Component<Props, Sub>;
p... |
use std::io;
fn main() {
let mut input = String::new();
println!("type in number of words");
io::stdin().read_line(&mut input )
.expect("Failed to read line");
let input: u32 = input.trim().parse()
.expect("Please type a number!");
println!("You entered: {}", input);
let mu... |
#[doc = "Register `CFGR1` reader"]
pub type R = crate::R<CFGR1_SPEC>;
#[doc = "Register `CFGR1` writer"]
pub type W = crate::W<CFGR1_SPEC>;
#[doc = "Field `MEM_MODE` reader - Memory mapping selection bits"]
pub type MEM_MODE_R = crate::FieldReader;
#[doc = "Field `MEM_MODE` writer - Memory mapping selection bits"]
pub ... |
use jsonrpc_core::{Notification, Params, Version};
use serde_json;
use uuid::Uuid;
use messages;
#[derive(Debug, Deserialize)]
pub struct Request<T> {
room_id: Uuid,
data: T,
}
#[derive(Debug, Serialize)]
pub struct NotificationParams<T> {
room_id: Uuid,
data: T,
}
// Offer
pub type OfferRequest = ... |
#![cfg(feature = "std")]
use tabled::{
builder::Builder,
settings::{
object::{Rows, Segment},
Alignment, Disable, Extract, Format, Modify, Padding,
},
};
use crate::matrix::Matrix;
use testing_table::test_table;
test_table!(
extract_segment_full_test,
Matrix::new(3, 3)
.wi... |
// Copyright 2018-2020, Wayfair GmbH
//
// 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... |
// Fabriquons un struct pour les chaussures
#[derive(PartialEq, Debug)]
struct Shoe {
size: u32,
style: String,
}
// Une fonction à deux arguments :
// un vecteur de structs (ça existe)
// Une taille de chaussure
// Et qui renvoie un vecteur de struct
// Cette fonction prend l'ownership du vecteur
fn... |
mod rom;
pub use crate::rom::*;
|
//! A simple Driver for the Waveshare 5.83" (B) v2 E-Ink Display via SPI
//!
//! # References
//!
//! - [Datasheet](https://www.waveshare.com/5.83inch-e-Paper-B.htm)
//! - [Waveshare C driver](https://github.com/waveshare/e-Paper/blob/master/RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_5in83b_V2.c)
//! - [Waveshare Python ... |
use crate::atoms;
use rustler::{Decoder, Error, NifResult, Term};
#[derive(PartialEq, Eq, Debug)]
pub enum BuilderOption {
AllLanguages,
AllSpokenLanguages,
AllLanguagesWithArabicScript,
AllLanguagesWithCyrillicScript,
AllLanguagesWithDevanagariScript,
AllLanguagesWithLatinScript,
WithLang... |
use std::{collections::HashMap, net::IpAddr};
mod client;
mod resolver;
pub use client::*;
pub use resolver::*;
pub type IpTable = HashMap<IpAddr, String>;
|
use std::collections::{HashSet, VecDeque};
use std::time::Instant;
const INPUT: &str = include_str!("../input.txt");
type Deck = VecDeque<usize>;
fn load_decks() -> (Deck, Deck) {
let mut lines = INPUT.lines();
lines.next(); // skip Player 1
let deck1: Deck = lines
.by_ref()
.take_while... |
use futures::prelude::*;
use state_machine_future::RentToOwn;
use std::io;
use std::marker::PhantomData;
use super::{
Connection,
encode,
MAX_FRAGMENT_LEN,
MAX_FRAGMENTS_PER_MESSAGE,
MessageFragments,
Packet,
PacketData,
recv_packet,
};
/// A future used to receive a message from a conn... |
// Copyright 2014 nerd-games.com.
//
// Licensed under the Apache License, Version 2.0.
// See: http://www.apache.org/licenses/LICENSE-2.0
// This file may only be copied, modified and distributed according to those terms.
/*#![macro_escape]
use super::vector::*;
use std::mem;
#[macro_export]
macro_rules! mat3 (
($... |
//! A framework for pre and post processing machine intelligence based data
extern crate image;
extern crate parenchyma;
pub use self::transformer::Transformer;
mod transformer;
mod transformers; |
#[doc = "Reader of register DDRPHYC_PTR1"]
pub type R = crate::R<u32, super::DDRPHYC_PTR1>;
#[doc = "Writer for register DDRPHYC_PTR1"]
pub type W = crate::W<u32, super::DDRPHYC_PTR1>;
#[doc = "Register DDRPHYC_PTR1 `reset()`'s with value 0x0604_111d"]
impl crate::ResetValue for super::DDRPHYC_PTR1 {
type Type = u3... |
extern crate rand;
use std::{thread, time};
use rand::{thread_rng, Rng};
trait Observer {
fn update(&self, generator: Box<&NumberGenerator>);
}
struct DigitObserver {}
impl DigitObserver {
fn new() -> DigitObserver {
DigitObserver {}
}
}
impl Observer for DigitObserver {
fn update(&self, ge... |
// Copyright 2019, 2020 Wingchain
//
// 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... |
#[cfg(nightly)]
pub use std::intrinsics::{likely, unlikely};
#[cfg(not(nightly))]
#[inline]
#[cold]
const fn cold() {}
#[cfg(not(nightly))]
#[inline]
pub const fn likely(b: bool) -> bool {
if !b {
cold()
}
b
}
#[cfg(not(nightly))]
#[inline]
pub const fn unlikely(b: bool) -> bool {
if b {
... |
use cocoa::base::id;
use core_foundation::date::CFTimeInterval;
/// The `MTLDrawable` protocol defines the interface for an object that represents
/// a displayable resource that can be used as a destination for rendering commands.
pub trait MTLDrawable {
/// Displays the displayable resource.
///
/// # Di... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - IPCC Processor 1 control register"]
pub c1cr: C1CR,
#[doc = "0x04 - IPCC Processor 1 mask register"]
pub c1mr: C1MR,
#[doc = "0x08 - Reading this register will always return 0x0000 0000."]
pub c1scr: C1SCR,
#[do... |
use super::base::*;
use super::coder::*;
use super::error::*;
use super::lexer::*;
use super::parser::*;
use super::strutil::Strutil;
pub struct HPU {
pub path: std::path::PathBuf,
pub command: Command,
pub parser: Parser,
pub lexer: Lexer,
pub valid_line: usize,
}
impl HPU {
pub fn new(path: ... |
#[doc = "Reader of register SYSTICK_CTL"]
pub type R = crate::R<u32, super::SYSTICK_CTL>;
#[doc = "Writer for register SYSTICK_CTL"]
pub type W = crate::W<u32, super::SYSTICK_CTL>;
#[doc = "Register SYSTICK_CTL `reset()`'s with value 0x4000_0147"]
impl crate::ResetValue for super::SYSTICK_CTL {
type Type = u32;
... |
use crate::service::ApiKeyService;
use actix_web::{web, HttpResponse};
use drogue_cloud_service_api::{
api::ApiKeyCreationOptions,
auth::user::{
authn::{AuthenticationRequest, AuthenticationResponse, Outcome},
UserInformation,
},
};
use std::ops::Deref;
pub struct WebData<S: ApiKeyService> ... |
use crate::hal::gpio::{p0, Output, PushPull};
pub type LcdCsPin = p0::P0_25<Output<PushPull>>;
pub type LcdDcPin = p0::P0_18<Output<PushPull>>;
pub type LcdResetPin = p0::P0_26<Output<PushPull>>;
|
#![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum ConversionErrorCode {
#[serde(rename = "UNKNOWN")]
Unknown,
#[serde(rename = "NO_ERROR")]
NoError,
... |
use commitments::CommitmentScheme;
struct PedersenCommitment {}
impl CommitmentScheme for PedersenCommitment {
fn setup(num_elements: u32) -> Vec<Vec<u8>> {
unimplemented!();
}
fn commit(generators: &[&[u8]], messages: &[&[u8]]) -> Vec<u8> {
unimplemented!();
}
fn open(commitment... |
#![feature(test)]
extern crate test;
#[macro_use]
extern crate nom;
use test::Bencher;
use nom::{IResult,digit};
// Parser definition
use std::str;
use std::str::FromStr;
// We parse any expr surrounded by parens, ignoring all whitespaces around those
named!(parens<i64>, ws!(delimited!( tag!("("), expr, tag!(")") ... |
// Licensed under the 2-Clause BSD license <LICENSE or
// https://opensource.org/licenses/BSD-2-Clause>. This
// file may not be copied, modified, or distributed
// except according to those terms.
//! # Burst
//!
//! Burst is a library supporting decomposing binary code
//! into instructions, while maintaining detail... |
extern crate advent_of_code_2017_day_2;
use advent_of_code_2017_day_2::*;
#[test]
fn part_1_example() {
// 5 1 9 5
// 7 5 3
// 2 4 6 8
//
// - The first row's largest and smallest values are 9 and 1, and their difference is 8.
// - The second row's largest and smallest values are 7 and 3, and ... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub mod operations {
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub async f... |
#[doc = "Reader of register FMC_CSQISR"]
pub type R = crate::R<u32, super::FMC_CSQISR>;
#[doc = "Writer for register FMC_CSQISR"]
pub type W = crate::W<u32, super::FMC_CSQISR>;
#[doc = "Register FMC_CSQISR `reset()`'s with value 0"]
impl crate::ResetValue for super::FMC_CSQISR {
type Type = u32;
#[inline(always... |
use std::sync::{Arc, Mutex, Condvar};
use std::process::exit;
use sdl2;
use sdl2::Sdl;
use sdl2::event::Event;
use sdl2::pixels;
use sdl2::keyboard::Keycode;
use sdl2::gfx::primitives::DrawRenderer;
use sdl2::render::WindowCanvas;
const SCREEN_WIDTH: u8 = 64;
const SCREEN_HEIGHT: u8 = 32;
const OUTPUT_WIDTH: u32 = 25... |
pub fn is_leap_year(year: u64) -> bool {
let l4 = year % 4 == 0;
let nl100 = year % 100 != 0;
let l400 = year % 400 == 0;
match (l4, nl100, l400) {
(true, true, _) => true,
(true, false, true) => true,
_ => false
}
}
|
extern crate greed_ecs;
extern crate serde;
extern crate serde_json;
#[cfg_attr(test,allow(unused_variables,unused_imports,dead_code))]
use greed_ecs::game::cardsmeta;
#[cfg_attr(test,allow(unused_variables,unused_imports,dead_code))]
#[test]
fn card_meta() {
let data = cardsmeta::locale_card_meta(cardsmeta::LocalE... |
use std::fmt;
use nom::{
IResult,
combinator::map,
branch::alt,
bytes::complete::tag
};
#[derive(Debug, PartialEq, Clone)]
pub enum SdpTransport {
Udp,
Tcp,
RtpAvp,
RtpSavp
}
pub fn parse_transport(input: &[u8]) -> IResult<&[u8], SdpTransport> {
alt((
map(tag("UDP"), |_| S... |
#![cfg(test)]
use super::*;
use std::f64::consts::PI;
use crate::physics::
{
BOLTZMANN_CONSTANT,
PLANCK_CONSTANT
};
use crate::physics::single_chain::test::Parameters;
mod base
{
use super::*;
use rand::Rng;
#[test]
fn init()
{
let parameters = Parameters::default();
... |
pub mod platform_traits;
pub mod foc_types;
pub mod foc_controller;
mod pid_controller;
mod dq_transform;
mod modulator;
mod foc_math_utils;
|
#![recursion_limit = "1024"]
use anyhow::{Context, Result};
use human_panic::setup_panic;
use boilrs::{generate, install, list, new, uninstall, utils};
fn main() -> Result<()> {
setup_panic!();
// * Creating cli app
let cli = utils::terminal::init_term().get_matches();
match cli.subcommand() {
... |
//! Generic helper types.
use std::error::Error;
use std::fmt::{self, Debug, Display, Formatter};
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use chrono::DateTime;
use chrono::FixedOffset;
use chrono::Local;
use serde_json;
/// Used for representing generic String errors as IronErrors.
#[derive(De... |
#![no_std]
#![no_main]
use core::{fmt::Write, panic::PanicInfo};
use esp32_hal::{
clock_control::{sleep, ClockControl, XTAL_FREQUENCY_AUTO},
dport::Split,
dprintln,
prelude::*,
serial::{config::Config, Pins, Serial},
target,
timer::Timer,
};
const BLINK_HZ: Hertz = Hertz(2);
#[entry]
fn ... |
pub mod dijkstra;
pub mod dir;
pub mod grid;
pub mod intcode;
pub mod io;
pub mod permutation;
|
extern crate libc;
use std::ffi::CStr;
use std::os::raw::c_char;
use super::dapi::MarketQuote;
use super::dapi::Bar;
use super::dapi::DailyBar;
use super::tapi::{Balance, AccountInfo, Order, Trade, Position, EntrustAction, OrderStatus, Side};
pub fn c_str_to_string(s : *const c_char) -> String {
unsafe {
... |
use crate::aabb::*;
use crate::mesh::*;
use crate::picture::*;
use crate::zbuffer::*;
use std::f32::consts::PI;
use std::time::{Duration, Instant};
#[derive(Debug)]
pub struct RenderOptions {
pub view_pos: Vec3,
pub light_pos: Vec3,
pub light_color: Vec3,
pub ambient_color: Vec3,
pub model_color: ... |
// Copyright 2019 The Grin Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
use chrono::{DateTime, Utc};
use serde::{self, Deserialize, Serialize};
use std::collections::HashMap;
use std::path::PathBuf;
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct Opcache {
pub opcache_enabled: bool,
pub cache_full: bool,
pub restart_pending: bool,
pub restart_in_progress: bool,
... |
use crate::errors::ResT;
use crate::rest::pmvd;
use crate::hbs::reg_templates;
use durations::MILLISECOND as MS;
use crossbeam_channel::{Receiver, TryRecvError};
use reqwest::Client;
use handlebars::Handlebars;
use std::thread;
pub struct Work {
pub iter_id: usize,
pub line_id: usize,
pub text: String,
... |
use crate::{YarnBuildpack, YarnBuildpackError};
use heroku_nodejs_utils::inv::Release;
use libcnb::build::BuildContext;
use libcnb::data::buildpack::StackId;
use libcnb::data::layer_content_metadata::LayerTypes;
use libcnb::layer::{ExistingLayerStrategy, Layer, LayerData, LayerResult, LayerResultBuilder};
use libcnb::B... |
pub fn call() {
println!("Call function.");
}
|
use libc::c_char;
use librespot::metadata::Artist;
use metadata::SpMetadata;
#[allow(non_camel_case_types)]
pub type sp_artist = SpMetadata<Artist>;
#[no_mangle]
pub unsafe extern "C" fn sp_artist_is_loaded(c_artist: *mut sp_artist) -> bool {
let artist = &*c_artist;
artist.is_loaded()
}
#[no_mangle]
pub u... |
use actix::Handler;
pub type Message = crate::pb::teddy::Message;
impl actix::Message for Message {
type Result = ();
}
impl Handler<Message> for super::session::WsChatSession {
type Result = ();
fn handle(&mut self, msg: Message, ctx: &mut Self::Context) {
ctx.binary(msg.body);
}
}
|
/// Decodes a raw Stream into Packets
pub mod decode;
/// Encodes Packets into a raw Stream
pub mod encode;
/// Describes a stream of semi-parsed data from a connection
pub mod stream;
/// Describes pieces of information from the network
pub mod packet;
pub use self::stream::Stream;
|
#![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ErrorResponse {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error: Option<error_response... |
pub const EXT_INSTANCE: &str = "instance";
pub const EXT_APPLICATION: &str = "application";
pub const EXT_DEVICE: &str = "device";
|
use std::process::{Command, Output};
use config::Config;
use report::scan_report::ScanReport;
use CONFIG;
#[cfg(target_os = "windows")]
pub const IKE_SCAN_BIN: &'static str = "ike-scan.exe";
#[cfg(not(target_os = "windows"))]
pub const IKE_SCAN_BIN: &'static str = "./ike-scan";
const SUCCESS_MSG: &'static str = "[✓]... |
extern crate notify;
use notify::{Watcher, RecursiveMode, RawEvent,raw_watcher};
//use std::collections::HashMap;
//use std::iter::Map;
//use std::sync::{Mutex,Arc};
//use std::error::Error;
use std::sync::mpsc::channel;
use std::io::prelude::*;
use std::net::{TcpStream};
use ssh2::Session;
use std::io::stdin;
use std... |
use std::cell::RefCell;
use std::collections::{HashMap, VecDeque};
use std::fs::File;
use std::io::Write;
use std::time::{Duration, SystemTime};
use log::debug;
use log::error;
type Ptr = u32;
type Size = u32;
const HISTORY_CAPACITY: usize = 100_000;
thread_local! {
static STATE: RefCell<HeapProfilerState> = Ref... |
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::prelude::*;
use std::iter::Iterator;
#[inline]
fn update_row(
player: i32,
marble: i32,
row: &mut Vec<i32>,
pos: i32,
scores: &mut HashMap<i32, i32>,
) -> i32 {
let n = row.len() as i32;
let npos;
if marble % 23 ... |
use crate::{
models::{Restaurant, Pin, User, NoIdPin},
mapper,
logic,
errors::*
};
pub fn index_included_by(community_id: i32) -> Result<Vec<Restaurant>, ErrCode>{
mapper::restaurant::find_all_pined_by(&community_id)
}
pub fn add(current: User, no_id_pin: NoIdPin) -> Result<Pin, ErrCode>{
logi... |
use core::{convert::AsMut, default::Default, ptr::copy_nonoverlapping};
use necsim_core_bond::{ClosedUnitF64, NonNegativeF64, PositiveF64};
use crate::{
cogs::Habitat,
intrinsics::{cos, floor, ln, sin, sqrt},
landscape::IndexedLocation,
};
#[allow(clippy::module_name_repetitions)]
pub trait RngCore: crat... |
use crate::parse::{ParseError, Token};
use crate::turtle::Turtle;
pub mod basic;
pub mod flow_control;
pub mod pen;
/// Represents a command
pub trait Command {
/// Run the command
fn run(&self, turtle: &mut Turtle);
/// Parse the command, gets given an iterator which represents the stream of tokens
... |
// This file is part of Bit.Country.
// Copyright (C) 2020-2021 Bit.Country.
// SPDX-License-Identifier: Apache-2.0
// 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... |
#[doc = "Register `IER` reader"]
pub type R = crate::R<IER_SPEC>;
#[doc = "Register `IER` writer"]
pub type W = crate::W<IER_SPEC>;
#[doc = "Field `TAMP1IE` reader - TAMP1IE"]
pub type TAMP1IE_R = crate::BitReader;
#[doc = "Field `TAMP1IE` writer - TAMP1IE"]
pub type TAMP1IE_W<'a, REG, const O: u8> = crate::BitWriter<'... |
use std::str;
#[allow(unused_imports)]
use nom::*;
use ast::Ast;
use datatype::Datatype;
named!(string<String>,
do_parse!(
str: map_res!(
delimited!(
tag!("\""),
take_until!("\""),
tag!("\"")
),
str::from_utf8
) >>
... |
use xor::xor;
fn main() {
let original_string = "1c0111001f010100061a024b53535009181c";
let xor_string = "686974207468652062756c6c277320657965";
// let actual = "746865206b696420646f6e277420706c6179";
xor(original_string, xor_string);
} |
use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use crate::lib::identity::identity_manager::IdentityManager;
use clap::Clap;
use slog::info;
/// Removes an existing identity.
#[derive(Clap)]
pub struct RemoveOpts {
/// The identity to remove.
identity: String,
}
pub fn exec(env: &... |
#![crate_type= "lib"]
#![feature(custom_derive,
custom_attribute,
plugin)]
#![plugin(serde_macros)]
#![cfg_attr(feature = "lints", plugin(clippy))]
#![cfg_attr(feature = "lints", allow(explicit_iter_loop))]
#![cfg_attr(feature = "lints", allow(should_implement_trait))]
#![cfg_attr(feature = "lints... |
use coi::{Container, Inject};
use rocket::{
http::Status,
outcome::IntoOutcome as _,
request::{FromRequest, Outcome},
Request, State,
};
use std::{marker::PhantomData, sync::Arc};
pub use coi_rocket_derive::inject;
#[doc(hidden)]
pub trait ContainerKey<T>
where
T: Inject + ?Sized,
{
const KEY:... |
use bio::io::fasta;
use std::collections::HashMap;
use std::io;
use crate::read_correction::CorrectionResults;
/// This is a wrapper for the bio::io::fasta::Writer that forces reads to be written in a specified order.
/// Reads that are not ready to be written are stored until the reads before it are written.
/// # ... |
#![allow(dead_code)]
use std::{
any::{Any, TypeId},
fmt,
mem::ManuallyDrop,
slice,
sync::Arc,
};
use crate::traits::*;
use crate::value::*;
use crate::VecCopy;
pub trait Elem: Any + DropBytes {}
impl<T> Elem for T where T: Any + DropBytes {}
/// This container is a WIP, not to be used in producti... |
/*
Copyright 2019-2023 Didier Plaindoux
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... |
pub struct DnsMessageHeader {
id: u16,
query: bool,
opcode: Opcode,
aa: bool,
tc: bool,
rd: bool,
ra: bool,
rcode: DnsResponseCode
qdcount: u16,
ancount: u16,
nscount: u16,
arcount: u16,
}
struct DnsMessageQuestion {
qname: Vec<Vec<u8>>,
qtype: DnsQueryType,
... |
use anyhow::{Context, Result};
use chrono::prelude::*;
use std::fs::File;
use std::io::BufRead;
mod gpx;
fn usage() -> ! {
eprintln!("usage: {} file.slopes", std::env::args().next().unwrap());
eprintln!("converts a Slopes export file into GPX on stdout");
std::process::exit(1);
}
fn main() -> Result<()> ... |
use crate::validate;
use std::io;
/// This [`Error`] represents anything that can go wrong with this library
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Metadata validation error
#[error("Validation Error")]
Validation(#[from] validate::Error),
/// filesystem IO error
#[error("IO Error... |
use chrono::Utc;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use drogue_cloud_database_common::models::{app::Application, diff::diff_paths};
use serde_json::json;
fn criterion_benchmark(c: &mut Criterion) {
let now = Utc::now();
let data = json!({
"spec": {
"cor... |
//! Contains all elements except [`greater_elements`].
use super::*;
mod babel_call;
mod clock;
mod comment;
mod comment_block;
mod diary_sexp;
mod example_block;
mod export_block;
mod fixed_width;
mod horizontal_rule;
mod keyword;
mod latex_environment;
mod node_property;
mod paragraph;
mod planning;
mod src_block;
... |
fn md5(input: &[u8]) -> [u8; 16] {
#![allow(non_snake_case)]
let s: [u32; 64] = [
7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
6, 10, 15, 21, 6, 10,... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::context::Context;
use diem_api_types::views;
use anyhow::{Error, Result};
use warp::{reject, Rejection, Reply};
pub async fn index(context: Context) -> Result<impl Reply, Rejection> {
let ledger_info = context.get_late... |
// Copyright (c) 2017 King's College London
// created by the Software Development Team <http://soft-dev.org/>
//
// The Universal Permissive License (UPL), Version 1.0
//
// Subject to the condition set forth below, permission is hereby granted to any person obtaining a
// copy of this software, associated documentati... |
#[cfg(test)]
mod test_delete_from_db {
use diar::{
command::CommandError,
commands::delete::delete_from_db,
domain::{model::Favorite, repository::IRepository},
};
use crate::infrastructure::inmemory::repository::Repository;
#[test]
fn delete() {
let fav = Favorite:... |
use actix_web::web;
use actix_web::{HttpResponse};
use handlebars::Handlebars;
use super::global;
// Macro documentation can be found in the actix_web_codegen crate
#[get("/")]
pub async fn index(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
let data = json!({
"title": global::get_config_name(),
... |
#[derive(Debug)]
struct Student{
name : String,
number:u32,
}
fn main() {
let mehran=Student{
name:String::from("Mehran"),
number:12,
};
println!("{:#?}",mehran.name);
}
|
pub trait Thing {
fn do_something_interesting(&self) -> i32;
}
pub struct A;
impl Thing for A {
fn do_something_interesting(&self) -> i32 {
1
}
}
pub struct B;
impl Thing for B {
fn do_something_interesting(&self) -> i32 {
2
}
}
pub fn do_something_to_everyone(everyone: &Vec<Box<T... |
#[doc = "Register `CCR` reader"]
pub type R = crate::R<CCR_SPEC>;
#[doc = "Register `CCR` writer"]
pub type W = crate::W<CCR_SPEC>;
#[doc = "Field `DUAL` reader - Dual ADC mode selection"]
pub type DUAL_R = crate::FieldReader;
#[doc = "Field `DUAL` writer - Dual ADC mode selection"]
pub type DUAL_W<'a, REG, const O: u8... |
pub mod common;
#[cfg(feature = "client")]
pub mod client;
#[cfg(feature = "server")]
pub mod server;
#[cfg(feature = "node")]
pub mod node;
|
use chrono::{TimeZone, Utc};
use cloudevents::{EventBuilder, EventBuilderV10};
use etherparse::{InternetSlice::*, ReadError, SlicedPacket, TransportSlice::*};
use pcap::{Capture, Packet};
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
use std::net::IpAddr;
use uuid::Uuid;
#[derive(Serialize, Deseriali... |
//! An SDC point record.
//!
//! At this point, we're keeping it simple and only handling 5.0.
use error::Error;
use result::Result;
/// An SDC point.
#[derive(Clone, Copy, Debug, Default)]
#[allow(missing_docs)]
pub struct Point {
pub time: f64,
pub range: f32,
pub theta: f32,
pub x: f32,
pub y: ... |
#[doc = "Reader of register CH1_DBG_CTDREQ"]
pub type R = crate::R<u32, super::CH1_DBG_CTDREQ>;
#[doc = "Reader of field `CH1_DBG_CTDREQ`"]
pub type CH1_DBG_CTDREQ_R = crate::R<u8, u8>;
impl R {
#[doc = "Bits 0:5"]
#[inline(always)]
pub fn ch1_dbg_ctdreq(&self) -> CH1_DBG_CTDREQ_R {
CH1_DBG_CTDREQ_R... |
use std::time::{SystemTime, UNIX_EPOCH};
use std::collections::VecDeque;
use rustc_serialize::*;
#[derive(Debug, Clone)]
pub enum BuildState {
Good,
Bad
}
#[derive(Debug, Clone)]
pub struct ServiceStatus {
time : u64,
status : BuildState
}
impl Encodable for ServiceStatus {
fn encode<S: Encoder... |
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(unused)]
#![no_std]
pub use bindings::*;
pub mod bindings;
use core::convert::Infallible;
// implement digital traits from embedded_hal
use embedded_hal::digital::v2::{InputPin, OutputPin, ToggleableOutputPin};
pub ... |
use std::os::raw::c_char;
use crate::util;
pub mod dataframe;
pub mod manipulation;
pub mod sum;
pub mod count;
pub mod mean;
pub mod variance;
#[no_mangle]
pub extern "C" fn opendp_trans__bootstrap() -> *const c_char {
let spec =
r#"{
"functions": [
{ "name": "make_identity", "ret": "FfiResult<FfiTr... |
use std::fs::File;
use std::io::ErrorKind;
use std::io::prelude::*;
fn main() {
let fp = File::open("hello.txt");
let mut f = match fp {
Ok(file) => file,
Err(error) => match error.kind() {
ErrorKind::NotFound => match File::create("hello.txt") {
Ok(fc) => fc,
... |
use crate::config::Config;
use slog::{o, Drain, Logger};
use std::sync::Mutex;
pub fn create_logger(config: &Config) -> Logger {
if config.log_json {
slog::Logger::root(
slog_async::Async::new(
Mutex::new(slog_json::Json::default(std::io::stderr())).map(slog::Fuse),
... |
//! Module is responsible for tables underlyign grid.
//!
//! It might be used when implementing your own [`TableOption`] and [`CellOption`].
//!
//! [`TableOption`]: crate::settings::TableOption
//! [`CellOption`]: crate::settings::CellOption
#[cfg(feature = "std")]
mod colored_config;
mod compact_multiline_config;
... |
#![deny(warnings)]
extern crate libc;
use std::mem;
use std::marker::PhantomData;
use std::os::unix::io::RawFd;
use libc::{c_void, size_t, ssize_t};
use libc::funcs::posix88::unistd::fork;
/// A continuation, accepting an argument of type `T`.
pub struct Cont<T> {
fd: RawFd,
phantom: PhantomData<Box<FnOnce(T... |
//! This example demonstrates using the [`Concat`] [`TableOption`] to concatenate
//! [`tables`](Table) together.
//!
//! * [`Concat`] supports appending tables vertically and horizontally.
//!
//! * Note how the base tables style settings take take precedence over the appended table.
//! If the two tables are of unequ... |
use super::matrix::model::ModelMatrix;
use super::webgl::{ProgramType, WebGlF32Vbo, WebGlI16Ibo, WebGlRenderingContext};
use crate::arena::block;
use ndarray::Array2;
pub struct TableGrid {
grid_index_buffer: WebGlI16Ibo,
grid_index_len: i32,
grid_vertexis_buffer: WebGlF32Vbo,
table_size: [u64; 2],
}
... |
#![feature(test)]
use std::{cmp::Reverse, collections::HashSet};
extern crate test;
use itertools::Itertools;
use lazy_static::lazy_static;
use rand::seq::SliceRandom;
use rand::Rng;
use rand::SeedableRng;
use rayon::prelude::*;
use std::io::prelude::*;
const SSS: u8 = 100;
lazy_static! {
static ref ALL_TEAMS... |
use crate::{
controllers::{handler, routes},
error,
repositories::postgres_repo::BicycleRepoPostgres,
services::bicycle::BicycleService,
};
use warp::{hyper::StatusCode, Filter};
#[tokio::main]
pub async fn rest() {
let bike_repo = BicycleRepoPostgres {};
let bike_service = BicycleService::new... |
use std::io::Read;
use crate::instructions::{Instructions, Instruction};
use crate::decoder::{DecodeError, DecodeResult, Decoder};
use crate::types::*;
type Local = (u32, Values);
struct Code {
locals: Vec<Local>,
body: Vec<Instruction>,
}
pub struct CodeSection(Vec<Code>);
impl CodeSection {
// read loc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.