text stringlengths 8 4.13M |
|---|
#[cfg(test)]
mod test;
use bson::RawDocumentBuf;
use serde::Deserialize;
use crate::{
bson::{doc, Document},
cmap::{Command, RawCommandResponse, StreamDescription},
error::Result,
operation::{append_options, OperationWithDefaults, Retryability},
options::ListDatabasesOptions,
selection_criteri... |
fn main() {
for n in 1..10 {
println!("Hello, world! {}", n);
if n%2 == 0 {
println!(" even number");
}
else {
println!(" odd number");
}
}
}
|
use super::spot::Spot;
use super::bonuses::{WordBonus, LetterBonus};
use super::{Move, Direction, Tile};
/// The board we're playing on
///
/// It contains an array of `Spot` and provide shortcuts to interract with them.
/// All positions range start at 0.
/// The ordinate position 0 is considered at the top.
pub stru... |
// Copyright (c) 2016, <daggerbot@gmail.com>
// This software is available under the terms of the zlib license.
// See COPYING.md for more information.
use std::cell::RefCell;
use std::mem;
use std::ptr;
use std::rc::Rc;
use std::sync::mpsc::Sender;
use aurum::winutil;
use winapi;
use device::DeviceBrid... |
use std::ops::AddAssign;
pub struct Callbacks<'a, _Arguments, _Return>
{
callbacks: Vec<Box<dyn 'a + Fn(&_Arguments) -> _Return>>,
}
impl<'a, _Arguments, _Return> Callbacks<'a, _Arguments, _Return>
{
pub fn new() -> Self {
Self{
callbacks: Vec::new(),
}
}
pub fn notify_all(&self, arguments: &_Arguments)
{
... |
// Implementation of the Bisection method algorithm as found on
// CENGAGE Learning's Numerical Analysis, Tenth Edition,
// by Richard L. Burden, J. Douglas Faires, Annete M. Burden.
// Copyright © 2019 Andre Rossi Korol <anrobits@yahoo.com.br>
// This work is free. You can redistribute it and/or modify it under the
/... |
use cgmath::Vector2;
use cgmath::Matrix4;
use math::Rot;
pub fn view(pos: Vector2<f32>, size: f32, rot: &Rot) -> Matrix4<f32> {
let cos = rot.cos;
let sin = rot.sin;
let Vector2 { x, y } = pos;
let m00 = cos / size;
let m01 = -sin / size;
let m10 = sin / size;
let m11 = m00;
let m03 ... |
use serde_derive::Deserialize;
use std::path::PathBuf;
#[derive(Debug, Deserialize, Clone)]
pub struct TomlConfig {
pub artifacts_dir: PathBuf,
pub url_prefix: String,
pub db_path: Option<String>,
}
|
use std::path::PathBuf;
use log::error;
use serde::{Serialize, Deserialize};
use crate::io::ReaderWriter;
use super::{config::Config, note::Note};
#[derive(Debug, Serialize, Deserialize)]
pub struct BucketItem {
context: String,
file: String,
file_name: Option<String>,
dest_path: PathBuf
}
/// The B... |
use std::path::{Path, PathBuf};
use nu_engine::{current_dir, CallExt};
use nu_path::expand_path_with;
use nu_protocol::{engine::Command, Example, Signature, Span, SyntaxShape, Value};
use super::PathSubcommandArguments;
struct Arguments {
columns: Option<Vec<String>>,
pwd: PathBuf,
}
impl PathSubcommandArgu... |
/// This module contains classifiers for openings.
use crate::{const_tile::pos, DenseBoard, PacoAction, PacoBoard, PacoError, PieceType};
/// Returns all the openings that can be detected on the given replay.
pub(crate) fn classify_opening(
initial_board: &DenseBoard,
actions: &[PacoAction],
) -> Result<String... |
// -------------------------------------------------------------------------------//
// Module to write tests for the challenge helper functions.
// Impl by Frodo45127
// -------------------------------------------------------------------------------//
use crate::utils::*;
#[test]
/// Test to ensure our function to c... |
//! TODO: how to sort struct fields with serde?
//! within this mod all the struct fields should be "sorted" statically to generate the correct
//! object hash, this is annoying but we have no way to find out how to do that with serde
// use std::collections::{BTreeMap, HashMap};
// use serde::{Serialize, Serializer};... |
#[doc = "Reader of register FIFO_LEVELS"]
pub type R = crate::R<u32, super::FIFO_LEVELS>;
#[doc = "Reader of field `RAF_LVL`"]
pub type RAF_LVL_R = crate::R<u8, u8>;
#[doc = "Reader of field `WAF_LVL`"]
pub type WAF_LVL_R = crate::R<u8, u8>;
#[doc = "Reader of field `TDF_LVL`"]
pub type TDF_LVL_R = crate::R<u8, u8>;
im... |
use tokio::prelude::*;
use futures::sync::mpsc;
#[derive(Clone)]
pub struct Broadcaster {
sender: mpsc::UnboundedSender<Msg>
}
enum Msg {
Subscribe(Box<dyn Sink<SinkItem=u8, SinkError=()> + Send + Sync + 'static>),
Broadcast(u8),
Close
}
/// This structure adds a convenient interface which you to
///... |
use super::POS;
pub fn open(pathname: u64, flags: u64, mode: u64) -> u64 {
let pathname_ptr = pathname as usize;
let pathname = unsafe { ::mem::c_to_str(pathname_ptr) };
println!("Syscall: open pathname={} flags={:x} mode={:x}", pathname, flags, mode);
if pathname == "/dev/tty" {
return 0xFFFF... |
use crate::commands::utils::handle_io;
use http::Uri;
use serde_json::Value;
use serenity::async_trait;
use songbird::{
input::{cached::Compressed, Metadata},
Event, EventContext, EventHandler,
};
use sqlx::{any::AnyConnection, Connection, Executor, Row};
use std::{fs, path::Path, sync::Arc, time::Duration};
us... |
#[doc = "Reader of register CTRL"]
pub type R = crate::R<u32, super::CTRL>;
#[doc = "Writer for register CTRL"]
pub type W = crate::W<u32, super::CTRL>;
#[doc = "Register CTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::CTRL {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
mod routes;
fn main() {
rocket::ignite().mount("/", routes![routes::index, routes::hello]).launch();
}
|
fn interpreter(code: &str, iterations: usize,
width: usize, height: usize) -> String
{
let mut res: Vec< Vec<char> > = vec![ ];
for i in 0..height{
res.push(vec![]);
for _j in 0..width{
res[i].push('0');
}
}
let mut pos_x = 0;
let mut ... |
use crate::prelude::*;
pub use crate::{Error, Result};
const MSGBOX: usize = 1024;
//#[derive(Message)]
//#[rtype(result = "()")]
//struct ActiveTick(());
#[derive(Debug, Clone, Message)]
#[rtype(result = "()")]
pub enum IncomingMsg {
Msg { msg: Arc<Vec<u8>> },
}
struct SocketActor {
//r: ReadHalf<TcpStream... |
use imgui_sys;
use libc::size_t;
use std::marker::PhantomData;
use std::ptr;
use super::{ImGuiInputTextFlags,
ImGuiInputTextFlags_AllowTabInput /* ImGuiInputTextFlags_CtrlEnterForNewLine, */,
ImGuiInputTextFlags_AlwaysInsertMode, ImGuiInputTextFlags_AutoSelectAll,
ImGuiInputTextFlag... |
use arkecosystem_client::{Connection, Manager};
#[test]
fn test_create_connection() {
let conn = Connection::new("test");
let mut manager = Manager::new();
assert!(manager.connect(conn).is_ok());
assert_eq!(manager.connections().count(), 1);
}
#[test]
fn test_create_existing_connection() {
let co... |
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
macro_rules! custom_encodable {
($struct_name:ident, $($field:ident),*) => {
impl <S: Encoder<E>, E> Encodable<S, E> for $struct_name {
fn encode(&self, encoder: &mut S) -> Result<(), E> {
encoder.emit_struct(stringi... |
use apllodb_sql_parser::{
apllodb_ast::{Command, Expression, InsertCommand, InsertValue},
ApllodbAst, ApllodbSqlParser,
};
use pretty_assertions::assert_eq;
use apllodb_test_support::setup::setup_test_logger;
#[ctor::ctor]
fn test_setup() {
setup_test_logger();
}
#[test]
fn test_insert_accepted() {
l... |
use libp2p::core::Negotiated;
use libp2p::swarm::protocols_handler::{KeepAlive, ProtocolsHandlerUpgrErr, ProtocolsHandlerEvent, SubstreamProtocol};
use libp2p::swarm::ProtocolsHandler;
use crate::message::{Message, PrePrepare, Prepare, Commit};
use tokio::prelude::{AsyncRead, AsyncWrite, Async, AsyncSink};
use crate::b... |
use std::collections::HashMap;
use std::time::Duration;
use serde::{Deserialize, Serialize};
// See line 38+120
//use isolanguage_1::LanguageCode;
use chrono::{DateTime, NaiveDate, Utc};
use crate::model::{Copyright, DatePrecision, Image, Page, TypeEpisode, TypeShow};
use crate::util;
macro_rules! inherit_show_simpl... |
extern crate hyper;
extern crate futures;
extern crate tokio_proto;
#[macro_use]
extern crate serde_json;
extern crate wordcut_engine;
extern crate config;
use futures::future;
use futures::Stream;
use futures::Future;
use hyper::header::{ContentLength, ContentType};
use hyper::server::{Http, Request, Response, Servi... |
use lazy_static::lazy_static;
use std::time;
use humantime;
use ansi_term::Color;
use std::env;
// TODO: Maybe we want to have some global static singleton that does
// different things for these depending on some settings?
//
lazy_static! {
pub static ref LEVEL: u32 = match env::var("FRIDAY_LOG_LEVEL") {
... |
fn main () {
/*
let v = vec! [1,2,3];
v.push(4);
//Error: Cannot borrow immutable local variable `v` as mutable.
*/
let mut v = vec! [1,2,3];
let v1 = &mut v;
}
|
use crate::error::Error;
use crate::error::Result;
use crate::service::CONTEXT;
use chrono::NaiveDateTime;
use rbatis::core::value::DateTimeNow;
use rbatis::crud::CRUD;
use rbatis::plugin::page::{Page, PageRequest};
use crate::domain::domain::{LoginCheck, SysRes, SysUser};
use crate::domain::dto::{IdDTO, SignInDTO, Us... |
pub mod check;
pub mod rt;
pub mod syntax;
mod error;
#[cfg(test)]
mod tests;
#[cfg(test)]
mod ui_tests;
pub use crate::error::Error;
pub(crate) use crate::error::ErrorData;
use std::path::Path;
use crate::check::check;
use crate::syntax::{SourceCacheResult, SourceMap};
pub fn run_input(input: String, opts: rt::... |
extern crate clap;
extern crate reproto;
#[macro_use]
extern crate log;
use reproto::backend::models as m;
use reproto::backend;
use reproto::commands;
use reproto::errors::*;
use reproto::logger;
use reproto::parser;
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
fn setup_opts<'a, 'b>() -> clap::App<'a, '... |
#[macro_use] extern crate lazy_static;
extern crate regex;
use std::fs::File;
use std::io::prelude::*;
use std::collections::{HashMap, HashSet};
use regex::Regex;
lazy_static! {
static ref EXTRACT_BAG: Regex = Regex::new(r"(\d+) (.*) bag").unwrap();
}
fn read_data(filepath: &str) -> std::io::Result<String> {
... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, API_VERSION};
#[non_exhaustive]
#[derive(Debug, thiserror :: Error)]
#[allow(non_camel_case_types)]
pub enum Error {
#[error(transparent)]
ConfidentialLedger_GetConstitution(#[... |
use avocado::prelude::*;
use config::{ConfigError, Config, Environment};
use failure::Error;
use failure::ResultExt;
#[derive(Clone, Debug, Deserialize)]
pub struct Mongodb {
pub uri: String,
pub db: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct Google {
pub id: String,
pub secret: Stri... |
use core::position::{HasSize, HasPosition};
use ui::core::attributes::{HorizontalAlign, VerticalAlign};
pub trait Alignable: HasSize + HasPosition {
fn halign(&mut self, parent: &HasSize, halign: HorizontalAlign, margin: usize) {
let (cols, _) = self.size();
let (_, y) = self.origin();
let ... |
/// A distribution of n distinct elements in m possible cells
#[derive(Debug)]
pub struct Distribution {
pub n: u16,
pub m: u16
}
pub struct DistributionIter<'a> {
distr: &'a Distribution,
index: u64
}
impl<'a> IntoIterator for &'a Distribution {
type Item = Vec<u16>;
type IntoIter = DistributionIter<'a>;... |
#[macro_use] extern crate c_str_macro;
use glutin::{
self,
dpi,
event_loop::ControlFlow,
event::{
Event,
DeviceEvent,
WindowEvent,
},
};
use gl::types::*;
use std::{
mem,
};
mod shaders;
fn main() {
let el = glutin::event_loop::EventLoop::new();
let wb = glu... |
#[doc = "Register `OPAMP2_TCMR` reader"]
pub type R = crate::R<OPAMP2_TCMR_SPEC>;
#[doc = "Register `OPAMP2_TCMR` writer"]
pub type W = crate::W<OPAMP2_TCMR_SPEC>;
#[doc = "Field `VMS_SEL` reader - VMS_SEL"]
pub type VMS_SEL_R = crate::BitReader;
#[doc = "Field `VMS_SEL` writer - VMS_SEL"]
pub type VMS_SEL_W<'a, REG, c... |
#[doc = "Reader of register STGENR_CIDR1"]
pub type R = crate::R<u32, super::STGENR_CIDR1>;
#[doc = "Reader of field `PRMBL_1`"]
pub type PRMBL_1_R = crate::R<u8, u8>;
#[doc = "Reader of field `CLASS`"]
pub type CLASS_R = crate::R<u8, u8>;
impl R {
#[doc = "Bits 0:3 - PRMBL_1"]
#[inline(always)]
pub fn prmb... |
use std::io::{self};
fn main() {
let mut n = String::new();
io::stdin().read_line(&mut n).unwrap();
let mut numbers = String::new();
io::stdin().read_line(&mut numbers).unwrap();
print!("{}", count(n.as_str(), numbers.as_str()));
}
fn count(n: &str, numbers: &str) -> i32 {
let m = n.trim_end_m... |
#[doc = "Register `SR` reader"]
pub type R = crate::R<SR_SPEC>;
#[doc = "Register `SR` writer"]
pub type W = crate::W<SR_SPEC>;
#[doc = "Field `RXNE` reader - Receive buffer not empty"]
pub type RXNE_R = crate::BitReader<RXNE_A>;
#[doc = "Receive buffer not empty\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, Part... |
//! Module defining the `ConfigSettings` struct, which allows to save and reload
//! the application default configuration.
use serde::{Deserialize, Serialize};
use crate::gui::styles::types::gradient_type::GradientType;
use crate::notifications::types::notifications::Notifications;
use crate::{Language, StyleType};
... |
mod fixtures;
use fixtures::{server, server_no_stderr, Error, FILES};
use pretty_assertions::assert_eq;
use reqwest::blocking::Client;
use reqwest::StatusCode;
use rstest::rstest;
use select::document::Document;
use select::predicate::Text;
#[rstest(
cli_auth_arg, client_username, client_password,
case("testu... |
use crate::engine_interaction::MAX_LAYERS;
use crate::gui::{ImCgVec2, ImDragf, ImEntity, ImVec};
use crate::rendering::colors::*;
use cgmath::num_traits::zero;
use cgmath::Vector2;
use imgui::Ui;
use imgui_inspect::InspectArgsDefault;
use imgui_inspect::InspectRenderDefault;
use imgui_inspect_derive::*;
use serde::{Des... |
use std::collections::HashMap;
use crate::read_lines::read_day;
type BagMap = HashMap<String, Vec<(usize, String)>>;
fn read_bags() -> BagMap {
let lines = read_day(7).map(|l| l.unwrap());
let mut bag_map = HashMap::new();
for line in lines {
read_bag(line, &mut bag_map);
}
bag_map
}
fn read_bag(line: Stri... |
// SPDX-License-Identifier: GPL-2.0
#[cfg(test)]
mod tests {
use std::collections::HashMap;
#[test]
fn get() {
let mut map = HashMap::new();
map.insert(1, String::from("one"));
map.insert(2, String::from("two"));
map.insert(3, String::from("three"));
map.insert(4, Str... |
use crate::objects::{MovingRect, Rect};
pub struct Contact(ContactID, ContactID);
impl Contact {
pub fn get_ids(&self) -> (ContactID, ContactID) {
(self.0, self.1)
}
}
#[derive(Copy, Clone)]
pub enum ContactID {
Obstacle,
Player,
}
pub fn gather_contacts(player: &MovingRect, obstacles: &[Rec... |
// ref: Index of the HTML 4 Attributes https://www.w3.org/TR/html401/index/attributes.html
pub struct AdhocAttr(pub String, pub String);
pub struct PresetAttr(pub &'static str, pub String);
pub struct IntAttr(pub &'static str, pub usize);
pub struct IntPerAttr(pub &'static str, pub usize);
pub struct FlagAttr(pub &'st... |
#![allow(dead_code)]
#![allow(unused_imports)]
use std::{mem::size_of, sync::atomic::AtomicU8};
#[macro_export]
macro_rules! log {
($($arg: tt)*) => {
#[cfg(debug_assertions)]
if $crate::LOG.load(std::sync::atomic::Ordering::Relaxed) {
let lock = std::io::stdout();
let lock =... |
#[macro_use]
extern crate rbatis;
pub mod model;
use model::*;
use rbatis::rbdc::datetime::FastDateTime;
use rbatis::sql::PageRequest;
htmlsql_select_page!(select_page_data(name: &str, dt: &FastDateTime) -> BizActivity => "example/example.html");
#[tokio::main]
pub async fn main() {
fast_log::init(fast_log::Con... |
use std::net::SocketAddr;
use futures_util::future::try_join;
use hyper::upgrade::Upgraded;
use tokio::net::{TcpStream};
//// Create a TCP connection to host:port, build a tunnel between the connection and
//// the upgraded connection
//pub async fn tunnel(upgraded: Upgraded, uri: String, acceptor: tokio_rustls::TlsA... |
use std::collections::HashMap;
pub struct Company {
departments: HashMap<String, Vec<String>>
}
impl Company {
pub fn new() -> Company {
Company {
departments: HashMap::new()
}
}
pub fn add_employee(&mut self, dept: &str, name: &str){
// if dept does not ... |
extern crate bit_vec;
extern crate rust_htslib;
use regex::Regex;
use rust_htslib::bcf::Read;
use std::path::Path;
#[derive(Serialize, Clone, Debug, PartialEq)]
pub struct Variant {
pub(crate) marker_type: String,
pub(crate) reference: String,
pub(crate) alternatives: Option<String>,
pub(crate) start_... |
#![allow(non_snake_case)]
//! The BIOS includes several System Call Functions which can be accessed by SWI
//! instructions.
//!
//! * All BIOS functions clobber `r0`, `r1`, and `r3`.
//! * Some functions also use `r2` as an input register.
//! * All other registers are unaffected.
// Note(Lokathor): This makes intra... |
use crate::functions::*;
use crate::types::{Arr1d, Arr2d, Arr3d};
use crate::util::*;
use itertools::izip;
use ndarray::{Array, Array1, Array2, Array3, Axis, Dimension};
pub trait LayerWithLoss {
fn predict(&self, input: Arr2d) -> Arr2d {
unimplemented!()
}
/// (バッチ次元、入力次元)の入力inputに対し、(バッチ次元、出力次元)を... |
/// A libusb implementation of the adapter hardware interface
#[cfg(feature = "libusb")]
mod libusb;
#[cfg(feature = "libusb")]
pub use libusb::*;
/// A trait representing a struct which provides access to a limited set of
/// USB operations
pub trait AdapterHardware {
fn write_interrupt(&mut self, data: &[u8])... |
use crate::{Elevation, Location, Trace};
// instead of receiving the values `Trace`,
// Trace borrows (pre-existing) instances of Trace
#[derive(Debug)]
pub struct Analyzer<'a> {
pub trace: &'a Trace,
statistics: Vec<Stats>,
}
#[derive(Debug)]
pub struct Stats {
distance: f64,
elevation: Elevation,
}
... |
use redis::Commands;
use serde_json::{json, Result, Value};
use std::collections::HashMap;
use std::io::prelude::*;
use std::io::BufReader;
use std::net::TcpStream;
use std::str;
use std::sync::mpsc;
use std::thread;
use uuid::Uuid;
use crate::message::{Message, ServiceMessage, ServiceMsgType, ServiceType};
static HE... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use std::fmt;
use anyhow::Error;
use once_cell::sync::OnceCell;
use strum::EnumProperty as _;
use strum_macros::EnumIter;
use strum_mac... |
//! The `window` module defines data structure for storing the tail of the ledger.
//!
use crate::packet::SharedBlob;
use solana_sdk::pubkey::Pubkey;
use std::cmp;
use std::sync::{Arc, RwLock};
#[derive(Default, Clone)]
pub struct WindowSlot {
pub data: Option<SharedBlob>,
pub coding: Option<SharedBlob>,
p... |
use chrono::{Duration, NaiveDateTime};
use serde::{Serialize, Serializer};
pub(crate) mod duration_tuple_secs {
use super::DurationWrapper;
use chrono::Duration;
use serde::{Serialize, Serializer};
pub fn serialize<S>(dur: &Option<(Duration, Duration)>, serializer: S) -> Result<S::Ok, S::Error>
wher... |
#![no_std]
use volatile_cell::VolatileCell;
// Known to apply to:
// STM32L4x6
ioregs!(RCC = {
0x00 => reg32 cr {
0 => msi_on : rw {
0 => Off,
1 => On,
},
1 => msi_rdy : ro {
0 => NotReady,
1 => Ready,
},
2 => msi_pll_en : rw... |
use std::io;
use std::io::Write;
use std::io::prelude::*;
use std::fs;
use std::fs::File;
use std::num::NonZeroU32;
use aes::Aes256;
use block_modes::{BlockMode,Cbc};
use block_modes::block_padding::Pkcs7;
use ring::error::Unspecified;
use ring::rand::SecureRandom;
use ring::{digest, pbkdf2, rand};
use data_encodin... |
// Copyright 2016 taskqueue developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://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 according ... |
//! main is our command line application implementation.
// Copyright (2017) Jeremy A. Wall.
//
// 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/LICEN... |
use cocoa::base::id;
use sys::MTLArrayType;
use {DataType, FromRaw, StructType};
pub struct ArrayType(id);
impl ArrayType {
pub fn array_length(&self) -> usize {
unsafe { self.0.arrayLength() as usize }
}
pub fn element_type(&self) -> DataType {
unsafe { self.0.elementType().into() }
... |
use super::{CombatStats, GameLog, InBackpack, Name, Player, Position, State, Viewport, Viewshed};
use rltk::{Point, Rltk, VirtualKeyCode, RGB};
use specs::prelude::*;
// ------------------------------------------------------------------------------------------------------------------ //
fn draw_inventory(world: &World... |
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use identity::application::role::GetAll;
use crate::authorization::auth;
use crate::container::Container;
use crate::error::PublicError;
async fn get_all(req: HttpRequest, c: web::Data<Container>) -> impl Responder {
let auth_id = auth(&req, &c).await?;... |
use actix_web::{App, HttpServer};
use server::db;
use server::routes;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let pool = db::create_pool();
HttpServer::new(move || {
App::new()
.data(pool.clone())
.configure(routes::room::add_route)
})
.bind("127.0.... |
use command::Command;
use event::Event;
use json::ComponentDefinition;
use quote::Tokens;
use schema_type::ReferencedUserType;
use syn::Ident;
use to_rust_qualified_name;
pub struct Component {
name: String,
pub qualified_name: Vec<String>,
pub rust_qualified_name: String,
pub data_reference_type: Refe... |
// 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... |
pub mod common;
pub mod pages;
mod shared;
mod util;
|
#[macro_use]
extern crate actix_web;
mod comp;
mod db;
mod error;
mod field;
mod input;
mod insert;
mod model;
mod query;
mod utils;
mod view;
use comp::{Comp, CompBox, DataTable, Doc};
use db::Db;
use field::{BoolField, DateTimeField, IdField, TextField};
use indexmap::IndexMap;
use insert::Insert;
use model::{Model... |
use std::fs::OpenOptions;
use std::io::Write;
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::{Duration, SystemTime};
use rppal::gpio::{Gpio, Level, Mode};
use libdriver::{api, util};
use libutil::SoftPwm;
use crate::{Error, Result};
// sensor input pins in BCM numbering
const GPIO_IR_L: u8 = 4;
const ... |
/// Struct to represent an Autonomous System
#[derive(Default, Clone, PartialEq, Eq, Hash, Debug)]
pub struct Asn {
/// Autonomous System number
pub number: u32,
/// Autonomous System name
pub name: String,
}
|
pub use crate::rand::*;
pub use crate::test_vectors::*;
pub use crate::*;
// re-export serde and file IO
pub use serde::{self, de::DeserializeOwned, Deserialize, Serialize};
pub use serde_json::Value;
pub use std::fs::File;
pub use std::io::{prelude::*, BufReader};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use hyper::{Request, Response, StatusCode, Body};
use hyper::server::conn::AddrStream;
use hyper::service::{make_service_fn, service_fn_ok};
use hyper::server::Server;
use hyper::rt::Future;
use super::router::Router;
use super::builder::BuilderWithHandlers;
#[derive(Debug... |
//! Defining a custom asset and format.
extern crate amethyst_assets;
extern crate futures;
extern crate rayon;
use std::str::{Utf8Error, from_utf8};
use std::sync::Arc;
use amethyst_assets::*;
use rayon::{Configuration, ThreadPool};
#[derive(Clone, Debug)]
struct DummyAsset(String);
impl Asset for DummyAsset {
... |
#[doc = "Reader of register ETZPC_HWCFGR"]
pub type R = crate::R<u32, super::ETZPC_HWCFGR>;
#[doc = "Reader of field `NUM_TZMA`"]
pub type NUM_TZMA_R = crate::R<u8, u8>;
#[doc = "Reader of field `NUM_PER_SEC`"]
pub type NUM_PER_SEC_R = crate::R<u8, u8>;
#[doc = "Reader of field `NUM_AHB_SEC`"]
pub type NUM_AHB_SEC_R = ... |
fn main() {
// let mut arr = [18, 36, 2, 69, 42, 80, 90, 83, 61, 70, 37, 67, 84, 90, 58, 10, 23, 42, 62, 48, 49, 58, 86, 1, 65, 20, 20, 26, 91, 8, 50, 28, 9, 59, 76, 96, 49, 54, 55, 8, 20, 90, 64, 81, 53, 75, 52, 8, 64, 52, 63, 39, 5, 83, 81, 2, 36, 41, 66, 81, 87, 36, 84, 8, 5, 27, 32, 46, 80, 62, 94, 39, 99, 15, ... |
use core::ops;
use proc_macro2::TokenStream;
use quote::ToTokens;
use syn::{
parse::{Parse, ParseStream},
Fields, Ident, ItemEnum, Result, Type,
};
/// A structure to make trait implementation to enums more efficient.
pub struct EnumData {
repr: ItemEnum,
field_types: Vec<Type>,
}
impl EnumData {
... |
#[doc = "Reader of register DDRPERFM_CTL"]
pub type R = crate::R<u32, super::DDRPERFM_CTL>;
#[doc = "Writer for register DDRPERFM_CTL"]
pub type W = crate::W<u32, super::DDRPERFM_CTL>;
#[doc = "Register DDRPERFM_CTL `reset()`'s with value 0"]
impl crate::ResetValue for super::DDRPERFM_CTL {
type Type = u32;
#[i... |
//! This is so nasty!
//!
//! We need to support 3DES to provide compatibility with Yubico's braindead
//! implementation of key management...
// use cortex_m_semihosting::{dbg, hprintln};
use core::convert::TryInto;
// needed to even get ::new() from des...
use des::cipher::{BlockDecrypt, BlockEncrypt, NewBlockCiphe... |
//! Session information.
//!
//! Initially created from database client and used through server, sql-processor, and storage-engine.
//!
//! A session holds these information:
//!
//! - Open database (0/1)
//! - Beginning transaction (0/1 if a database is open; 0 if any database isn't open)
//!
//! Only storage-engine h... |
#![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 ClusterProperties {
#[serde(rename = "clusterId", default, skip_serializing_if = "Option::is_none")]
pub cl... |
use hyper::{Body, Response};
use crate::db;
use crate::html;
use crate::http::util;
pub fn handle_get() -> Result<Response<Body>, hyper::Error> {
let db = db::DB::new();
let games = match db.get_games() {
Ok(d) => d,
Err(e) => return util::db_error_page(e),
};
Ok(Response::new(Body::... |
use block::Block;
use blocks::wm::*;
use wm::WindowManager;
use util::WindowManagers;
pub struct Wsp {
wm: Box<WindowManager>,
icon: String,
active_icon: String,
}
impl Wsp {
pub fn new() -> Wsp {
Wsp {
wm: Box::new(Bspwm::new()),
icon: String::new(),
active... |
// Copyright 2019 Parity Technologies
//
// 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... |
#[doc = "Register `CMD` reader"]
pub type R = crate::R<CMD_SPEC>;
#[doc = "Register `CMD` writer"]
pub type W = crate::W<CMD_SPEC>;
#[doc = "Field `CMDINDEX` reader - Command index"]
pub type CMDINDEX_R = crate::FieldReader;
#[doc = "Field `CMDINDEX` writer - Command index"]
pub type CMDINDEX_W<'a, REG, const O: u8> = ... |
extern crate rand;
use self::rand::random;
use std::f32;
use std::iter::Cycle;
use std::slice::Iter;
use synth::module;
// TODO We could try smoothly mixing between the waves.
#[derive(Debug)]
#[derive(Clone)]
pub enum Waveform {
Sine,
Square,
Sawtooth,
Triangle,
Noise
}
impl Waveform {
fn ... |
// vim: shiftwidth=2
use std::fs::{File, canonicalize, read_to_string};
use std::io::{self, BufRead};
use std::num::ParseIntError;
use std::path::{Path, PathBuf};
use std::collections::HashSet;
use crate::key_codes::KeyCode;
pub fn list_keyboards_to_stdout() -> io::Result<()> {
for p in list_keyboards()? {
pri... |
use super::point::Point;
use super::ray::Ray;
use super::vector::Vector;
pub struct Camera {
location: Point,
u: Vector,
v: Vector,
n: Vector,
distance: f64,
width: u32,
height: u32
}
impl Camera {
pub fn new(location: Point, v: Vector, n: Vector, distance: f64, width: u32, height: u32... |
use crate::ast::*;
use crate::span::Spanned;
use crate::value::Value;
use crate::Pos;
use pest::error::LineColLocation;
use pest::iterators::Pair;
use pest::Parser;
use std::collections::BTreeMap;
use std::fmt;
#[derive(Parser)]
#[grammar = "query.pest"]
struct QueryParser;
/// Parser error
#[derive(Error, Debug, Par... |
#[cfg(test)]
#[path = "../../../tests/unit/format/problem/reader_test.rs"]
mod reader_test;
#[path = "./job_reader.rs"]
mod job_reader;
#[path = "./fleet_reader.rs"]
mod fleet_reader;
#[path = "./objective_reader.rs"]
mod objective_reader;
use self::fleet_reader::{create_transport_costs, read_fleet, read_travel_lim... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, API_VERSION};
#[non_exhaustive]
#[derive(Debug, thiserror :: Error)]
#[allow(non_camel_case_types)]
pub enum Error {
#[error(transparent)]
CreateKey(#[from] create_key::Error),... |
use poise::serenity_prelude::{Mentionable, User};
use crate::{
types::{Error, PoiseContext},
utils::{
apis::neko_api,
discord::{reply_embed, reply_plain},
},
};
async fn _neko_command(ctx: PoiseContext<'_>, user: User, key: &str) -> Result<(), Error> {
let title_builder = match key {
"baka" => "{} calls {} ... |
/*
* Datadog API V1 Collection
*
* Collection of all Datadog Public endpoints.
*
* The version of the OpenAPI document: 1.0
* Contact: support@datadoghq.com
* Generated by: https://openapi-generator.tech
*/
/// UsageCustomReportsAttributes : The response containing attributes for custom reports.
#[derive(Cl... |
pub trait Policy<O, R>
{
fn execute(&self, operation: O) -> R;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.