text stringlengths 8 4.13M |
|---|
use crate::Segment;
/// An iterator for `Segment`.
///
/// Difference from a normal iterator (this is required for efficient binary construction):
///
/// * It knows exactly the number of bytes of all segments combined.
/// * It can tell whether there's just one single non-empty segment in this iterator.
pub trait S... |
use alloc::arc::Arc;
use core::cell::UnsafeCell;
use disk::ahci::Ahci;
use disk::ide::Ide;
use env::Environment;
use super::config::PciConfig;
use super::common::class::*;
use super::common::subclass::*;
use super::common::programming_interface::*;
use super::common::vendorid::*;
use super::common::deviceid::*;
us... |
#[doc = "Register `MMONR` reader"]
pub type R = crate::R<MMONR_SPEC>;
#[doc = "Field `MISSMON` reader - cache miss monitor counter"]
pub type MISSMON_R = crate::FieldReader<u16>;
impl R {
#[doc = "Bits 0:15 - cache miss monitor counter"]
#[inline(always)]
pub fn missmon(&self) -> MISSMON_R {
MISSMON... |
fn hello()
{
println!("hello there");
println!("i am a x")
}
fn main() {
let x=hello();
x;
x;
}
|
use necsim_core::{
cogs::{Backup, Habitat},
landscape::{IndexedLocation, LandscapeExtent, Location},
};
#[allow(clippy::module_name_repetitions)]
#[cfg_attr(feature = "cuda", derive(rust_cuda::common::RustToCuda))]
#[derive(Debug)]
pub struct AlmostInfiniteHabitat {
extent: LandscapeExtent,
}
impl Default... |
use super::vm_inst::*;
use crate::error::{ParseErrKind, RubyError, RuntimeErrKind};
use crate::parse::node::{BinOp, Node, NodeKind, UnOp};
use crate::*;
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct Codegen {
// Codegen State
//pub class_stack: Vec<IdentId>,
method_stack: Vec<MethodRef>... |
#[macro_use]
extern crate clap;
extern crate git2;
extern crate colored;
use git2::*;
use colored::Colorize;
macro_rules! unwrap_or_exit {
($e:expr) => {
match $e {
Ok(t) => t,
Err(e) => {
eprintln!("{} {}", "error:".red(), e.message());
std::proces... |
extern crate shared_memory;
use shared_memory::SharedMemCast;
pub const LENGTH: usize = 1024;
//#[derive(Debug)]
pub struct RingBuffer {
pub data: [usize; LENGTH],
pub start_idx: usize,
pub end_idx: usize,
}
impl RingBuffer {
pub fn new(data: [usize; LENGTH],
start_idx: usize,
end_... |
//! Error type for tinyexpr crate.
use std::error::Error;
use std::fmt;
use std::result;
use std::num::ParseFloatError;
/// Result type used throughout the crate.
pub type Result<T> = result::Result<T, TinyExprError>;
/// Error type for tinyexpr-rs crate.
#[derive(Debug)]
pub enum TinyExprError {
/// Parse error... |
/*
Copyright (c) 2023 Uber Technologies, Inc.
<p>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
<p>http://www.apache.org/licenses/LICENSE-2.0
<p>Unless required by applicable law or agreed to ... |
use std::fmt::Display;
/// Logging levels according to SysLog
#[derive(Debug)]
pub enum DataDogLogLevel {
/// Emergency level
Emergency,
/// Alert level
Alert,
/// Critical level
Critical,
/// Error level
Error,
/// Warning level
Warning,
/// Notice level
Notice,
///... |
#[derive(Clone, Copy)]
pub struct Memory {
pub ram: [u8; 0x10000],
}
impl Default for Memory {
fn default() -> Self {
Memory { ram: [0; 0x10000] }
}
}
|
use actix::prelude::*;
#[derive(Message)]
#[rtype(result = "()")]
pub struct Info {
pub info:
crate::participants::producer_folder::producer_structs::Info,
}
#[derive(Message)]
#[rtype(result = "()")]
pub struct TurnList {
pub list: Vec<(String, crate::participants::producer_folder::producer_structs::Participant)... |
use approx;
use spatialos_sdk::worker::{entity::Entity, snapshot::*, EntityId};
use std::{collections::BTreeMap, env};
use crate::generated::improbable::*;
#[test]
pub fn writing_invalid_entity_returns_error() {
let snapshot_path = env::temp_dir().join("test2.snapshot");
let entity = Entity::new();
let ... |
extern crate rust_skeleton;
use rust_skeleton::{Server, Props};
#[test]
fn server_start_test() {
Server::serve(Props {
host: "127.0.0.1".to_string(),
port: 1000
});
}
|
#[doc = "Register `OAR1` reader"]
pub type R = crate::R<OAR1_SPEC>;
#[doc = "Register `OAR1` writer"]
pub type W = crate::W<OAR1_SPEC>;
#[doc = "Field `ADD` reader - Interface address"]
pub type ADD_R = crate::FieldReader<u16>;
#[doc = "Field `ADD` writer - Interface address"]
pub type ADD_W<'a, REG, const O: u8> = cra... |
#[macro_use] extern crate clap;
#[macro_use] extern crate failure;
use std::fs;
use std::path::Path;
use clap::{App, Arg};
use failure::Error;
#[derive(Fail, Debug)]
#[fail(display = "path is empty")]
struct PathEmptyError;
fn main() {
if let Err(err) = inner_main() {
eprintln!("{}", err);
}
}
fn inn... |
#[derive(Serialize, Deserialize)]
pub struct Version(pub u32, pub u32, pub u32);
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InitInfo {
pub plugin_name: String,
pub plugin_version: Version,
pub protocol_version: Version,
}
#[derive(Serialize, Deserialize)]
pub struct MessageID(... |
use std::ops;
/// A 2D Point
#[derive(Debug, Hash)]
pub struct Point(i32, i32);
impl std::fmt::Display for Point {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "({}, {})", self.x(), self.y())
}
}
impl Point {
pub fn new(x: i32, y: i32) -> Point {
Point(x,... |
//! CBM DOS directories
use std::fmt;
use std::fmt::Write;
use std::io;
use std::iter;
use crate::disk::block::{Location, Position, PositionedData, BLOCK_SIZE};
use crate::disk::chain::{ChainIterator, ChainSector};
use crate::disk::file::Scheme;
use crate::disk::geos::{GEOSFileStructure, GEOSFileType};
use crate::dis... |
use std::collections::{HashMap, HashSet};
pub fn solve_puzzle_part_1(input: &str) -> String {
let programs: HashMap<usize, HashSet<usize>> = input.lines().map(to_program).collect();
depth_first_search(&programs, 0).len().to_string()
}
pub fn solve_puzzle_part_2(input: &str) -> String {
let programs: Hash... |
#[doc = "Register `CCR` reader"]
pub type R = crate::R<CCR_SPEC>;
#[doc = "Register `CCR` writer"]
pub type W = crate::W<CCR_SPEC>;
#[doc = "Field `INSTRUCTION` reader - Instruction"]
pub type INSTRUCTION_R = crate::FieldReader;
#[doc = "Field `INSTRUCTION` writer - Instruction"]
pub type INSTRUCTION_W<'a, REG, const O... |
use structopt::StructOpt;
/// A blazing fast static files-serving web server powered by Rust Iron
#[derive(Debug, StructOpt)]
pub struct Options {
#[structopt(long, default_value = "my-static-server", env = "SERVER_NAME")]
/// Name for server
pub name: String,
#[structopt(long, default_value = "[::]", ... |
extern crate byteorder;
extern crate rvt;
#[macro_use]
extern crate text_io;
use std::fs::File;
use rvt::common::Voxel;
fn main() {
let mut file_path = "".to_string();
for arg in std::env::args().skip(1) {
file_path = arg;
}
if file_path == "" {
println!("ERROR: MUST INPUT FILENAME");... |
// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
use wasmlib::*;
//@formatter:off
pub struct Bet {
pub amount: i64,
pub better: ScAgentId,
pub number: i64,
}
//@formatter:on
impl Bet {
pub fn from_bytes(bytes: &[u8]) -> Bet {
let mut decode = BytesDecoder::new(bytes);
... |
use crate::libs::color::Pallet;
#[derive(Clone)]
pub struct Pointlight {
position: [f32; 3],
light_intensity: f32,
light_attenation: f32,
color: Pallet,
}
impl Pointlight {
pub fn new(position: [f32; 3]) -> Self {
Self {
position,
light_attenation: 0.1,
... |
#[allow(unreachable_code)]
fn setup_device(cfg_settings:&mut Devicecfg) -> (StatusType) {
let mut input = String::new();
let mut cfg_complete = false;
println!("Setup custom config: s");
println!("Use Default settings: d");
println!("Quit: q");
while !cfg_complete {
match io::stdin().r... |
/*!
```rudra-poc
[target]
crate = "serde-fressian"
version = "0.1.1"
[report]
issue_url = "https://github.com/pkpkpk/serde-fressian/issues/1"
issue_date = 2021-02-24
[[bugs]]
analyzer = "UnsafeDataflow"
bug_class = "Other"
rudra_report_locations = ["src/wasm/mod.rs:72:1: 81:2"]
```
!*/
#![forbid(unsafe_code)]
use se... |
pub mod game;
mod play; |
extern crate reqwest;
extern crate scraper;
use std::io::Read;
use scraper::{Html, Selector};
fn main() {
let mut resp = reqwest::get("http://sprichwort.gener.at/or/").unwrap();
assert!(resp.status().is_success());
let mut content = String::new();
resp.read_to_string(&mut content).unwrap();
for s... |
use actix_web::{get, Responder, web};
use log::{debug, trace};
use libdriver::api::AsyncSensor;
use crate::app;
use crate::app::map_rover_result_to_response;
pub fn config(cfg: &mut web::ServiceConfig) {
cfg.service(get_obstacles)
.service(get_lines)
.service(get_distance);
}
#[get("/obstacles")... |
use crate::keyboard::*;
use crate::property_editor::*;
use crate::tools::*;
use drg::asset::property::prop_type::*;
use drg::asset::*;
use imgui::*;
use std::path::Path;
pub struct EditableImport {
pub class_package: ImString,
pub class: ImString,
pub name: ImString,
pub outer: Reference,
}
impl Default for E... |
use std::path::Path;
use std::fs::File;
use std::io::Read;
use std::collections::HashSet;
#[derive(Debug)]
struct Prog {
name: String,
weight: u32,
child_names: Vec<String>,
}
#[derive(Debug)]
struct SumWeight {
name: String,
child_weight: u32,
weight: u32,
}
impl SumWeight {
fn get_tota... |
use std::{
fs::{create_dir, read_dir, remove_file},
path::{Path, PathBuf},
};
use anyhow::{Context, Result};
use futures::AsyncWriteExt;
use lazy_static::lazy_static;
use mongodb::{bson::oid::ObjectId, gridfs::GridFsBucket, Client};
use crate::{
bench::{drop_database, Benchmark, DATABASE_NAME},
fs::{o... |
use rustzx_core::{
zx::{machine::ZXMachine, sound::ay::ZXAYMode},
EmulationMode, RustzxSettings,
};
use std::path::PathBuf;
use structopt::StructOpt;
use strum::{EnumString, EnumVariantNames, VariantNames};
#[cfg(feature = "sound-cpal")]
const DEFAULT_SOUND_BACKEND_VALUE: &str = "cpal";
#[cfg(not(feature = "s... |
#[cfg(test)]
#[macro_use] extern crate quickcheck;
const DEFAULT_BLOCK_RESTART_INTERVAL: usize = 16;
const DEFAULT_BLOCK_SIZE: u64 = 8192;
const MIN_BLOCK_SIZE: u64 = 1024;
const DEFAULT_COMPRESSION_LEVEL: u32 = 0;
const DEFAULT_COMPRESSION_TYPE: CompressionType = CompressionType::None;
const DEFAULT_NB_CHUNKS: usiz... |
use super::*;
use std::collections::VecDeque;
#[derive(Debug)]
pub struct Path {
history: VecDeque<Point>,
}
const HISTORY_SIZE: usize = 5;
impl Path {
pub fn new() -> Path {
Path {
history: VecDeque::with_capacity(HISTORY_SIZE),
}
}
pub fn push(&mut self, p: &Point) {
... |
use crate::vec3::Vec3;
use crate::material::_Material;
use crate::ray::Ray;
use crate::hitable::HitRecord;
use crate::hitable::sphere::random_point_in_unit_sphere;
#[derive(Debug, Copy, Clone)]
pub struct Lambertian {
pub albedo: Vec3
}
impl _Material for Lambertian {
fn scatter(&self, _ray_in: &Ray, hit: &Hi... |
use crate::sidebar::make_section;
use crate::{
gui::{BuildContext, Ui, UiMessage, UiNode},
scene::commands::{light::SetPointLightRadiusCommand, SceneCommand},
send_sync_message,
sidebar::{make_f32_input_field, make_text_mark, COLUMN_WIDTH, ROW_HEIGHT},
Message,
};
use rg3d::{
core::pool::Handle,... |
use std;
use thiserror::Error;
use crate::model::ErrorMessage;
use crate::persistence::Error as PersistenceError;
use crate::reject::get_internal_error_message;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug)]
pub enum Error {
#[error("{source}")]
Persistence {
#[from]
... |
#[cfg(test)]
mod test;
use std::{collections::HashMap, fmt, ops::Deref, sync::Arc, time::Duration};
use rand::{rngs::SmallRng, seq::SliceRandom, SeedableRng};
use super::TopologyDescription;
use crate::{
error::{ErrorKind, Result},
options::ServerAddress,
sdam::{
description::{
server... |
use crate::common::types::{
BroadcastMessage,
Register
};
use warp::Filter;
pub fn json_body() -> impl Filter<Extract = (BroadcastMessage,), Error = warp::Rejection> + Clone {
warp::body::content_length_limit(1024 * 16).and(warp::body::json())
}
pub fn json_body_register() -> impl Filter<Extract = (Regist... |
fn main() {
// Generate lorem ipsum text with Title Case.
let title = lipsum::lipsum_title();
// Print underlined title and lorem ipsum text.
println!("{}\n{}\n", title, str::repeat("=", title.len()));
// First command line argument or "" if not supplied.
let arg = std::env::args().nth(1).unwra... |
#[macro_use]
mod compiletest;
#[rustversion::attr(not(nightly), ignore)]
#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/*.rs");
}
assert_no_panic! {
mod test_readme {
#[no_panic]
fn demo(s: &str) -> &str {
&s[1..]
}
fn main() {
... |
use core::sync::atomic::AtomicBool;
pub static PANICKED: AtomicBool = AtomicBool::new(false);
#[alloc_error_handler]
fn alloc_error_handler(layout: core::alloc::Layout) -> ! {
panic!("alloc error: layout={:?}", layout);
}
/// This function is called on panic.
#[panic_handler]
#[cfg(not(test))]
fn panic(info: &co... |
use std::borrow::Cow;
use std::cmp::{max, min};
use std::prelude::v1::*;
use regex::{Captures, Regex};
use tuikit::prelude::*;
use unicode_width::UnicodeWidthChar;
use crate::field::get_string_by_range;
use crate::AnsiString;
use bitflags::_core::str::FromStr;
lazy_static! {
static ref RE_ESCAPE: Regex = Regex::... |
#[macro_use]
extern crate log;
extern crate futures;
extern crate lapin_futures as lapin;
extern crate tokio;
use futures::future::Future;
use futures::Stream;
use lapin::channel::{BasicProperties, BasicPublishOptions, QueueDeclareOptions};
use lapin::client::ConnectionOptions;
use lapin::types::FieldTable;
use tokio:... |
use bencher::{benchmark_group, benchmark_main, Bencher};
use paillier::*;
mod helpers;
use helpers::*;
pub fn bench_encryption_ek<KS: KeySize>(b: &mut Bencher) {
let keypair = KS::keypair();
let ek = EncryptionKey::from(&keypair);
b.iter(|| {
let _ = Paillier::encrypt(&ek, 10);
});
}
pub fn... |
use super::types::*;
use arbitrary::Arbitrary;
use std::collections::HashMap;
#[derive(Debug, Clone, PartialEq, Arbitrary)]
pub struct Vocabulary<IndexT: ToFromUsize> {
pub map: HashMap<String, IndexT>,
pub reverse_map: Vec<String>,
pub numeric_ids: bool,
}
impl<IndexT: ToFromUsize> Vocabulary<IndexT> {
... |
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*/
fn main() {
println!("cargo:rerun-if-changed=distance.c");
if cfg!(target_os = "macos") {
std::env::set_var("CFLAGS", "-mavx2 -mfma -Wno-error -MP -O2 -D NDEBUG -D MKL_ILP64 -D USE_AVX2 -D USE_ACCELERA... |
use kagura::prelude::*;
pub fn right_bottom(is_showing: bool, btn: Html, content: Html) -> Html {
Html::span(
Attributes::new()
.class("dropdown")
.class("dropdown-rb")
.class(format!("dropdown-{}", is_showing)),
Events::new(),
vec![btn, content],
)
}... |
struct Solution {}
impl Solution {
pub fn find_median_sorted_arrays(nums1: Vec<i32>, nums2: Vec<i32>) -> f64 {
let total_len = nums1.len() + nums2.len();
let mut N = total_len/2+1;
//total_len = if total_len == 2 { 4 } else { total_len };
//println!("{}", total_len);
let mut... |
// Copyright 2020 The MWC 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 agreed... |
pub mod palindromic_substrings;
pub mod minimum_path_sum;
pub mod unique_paths_ii; |
use hyper::{Client, Url, Error};
use hyper::status::StatusCode;
use sources::{Source, SourceError};
use ::{Package, PackageInfo};
use serde_json;
pub struct GithubSource {
package: Package,
account: String,
repository: String
}
impl GithubSource {
pub fn new(package: Package) -> GithubSource {
... |
extern crate repsheet_etl;
use std::fs::File;
use std::io::prelude::*;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Vacant, Occupied};
use std::hash;
use repsheet_etl::method::Method;
use repsheet_etl::actor::Actor;
use repsheet_etl::address::Address;
use std::time::Instant;
use std::borrow::B... |
// This file is part of Substrate.
// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the F... |
//! Crate documentation
/// Print hello world to the screen
/// # Title
pub fn print_hello(){
println!("Hello World!");
}
/// Return sum of input
///
/// # Examples
/// ```
/// let z = rustyplayground::add(1, 2);
///
/// assert_eq!(3, z)
/// ```
pub fn add(x: isize, y: isize) -> isize {
x + y
}
pub mod new... |
use crate::{get, CycleError, Graph};
use std::collections::{BTreeMap, BTreeSet};
fn check(graph: Graph<u32>, order: &[u32]) {
assert_eq!(get(&graph).unwrap(), order);
}
fn check_cycle(graph: Graph<u32>) {
let err = get(&graph).unwrap_err();
assert!(matches!(err, CycleError(_)));
}
#[test]
fn empty() {
check(... |
fn main() {
println!("Hello, world free drive!");
}
|
mod casting;
mod literals;
mod inference;
mod aliasing;
fn main() {
casting::main();
literals::main();
inference::main();
aliasing::main();
} |
pub mod nightlies;
pub mod releases;
|
use std::collections::HashMap;
use std::sync::Arc;
use futures::{future::poll_fn, pin_mut, select, FutureExt, SinkExt, StreamExt};
use tokio::sync::oneshot;
use crate::{
client::{ClientState, ClientTaskTracker, RouterCapabilities},
pollable::PollableValue,
proto::{msg_code, rx::RxMessage, TxMessage},
... |
use crate::{
layout::LayoutTag,
models::{
monitor::Monitor, rect::*, screen::*, windowwrapper::*, workspace::*, HandleState,
WindowState,
},
state::State,
xlibwrapper::xlibmodels::*,
};
pub fn window_inside_screen(w_geom: &Geometry, screen: &Screen) -> bool {
let inside_width = ... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use crate::{DealID, Randomness, RegisteredProof, SectorID, SectorNumber};
use cid::Cid;
use clock::ChainEpoch;
pub type SealRandomness = Randomness;
pub type InteractiveSealRandomness = Randomness;
/// Information needed to verify a seal... |
//! Implements the Feather command dispatching framework,
//! based on our `lieutenant` library (a Rust fork
//! of Mojang's [brigadier](https://github.com/Mojang/brigadier).
//!
//! Also implements vanilla commands not defined by plugins.
mod arguments;
mod impls;
use feather_core::text::{Text, TextComponentBuilder}... |
use core::fmt;
use core::fmt::{Debug, Display, Formatter};
use core::result::Result;
use core::result::Result::{Err, Ok};
use std::error::Error;
use std::ops::Index;
use matrix::format::conventional::Conventional;
use crate::coordinate::Coordinate;
use crate::game_board::Color;
use crate::ruleset::board_type::space::... |
use std::env;
use std::io::{self, Result, Write};
use std::process::Command;
fn main() -> Result<()> {
let output = Command::new("cargo")
.args(&["build"])
.env("RUSTFLAGS", "-D warnings")
.output()?;
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.st... |
use super::num::Integer;
use std::ops::Sub;
use std::marker::Sized;
use std::fmt::Debug;
///Trait that checks if two integers are coprime
pub trait IsCoprime {
fn is_coprime(&self, other:&Self) -> bool;
}
///Trait that implemends the extended euclidean algorithm
pub trait ExtGcd {
fn extended_gcd(&self, ... |
mod submod1;
mod submod2;
use submod1::*;
use submod2::*;
pub fn test_simpl_fails() -> Res {
match ResTyp::Ok((42, 42)) {
ResTyp::Ok(res) => res,
}
}
pub fn test_tuple_destructuring() {
let tuple = MyTupleType(1u16, 2u8).clone();
let MyTupleType(_a, _b) = tuple;
}
#[cfg(test)]
mod tests {
... |
use bigdecimal::BigDecimal;
use chrono::{NaiveDateTime, Utc};
use octo_budget_lib::auth_token::UserId;
use crate::apps::forms::record::FormData;
use crate::db::{models::Record, DatabaseQuery, PooledConnection};
use crate::errors::DbResult;
pub struct CreateRecord {
amount: BigDecimal,
amount_currency: String,... |
use bytes::{Buf, BufMut, Bytes, BytesMut};
use crate::error::RSocketError;
use crate::utils::Writeable;
mod cancel;
mod error;
mod keepalive;
mod lease;
mod metadata_push;
mod payload;
mod request_channel;
mod request_fnf;
mod request_n;
mod request_response;
mod request_stream;
mod resume;
mod resume_ok;
mod setup;
... |
use std::raw::Slice;
use std::mem::{transmute, size_of};
use std::num::Int;
use std::num::ToPrimitive;
/// Splice together to slices of the same type that are contiguous in memory.
/// Panics if the slices aren't contiguous with "a" coming first.
/// Also panics in some improbable cases of arrays so large they overflo... |
use super::board::Board;
use super::player::Player;
use std::fmt;
#[derive(Clone, Debug)]
pub enum MovementType {
/// The null movement, yields by itself ∅
Stay,
/// Describes a piece's movements based on any orthogonal basis.
/// `Undirected(a, b)` is equivalent to moving `a` squares in any direction ... |
use std::error;
use std::fmt;
use std::io;
use std::convert;
const USAGE: &str = "USAGE: boggle dictionary board";
#[derive(Debug)]
pub enum Error {
Usage,
Io(io::Error),
BoardSize(&'static str),
}
impl convert::From<io::Error> for Error {
fn from(err: io::Error) -> Self {
Error::Io(err)
... |
use proc_macro2::Span;
use syn::spanned::Spanned;
use syn::{Attribute, Lit, LitStr, Meta, NestedMeta};
#[cfg(feature = "proc_macro_diagnostics")]
macro_rules! if_proc_macro_diagnostics {
($($x:tt)*) => { $($x)* };
}
#[cfg(not(feature = "proc_macro_diagnostics"))]
macro_rules! if_proc_macro_diagnostics {
($($x:... |
pub struct PermuteIter<T> {
elems: Vec<T>,
items_left: usize,
indices: Option<Vec<usize>>,
}
impl<T: Clone> PermuteIter<T> {
pub fn new(elems: Vec<T>) -> Self {
let items_left = Self::permutation_count(&elems);
PermuteIter { elems, items_left, indices: None }
}
fn permutation_count(elems: &Vec<T>) -> usize ... |
use hacspec_lib::*;
use tls_cryptolib::*;
#[test]
fn sign_verify() {
let payload = ByteSeq::from_public_slice("This is the message to be signed".as_bytes());
let entropy =
ByteSeq::from_hex("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef");
let (sk, pk) = kem_keygen(&NamedGroup::S... |
use dancing_links::{
latin_square::{self},
sudoku::{self, Sudoku},
ExactCover,
};
/// Generate a Sudoku puzzle from an input string.
///
/// # Expected Format
/// - 0 denotes an empty value
/// - The numbers are presented in row-major order. So the first `side_length`
/// numbers are the first row, th... |
use crate::bba_init_proof;
use crate::bba_open_proof;
use crate::bba_update_proof;
use crate::endo::EndoScalar;
use crate::fft::lagrange_commitments;
use crate::proof_system;
use crate::schnorr;
use algebra::{AffineCurve, PrimeField, ProjectiveCurve, UniformRand, VariableBaseMSM, Zero};
use array_init::array_init;
use ... |
#[doc = "Register `APB1HRSTR` reader"]
pub type R = crate::R<APB1HRSTR_SPEC>;
#[doc = "Register `APB1HRSTR` writer"]
pub type W = crate::W<APB1HRSTR_SPEC>;
#[doc = "Field `CRSRST` reader - Clock Recovery System reset"]
pub type CRSRST_R = crate::BitReader<CRSRST_A>;
#[doc = "Clock Recovery System reset\n\nValue on rese... |
use once_cell::sync::Lazy;
use serenity::model::prelude::{ChannelId, GuildId, Member};
use serenity::prelude::Context;
use crate::core::consts::OWNER_ID;
pub static GREETINGS: Lazy<Greetings> = Lazy::new(|| Greetings::new());
#[derive(Debug, Default)]
pub struct Greetings {
messages: Vec<String>,
weights: Ve... |
use lazy_static::lazy_static;
use primitives::Primitive;
use smallvec::SmallVec;
use smol_str::SmolStr;
use std::collections::HashMap;
pub mod eqmap;
pub mod primitives;
pub mod distribution;
use serde::{Serialize, Deserialize};
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub enum Relation {
Eq,
Neq... |
use crate::models::player::{Player, PlayerState};
use bevy::prelude::*;
pub struct GravityLevel(pub f32);
pub fn init(
mut player_positions: Query<&mut Transform, With<Player>>,
player_state: ResMut<PlayerState>,
level: Res<GravityLevel>,
) {
if player_state.jumping || player_state.grounded || player_... |
use std::cmp::Ordering;
use std::fmt::Display;
use std::mem::{replace, swap};
use std::ptr;
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
enum Color {
Red,
Black,
}
enum Direction {
Left,
Right,
}
#[derive(Debug)]
struct Node<K, V> {
key: K,
value: V,
left: *mut Node<K, V>,
right: *mut... |
pub use super::super::db::test;
pub fn hello() -> String {
test::testone()
}
|
use ethane::rpc::{Rpc, SubscriptionRequest};
use ethane::{Connection, ConnectionError, Http, Request, Subscribe, Subscription, WebSocket};
use regex::{Regex, RegexBuilder};
use serde::de::DeserializeOwned;
use std::fmt::Debug;
use std::io::{BufRead, BufReader};
use std::process::{Child, Command};
#[cfg(target_family =... |
#[doc = "Register `DDRPERFM_TCNT` reader"]
pub type R = crate::R<DDRPERFM_TCNT_SPEC>;
#[doc = "Field `CNT` reader - CNT"]
pub type CNT_R = crate::FieldReader<u32>;
impl R {
#[doc = "Bits 0:31 - CNT"]
#[inline(always)]
pub fn cnt(&self) -> CNT_R {
CNT_R::new(self.bits)
}
}
#[doc = "DDRPERFM time ... |
#![recursion_limit = "1024"]
use std::convert::TryInto;
use egg::{EClass, Id, Pattern, RecExpr, SearchMatches, Searcher};
use wasm_bindgen::prelude::*;
use yew::{prelude::*, services::ConsoleService};
mod math;
use math::*;
type Extractor<'a> = egg::Extractor<'a, MathCostFn, Math, ConstantFold>;
struct Queried {
... |
use std::{rc::Rc, str::FromStr};
use super::{Expr, Environment, DType, dtype::Msg, core_lib::*, TypeCheck, decl::Decl};
use crate::{expr::compiler::fill_slice_with_vec, token::{Token, TokenType, literal::Literal}};
pub trait Interpret {
fn interpret(&mut self, env: &mut Environment) -> Option<(Vec<u8>, DType)>;
... |
#[doc = "Register `HASH_HR0` reader"]
pub type R = crate::R<HASH_HR0_SPEC>;
#[doc = "Field `H0` reader - H0"]
pub type H0_R = crate::FieldReader<u32>;
impl R {
#[doc = "Bits 0:31 - H0"]
#[inline(always)]
pub fn h0(&self) -> H0_R {
H0_R::new(self.bits)
}
}
#[doc = "HASH digest register 0\n\nYou c... |
mod builder;
mod envelop;
pub mod error;
mod handler;
mod receiver;
pub mod receivers;
mod relay;
mod stats;
mod trait_object;
pub mod type_tag;
pub mod __reexport {
pub use ctor;
pub use serde;
}
#[macro_use]
extern crate log;
pub mod derive {
pub use messagebus_derive::*;
}
// privavte
use core::{
... |
use aspotify::{Client, ClientCredentials};
#[tokio::main]
async fn main() {
// Read the client credentials from the .env file
dotenv::dotenv().unwrap();
// Make the Spotify client using client credentials flow
let client = Client::new(ClientCredentials::from_env().unwrap());
// Call the Spotify A... |
pub use models::*;
pub use routes::init;
mod routes;
mod models;
|
use crate::util::constants;
#[cfg(debug_assertions)]
use crate::util::constants::BYTES_IN_WORD;
use crate::util::conversions;
use crate::util::heap::layout::vm_layout_constants::BYTES_IN_CHUNK;
use crate::util::side_metadata::address_to_meta_address;
use crate::util::side_metadata::load_atomic;
use crate::util::side_me... |
use actix_cors::Cors;
use actix_web::{web, App, HttpServer};
use dotenv;
extern crate paseto;
extern crate rand;
mod controllers;
pub mod file_handling;
pub mod token;
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
// validate_token("v2.public.eyJlbWFpbCI6ImV4YW1wbGVAZ21haWwuY29tIiwiZXhwIjoiMjAyMC0wN... |
use rltk::{ Rltk,
GameState,
RGB };
use specs::prelude::*;
mod components;
pub use components::*;
mod map;
pub use map::*;
mod player;
pub use player::*;
mod rect;
pub use rect::*;
pub struct State{
ecs: World
}
impl GameState for State {
fn tick(&mut self, ctx: &mut Rltk) {
c... |
#![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 KqlScriptsResourceCollectionResponse {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub value: ... |
use std::collections::HashMap;
mod terminal;
use crate::terminal::hr::{hr_term, TermialInput};
use crate::terminal::departments::Department;
use crate::terminal::personal::Person;
fn main() {
println!("Welcome to Rust HR Terminal!");
println!("");
let mut departments: HashMap<String, Department> = HashM... |
/*! Hex dump utility.
Format the contents of a byte slice as a classic hex dump.
```
use hexdump::hexdump;
const BYTES: &'static [u8] = b"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF";
assert_eq!(format!("{}", hexdump(BYTES, 32)),
"00000020: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF |.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.