blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
140
path
stringlengths
5
183
src_encoding
stringclasses
6 values
length_bytes
int64
12
5.32M
score
float64
2.52
4.94
int_score
int64
3
5
detected_licenses
listlengths
0
47
license_type
stringclasses
2 values
text
stringlengths
12
5.32M
download_success
bool
1 class
b4a8e65bed45d75dd4f384ed9a7bf50782be4a19
Rust
ashleysmithgpu/rust_vulkan_api_generator
/vkraw/tests/device.rs
UTF-8
6,871
3
3
[]
no_license
#[cfg(test)] mod tests { use std::ptr; use std::vec; use std; /* enum VulkanParameter { ApplicationInfo { next: Option<VulkanParameter>, application_name: str, application_version: u32, engine_name: str, engine_version: u32, api_version: u32 }, InstanceCreateInfo { next: Option<VulkanParameter>, flags: u32, appl...
true
beaefd3bbf0b10c92ada4d1b0f3bd5eecdc001a9
Rust
vmx/rust-ipld
/dag-cbor/tests/lib.rs
UTF-8
1,025
2.828125
3
[ "MIT", "Apache-2.0" ]
permissive
use std::collections::BTreeMap; use ipld_core::Ipld; use ipld_dag_cbor; #[test] fn encode_struct() { // Create a contact object that looks like: // Contact { name: "Hello World", details: CID } let mut map = BTreeMap::new(); map.insert("name".to_string(), Ipld::String("Hello World!".to_string())); ...
true
6b8de65a412ad43e0463c43375ba5770aa7337d8
Rust
jakmeier/paddlers-browser-game
/paddlers-game-master/src/setup/map_generation/village_creation.rs
UTF-8
5,092
2.921875
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! For generating villages on the map use crate::db::DB; use crate::setup::map_generation::Lcg; use paddlers_shared_lib::game_mechanics::map::*; use paddlers_shared_lib::prelude::*; impl DB { pub fn add_village(&self, pid: PlayerKey) -> Result<Village, &'static str> { // Find unsaturated stream l...
true
6891f2913e2a6c8eaf888d6de93e2649e591654a
Rust
zachross015/mixal
/src/word.rs
UTF-8
2,091
3.28125
3
[]
no_license
use std::fmt; use crate::instruction_functions::adjusted_field_specification; #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct Word { pub positive: bool, pub bytes: [u8; 5], } impl Word { pub fn new(positive: bool, b: [u8; 5]) -> Word { Word { positive: positive, ...
true
c4b74e450464974c68c2103b594ed943e8b16ca7
Rust
irbis-labs/rsmorphy
/src/container/hyphen.rs
UTF-8
404
3.015625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord)] pub struct HyphenSeparatedParticle { pub particle: String, } impl HyphenSeparatedParticle { pub fn new<P>(particle: P) -> Self where P: Into<String>, { let particle = particle.into(); HyphenSeparatedParticle { particle } ...
true
ad472ebdc443a19156d2cc74d691a6f0bf84a325
Rust
adamgreig/stm32ral
/src/stm32f3/stm32f3x4/rcc.rs
UTF-8
63,340
2.640625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
#![allow(non_snake_case, non_upper_case_globals)] #![allow(non_camel_case_types)] //! Reset and clock control use crate::RWRegister; #[cfg(not(feature = "nosync"))] use core::marker::PhantomData; /// Clock control register pub mod CR { /// Internal High Speed clock enable pub mod HSION { /// Offset (...
true
0729666d5e6cfff61079832cf4046e7a895218c3
Rust
TheDan64/limonite
/src/syntax/items.rs
UTF-8
1,037
2.796875
3
[ "Apache-2.0" ]
permissive
use crate::span::Spanned; use crate::syntax::{Block, Type}; pub type Item<'s> = Spanned<ItemKind<'s>>; // TODO: Better place for this #[derive(Clone, Debug, PartialEq)] pub struct FnSig<'s> { params: Vec<(Spanned<&'s str>, Type<'s>)>, ret: Option<Type<'s>>, } impl<'s> FnSig<'s> { pub fn new(params: Vec<(...
true
2e87120659efedc04eb25b27effdb8483f438133
Rust
M3kH/dgc
/dgc-cli/src/main.rs
UTF-8
3,810
2.84375
3
[]
no_license
use clap::{App, Arg}; use dgc_lib::dgc; use serde_json::Value; use std::io::{self, Read, Write}; fn main() { let matches = App::new("dgc") .version("1.0") .author("Mauro Mandracchia <mauromandracchia@gmail.com>") .about("Encode and Decode for Digital Green Certificate") .subcommand(...
true
0a65860505d2af6a2019bea46c839b53c27a6e48
Rust
innoave/genevo
/src/population/mod.rs
UTF-8
12,687
3.640625
4
[ "Apache-2.0", "MIT" ]
permissive
//! The `population` module defines the `Population` struct and the //! `PopulationBuilder` for building random populations. //! //! To use the `PopulationBuilder` for building `Population`s of a custom //! `genetic::Genotype` an implementation of the `GenomeBuilder` must be //! provided. A `GenomeBuilder` can build ne...
true
893492d2e7c7fa91ed4967264d1aeb4eea982162
Rust
lyfzero/OS-learning
/rust_learning/variables/src/main.rs
UTF-8
1,267
3.734375
4
[]
no_license
fn main() { // 设置可变 let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); // 常量 const MAX_POINTS: u32 = 100_000; println!("The value of MAX_POINTS is: {}", MAX_POINTS); // 隐藏 let x = 5; let x = x + 1; let x = x * 2; pr...
true
e737aa8fe679f172b3db8f7ccc5898200daa4d6e
Rust
jackthecodemonkey/simple-bank-console-app
/src/models/commands.rs
UTF-8
967
3.078125
3
[]
no_license
use super::super::traits::ValidateCommands::ValidateCommands; #[derive(Debug)] pub struct commands { pub arguments: Vec<String>, } impl commands { pub fn new(commands: Vec<String>) -> Self { commands { arguments: commands, } } } #[derive(Debug)] pub struct ValidCommands { ...
true
dc5a58b6d4496d814a32a3fa2a6e9569c5486bef
Rust
enso-org/enso
/app/gui/controller/engine-protocol/src/binary/client.rs
UTF-8
13,583
2.8125
3
[ "AGPL-3.0-only", "Apache-2.0", "AGPL-3.0-or-later" ]
permissive
//! Module defines LS binary protocol client `API` and its two implementation: `Client` and //! `MockClient`. use crate::prelude::*; use crate::binary::message::ErrorPayload; use crate::binary::message::FromServerPayloadOwned; use crate::binary::message::MessageFromServerOwned; use crate::binary::message::MessageToSe...
true
736a986347d82def44bcea5c2d01612734737d30
Rust
pchickey/cap-std
/cap-primitives/src/posish/darwin/fs/file_path.rs
UTF-8
841
2.703125
3
[ "MIT", "LLVM-exception", "Apache-2.0" ]
permissive
//! `get_path` translation code for macOS derived from Rust's //! library/std/src/sys/unix/fs.rs at revision //! 108e90ca78f052c0c1c49c42a22c85620be19712. use posish::fs::getpath; use std::{fs, os::unix::ffi::OsStringExt, path::PathBuf}; pub(crate) fn file_path(file: &fs::File) -> Option<PathBuf> { // The use of ...
true
3551578bb7ea364d6f8330194f50e6b9f3a27975
Rust
jlb6740/wasmtime
/crates/wiggle/generate/src/codegen_settings.rs
UTF-8
3,366
2.59375
3
[ "LLVM-exception", "Apache-2.0" ]
permissive
use crate::config::{AsyncConf, ErrorConf}; use anyhow::{anyhow, Error}; use proc_macro2::TokenStream; use quote::quote; use std::collections::HashMap; use std::rc::Rc; use witx::{Document, Id, InterfaceFunc, Module, NamedType, TypeRef}; pub use crate::config::Asyncness; pub struct CodegenSettings { pub errors: Er...
true
962b62e18c6f74c5408807a479043b8470ef055a
Rust
Celeo/bless_you_bot
/src/main.rs
UTF-8
5,270
2.78125
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use log::{debug, error, info}; use once_cell::sync::Lazy; use regex::Regex; use serenity::{ model::{channel::Message, gateway::Ready}, prelude::*, }; use std::{env, path::Path, process}; const WORDS_FILE_RAW: &str = include_str!(concat!(env!("OUT_DIR"), "/words_alpha.txt")); const MINIMUM_MESSAGE_LENGTH: usize...
true
a5a0784bb84e70d3b7cc8ef1300b3f184210a305
Rust
scotow/minecrust
/src/fsm.rs
UTF-8
3,238
3.015625
3
[]
no_license
use crate::packets::{Handshake, LoginRequest, Packet, Ping, StatusRequest}; use crate::types::{Receive, ServerDescription, TAsyncRead, TAsyncWrite}; use anyhow::Result; use futures::prelude::*; pub struct Fsm<'a> { server_description: &'a ServerDescription, state: State, reader: &'a mut dyn TAsyncRead, ...
true
936e045a921eb1892570e35aca73571f445cc789
Rust
skgbanga/AOC
/2017/1/pro.rs
UTF-8
1,280
3.125
3
[]
no_license
use std::{ convert::TryInto, fs::File, io::{BufRead, BufReader}, }; fn part1(line: &str) -> i32 { // python code: // // s = sum(int(a) for a, b in zip(line, line[1:] + [line[0]]) if a == b) line.chars() .zip(line.chars().cycle().skip(1)) .fold(0, |acc, (a, b)| { ...
true
3c7abbeafa93b97e06f4497763e36d702b6d4544
Rust
garrettkoontz/aoc-2019-rust
/src/aoc/day1.rs
UTF-8
888
3.125
3
[]
no_license
use crate::utils; const FILE_NAME: &str = "day1.txt"; pub fn part1(path: &str) -> i32 { let file_path = &format!("./{}/{}", path, FILE_NAME); let inputs = utils::read_file(file_path); inputs .into_iter() .map(|x| fuel_required(x.parse::<i32>().unwrap())) .fold(0, |acc, x| acc + x) ...
true
19eaabb82d65367c7da160a0a482e51b51ab0436
Rust
elertan/amino_api
/src/api/v1/community/s/user_profile/fetch_list/fetch_recent.rs
UTF-8
3,002
3.015625
3
[]
no_license
use crate::api::v1::api_instance::ApiInstance; use crate::api::v1::models::api_response::ApiResponse; use crate::api::v1::community::community::Community; use chrono::{Utc, DateTime}; use crate::api::v1::models::user::User; #[derive(Debug, Clone)] pub struct FetchRecentParams { pub start: Option<u32>, pub size...
true
ab4d5a650a5423408025e457f20d4039729264d5
Rust
foundpatterns/scl
/parser/tests/invalid.rs
UTF-8
1,556
2.875
3
[]
no_license
extern crate scl; use scl::{parse_file, Error}; fn assert_error_msg(filename: &str, needle: &str) { let res = parse_file(&format!("./tests/invalid/{}.scl", filename)); assert!(res.is_err()); let err = res.unwrap_err(); match err { Error::InvalidSyntax(msg) => { println!("{}", msg);...
true
61f10607f6d2fc71ff92d31b41883914c922022b
Rust
ICGNYN/RustLearning
/勉強/ownership/3.rs
UTF-8
295
3.125
3
[]
no_license
fn main(){ let a: [i32; 5] = [0,1,2,3,4]; let b: [i32; 5] = a; println!("{:?}",a); println!("{:?}",b); let mut c = Vec::new(); c.push(1); //let d: Vec<i16> = vec![0,0,0]; let d = vec![0; 10]; println!("{:?}",d ); let e = 5.0/3.0; println!("{}",e); }
true
c99ae123a3d4fec734c2702d4b31e49b4cd7eb2b
Rust
koaji/Rust-learning
/rust-doc/first_loop/src/main.rs
UTF-8
325
3.484375
3
[]
no_license
fn main() { /* 無限ループ loop { println!("Loop !!") }*/ let mut x = 5; let mut done = false; while !done { x += x - 3; println!("{}", x); if x % 5 == 0 { done = true; } } for x in 0..10 { println!("{}", x); } }
true
f504a51fce6543be22e55c275a32d7d2af4dcdaa
Rust
UnicodingUnicorn/buckets
/src/main.rs
UTF-8
778
2.640625
3
[]
no_license
use actix_web::{ get, App, HttpResponse, HttpServer, Responder }; use actix_web::web::Data; use handlebars::Handlebars; use std::collections::BTreeMap; use std::sync::Arc; #[actix_web::main] async fn main() -> std::io::Result<()> { let mut handlebars = Handlebars::new(); handlebars.register_template_file("main...
true
8f1313e45515a95fc132681eed3fa0e8123aacc9
Rust
KodrAus/elastic-responses
/src/get.rs
UTF-8
1,524
2.625
3
[ "Apache-2.0", "MIT" ]
permissive
use serde::de::DeserializeOwned; use serde_json::Value; use parsing::{IsOk, HttpResponseHead, ResponseBody, Unbuffered, MaybeOkResponse}; use error::*; /// Response for a [get document request](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html). #[derive(Deserialize, Debug)] pub struct Get...
true
5cb8fbbf1feca84c6cbebe1ea63648db06d7f1ca
Rust
Mic92/cntr
/src/files.rs
UTF-8
1,202
3.140625
3
[ "MIT" ]
permissive
use nix::fcntl::OFlag; use std::fs::create_dir_all; use std::fs::File; use std::io; use std::os::unix::prelude::*; use std::path::Path; #[derive(PartialOrd, Eq, PartialEq)] pub enum FdState { None, Readable, ReadWritable, } pub fn fd_path(fd: &Fd) -> String { format!("/proc/self/fd/{}", fd.raw()) } p...
true
ad03a8c5af83ce39f8f42d2b070a00802518f614
Rust
bouzuya/rust-atcoder
/cargo-atcoder/contests/arc119/src/bin/c.rs
UTF-8
658
2.703125
3
[]
no_license
use std::collections::HashMap; use proconio::input; fn main() { input! { n: usize, a: [i64; n], }; let b = a .into_iter() .enumerate() .map(|(i, a_i)| a_i * if i % 2 == 0 { 1 } else { -1 }) .collect::<Vec<i64>>(); let c = std::iter::once(0) .cha...
true
c57101f3d1185a6f03a445aa79d7c409e273f738
Rust
pola-rs/polars
/crates/polars-row/src/lib.rs
UTF-8
13,846
3.5
4
[ "MIT" ]
permissive
//! Row format as defined in `arrow-rs`. //! This currently partially implements that format only for needed types. //! For completeness sake the format as defined by `arrow-rs` is as followed: //! Converts [`ArrayRef`] columns into a [row-oriented](self) format. //! //! ## Overview //! //! The row format is a variable...
true
a9c4d5cede12d317dbe68ebceea8cd2e7cd5eef4
Rust
mcneja/disguiser
/src/coord.rs
UTF-8
1,370
3.265625
3
[]
no_license
#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd, Hash)] pub struct Coord(pub i32, pub i32); impl Coord { pub fn dot(self, rhs: Self) -> i32 { self.0 * rhs.0 + self.1 * rhs.1 } pub fn length_squared(self) -> i32 { self.0 * self.0 + self.1 * self.1 } pub fn mul_components(self, r...
true
674ac05fcf7bbcde267a2e4fe67b0304a145ab76
Rust
tokio-rs/tokio
/tokio/src/sync/oneshot.rs
UTF-8
42,481
3.625
4
[ "MIT" ]
permissive
#![cfg_attr(not(feature = "sync"), allow(dead_code, unreachable_pub))] //! A one-shot channel is used for sending a single message between //! asynchronous tasks. The [`channel`] function is used to create a //! [`Sender`] and [`Receiver`] handle pair that form the channel. //! //! The `Sender` handle is used by the p...
true
bb72c8dbdda3255677fecff2e8d246cefafb5f26
Rust
shonenada/roundrobin-rs
/src/rr.rs
UTF-8
1,561
3.4375
3
[ "MIT" ]
permissive
use std::sync::{Arc, RwLock}; #[derive(Debug)] pub struct Server { url: String, } impl Server { pub fn new(url: String) -> Server { return Server { url }; } } #[derive(Debug)] pub struct RoundRobinBalancer { pub servers: Vec<Server>, cur_idx: Arc<RwLock<usize>>, } impl RoundRobinBalancer...
true
5323ef65d0c180b81b31239a8e16ff5ee36f5e67
Rust
leoschwarz/musicbrainz_rust
/src/entities/event.rs
UTF-8
3,600
2.984375
3
[ "Apache-2.0" ]
permissive
use xpath_reader::{FromXml, FromXmlOptional, Error, Reader}; use crate::entities::{Mbid, ResourceOld}; use crate::entities::date::PartialDate; enum_mb_xml_optional! { pub enum EventType { var Concert = "Concert", var Festival = "Festival", var LaunchEvent = "Launch event", var Conv...
true
394980e2d7036784f813bd1c0488060debd27b8b
Rust
kengonakajima/snippets
/rust/hello/main.rs
UTF-8
261
2.796875
3
[]
no_license
use std::fs::File; use std::io::prelude::*; fn main() -> std::io::Result<()> { let mut file = File::create("hoge_rs.txt")?; for i in 0..1000000 { let s = format!("hoge:{}\n",i); file.write( & s.into_bytes() )?; // file.flush()?; } Ok(()) }
true
aea263ba641672b02483ddcac5424d50267f96cc
Rust
znewman01/bellman-bignat
/src/util/bit.rs
UTF-8
6,473
2.953125
3
[ "Apache-2.0", "MIT" ]
permissive
// (mostly from franklin-crypto) use sapling_crypto::bellman::pairing::ff::Field; use sapling_crypto::bellman::pairing::Engine; use sapling_crypto::bellman::{ConstraintSystem, LinearCombination, SynthesisError}; use sapling_crypto::circuit::boolean::Boolean; use std::fmt::{self, Display, Formatter}; use OptionExt; #...
true
539ed7aee4003c3f4a886ac1cea98ce4a2485164
Rust
maximbaz/advents-of-code
/src/year2020/day18.rs
UTF-8
6,455
3.484375
3
[ "ISC" ]
permissive
use super::super::*; use Expression::*; use Operator::*; pub struct Task; impl Solution for Task { type Input = Vec<Vec<char>>; type Output = i64; fn parse_input(&self, input: String) -> Self::Input { input .trim() .lines() .map(|line| line.chars().filter(|c| !...
true
02a533a78b511c7c2e1c0a9d434327b4817257d4
Rust
CBenoit/advent-of-code
/2020/src/bin/2-1.rs
UTF-8
1,334
3.421875
3
[]
no_license
use std::io::{self, BufRead}; fn main() -> Result<(), Box<dyn std::error::Error>> { let stdin = io::stdin(); let stdin = stdin.lock(); let nb_valids = stdin.lines() .filter_map(Result::ok) .filter_map(Line::new) .filter(Line::is_valid) .count(); println!("{}", nb_valid...
true
86e35c4e8d14ff037f591e5c52422e6ece684d4d
Rust
liuzl/rust_misc
/6_struct.rs
UTF-8
952
3.53125
4
[]
no_license
#[derive(Debug)] struct Person<'a> { name: &'a str, age: u8, } struct Nil; struct Pair(i32, f32); struct Point { x: f32, y: f32, } #[allow(dead_code)] struct Rectangle { top_left: Point, bottom_right: Point, } fn main() { let name = "RUC"; let age = 81; let ruc = Person {name, a...
true
c113a71a6f1927d60615ce472831a41dd4b080ff
Rust
neovide/neovide
/src/editor/window.rs
UTF-8
11,246
2.703125
3
[ "MIT" ]
permissive
use std::{collections::HashMap, sync::Arc}; use log::warn; use unicode_segmentation::UnicodeSegmentation; use crate::{ bridge::GridLineCell, editor::{grid::CharacterGrid, style::Style, AnchorInfo, DrawCommand, DrawCommandBatcher}, renderer::{LineFragment, WindowDrawCommand}, }; pub enum WindowType { ...
true
204856e91414983ba04f41eee04df151580104a4
Rust
nenad1002/advent-of-code-2020-rust
/Day11/src/main.rs
UTF-8
4,210
3.171875
3
[]
no_license
use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; fn main() { let mut board = read_input(); println!("{:?}", part_2_solution(&mut board)); } fn part_1_solution(board: &mut Vec<String>) -> i32 { let neigh = [ [1, 0], [0, 1], [-1, 0], [0, -1], [-1...
true
d2bace3f44993dcb3ebf4c6354f8bcbbbcb6f149
Rust
pismute/exercism
/rust/forth/src/lib.rs
UTF-8
7,280
3.078125
3
[]
no_license
#![feature(if_let_guard)] use std::collections::HashMap; pub type Value = i32; pub type Result = std::result::Result<(), Error>; type Stack = Vec<Value>; type Words = HashMap<String, Vec<Term>>; type TermResult = std::result::Result<(), (Term, Error)>; #[derive(Clone, Debug)] enum Term { Var(Box<Word>), Val...
true
d33cb87b6580dd859782a425293da290a80c4b5f
Rust
uplol/chooch
/src/main.rs
UTF-8
5,516
2.609375
3
[]
no_license
use std::{net::IpAddr, path::PathBuf}; use chooch::Choocher; use futures::StreamExt; use hyper::Uri; use indicatif::{ProgressBar, ProgressStyle}; use rand::Rng; use structopt::StructOpt; use tokio::io::AsyncWriteExt; fn parse_bytes(src: &str) -> Result<usize, &'static str> { bytefmt::parse(src).map(|n| n as usiz...
true
25dbafc4e8099764ee0e0d8d0e273f7b47404ba6
Rust
caklimas/rust-nes
/src/mappers/mapper_results.rs
UTF-8
1,701
3
3
[]
no_license
pub struct MapperReadResult { pub data: u8, pub mapped_address: u32, pub read_from_cart_ram: bool, pub read_from_mapper_ram: bool } impl MapperReadResult { pub fn from_cart_ram(mapped_address: u32) -> Self { MapperReadResult { data: 0, mapped_address, rea...
true
7f8722b9bc4dda94d282cf94dd38afc28aad683a
Rust
OneFourth/advent2019
/day24/src/main.rs
UTF-8
7,426
3.171875
3
[]
no_license
use std::collections::HashMap; use std::collections::HashSet; fn state_to_str(state: &HashMap<(isize, isize), bool>) -> String { let mut s = "".to_string(); for y in 0..5 { for x in 0..5 { match state.get(&(x, y)).unwrap() { true => s += "#", false => s += "....
true
6f503c4727fa5717be755886d778508ee2706b95
Rust
KodrAus/rust-web-app
/src/domain/customers/queries/get_customer_with_orders.rs
UTF-8
1,751
2.984375
3
[]
no_license
/*! Contains the `GetCustomerWithOrdersQuery` type. */ use crate::domain::{ customers::*, infra::*, orders::*, Error, }; /** Input for a `GetCustomerWithOrdersQuery`. */ #[derive(Deserialize)] pub struct GetCustomerWithOrders { pub id: CustomerId, } /** An order with a order summary for each of i...
true
1d972918351f8e5b95308f5d1882ab6e2949b725
Rust
thesues/nand2tetris
/projects/10/jackanalyzer-rs/src/main.rs
UTF-8
31,653
3.125
3
[]
no_license
extern crate regex; use std::env; use std::vec::Vec; use std::process; use std::fs; use std::fs::File; use std::io::prelude::*; use std::io::{BufReader}; use std::fs::OpenOptions; use std::fmt; #[derive(Debug, Clone)] enum TokenType{ KEYWORD(String), SYMBOL(String), INTEGER(u16), STRING(String), ...
true
356ffe68bd0e7931d9112e965cc1e8cd7558667f
Rust
OwenDF/LearningRust
/HelloWorld.rs
UTF-8
256
3.171875
3
[]
no_license
fn main() { print!("Hello, World, "); println!("I'm a Rustacean!"); println!("My Name is {name}", name = "Owen"); println!("Pi is roughly {pi_exact:.precision$}", pi_exact = 3.141592, precision = 3) }
true
edb0c502c01151eab9f6e294fa5bae709a01b07f
Rust
viquezclaudio/core-rs-albatross
/primitives/trie/src/key_nibbles.rs
UTF-8
14,037
3.421875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::borrow::Cow; use std::cmp; use std::fmt; use std::ops; use std::str; use std::usize; use log::error; use beserial::{Deserialize, ReadBytesExt, Serialize, SerializingError, WriteBytesExt}; use nimiq_database::AsDatabaseBytes; use nimiq_keys::Address; /// A compact representation of a node's key. It stores th...
true
589ae1a23c172ee5616c02f5cfdcfc8a6f23444f
Rust
clap-rs/clap
/clap_bench/benches/04_new_help.rs
UTF-8
6,089
2.984375
3
[ "Apache-2.0", "MIT" ]
permissive
use clap::Command; use clap::{arg, Arg, ArgAction}; use criterion::{criterion_group, criterion_main, Criterion}; fn build_help(cmd: &mut Command) -> String { let help = cmd.render_help(); help.to_string() } fn app_example1() -> Command { Command::new("MyApp") .version("1.0") .author("Kevin...
true
a236e0f3b3e8e6016f2b3ad9bde28b4e2abffd7b
Rust
wladwm/surge-ping
/src/error.rs
UTF-8
1,058
2.75
3
[ "MIT" ]
permissive
#![allow(dead_code)] use std::io; use thiserror::Error; pub type Result<T> = std::result::Result<T, SurgeError>; /// An error resulting from a ping option-setting or send/receive operation. /// #[derive(Error, Debug)] pub enum SurgeError { #[error("buffer size was too small")] IncorrectBufferSize, #[erro...
true
a94958284da5941cf7a398e8c9e6115f15e97106
Rust
seanlees/rust-yt-dl
/examples/process_test.rs
UTF-8
2,218
2.5625
3
[]
no_license
extern crate core; extern crate local_encoding; extern crate regex; use std::process::{Command, Stdio, Child}; use std::error::Error as EType; use std::io::{BufReader, Read, BufRead}; use std::thread; use core::time; use local_encoding::{Encoding, Encoder}; use regex::Regex; fn main() { let url = " https://www.y...
true
3a90c11c4ac09758a53f8562198f1037736856e8
Rust
starblue/advent_of_code
/a2020/src/bin/a202021.rs
UTF-8
5,270
2.84375
3
[]
no_license
use core::slice::Iter; use std::collections::BTreeMap; use std::collections::HashMap; use std::collections::HashSet; use std::fmt; use std::io; use std::io::Read; use nom::bytes::complete::tag; use nom::character::complete::alpha1; use nom::character::complete::line_ending; use nom::combinator::map; use nom::combinat...
true
42b8f2b6f17ced0ea9a19b70eabceeededa506e0
Rust
mjbryant/advent
/2018/day_3/part_a/main.rs
UTF-8
3,203
3.671875
4
[]
no_license
use std::env; use std::fs::File; use std::io::{BufRead, BufReader}; #[derive(Debug)] struct Rectangle { id: u32, x: usize, y: usize, width: usize, height: usize, } impl Rectangle { pub fn from_input(input: &str) -> Self { let mut words = input.split_whitespace(); let rect_id = ...
true
be123d5ecaa0518165f0791518c671020ecabf77
Rust
epwalsh/check-links
/src/main.rs
UTF-8
5,592
2.640625
3
[]
no_license
#[macro_use] extern crate lazy_static; use std::sync::Arc; use std::time::Duration; use exitfailure::ExitFailure; use ignore::WalkBuilder; use structopt::StructOpt; use tokio::sync::mpsc::channel; mod doc_file; mod link; mod log; use doc_file::DocFile; use link::LinkStatus; use log::Logger; #[derive(Debug, StructO...
true
1c31c8503ea381962ddf9af511ca4ef0f95324f7
Rust
noscripter/differential-dataflow
/src/stream.rs
UTF-8
2,707
2.765625
3
[ "MIT" ]
permissive
use std::hash::Hash; use timely::Data; use timely::progress::Timestamp; use timely::dataflow::scopes::Child; use timely::dataflow::{Scope, Stream}; use timely::dataflow::operators::*; use ::Delta; /// A mutable collection of values of type `D` #[derive(Clone)] pub struct Collection<G: Scope, D: Data> { pub inner...
true
1e1dc8c79b362f593d1d89604a3231987340c1a4
Rust
u-03c9/sctp
/src/chunk/chunk_header.rs
UTF-8
3,837
3.203125
3
[ "MIT" ]
permissive
use super::{chunk_type::*, *}; use bytes::{Buf, BufMut, Bytes, BytesMut}; use std::fmt; ///chunkHeader represents a SCTP Chunk header, defined in https://tools.ietf.org/html/rfc4960#section-3.2 ///The figure below illustrates the field format for the chunks to be ///transmitted in the SCTP packet. Each chunk is form...
true
13d52852b3b5072711d4d89e4951b700aae1140b
Rust
pchampin/sophia_rs
/resource/src/resource/_error.rs
UTF-8
3,594
2.953125
3
[ "LicenseRef-scancode-cecill-b-en", "CECILL-B" ]
permissive
use sophia_api::term::TermKind; use sophia_api::{prelude::*, term::SimpleTerm}; use std::error::Error; use std::fmt; /// An error raised when creating a [`Resource`](crate::Resource) #[derive(Debug)] pub enum ResourceError<E: Error> { /// The IRI is not absolute (an can therefore not be dereferenced) IriNotAbs...
true
c9598bae5519aee949b62748c84f6dd9ce30ffc9
Rust
RustWorks/files-store
/users/src/domain/signup.rs
UTF-8
727
2.953125
3
[]
no_license
use bcrypt::BcryptError; use serde::Deserialize; use std::convert::TryFrom; use validator::Validate; use crate::domain::User; use crate::password::secure_user; #[derive(Debug, Clone, Validate, Deserialize)] pub struct Signup { #[validate(length(min = 3, message = "validation.login.short"))] pub login: String,...
true
ef70ef9e934ff852796aefef88bb67258bc506a0
Rust
wayeast/demo-cookie-weirdness
/client/src/lib.rs
UTF-8
9,263
3.046875
3
[]
no_license
use seed::{prelude::*, *}; // Paths const LOGIN: &str = "login"; // ------ ------ // Init // ------ ------ fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model { orders .subscribe(Msg::UrlChanged) .send_msg(Msg::CheckAuth); let user = User::Loading; Model { base_url: url...
true
146852397f48a55207a9d6cd16450863f2fdf0b3
Rust
JeeZeh/advent-of-code
/2022/src/day18.rs
UTF-8
3,658
3.296875
3
[]
no_license
use std::{ collections::{HashMap, HashSet, VecDeque}, ops::Add, }; const DIRECTIONS: [Pos; 6] = [ Pos(-1, 0, 0), // Left Pos(1, 0, 0), // Right Pos(0, 1, 0), // Up Pos(0, -1, 0), // Down Pos(0, 0, 1), // Forward Pos(0, 0, -1), // Back ]; pub fn solve(input: String) -> (usize, usize)...
true
a55e78e2d98a0d71cffd36362916786acbf991b9
Rust
NathanHowell/google-cloud-storage-rs
/src/serde.rs
UTF-8
3,338
2.90625
3
[ "MIT" ]
permissive
#[inline] pub(crate) fn is_default<T: Default + PartialEq>(value: &T) -> bool { value == &Default::default() } pub(crate) mod into_string { use serde::{Deserialize, Serialize, Serializer}; pub fn serialize<S, T>(value: &T, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, ...
true
912208494a09fa81fc076326242bc19c50c08531
Rust
malkoG/RustPython
/vm/src/obj/objfilter.rs
UTF-8
1,998
2.546875
3
[ "MIT" ]
permissive
use super::objbool; use super::objiter; use super::objtype::PyClassRef; use crate::pyobject::{IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue}; use crate::vm::VirtualMachine; pub type PyFilterRef = PyRef<PyFilter>; /// filter(function or None, iterable) --> filter object /// /// Return an it...
true
d9edf05d18088099fec7339086a4692acbad38b4
Rust
emberian/pct
/src/cfg/test.rs
UTF-8
4,564
2.765625
3
[]
no_license
#![cfg(test)] use cfg::{ll1, Symbol, Cfg, EPSILON, END_OF_INPUT, Token, Rule}; use cfg::util::{compute_first_of, Follow, compute_follow}; use cfg::bnf::{from_str, to_string}; #[test] fn first_is_correct() { let mut cfg = Cfg::new(); let s = cfg.add_nonterminal(); let a = cfg.add_nonterminal(); let b ...
true
9cc03bb23d60dc3bdbb85993a1776c4483fe7bc8
Rust
Smithay/smithay
/src/backend/x11/buffer.rs
UTF-8
7,753
2.703125
3
[ "MIT" ]
permissive
//! Utilities for importing buffers into X11. //! //! Buffers imported into X11 are represented as X pixmaps which are then presented to the window. //! //! At the moment only [`Dmabuf`] backed pixmaps are supported. //! //! ## Dmabuf pixmaps //! //! A [`Dmabuf`] backed pixmap is created using the [`DRI3`](x11rb::proto...
true
c661bba1bd14e832d8a7fdff8e0b8cfa63470f70
Rust
themasch/aoc-2020
/src/day10.rs
UTF-8
5,467
3.28125
3
[]
no_license
use crate::*; use std::convert::TryInto; use std::io::BufRead; pub struct Input(Vec<usize>); impl<R: BufRead> ReadInput<R> for Input { fn read(b: R) -> Result<Input, ()> { Ok(Input( b.lines() .flatten() .filter_map(|line| line.parse::<usize>().ok()) ...
true
df30a94842bd27c93e77442a5be4c0502ad14b43
Rust
matijaskala/election
/src/lib.rs
UTF-8
3,048
3.125
3
[]
no_license
pub struct Tensor { candidates: u32, data: Vec<u64>, votes: u64, } pub fn new_tensor(c: u32) -> Tensor { Tensor{candidates: c, data: vec![0; (5*c*c) as usize], votes: 0} } impl Tensor { pub fn add_ballot(&mut self, ballot: &[u8]) { let c = self.candidates as usize; assert!(5*c*c ==...
true
2d3ac9c42d2978f9415bc799ad6b863c8b5a5014
Rust
takatori/hyperloglog
/src/lib.rs
UTF-8
9,191
3.046875
3
[]
no_license
extern crate rand; use rand::Rng; use std::fmt; use std::error::Error; use std::hash::{Hash, Hasher}; use std::collections::BTreeMap; /// SiphasherはRust1.13.0で非推奨になった。しかしそれを置き換えるSipHasher24は /// 現状では非安定(unstable)なため、安定版のRustリリースは利用できない。 #[allow(deperaceted)] use std::hash::SipHasher; /// 推定アルゴリズム。デバッグ出力用 pub enum Es...
true
435f5c6e8a6bd7be2dfa301c90c499e87542f466
Rust
millerjs/harNes
/src/cartridge.rs
UTF-8
4,318
2.75
3
[]
no_license
use types::*; use std::io::Read; use std::io::Error as IOError; use std::path::Path; use std::fs::File; use std::fmt; quick_error! { #[derive(Debug)] pub enum CartridgeError { LoadError(err: String) { from() } IOError(err: IOError) { from() } } } pub type Flags = Byte; #[repr(C, packed)] ...
true
11f1056cb339e8860c6090dbe45e9418ac41280b
Rust
polymath-is/loadstone
/tools/webserver/src/bin/webserver.rs
UTF-8
4,841
2.875
3
[]
no_license
use std::{ path::PathBuf, }; use server::device::{new_system_port, write_to_device, read_from_device}; use warp::{ Filter, http::StatusCode, reply::Response, }; enum MetricsError { BadPath, BadDevice, WriteError, ReadError, BadMetrics } impl std::fmt::Display for MetricsError { ...
true
b632d8b048cb912a8e2fa4b8ed31dc1344fc046c
Rust
mnts26/aws-sdk-rust
/sdk/outposts/src/model.rs
UTF-8
33,755
2.609375
3
[ "Apache-2.0" ]
permissive
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. /// <p>Information about a site.</p> #[non_exhaustive] #[derive(std::clone::Clone, std::cmp::PartialEq)] pub struct Site { /// <p>The ID of the site.</p> pub site_id: std::option::Option<std::string::String>, /// <p>The ID of t...
true
498958f59ce17e9acd7b75a0903eae265e38f0f1
Rust
MindFlavor/azure-sdk-for-rust
/sdk/cosmos/tests/permission_token_usage.rs
UTF-8
5,014
2.6875
3
[ "MIT", "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later" ]
permissive
#![cfg(all(test, feature = "test_e2e"))] use azure_core::Context; use azure_cosmos::prelude::*; use collection::*; use serde::{Deserialize, Serialize}; use std::borrow::Cow; mod setup; #[derive(Clone, Serialize, Deserialize, Debug)] struct MySampleStruct<'a> { id: Cow<'a, str>, age: u32, phones: Vec<Cow<'...
true
b31f6630c16d428dc214202dc3b457abbbbb8160
Rust
ellipticoin/moonshined
/ellipticoin_contracts/src/contract.rs
UTF-8
893
2.65625
3
[]
no_license
use crate::helpers::pad_left; use ellipticoin_types::{ db::{Backend, Db}, Address, ADDRESS_LENGTH, }; use serde::{de::DeserializeOwned, Serialize}; use std::convert::TryInto; pub trait Contract { const NAME: Name; fn get<K: Into<Vec<u8>>, V: DeserializeOwned + Default, B: Backend>( db: &mut Db...
true
4cb4d2ebe3a630ad0222f1a1845a8dbd99e00651
Rust
nrbray/infrabase
/src/wireguard.rs
UTF-8
2,153
3.421875
3
[]
no_license
use std::io::Write; use std::process::{Command, Stdio}; use anyhow::{ensure, Result}; fn run(cmd: &str, args: &[&str], input: Option<&[u8]>) -> Result<Vec<u8>> { let mut child = Command::new(cmd) .args(args) .stdin(Stdio::piped()) .stdout(Stdio::piped()) .spawn()?; if let Some(...
true
065caf5d02c22c4352a67eca3682e3187ef51272
Rust
dwuid/advent-of-code-2015
/aoc_22/src/types/mod.rs
UTF-8
2,522
2.921875
3
[ "MIT" ]
permissive
#[macro_export] macro_rules! decrease { ($i: expr, $e: expr) => { if $i < $e { $i = 0; } else { $i -= $e; } } } mod spells; pub use self::spells::available_spells; #[derive(Clone, Debug)] pub struct Character { pub hitpoints: u16, pub damage: u16, pub armor: u16, pub mana: ...
true
7653aee0e44c923838aa0142523917c05ae567ed
Rust
Mokosha/pbrt_rust
/src/primitive/mod.rs
UTF-8
6,777
2.578125
3
[]
no_license
mod aggregates; mod geometric; mod transformed; use area_light::AreaLight; use bbox::BBox; use bbox::HasBounds; use bsdf::BSDF; use bsdf::bssrdf::BSSRDF; use diff_geom::DifferentialGeometry; use intersection::Intersectable; use intersection::Intersection; use material::Material; use ray::Ray; use shape::Shape; use tra...
true
d21714a38789854450379f9f617c4ba5d600266f
Rust
robohouse-delft/abbrws-rs
/abbrws/src/parse/signal.rs
UTF-8
5,704
3.1875
3
[]
no_license
use serde::Deserialize; #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Deserialize)] pub enum SignalKind { #[serde(rename = "DI")] DigitalInput, #[serde(rename = "DO")] DigitalOutput, #[serde(rename = "AI")] AnalogInput, #[serde(rename = "AO")] AnalogOutput, #[serde(rename = "GI")] GroupInp...
true
3e4c874282f9d8b27a182c74a1ea5f224908ff29
Rust
swiboe/swiboe
/src/rpc.rs
UTF-8
2,580
2.5625
3
[ "Apache-2.0" ]
permissive
// Copyright (c) The Swiboe development team. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE.txt // in the project root for license information. use serde; use serde_json; use std::error::Error as StdError; use serde::{Serialize, Deserialize}; // NOCOM(#sirver): add documentation ...
true
1f46375b6c20a0502f0ffea59884b7880af77b3c
Rust
samuelcolvin/edgerender-rust
/src/rust/env.rs
UTF-8
3,172
2.625
3
[ "MIT" ]
permissive
use crate::config::Config; use crate::router::RouteMatch; use js_sys::{Error, SyntaxError}; use serde::Deserialize; use serde_json::{to_string_pretty, Value as SerdeValue}; use std::collections::HashMap; use tera::{Context, Result as TeraResult, Tera}; use wasm_bindgen::prelude::*; #[derive(Deserialize)] pub struct Te...
true
b201a55bdeb13daf4b28f0ef73586933898e1988
Rust
muzudho/pyon-pyon-game
/src/main.rs
UTF-8
1,232
3
3
[ "MIT" ]
permissive
mod board; mod command_line; mod protocol; mod view; use crate::board::Board; use crate::command_line::CommandLine; use std; fn main() { println!( "ぴょんぴょんゲーム コマンド: `do b5c3` - b5 の駒を c3 へ移動。 `pos` - 局面表示。" ); let xfen = "xfen 1o1o1/o1o1o/5/x1x1x/1x1x1 x"; if let Some(mut board) = Board::from_xfen(xfen) ...
true
53812f8a617a3d8a21538e27f53c743dc22561ae
Rust
jazznerd206/Rustoleum
/documentation_exercises/math/arithmetic_functions.rs
UTF-8
96
2.734375
3
[ "Unlicense" ]
permissive
fn main() { print!("{}", addition(3,3)); } fn addition(x: i32, y: i32) -> i32 { x + y }
true
8991868577fbdf8e64db57eac9e862505698de7f
Rust
Connicpu/ecs-game
/src/world/item.rs
UTF-8
437
3.40625
3
[]
no_license
use self::Item::*; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum Item { Empty, Coins(u32), ExtraLife, } impl Item { pub fn parse(value: char) -> Result<Item, char> { Ok(match value { '-' => Empty, 'c' => Coins(1), 'C' => Coins(3), ...
true
7c9d472d8e337c465f882e74ab8716259fa5bf37
Rust
fossabot/rundeck
/cli/src/job.rs
UTF-8
1,585
2.65625
3
[]
no_license
use api::job::JobService; use api::Job; use api::job::RunBody; use prettytable::format; use prettytable::row::Row; use prettytable::cell::Cell; use std::collections::HashMap; pub fn list_jobs( service: &JobService, project: &str, quiet: bool, completion: bool, filters: Vec<&str>, ) { let jobs: ...
true
0b5940c67dff3d557df9171d721f28bcc993ffb3
Rust
stm32-rs/stm32-rs-nightlies
/stm32l4/src/stm32l4p5/flash/sr.rs
UTF-8
29,563
2.6875
3
[]
no_license
#[doc = "Register `SR` reader"] pub type R = crate::R<SR_SPEC>; #[doc = "Register `SR` writer"] pub type W = crate::W<SR_SPEC>; #[doc = "Field `EOP` reader - End of operation"] pub type EOP_R = crate::BitReader<EOPR_A>; #[doc = "End of operation\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub en...
true
e27ea2d2387996c3c1f888dbe769423642be4829
Rust
liqcomb/os
/src/arch/x86_64/timer.rs
UTF-8
2,951
2.609375
3
[]
no_license
use arch::idt::IDT; use arch::io; use arch::pic::PIC; use spin::Mutex; type TimerCallback = fn(u64); const MAX_CALLBACKS: usize = 30; const TIMER_C0_DATA: u16 = 0x40; const TIMER_C1_DATA: u16 = 0x41; const TIMER_C2_DATA: u16 = 0x42; const TIMER_MODE_CTRL: u16 = 0x43; const TIMER_WRAP: u64 = 0x100000000; static mut S...
true
136f0498300c20f4fda49862b654dc8f73263b3e
Rust
Floeckchengrafik/LangJam0001-Comstruct
/tontuna/tontuna/src/lexer.rs
UTF-8
3,585
3.328125
3
[]
no_license
use logos::Logos; #[derive(Eq, PartialEq, PartialOrd, Ord, Debug, Copy, Clone, Logos)] pub(crate) enum TokenKind { #[token("fn")] Fn, #[token("let")] Let, #[token("while")] While, #[token("if")] If, #[token("else")] Else, #[token("for")] For, #[token("in")] In, ...
true
887ef2823a5b7ed2d4a7f24750a45f39442799a2
Rust
YoloDev/skorm
/crates/store/src/store/sink.rs
UTF-8
4,005
2.59375
3
[]
no_license
use super::{ expand, insert_prefix, prefix::ExpandError, Lit, Store, StoredBlankNode, StoredLiteral, StoredObject, StoredPredicate, StoredSubject, StoredTriple, StoredUri, TripleDatabase, Uri, }; use evitable::*; use skorm_parse::{ AsRdfObject, AsRdfParserSink, AsRdfPredicate, AsRdfPrefix, AsRdfStatement, AsRdfSu...
true
2c694097a21c26c731d570ce1bcae90e4d1f61e8
Rust
txowner/dingtalk-rs
/src/lib.rs
UTF-8
18,154
2.625
3
[ "MIT" ]
permissive
use hmac::{Hmac, Mac, NewMac}; use serde_json::Value; use sha2::Sha256; use std::{ env, fs, io::{Error, ErrorKind}, path::PathBuf, time::SystemTime, }; mod msg; use msg::*; pub use msg::{ DingTalkMessage, DingTalkMessageActionCardBtn, DingTalkMessageActionCardBtnOrientation, DingTalkMessageAct...
true
66a2a4b70fbc74431b86010803a540e2d383c1ce
Rust
DeltaManiac/Exercism
/dot-dsl/src/lib.rs
UTF-8
2,745
3.0625
3
[]
no_license
use std::collections::HashMap; #[derive(PartialEq, Eq, Default, Clone, Debug)] pub struct Edge { start: String, end: String, attrs: HashMap<String, String>, } impl Edge { pub fn new(s: &str, e: &str) -> Self { Edge { start: s.to_string(), end: e.to_string(), ...
true
4b209fef0994b40b86ab47b2c9b7f5be93fd8373
Rust
pcolusso/link-shortener
/src/main.rs
UTF-8
2,210
3
3
[]
no_license
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; #[macro_use] extern crate rocket_contrib; use std::sync::Mutex; use std::collections::HashMap; use rocket::State; use rocket::response::Redirect; use rocket_contrib::serve::StaticFiles; use rocket_contrib::json::{Json, JsonValue}; use serde...
true
e195425c17e729983ff0ea9be5e809ed9ecffbe6
Rust
Kampfkarren/advent-of-code-2018-rust
/src/day8/mod.rs
UTF-8
2,113
3.40625
3
[]
no_license
type Number = u64; #[derive(Debug, Eq, PartialEq)] struct Node { children: Vec<Box<Node>>, metadata: Vec<Number>, } impl Node { fn descendants(&self) -> Vec<&Node> { let mut descendants = vec![self]; for child in &self.children { descendants.append(&mut child.descendants()); } descenda...
true
31abae91288b73ace1a3ce5b3d392c68274a32fb
Rust
chazzam/aoc2019
/src/intcode.rs
UTF-8
10,137
2.9375
3
[ "Apache-2.0" ]
permissive
use std::convert::TryInto; use std::io::{self, Read}; use std::collections::HashMap; pub fn int_input(in_str: &str) -> Vec<i64> { //println!("in: {}", &in_str.trim()); let results = in_str .trim() .split(',') .filter_map(|x| if x.trim() != "" { x.trim().parse::<i64>().ok() } else { None }) .collect...
true
fe6cfcfede13d7d8db3973ab5256a9aa894194c6
Rust
keroro520/jsonrpc-client-rs
/pubsub/src/lib.rs
UTF-8
13,156
2.6875
3
[ "Apache-2.0", "MIT" ]
permissive
//! This crate adds support for subscriptions as defined in [here]. //! //! [here]: https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB extern crate futures; extern crate jsonrpc_client_core; extern crate jsonrpc_client_utils; #[macro_use] extern crate serde; extern crate serde_json; extern crate tokio; #[macro_...
true
f9854918afc5325b26835f91643a342fc0084458
Rust
diffeo/kodama
/src/chain.rs
UTF-8
8,291
2.609375
3
[ "MIT" ]
permissive
use std::mem; use crate::condensed::CondensedMatrix; use crate::dendrogram::Dendrogram; use crate::float::Float; use crate::method; use crate::{LinkageState, MethodChain}; /// Perform hierarchical clustering using the "nearest neighbor chain" /// algorithm as described in Müllner's paper. /// /// In general, one shou...
true
d2681290350916269d5f8fe49e97a014ebe88f3a
Rust
theemathas/binary_turk
/game/src/castle.rs
UTF-8
3,003
3.015625
3
[ "MIT" ]
permissive
use color::{Color, White, Black}; use square::{Square, File, Rank}; pub use self::Side::{Kingside, Queenside}; #[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum Side { Kingside, Queenside, } impl Side { pub fn require_empty_squares(self, c: Color) -> Vec<Square> { match (c, self) { ...
true
ed65b363589d899c4f04596f6b03bc494010f34e
Rust
LucioFranco/clique
/tests/cluster.rs
UTF-8
1,542
2.8125
3
[ "MIT" ]
permissive
use clique::{Cluster, Endpoint, Message, Transport2}; use std::collections::HashMap; use tokio::sync::mpsc; type Sender = mpsc::Sender<(Endpoint, Message)>; type Receiver = mpsc::Receiver<(Endpoint, Message)>; #[derive(Debug)] struct SimulatedCluster { nodes: HashMap<Endpoint, Sender>, messages: Receiver, } ...
true
722e9d7fa274ffb850deb88e9f22cc01766412bd
Rust
PinkDiamond1/drand-verify
/src/verify_js.rs
UTF-8
2,004
2.734375
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use wasm_bindgen::prelude::*; use super::points::{g1_from_variable, InvalidPoint}; use super::verify::{verify, VerificationError}; struct VerifyWebError(pub String); impl From<hex::FromHexError> for VerifyWebError { fn from(source: hex::FromHexError) -> Self { Self(source.to_string()) } } impl From<...
true
d1848d006d302193610b45d8ec2a5c6e1e8a9657
Rust
domain-independent-dp/didp-rs
/didp-yaml/src/dypdl_parser/table_registry_parser.rs
UTF-8
56,222
2.78125
3
[ "Apache-2.0", "MIT" ]
permissive
use crate::util; use dypdl::prelude::*; use dypdl::{StateMetadata, TableRegistry}; use lazy_static::lazy_static; use rustc_hash::FxHashMap; use std::error::Error; use std::fmt; use std::str; use yaml_rust::Yaml; enum TableReturnType { Integer(Integer), Continuous(Continuous), Set(Set), Vector(usize, Ve...
true
def9cd72b49caca63097fb04c30bb0d33e756515
Rust
ibraheemdev/rustbot
/src/moderation.rs
UTF-8
3,130
3.0625
3
[ "MIT" ]
permissive
use crate::{serenity, Context, Error, PrefixContext}; /// Deletes the bot's messages for cleanup /// /// ?cleanup [limit] /// /// Deletes the bot's messages for cleanup. /// You can specify how many messages to look for. Only messages from the last 24 hours can be deleted. #[poise::command(on_error = "crate::acknowled...
true
878ff52a40323e464e800e1caa9eab2f0d195ee0
Rust
nbliznashki/radix_new
/radix_column/src/asbytes.rs
UTF-8
880
3.3125
3
[]
no_license
use std::mem::MaybeUninit; pub trait AsBytes { fn bytelen(&self) -> usize; //SAFETY: The type T should contain any references //and therefore it should be able to simply copy it as bytes unsafe fn copy(&self, data: &mut [MaybeUninit<u8>]); fn as_bytes(&self) -> &[u8]; fn from_bytes(data: &[u8])...
true
f9707c8ed9bb8bac21daa4644ba4ae9921c34a9d
Rust
hegza/oil-rs
/src/tracker/test.rs
UTF-8
5,159
2.9375
3
[ "MIT" ]
permissive
use super::*; use crate::datamodel::*; use crate::view::tracker_cli::TrackerCli; use chrono::{DateTime, Datelike, NaiveTime}; use lazy_static::lazy_static; lazy_static! { static ref TEST_EVENT: EventData = EventData::new( Interval::FromLastCompletion(TimeDelta::Hm(0, 1)), "Test EventData".to_string...
true
36abc37460d6779f86e05b55fdb98c52ccffd00a
Rust
ThinkChaos/rtsp-rs
/rtsp-common/src/version.rs
UTF-8
3,962
3.265625
3
[ "MIT" ]
permissive
use std::convert::{Infallible, TryFrom}; use std::error::Error; use std::fmt::{Display, Formatter, Result as FormatterResult}; #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum Version { Rtsp1_0, Rtsp2_0, } impl Version { pub fn as_encoded(&self) -> &'static [u...
true
f5e04ef27e4982f1128b4fbb1bae4db5d776a67e
Rust
roadrunner-craft/core
/src/world/world.rs
UTF-8
4,110
2.84375
3
[ "MIT" ]
permissive
use crate::chunk::{Chunk, ChunkGrid, ChunkGridCoordinate, ChunkGroup}; use crate::utils::ThreadPool; use crate::world::generation::generate_chunk; use crate::world::generation::WorldSeed; use crate::world::WorldCoordinate; use math::random::Seed; use std::collections::HashSet; use std::sync::mpsc::{channel, Receiver, ...
true