text stringlengths 8 4.13M |
|---|
#[doc = "Reader of register ETH_DMADSR"]
pub type R = crate::R<u32, super::ETH_DMADSR>;
#[doc = "Reader of field `AXWHSTS`"]
pub type AXWHSTS_R = crate::R<bool, bool>;
#[doc = "Reader of field `AXRHSTS`"]
pub type AXRHSTS_R = crate::R<bool, bool>;
#[doc = "Reader of field `RPS0`"]
pub type RPS0_R = crate::R<u8, u8>;
#[... |
//! A set of utilities to help with common use cases that are not required to
//! fully use the library.
#[macro_use]
pub mod macros;
pub mod builder;
mod colour;
mod message_builder;
pub use self::colour::Colour;
use base64;
use std::ffi::OsStr;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use ::in... |
//! Defines the main structure to be used in this library.
//!
//! It wraps Lua, and ensures that the correct callbacks are defined for
//! each of the methods used by the Awesome Lua libraries.
use std::path::PathBuf;
use super::lua::{Lua, LuaErr};
use super::callbacks::{self, Button, Client, Drawin, Keygrabber,
... |
use token;
use std::fmt;
#[derive(PartialEq, Clone)]
pub enum EvalType {
TInvalid,
TInteger,
TVector
}
#[derive(Clone)]
pub enum Nodes {
AddNode(Box<Nodes>),
SubNode(Box<Nodes>),
MulNode(Box<Nodes>),
DivNode(Box<Nodes>),
IntNode(Box<Nodes>),
UMinusNode(Box<Nodes>),
ExprNode(Eva... |
/*!
```rudra-poc
[target]
crate = "ms3d"
version = "0.1.2"
[report]
issue_url = "https://github.com/andrewhickman/ms3d/issues/1"
issue_date = 2021-01-26
rustsec_url = "https://github.com/RustSec/advisory-db/pull/723"
rustsec_id = "RUSTSEC-2021-0016"
[[bugs]]
analyzer = "UnsafeDataflow"
bug_class = "UninitExposure"
ru... |
use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Loc(pub usize, pub usize);
impl fmt::Display for Loc {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}-{}", self.0, self.1)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Annot<T> {
pub v... |
use std::collections::HashMap;
use crate::util::prelude::*;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct WorldId(u32);
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct MaterialId(u32);
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Tick(u64);
impl std::ops::Add<u64> for T... |
use std::{
fs::File,
io::{BufWriter, Write},
};
pub fn write_to_file(best : i32, time : f64, filename : std::string::String) {
let file = File::create(&filename).unwrap();
let mut writer = BufWriter::new(&file);
write!(&mut writer, "{}\t{}", best, time);
} |
use wasm_bindgen::prelude::wasm_bindgen;
use crate::Matrix;
/// An instance of NeuralNet is able to perform calculations on some
/// input data. It can be "trained" to give a specific result on some
/// specific input. It consists of layers of nodes, through which data
/// "flows".
#[wasm_bindgen]
pub struct NeuralNet... |
use crate::Gc;
use std::{cmp::Ordering, hash::Hash, iter::FromIterator, ops::Index};
use vec_map::{Entry, VecMap};
pub struct OneToMany<ONE, MANY>(VecMap<ONE, Box<[MANY]>>);
impl<ONE, MANY> OneToMany<ONE, MANY> {
pub fn get(&self, index: &ONE) -> &[MANY]
where
ONE: Clone + Into<usize>,
{
s... |
use bson;
use mongodb::coll::results::InsertOneResult;
use mongodb::db::{Database, ThreadedDatabase};
use mongodb::oid::ObjectId;
use mongodb::DecoderError;
use r2d2::{Pool, PooledConnection};
use r2d2_mongodb::MongodbConnectionManager;
use crate::utils;
use crate::utils::HandlerErrors;
pub type APIKey = String;
pub... |
use super::*;
/// An incoming inline query.
#[derive(Debug,Deserialize)]
pub struct InlineQuery {
/// The unique identifier for this query.
pub id: String,
/// The sender.
pub from: Box<User>,
/// The sender's location.
pub location: Option<Box<Location>>,
/// The text of the query.
pub... |
use crate::prelude::*;
fn decompress(s: &str) -> Result<String> {
use parsers::*;
#[derive(Debug, Clone)]
enum Section<'s> {
Text(&'s str),
Repetition(usize, &'s str),
}
let section = alt((
map(alpha1, |s: &str| Section::Text(s)),
map(
flat_map(
... |
mod file;
mod gzip;
use rustzx_core::{
error::IoError,
host::{BufferCursor, DataRecorder, LoadableAsset, SeekFrom, SeekableAsset},
};
use std::boxed::Box;
pub use file::FileAsset;
pub use gzip::GzipAsset;
pub trait DynamicAssetImpl: LoadableAsset + SeekableAsset {}
impl<T: AsRef<[u8]>> DynamicAssetImpl for... |
/*
* RIDB API Additional Functions 0.1
*
* The Recreation Information Database (RIDB) provides data resources to citizens, offering a single point of access to information about recreational opportunities nationwide. The RIDB represents an authoritative source of information and services for millions of visitors to... |
use std::borrow::Cow;
use std::error::Error;
use heed_traits::{BytesDecode, BytesEncode};
use bytemuck::{Pod, PodCastError, bytes_of, bytes_of_mut, try_from_bytes};
/// Describes a type that must be [memory aligned] and
/// will be reallocated if it is not.
///
/// A [`Cow`] type is returned to represent this behavio... |
//! Math helpers.
use std::ops::Sub;
use crc::crc32;
/// Feature scaling helper - normalization (also called min-max scaling)
pub fn normalize<T>(value: T, min: T, max: T) -> f64
where
T: Copy + Sub<Output = T> + Into<f64>,
{
(value - min).into() / (max - min).into()
}
/// Given some data and a ratio, for in... |
#![recursion_limit="128"]
use std::collections::HashMap;
use std::u32;
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
extern crate syn;
#[macro_use]
extern crate quote;
use proc_macro2::{Span, TokenStream};
trait IterExt: Iterator + Sized {
fn collect_vec( self ) -> Vec< Self::Item > {
... |
fn is_whitespace(text: &str) -> bool {
text.chars()
.all(|c| c.is_whitespace())
}
fn main(){
print!("{}\n", is_whitespace("Vilmar Catafesta"))
}
|
use rand::{prelude::*, seq::SliceRandom};
use std::{collections::HashMap, fmt::Debug, hash::Hash};
/// Represents the relation between a location and neighbors
pub trait Relation: Debug {
type Loc;
type Item;
/// Returns an iterator over all relations to a given location
fn related(&self, at: Self::Loc, f: im... |
fn f() {
print!("1");
}
fn main() {
f();
// prints 2
{
f();
// prints 3
fn f() { print!("3"); }
}
f();
// prints 2
fn f() { print!("2"); }
}
|
use anyhow::*;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, fmt, iter::FromIterator};
use super::super::*;
/// A value assigned to an attribute in a widget.
/// This can be a primitive String that contains any amount of variable
/// references, as would be generated b... |
#[doc = "Register `TOCC` reader"]
pub type R = crate::R<TOCC_SPEC>;
#[doc = "Register `TOCC` writer"]
pub type W = crate::W<TOCC_SPEC>;
#[doc = "Field `ETOC` reader - Enable Timeout Counter"]
pub type ETOC_R = crate::BitReader;
#[doc = "Field `ETOC` writer - Enable Timeout Counter"]
pub type ETOC_W<'a, REG, const O: u8... |
#[derive(Debug)]
#[repr(packed)]
pub struct Tss {
pub prev_tss: u32,
pub sp0: usize,
pub ss0: usize,
pub sp1: usize,
pub ss1: usize,
pub sp2: usize,
pub ss2: usize,
pub cr3: usize,
pub ip: usize,
pub flags: usize,
pub ax: usize,
pub cx: usize,
pub dx: usize,
pub b... |
extern crate tinymt;
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
use tinymt::tinymt32;
// NOTE: 本当はパスが適切に解釈される `module` を使うのが望ましいが, バグのため使用できないので `raw_module` で代用している
// ref: https://github.com/rustwasm/wasm-bindgen/issues/1921
// #[wasm_bindgen(module = "/src/crate/import")]
#[cfg(not(test))]
#[wasm_bin... |
//! <https://github.com/EOSIO/eosio.cdt/blob/4985359a30da1f883418b7133593f835927b8046/libraries/eosiolib/core/eosio/time.hpp#L134-L210>
use crate::{TimePoint, TimePointSec, NumBytes, Read, Write};
use alloc::string::ToString;
use chrono::{Utc, TimeZone, SecondsFormat};
use codec::{Encode, Decode};
#[cfg(feature = "std"... |
#[doc = "Flash macro control\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--w... |
use bytes::Bytes;
use future::{select_all, Either};
use futures_util::{future, pin_mut, stream::StreamExt, stream::TryStreamExt};
use mpsc::UnboundedSender;
use time::Duration;
use tokio::{
sync::mpsc::{self, Receiver, Sender},
time,
};
use tracing::{info, info_span};
use tracing_futures::Instrument;
use mqtt3... |
#[doc = "Register `OTG_GAHBCFG` reader"]
pub type R = crate::R<OTG_GAHBCFG_SPEC>;
#[doc = "Register `OTG_GAHBCFG` writer"]
pub type W = crate::W<OTG_GAHBCFG_SPEC>;
#[doc = "Field `GINTMSK` reader - GINTMSK"]
pub type GINTMSK_R = crate::BitReader;
#[doc = "Field `GINTMSK` writer - GINTMSK"]
pub type GINTMSK_W<'a, REG, c... |
mod server;
pub use server::Server;
mod util;
mod importer;
pub use importer::Importer;
pub const BUFFER_SIZE: usize = 10000;
pub const SOCKET_PATH: &str = env!("SOCKET_PATH");
pub const CONFIG_PATH: &str = env!("CONFIG_PATH");
pub const STATE_PATH: &str = env!("STATE_PATH");
pub const REPOSITORY_DIR: &str = env!("... |
// endianness is not configurable
pub fn int_to_bytes(int: u64, length: usize) -> Vec<u8> {
let mut vec = int.to_le_bytes().to_vec();
vec.resize(length, 0);
vec
}
pub fn integer_squareroot(n: u64) -> u64 {
let mut x = n;
let mut y = (x + 1) / 2;
while y < x {
x = y;
y = (x + n ... |
#[doc = "Reader of register CMD_RESP_CTRL"]
pub type R = crate::R<u32, super::CMD_RESP_CTRL>;
#[doc = "Writer for register CMD_RESP_CTRL"]
pub type W = crate::W<u32, super::CMD_RESP_CTRL>;
#[doc = "Register CMD_RESP_CTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::CMD_RESP_CTRL {
type Type = u32;
... |
use std::collections::HashMap;
use super::Parser;
use crate::dom::{AttrMap, Node};
pub struct HTMLParser {
pos: usize,
input: String,
}
impl HTMLParser {
pub fn new(input: String) -> HTMLParser {
HTMLParser { pos: 0, input }
}
pub fn run(&mut self) -> Node {
self.consume_whitespa... |
use std::cell::RefCell;
use std::rc;
use crate::object;
use crate::store;
use crate::transaction;
use crate::network::client_messages;
use crate::network::*;
pub struct ReadResponse {
pub client_id: ClientId,
pub request_id: RequestId,
pub object_id: object::Id,
pub result: Result<store::ReadState, s... |
extern crate speedtest_rs;
#[macro_use]
extern crate log;
extern crate env_logger;
#[macro_use]
extern crate clap;
use clap::{App, Arg};
// use speedtest_rs::speedtest::run_speedtest;
use speedtest_rs::speedtest;
use std::io::{self, Write};
#[allow(dead_code)]
fn main() {
env_logger::init().unwrap();
let ma... |
use rand::os::OsRng;
use rand::Rng;
use hmac::{Hmac, Mac};
use sha2::Sha512;
use base64;
pub fn make_random_string() -> String {
let mut rng = OsRng::new().expect("can't access the OS random number generator");
rng.gen_ascii_chars().take(30).collect()
}
pub fn authenticate(challenge: &str, key: &str, digest: ... |
//
// Copyright 2020 The Project Oak Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o... |
pub mod asset;
pub mod bindings;
mod reader;
mod util;
pub use asset::*;
|
use crate::net::SignerID;
use tapyrus::PublicKey;
pub fn sender_index(sender_id: &SignerID, pubkey_list: &[PublicKey]) -> usize {
//Unknown sender is already ignored.
pubkey_list
.iter()
.position(|pk| pk == &sender_id.pubkey)
.unwrap()
}
|
// Crate linkage metadata
#[ link(name = "closures",
vers = "0.1.2",
author = "smadhueagle") ];
#[pkg(id = "closures", vers = "0.1.2")];
// Additional metadata attributes
#[ desc = "A simple example of closures in rust"];
#[ license = "MIT" ];
#[crate_type = "bin"];
// returning an owned closure - t... |
use std::convert::From;
use std::i32;
use crate::mesh::{Vec2, Vec4};
use std::ops::{Add, Mul};
#[derive(Debug, PartialEq, Copy, Clone)]
pub struct RGBA {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}
impl RGBA {
pub fn alpha(&self, a: f32) -> Self {
Self {
r: self.r,
... |
pub mod term_selector;
pub mod term_scorer;
use term::Term;
use schema::FieldRef;
use query::term_selector::TermSelector;
use query::term_scorer::TermScorer;
#[derive(Debug, PartialEq)]
pub enum Query {
All {
score: f64,
},
None,
Term {
field: FieldRef,
term: Term,
sco... |
//! Advanced
fn main() {
let war = 10;
println!("war is {}", war);
// war = 20;
// 03.rs:7:5: 7:13 error: re-assignment of immutable variable `war`
// 03.rs:7 war = 20;
//
// 고칠수없는 변수의 값을 고쳤다는뜻.
// Rust는 변수선언을 하면 기본적으로 immutable임
println!("war never changes");
println!("");... |
extern crate sdl2;
extern crate rand;
pub mod objparse;
use objparse::{Model, Face, Vertex};
use sdl2::event::{Event};
use sdl2::rect::{Point};
use sdl2::pixels::{Color};
use sdl2::render::{Renderer};
use std::time::{Instant, Duration};
use std::thread::{sleep};
static WIDTH : u32 = 500;
static HEIGHT : u32 = 500... |
//vim: tw=80
use std::future::Future;
use std::task::Poll;
use std::pin::Pin;
use futures::channel::oneshot;
use futures::{future, stream, StreamExt, FutureExt, TryFutureExt};
#[cfg(feature = "tokio")]
use std::rc::Rc;
use tokio;
#[cfg(feature = "tokio")]
use tokio::runtime::current_thread;
use futures_locks::*;
// C... |
// This file is part of Substrate.
// Copyright (C) 2020 Parity Technologies (UK) Ltd.
// 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://... |
extern crate td_rredis as redis;
use std::error;
use std::fmt;
use std::io;
use std::hash::Hash;
use std::str::{from_utf8, Utf8Error};
use std::collections::{HashMap, HashSet};
use std::convert::From;
use redis::RedisResult;
fn test_get() -> redis::RedisResult<()> {
let client = redis::Client::open("redis://127.... |
use anyhow::{Context, Result};
use regex::Regex;
use structopt::StructOpt;
/// Remove the log files emitted in Sightglass runs.
#[derive(StructOpt, Debug)]
#[structopt(name = "clean")]
pub struct CleanCommand {}
impl CleanCommand {
pub fn execute(&self) -> Result<()> {
// Remove log files.
let log... |
fn main() {
let low = 109165;
let high = 576723;
println!("{}", (low..high).fold(0, |count, num| count + if valid_num(num) { 1 } else { 0 }));
}
fn valid_num(num: u32) -> bool {
let mut has_double = false;
let multiples = [10,100,1000,10000,100000];
for tens in multiples.iter() {
let cur_digit = (num... |
/*
Conversion from quaternions to Euler rotation sequences.
From: http://bediyap.com/programming/convert-quaternion-to-euler-rotations/
*/
use crate::{DQuat, Quat};
/// Euler rotation sequences.
///
/// The angles are applied starting from the right.
/// E.g. XYZ will first apply the z-axis rotation.
///
/// YXZ can... |
pub use hooks::NO_CONFIG_FILE_FOUND_ERROR_CODE;
use std::collections::HashMap;
mod hooks;
pub fn get_root_directory_path<F>(
run_command: F,
target_directory: Option<&str>,
) -> Result<Option<String>, Option<String>>
where
F: Fn(
&str,
Option<&str>,
bool,
Option<&HashMap<St... |
extern crate exonum;
extern crate exonum_configuration;
extern crate queue_constructor;
use exonum::helpers::{self, fabric::NodeBuilder};
use exonum_configuration as configuration;
fn main() {
exonum::crypto::init();
helpers::init_logger().unwrap();
let node = NodeBuilder::new()
.with_service(Box... |
use serde::Deserialize;
use std::fmt::{Display, Error, Formatter};
/// Modifier for interactive commands,
/// specifying the amount of normalization in the output.
#[derive(Deserialize, Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum Rewrite {
AsIs,
Instantiated,
HeadNormal,
Simplif... |
/* Version de l'alogo avec la preuve rand faite à la Schnorr et les cartes en struct*/
extern crate curve25519_dalek;
extern crate rand_core;
extern crate rand;
extern crate sha2;
use rand_core::OsRng;
use curve25519_dalek::constants;
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scal... |
use hacspec_lib::*;
use hacspec_p256::*;
use hacspec_sha256::*;
#[derive(Debug)]
pub enum Error {
InvalidScalar,
InvalidSignature,
}
pub type P256PublicKey = Affine;
pub type P256SecretKey = P256Scalar;
pub type P256Signature = (P256Scalar, P256Scalar); // (r, s)
pub type P256SignatureResult = Result<P256Sign... |
use crate::message::SOH;
use crate::data_dictionary::*;
use crate::quickfix_errors::*;
pub fn validate_tag(msg: &str, dict: &DataDictionary) -> Result<(), SessionLevelRejectErr> {
// validate that tag is correct according to data_dictionary
// and value is in permissible range
// get the message type
l... |
use executor::*;
use std::fs::File;
use std::io::Write;
use std::path::Path;
const BUILTIN_RULES : &'static str = "\
# The rules
rule C_COMPILER
command = clang $cflags -c $in -o $out
";
fn dump_target(f: &mut File, target_name: &str, target: &Target) {
f.write_fmt(format_args!("# Target: {}\n", target_name)).... |
#![no_std]
use nrf52832_hal as hal;
pub use display_interface;
pub use display_interface_spi;
pub use st7789;
pub mod animated_st7789;
pub mod backlight;
pub mod battery_controller;
pub mod button;
pub mod cst816s;
pub mod lcd;
pub mod motor_controller;
pub mod watchdog;
|
use artell_domain::artist::{
ArtistId, ArtistRepository, {Artist, Error as ArtistDomainError},
};
pub struct Params {
pub name: String,
pub email: String,
pub status_msg: String,
pub description: String,
pub instagram: String,
pub twitter: String,
}
#[derive(Error, Debug)]
pub enum Error {... |
use actix::prelude::*;
use actix_web::{dev::Body, http::StatusCode, web::HttpResponse, ResponseError};
use diesel::prelude::*;
use diesel::sql_types::Integer;
use failure_derive::Fail;
use serde::Deserialize;
use crate::db::models::{NewHistory, Song};
use crate::db::schema::songs;
use crate::db::DbExecutor;
use crate:... |
// ===============================================================================
// Authors: AFRL/RQQA
// Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division
//
// Copyright (c) 2017 Government of the United State of America, as represented by
// the Secretary of th... |
#![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 AppProperties {
#[serde(rename = "applicationId", default, skip_serializing_if = "Option::is_none")]
pub ap... |
#![feature(try_trait)]
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
extern crate gl;
mod gl_shaders;
mod gl_buffer;
mod gl_framebuffer;
mod gl_vertex_array;
mod gl_texture;
mod gl_err;
mod shader;
mod gl_render;
pub use gl_shaders::AttribInfo;
pub use gl_shaders::Un... |
use futures_01::future::Future as Future01;
use futures_01::stream::Stream as Stream01;
use futures_01::Poll as Poll01;
use futures_util::compat::Compat;
use futures_util::stream::Stream;
use std::marker::PhantomData;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio_02::time::Sleep as Delay2;
use tokio_stre... |
use crate::chunk::ChunkGridCoordinate;
use math::random::Seed;
use std::num::Wrapping;
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct WorldSeed(pub Seed);
impl WorldSeed {
pub fn new() -> Self {
Self(Seed::new())
}
pub fn to_chunk_seed(&self, coords: ChunkGridCoordinate) -> ChunkSeed {
... |
mod opening;
pub mod puzzle;
pub mod reverse_amazon_search;
pub(crate) mod tree;
/// Analysis methods for paco sako. This can be used to analyze a game and
/// give information about interesting moments. E.g. missed opportunities.
use serde::Serialize;
use crate::{
determine_all_threats, BoardPosition, DenseBoard... |
static MAX_HEALTH: i32 = 100;
static GAME_NAME: &'static str = "Monster Attack";
fn main() {
}
|
use bitflags;
use std::path::PathBuf;
use std::{ffi::OsStr, fs};
pub struct Config {
pub files: Vec<PathBuf>,
pub print_flags: PrintFlags,
}
impl Config {
pub fn new(input_path: PathBuf, print_flags: PrintFlags, do_file: bool) -> Result<Config, &'static str> {
let mut config = Config {
... |
///// chapter 2 "using variables and types"
///// program section:
//
fn main() {
let health = 32;
let y = &health;
println!("{}", y);
// let tricks = 10;
// let reftricks = &mut tricks;
let mut score1 = 0;
// let score2 = &score;
let score3 = &mut score1;
println!("{}", score3);... |
#[doc = "Register `RTCCR` reader"]
pub type R = crate::R<RTCCR_SPEC>;
#[doc = "Register `RTCCR` writer"]
pub type W = crate::W<RTCCR_SPEC>;
#[doc = "Field `CAL` reader - Calibration value"]
pub type CAL_R = crate::FieldReader;
#[doc = "Field `CAL` writer - Calibration value"]
pub type CAL_W<'a, REG, const O: u8> = crat... |
use lspower::lsp::{self, notification::Notification};
use serde::{Deserialize, Serialize};
use strum_macros::{Display, EnumIter};
#[derive(EnumIter)]
pub enum LspServerCommand {
CompositionInitialize,
SetMeasurementFilter,
AddFieldFilter,
RemoveFieldFilter,
AddTagValueFilter,
RemoveTagValueFilt... |
pub struct Ray3 {
origin: Vec3<f32>;
direction: Vec3<f32>;
} |
use std::env;
use std::path::Path;
use tantivy::collector::TopDocs;
use tantivy::query::QueryParser;
use tantivy::schema::*;
use tantivy::schema::{Schema, STORED, TEXT};
use tantivy::{Index, ReloadPolicy};
fn create_schema() -> Schema {
let mut schema_builder = Schema::builder();
schema_builder.add_text_fiel... |
pub mod routes;
pub mod config;
pub mod logging;
pub mod catchers;
pub mod server; |
mod buf;
mod key;
mod node;
mod interpolator;
mod search;
#[cfg(test)]
mod tests;
use {
std::{
ops::Index,
marker::PhantomData
},
buf::Buffer,
search::search,
};
pub use {
key::{
TrackKey,
TrackKeyDistance,
},
node::TrackNode,
interpolator::TrackInterpo... |
use super::*;
pick! {
if #[cfg(target_feature="sse2")] {
#[derive(Default, Clone, Copy, PartialEq, Eq)]
#[repr(C, align(16))]
pub struct i64x2 { sse: m128i }
} else if #[cfg(target_feature="simd128")] {
use core::arch::wasm32::*;
#[derive(Clone, Copy)]
#[repr(transparent)]
pub struct i... |
// Copyright 2017 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... |
//! Error module with all error used by soft
#![allow(missing_docs)]
error_chain!{
types {
Error, ErrorKind, ResultExt, Result;
}
links {}
foreign_links {
Io(::std::io::Error);
AppDirs(::app_dirs::AppDirsError);
SystemTime(::std::time::SystemTimeError);
Int(::s... |
use std::fs::{DirBuilder, File, Metadata, OpenOptions};
use std::io::{self, Error, ErrorKind};
use std::os::unix::fs::{DirBuilderExt, MetadataExt, PermissionsExt};
use std::os::unix::prelude::OpenOptionsExt;
use std::path::Path;
// of course we can also write "file & 0o040 != 0", but this makes the intent explicit
enu... |
#[doc = "Register `DDRCTRL_PERFLPR1` reader"]
pub type R = crate::R<DDRCTRL_PERFLPR1_SPEC>;
#[doc = "Register `DDRCTRL_PERFLPR1` writer"]
pub type W = crate::W<DDRCTRL_PERFLPR1_SPEC>;
#[doc = "Field `LPR_MAX_STARVE` reader - LPR_MAX_STARVE"]
pub type LPR_MAX_STARVE_R = crate::FieldReader<u16>;
#[doc = "Field `LPR_MAX_S... |
use flatbuffers::EndianScalar;
use std::cell::{RefCell, RefMut};
use std::ffi::OsString;
use std::net::SocketAddr;
use flatbuffers::FlatBufferBuilder;
use thread_local::ThreadLocal;
use crate::base::{finalize_request, response_or_error};
use crate::client::tcp_client::TcpClient;
use crate::generated::*;
use crate::st... |
use rand::{thread_rng, Rng};
use crate::{common::BetContext, common::Environment};
pub(crate) fn is_broke(context: &BetContext) -> bool {
context.total_money == 0
}
pub(crate) fn reach_goal(context: &BetContext) -> bool {
context.total_money >= context.start_money * 2
}
pub(crate) fn should_end(context: &Be... |
use std::borrow::Cow;
use std::io::Write;
use std::mem;
use byteorder::{ByteOrder, WriteBytesExt};
use nom::*;
use errors::{PcapError, Result};
use pcapng::blocks::timestamp::{self, Timestamp};
use pcapng::options::{pad_to, parse_options, Opt, Options};
use pcapng::{Block, BlockType};
use traits::WriteTo;
pub const ... |
pub mod api;
pub mod common;
pub mod connection;
pub mod error;
pub mod http;
pub use connection::*;
|
// Problem 38 - Pandigital multiples
//
// Take the number 192 and multiply it by each of 1, 2, and 3:
//
// 192 × 1 = 192
// 192 × 2 = 384
// 192 × 3 = 576
//
// By concatenating each product we get the 1 to 9 pandigital, 192384576. We will
// call 192384576 the concatenated product of 192 and (1,2,3)
//
/... |
// 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::mem;
/// Gets some associated data.
pub trait Get<T> {
fn get (&self) -> T;
}
impl<T: Clone> Get<T> for T {
fn get (&self) -> T {
... |
//! Hello world server.
//!
//! A simple client that opens a TCP stream, writes "hello world\n", and closes
//! the connection.
//!
//! You can test this out by running:
//!
//! ncat -l 6142
//! nc.exe -l -p 6142 -t -e cmd.exe
//!
//! And then in another terminal run:
//!
//! cargo run --example hello_world... |
// ユーザの記事
pub struct DomainUserArticle {
id: i32,
// 記事タイトル
title: String,
// 記事URL
url: String,
}
impl DomainUserArticle {
pub fn new(id: i32, title: String, url: String) -> DomainUserArticle {
DomainUserArticle {
id,
title,
url,
}
}
... |
// Debug module used to compare my cpu with Nintendulator's log of the nestest rom
#![allow(dead_code)]
use crate::cpu::{AddrMode, Cpu, OPTABLE};
impl<'a> Cpu<'a> {
/// Gets the operand addr without changing the program counter. Used in trace module
fn operand_addr_peek(&mut self, mode: AddrMode, pc: u16) ->... |
fn main() {
// イミュータブルな束縛を作っておく。
let x = 1;
// `&値` で参照がとれる。
let y: &isize = &x;
// ミュータブルな束縛を作っておく。
let mut a = 1;
// `&mut 値`でミュータブルな参照がとれる。値もミュータブルである必要がある。
let b = &mut a;
// `*参照 = 値`で代入できる。これは`&mut`型ならいつでも可能。
*b = 2;
// bの参照先が書き変わっている。aは一定の条件を満たしている(Copyな)ため参照外しができる。
... |
// SPDX-FileCopyrightText: 2020-2021 HH Partners
//
// SPDX-License-Identifier: MIT
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct CreationInfo {
/// https://spdx.github.io/spdx-spec/2-document-creation-infor... |
use std::io::{BufReader, BufRead, Write};
use std::process::{ChildStdin, ChildStdout, Command, Stdio};
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Satisfiability {
Sat,
Unsat,
Unknown,
}
#[derive(Debug)]
pub struct Z3 {
z3_stdin: ChildStdin,
z3_stdout: BufReader<ChildStdout>,
}
impl Z3 ... |
//! This example demonstrates using the [`JsonTable::collapse`] function
//! to greatly improve the readability of a [`JsonTable`].
use json_to_table::json_to_table;
fn main() {
let json = serde_json::json!({
"key1": "value1",
"key2": {
"key1": 123,
"key2": [1, 2, 3, 4, 5],... |
use ::*;
/// Remoes all line segments that can't possibly be part of a cycle.
pub fn prune<P, I, S: 'static>(segments: I, epsilon: f32, only_starts: bool) -> Vec<PathSegment<S>>
where
I: IntoIterator<Item = P>,
P: Into<smallvec::SmallVec<[Point<S>; 2]>>,
{
let mut dual_qt = util::populate(segments, epsilon... |
fn main() {
let i = 3;
{
let borrow1 = &i;
println!("borrow1: {}", borrow1);
}
{
let borrow2 = &i;
println!("borrow2: {}", borrow2);
}
}
|
mod config;
mod model;
mod raft_network;
mod raft_storage;
use std::sync::Arc;
use clap;
use tokio;
use tokio::join;
#[tokio::main]
pub async fn main() {
let matches = clap::App::new("Simple RAFT experiment")
.version("1.1.1.1.1.1.1")
.author("monoid")
.arg(
clap::Arg::with_nam... |
extern crate hllvm;
use hllvm::{ir, target, support};
fn build_module(context: &ir::Context) -> ir::Module {
let mut module = ir::Module::new("mymodule", context);
let int8 = ir::IntegerType::new(8, &context);
let stru = ir::StructType::new(&[&int8.as_ref()], false, context);
let func_ty = ir::Funct... |
use super::keys::*;
use super::trie_node::TrieNode;
use super::{NibbleVec, SubTrie, SubTrieMut, SubTrieResult};
impl<'a, V> SubTrie<'a, V> {
/// Look up the value for the given key, which should be an extension of this subtrie's key.
///
/// The key may be any borrowed form of the trie's key type, but Trie... |
extern crate quick_xml;
use quick_xml::{XmlWriter, Element, Event};
use quick_xml::error::Error as XmlError;
use std::collections::HashMap;
use toxml::ToXml;
/// Types and functions for
/// [iTunes](https://help.apple.com/itc/podcasts_connect/#/itcb54353390) extensions.
pub mod itunes;
/// Types and functions for ... |
use std::sync::Arc;
use chrono::{Duration, FixedOffset, Timelike, Utc};
use eyre::Report;
use image::{png::PngEncoder, ColorType, ImageEncoder};
use plotters::{
prelude::{
AreaSeries, BitMapBackend, ChartBuilder, Circle, EmptyElement, IntoDrawingArea,
IntoSegmentedCoord, PointSeries, Rectangle, Seg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.