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
e9058a650920a8dc89493adebc2413785d5fa739
Rust
sl-sh-dev/sl-console
/examples/simple.rs
UTF-8
1,028
2.828125
3
[ "MIT" ]
permissive
use sl_console::color; use sl_console::*; use std::io::{Read, Write}; fn main() { // Initialize 'em all. con_init().unwrap(); let mut conout = conout().into_raw_mode().unwrap(); let conin = conin(); write!( conout, "{}{}{}yo, 'q' will exit.{}{}", sl_console::clear::All, ...
true
5537ea03866d849e9dad8bbeebc78c1f869f4463
Rust
robojeb/ffmpeg-libav-rs
/crates/ffav/src/util/mod.rs
UTF-8
1,665
2.65625
3
[]
no_license
//! Types and Traits for enforcing API safety through the Type system /// Types for managing channel layouts of Audio streams pub mod channels; /// Types for representing Video frame pixel layouts pub mod color; pub mod marker; /// Types for representing Audio sample formats and layouts pub mod sampling; pub mod time;...
true
ea785d98a63e562003557fcaf749fca620d5cc3b
Rust
killertux/number-5
/src/main.rs
UTF-8
1,275
2.5625
3
[]
no_license
use std::env; use warp::Filter; mod phrases; mod weather; mod where_should_we_eat; #[tokio::main] async fn main() { pretty_env_logger::init(); let get_place_to_eat = warp::path("where-should-we-eat").and_then(where_should_we_eat::get_place_to_eat); let get_place_to_eat_with_offset = warp::path!("...
true
56ba853e4b25eb9e7240fe310e3229a5606babfc
Rust
jaspercb/raytracer
/src/aabb.rs
UTF-8
1,349
3.078125
3
[]
no_license
use crate::math::Vec3; use crate::ray::Ray; #[derive(Debug, Clone, Copy)] pub struct AABB { _min: Vec3, _max: Vec3, } impl AABB { pub fn new(_min: Vec3, _max: Vec3) -> AABB { return Self { _min, _max }; } pub fn min(&self) -> Vec3 { self._min } pub fn max(&self) -> Vec3 {...
true
4cf7e0e144f6016119a05d11b32f41483cbac274
Rust
Guvalif/db-tutorial-rust
/src/table.rs
UTF-8
1,142
3.09375
3
[]
no_license
use std::fmt; use std::mem::size_of; use row::Row; const PAGE_SIZE: usize = 4096; const TABLE_MAX_PAGES: usize = 100; const ROW_SIZE: usize = size_of::<Row>(); const ROWS_PER_PAGE: usize = PAGE_SIZE / ROW_SIZE; const TABLE_MAX_ROWS: usize = ROWS_PER_PAGE * TABLE_MAX_PAGES; pub struct Table { n_rows: u32, pag...
true
4c074fdd057d50db8677959ccdce661d3c07d550
Rust
binshengliu/exercism-rust
/roman-numerals/src/lib.rs
UTF-8
855
3.4375
3
[ "MIT" ]
permissive
use std::fmt; const MAP: [(u16, &str); 13] = [ (1, "I"), (4, "IV"), (5, "V"), (9, "IX"), (10, "X"), (40, "XL"), (50, "L"), (90, "XC"), (100, "C"), (400, "CD"), (500, "D"), (900, "CM"), (1_000, "M"), ]; pub struct Roman { string: String, } impl Roman { pub f...
true
3790a59cc8076d1a9fe29624cf55126a3b5d5ab6
Rust
immunant/c2rust
/dynamic_instrumentation/src/mir_utils/deref.rs
UTF-8
1,240
2.953125
3
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
use rustc_middle::{ mir::{Place, PlaceRef, ProjectionElem}, ty::TyCtxt, }; pub fn has_outer_deref(p: &Place) -> bool { matches!( p.iter_projections().last(), Some((_, ProjectionElem::Deref)) ) } /// Get the inner-most dereferenced [`Place`]. pub fn strip_all_deref<'tcx>(p: &Place<'tcx>...
true
d487f95de3747b0048367d4446624e5911aa12d0
Rust
fredrik-jansson-se/rust-advent-of-code-2018
/src/aoc8.rs
UTF-8
2,271
3.53125
4
[]
no_license
use std::fs; pub fn run() { let input = fs::read_to_string("day8.txt").unwrap(); println!("day8-1: {}", run_1(&input[0..(input.len() - 1)])); println!("day8-2: {}", run_2(&input[0..(input.len() - 1)])); } #[derive(Debug)] struct Node { metadata: Vec<u32>, children: Vec<Node>, } fn to_vec(input: &...
true
173c7bffc66c57084fc6ca0a6b7076d5f64e6f66
Rust
guillaume-be/rust-bert
/src/pipelines/mod.rs
UTF-8
21,482
2.90625
3
[ "Apache-2.0" ]
permissive
//! # Ready-to-use NLP pipelines and models //! //! Based on Huggingface's pipelines, ready to use end-to-end NLP pipelines are available as part of this crate. The following capabilities are currently available: //! //! **Disclaimer** //! The contributors of this repository are not responsible for any generation from ...
true
be1ee32187ac9e9de574a83f6e7c50876463c4b8
Rust
Eventide/learn-rust
/pancake/src/lib.rs
UTF-8
2,250
4.0625
4
[ "MIT" ]
permissive
/// Reverse the items in the list from [0..index]. #[inline] fn reverse_until_index<T>(v: &mut [T], index: usize) { v[..index+1].reverse(); } /// Return the index of the largest item in the Vec between [0..index]. #[inline] fn index_of_max<T>(v: &[T], index: usize) -> usize where T: PartialOrd { let mut max = ...
true
9754e8d82419c3d0c28d7bde48a786ab2dca28bc
Rust
vladimiroff/quickmd
/src/assets.rs
UTF-8
3,634
3.390625
3
[ "Apache-2.0", "MIT" ]
permissive
//! Management of external assets like Javascript and CSS. //! //! The files are stored into the binary as strings and written to the filesystem when the //! application runs. For the HTML file, this allows the webview to load a URL instead of a string //! body, which makes reloading smoother (update the file, refresh)...
true
dfcd05680f2ec84b3a21faa079e836e1e9cce331
Rust
macisamuele/loader-rs
/src/testing_helpers.rs
UTF-8
6,262
2.546875
3
[ "MIT" ]
permissive
#[cfg(test)] use crate::{LoaderError, LoaderTrait}; use std::path::{Path, PathBuf}; #[cfg(test)] use std::sync::Arc; use url::Url; pub(in crate) fn test_data_file_path(path_components: &[&str]) -> Result<PathBuf, std::io::Error> { let repository_path = Path::new(file!()).canonicalize().unwrap().parent().unwrap().p...
true
5bf166c234c92dcb578c7a16a4bcb91fb2ae1625
Rust
mpuromaki/advent_of_code_2020
/day_01/src/main.rs
UTF-8
3,392
3.34375
3
[]
no_license
/*! # Advent of Code 2020 - Day 01 [Link to task.](https://adventofcode.com/2020/day/1) Find three values from list where: ```text ignore value_1 + value_2 + value_3 == 2020 ``` Correct answer for website is calculated by: ```text ignore value_1 * value_2 * value_3. ``` ## Usage example ```text ignore PS> cargo r...
true
9dea147b849aacb46edaadd350690f9eed9b0288
Rust
Woyten/raytracer
/src/ray.rs
UTF-8
1,187
3.265625
3
[ "MIT" ]
permissive
use crate::object::Object; use crate::prelude::*; use std::f64; pub struct Ray { pub start: Point3, pub direction: Vector3, } impl Ray { pub fn trace(&self, scene: &[&dyn Object], num_recursions: usize) -> Color { match self.find_nearest(scene) { Some((alpha, object)) => object.get_col...
true
ed822816251fa33d795f7e77d804d3330df4c037
Rust
xiuxiu62/shake-stack
/src/main.rs
UTF-8
2,117
2.78125
3
[]
no_license
use queue::Queue; use stack::Stack; use store::Order; pub mod queue; pub mod stack; pub mod store; fn sleep(ms: u64) { std::thread::sleep(std::time::Duration::from_micros(ms)); } fn populate_stack<'a>(data: &mut Stack<Order<'a>>, input: &Vec<(&'a str, &'a str)>) { for i in input { sleep(550); ...
true
c94c048926cfe8bc3e31e93eaaee166298aa99ca
Rust
nsiebenaller/UDP-Messenger
/client/src/global_state.rs
UTF-8
345
3.03125
3
[]
no_license
#[derive(Copy, Clone)] pub struct GlobalState { pub running: bool, } impl Default for GlobalState { fn default() -> Self { Self { running: true, } } } impl GlobalState { pub fn shutdown(&mut self) { self.running = false; } pub fn is_running(self) -> bool { ...
true
c47f47dfb9cdae79e2a00ec1c7f508cdc745854c
Rust
qiwei9743/leetcode_rs
/src/orig/327.count-of-range-sum.rs
UTF-8
959
2.9375
3
[]
no_license
/* * @lc app=leetcode id=327 lang=rust * * [327] Count of Range Sum * * https://leetcode.com/problems/count-of-range-sum/description/ * * algorithms * Hard (34.17%) * Likes: 564 * Dislikes: 72 * Total Accepted: 37.9K * Total Submissions: 110.8K * Testcase Example: '[-2,5,-1]\n-2\n2' * * Given an i...
true
5e6aca34ac69235435828a31ee4109a2c171b977
Rust
sharkAndshark/geoengine
/services/src/handlers/datasets.rs
UTF-8
4,336
2.53125
3
[]
no_license
use crate::contexts::Context; use crate::datasets::listing::DataSetListOptions; use crate::datasets::listing::DataSetProvider; use crate::handlers::authenticate; use crate::users::session::Session; use crate::util::user_input::UserInput; use warp::Filter; pub(crate) fn list_datasets_handler<C: Context>( ctx: C, ) ...
true
12db3cbf5f00c42fe14dee1da37f53f1db0f1db5
Rust
sahil-blulabs/learning_rust
/Lesson1/02_Using_mutable_variable.rs
UTF-8
140
3.015625
3
[]
no_license
fn main() { let mut m = 45; m = 50; // LEARN: ↑ this throws below error: // LEARN: `cannot assign twice to immutable variable`. }
true
1b3db08ff838f4dac73f5c6271766abb1248f79e
Rust
jnaulty/bors
/github/src/client/reactions.rs
UTF-8
17,529
3
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate::{ client::{Client, PaginationOptions, Response, Result, MEDIA_TYPE_REACTIONS_PREVIEW}, Reaction, ReactionType, }; use serde::Serialize; #[derive(Debug, Serialize)] struct ReactionsRequest { content: ReactionType, } #[derive(Debug, Default, Serialize)] pub struct ListReactionsOptions { pub c...
true
30b84168c3358283f8771e3b5ba056f336e41a59
Rust
2000jedi/Yudi-s-Shell
/src/parser.rs
UTF-8
3,530
2.984375
3
[ "BSD-3-Clause" ]
permissive
use peg; #[derive(Debug, PartialEq)] pub struct Atom { pub pars : Vec<String>, // parameters of the process pub src : Option<String>, // direct pipe from a file pub dest : Option<String>, // direct pipe to a file } #[derive(Debug, PartialEq)] pub enum Op { AND, // && OR, // || SEQ ...
true
d731f971009b11ce482c8ec0b45185069e04e8b3
Rust
maxtnuk/gluesql
/core/src/executor/evaluate/expr.rs
UTF-8
2,784
3.40625
3
[ "Apache-2.0" ]
permissive
use { super::{EvaluateError, Evaluated}, crate::{ ast::{AstLiteral, BinaryOperator, DataType, UnaryOperator}, data::{Literal, Value}, result::Result, }, std::borrow::Cow, }; pub fn literal(ast_literal: &AstLiteral) -> Result<Evaluated<'_>> { Literal::try_from(ast_literal).ma...
true
57c0c77e48eb10e564f0d70908a61b8c0da259c1
Rust
ChrisTrevisan/Mastermind_Interactor
/src/main.rs
UTF-8
1,965
3.5
4
[]
no_license
extern crate rand; use std::io; use rand::Rng; fn main() { let mut rng = rand::thread_rng(); let secret : String = format!("{:06}",rng.gen_range(0,999999)); let mut scnt : [i32;10] = [0;10]; println!("{}",secret); for c in secret.chars() { scnt[c as usize - '0' as usize] += 1; } let ...
true
9bf1b5f075ffb9024cda7da09dea20380aeb4bd9
Rust
nochat1205/DailySchedule_2020
/04-learn-rust-the-hard-way/ex39.rs
UTF-8
827
3.28125
3
[]
no_license
fn main() { let ten_things = "Apples Oranges Crows Telephone Light Sugar"; println!("Wait there's not 10 things in that list, let's fix that."); let mut stuff = ten_things.split(' ').collect::<Vec<_>>(); let mut more_stuff = vec!["Day", "Night", "Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"];...
true
1a14a5f2fb90911ba81ca495b8e88d01b9ae3b22
Rust
dannbuckley/rust-algorithms
/dynamic-programming/optimal-binary-search-tree/src/main.rs
UTF-8
1,793
3.25
3
[ "MIT" ]
permissive
extern crate matrix; use matrix::prelude::*; use std::vec::Vec; // Finds an optimal binary search tree by dynamic programming // Input: An array p[1..n] of search probabilities for a sorted list of n keys // Output: Average number of comparisons in successful searches in the // optimal BST and table r of subtrees...
true
bb8421b14d10af7b6cb418aee05df8bc56a58b17
Rust
kiliaosi/my-explorer
/day06/src/lib/func.rs
UTF-8
541
3.546875
4
[]
no_license
//方法是依附于对象的函数 //例子 给出一个描述长方形的结构体, 给出计算面积和周长的函数 pub struct Rect{ width:f64, height:f64, } impl Rect{ fn new(width:f64, height:f64)->Rect{ Rect{ width, height, } } fn calc_per(&self)->f64{ self.width*2.0+self.height*2.0 } fn calc_area(&self)->f64{ self.width*self.height } ...
true
12367e9d2aacce7148c6d152bf97ffc1e8951abf
Rust
shaolang/exercism
/rust/run-length-encoding/src/lib.rs
UTF-8
1,153
3.421875
3
[]
no_license
use regex::Regex; pub fn encode(source: &str) -> String { if source == "" { "".to_string() } else { chunk(source) .iter() .map(|(n, c)| match *n { 1 => c.to_string(), n => format!("{}{}", n, c) }...
true
0d251b98bf7ae40818aa78f80b496cac2cf519b5
Rust
SnoozeTime/spacegame
/src/prefab/player.rs
UTF-8
1,680
2.609375
3
[]
no_license
use crate::assets::prefab::Prefab; use crate::core::transform::Transform; use crate::gameplay::collision::BoundingBox; use crate::gameplay::health::{Health, Shield}; use crate::gameplay::physics::DynamicBody; use crate::gameplay::player::{Player, Stats, Weapon}; use crate::gameplay::trail::Trail; use crate::render::par...
true
24c5187b4248068f080185148e18d546eb1429b6
Rust
nikomatsakis/rust
/src/test/run-pass/expr-alt-box.rs
UTF-8
287
2.5625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "bzip2-1.0.6", "BSD-1-Clause" ]
permissive
// -*- rust -*- // Tests for alt as expressions resulting in boxed types fn test_box() { let res = alt true { true { @100 } }; assert (*res == 100); } fn test_str() { let res = alt true { true { "happy" } }; assert (res == "happy"); } fn main() { test_box(); test_str(); }
true
e0daa61eaff277601b867ca6dfc524b9e9eaf5ca
Rust
dminor/tern
/src/vm.rs
UTF-8
18,467
2.9375
3
[]
no_license
use crate::codegen; use crate::typeinfer; use std::borrow::Borrow; use std::collections::HashMap; use std::fmt; macro_rules! err { ($vm:expr, $msg:expr) => {{ return Err(codegen::InterpreterError { err: $msg.to_string(), line: $vm.line, col: $vm.col, }); }}; ...
true
ffde467c84bd57a17997f8d1fd49b6828935814e
Rust
Firehed/arcadecontrols
/src/mcp23017/mod.rs
UTF-8
3,748
2.953125
3
[]
no_license
use i2c::I2C; #[allow(dead_code)] const BANK0_GPIOA: u8 = 0x12; #[allow(dead_code)] const BANK0_GPIOB: u8 = 0x13; const BANK1_GPIOA: u8 = 0x09; const BANK1_GPIOB: u8 = 0x19; #[derive(Debug)] pub struct ReadResult { a0: bool, a1: bool, a2: bool, a3: bool, a4: bool, a5: bool, a6: bool, ...
true
bbe8a5dcfc144d1999f6c3764eb48862f026bf97
Rust
pwoolcoc/tantivy
/src/directory/read_only_source.rs
UTF-8
3,652
3.40625
3
[ "MIT" ]
permissive
use super::shared_vec_slice::SharedVecSlice; use common::HasLen; #[cfg(feature = "mmap")] use fst::raw::MmapReadOnly; use stable_deref_trait::{CloneStableDeref, StableDeref}; use std::ops::Deref; /// Read object that represents files in tantivy. /// /// These read objects are only in charge to deliver /// the data in...
true
239eb21daade9b46336b02b2cf19249a32bc89fb
Rust
hermitmotel/rocket-httpd
/src/main.rs
UTF-8
1,246
2.859375
3
[ "MIT" ]
permissive
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; use rocket::http::RawStr; use rocket::request::Form; use rocket::response::Debug; use rocket::Data; use std::{env, io}; #[derive(FromForm)] struct UserLogin<'r> { username: &'r RawStr, password: &'r RawStr, } // curl http://localhost:80...
true
c71cfc185b343b53ad216993838875eac1cd9744
Rust
rnegrin90/AdventOfCode2019
/advent_of_code/src/day02/mod.rs
UTF-8
2,643
3.390625
3
[ "Apache-2.0" ]
permissive
fn opcode_1(operator_1: i32, operator_2: i32) -> i32 { operator_1 + operator_2 } fn opcode_2(operator_1: i32, operator_2: i32) -> i32 { operator_1 * operator_2 } fn evaluate_memory(instructions: &mut Vec<i32>) -> i32 { let mut current_position = 0; let result: i32; loop { match instruction...
true
b8bd662912c2028a47c9b56e4bf891572fea835b
Rust
BrokenSt0rm/openweather-proxy-rs
/src/infrastructure/repositories/weather.rs
UTF-8
1,505
2.8125
3
[ "MIT" ]
permissive
use async_trait::async_trait; use reqwest::Client; use rust_decimal::Decimal; use crate::types::{error::OpenWeatherProxyError, open_weather::Weather, request::Units}; #[async_trait] pub trait WeatherRepository { async fn get_by_coordinates( &self, lat: Decimal, lon: Decimal, unit: ...
true
f27fe77deeccd558196e740900abe1078d094b68
Rust
d653/rust_advent_of_code_2018
/day12/src/main.rs
UTF-8
2,447
3.0625
3
[]
no_license
use std::fs::File; use std::io::BufRead; use std::io::BufReader; fn pad((offset, state): &(i64, Vec<bool>)) -> (i64, Vec<bool>) { let first = state .iter() .enumerate() .find(|(_, &b)| b) .unwrap() .0; let last = state .iter() .enumerate() .filter...
true
526e5207689c8af0c85501677cd2538a3605ac68
Rust
Alkamist/KeyboardMeleeRust
/src/digital_melee_controller/src/air_dodge_logic.rs
UTF-8
2,697
2.921875
3
[]
no_license
use std::time::{Instant, Duration}; use crate::button::Button; use crate::analog_axis::AnalogAxis; pub struct AirDodgeLogic { air_dodge_input: Button, air_dodge_time: Instant, is_air_dodging: bool, x_level_long: f64, y_level_long: f64, x_level_medium: f64, y_level_medium: f64, x_level_...
true
8c49e7fc9bc26dfd0b591b574e404ccb1a852c9c
Rust
Oporto/mqp_fsae_digital
/rust-client/readWS.rs
UTF-8
1,131
2.890625
3
[]
no_license
use std::error::Error; use std::thread; use std::time::{Duration, SystemTime}; use std::collections::LinkedList; use rppal::gpio::Gpio; const PIN_N: u8 = 23; pub fn readWS() -> f32{ let mut start = SystemTime::now(); let gpio = Gpio::new()?; let mut pin = gpio.get(PIN_N)?.into_input(); let mut in_int...
true
6855f251e4a54f87782d968189456d6561379e7e
Rust
provable-things/ptokens-core
/src/btc_on_eth/check_core_is_initialized.rs
UTF-8
1,784
2.875
3
[]
no_license
use crate::{ chains::{ btc::{btc_state::BtcState, core_initialization::check_btc_core_is_initialized::check_btc_core_is_initialized}, eth::{core_initialization::check_eth_core_is_initialized::check_eth_core_is_initialized, eth_state::EthState}, }, traits::DatabaseInterface, types::Result...
true
d2a8ef765b4c0027ffb0167b2c2f825d25cd3cc1
Rust
sym233/leetcode_problems
/2080. Range Frequency Queries/2080. Range Frequency Queries (prefix sum).rs
UTF-8
1,221
3.390625
3
[]
no_license
use std::collections::HashMap; struct RangeFreqQuery { maps: Vec<HashMap<i32, i32>>, } /** * `&self` means the method takes an immutable reference. * If you need a mutable reference, change it to `&mut self` instead. */ impl RangeFreqQuery { fn new(arr: Vec<i32>) -> Self { let mut maps: Vec<HashM...
true
89a4ab73d78178023251a6677fe694c327ccb2cd
Rust
Niedzwiedzw/learning-audio-programming
/src/lo_pass_filter.rs
UTF-8
3,822
2.75
3
[]
no_license
use hound::{WavReader, WavWriter}; use itertools::{Itertools, Tee}; use ringbuf::{Consumer, Producer, RingBuffer}; pub const INPUT_FILE: &str = "./data/audio-input.wav"; const OUTPUT_FILE_LO_PASS: &str = "./output/after-lo-pass.wav"; const OUTPUT_FILE_HI_PASS: &str = "./output/after-hi-pass.wav"; const I24_MAX: i32 =...
true
e00597df7d7c5286a7051d8f8e0568c3d049d166
Rust
iCodeIN/zbus
/zbus/src/lib.rs
UTF-8
25,202
2.921875
3
[ "MIT" ]
permissive
#![deny(rust_2018_idioms)] #![doc( html_logo_url = "https://storage.googleapis.com/fdo-gitlab-uploads/project/avatar/3213/zbus-logomark.png" )] //! This crate provides the main API you will use to interact with D-Bus from Rust. It takes care of //! the establishment of a connection, the creation, sending and recei...
true
4d6537a44cbda0dfe2148ee6009a0734f6d2c6d3
Rust
lnicola/rust-analyzer
/crates/syntax/src/parsing.rs
UTF-8
1,619
2.890625
3
[ "Apache-2.0", "MIT" ]
permissive
//! Lexing, bridging to parser (which does the actual parsing) and //! incremental reparsing. mod text_tree_sink; mod reparsing; use parser::SyntaxKind; use text_tree_sink::TextTreeSink; use crate::{syntax_node::GreenNode, AstNode, SyntaxError, SyntaxNode}; pub(crate) use crate::parsing::reparsing::incremental_repa...
true
c05484d179ea15f10193e51c77f5db6c7126db58
Rust
blakeohare/tetris
/rust-sdl/src/main.rs
UTF-8
14,257
2.765625
3
[ "CC0-1.0" ]
permissive
use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::pixels::Color; use sdl2::rect::Rect; use sdl2::render::Canvas; use sdl2::video::Window; use std::time::{Duration, SystemTime, UNIX_EPOCH}; struct Game { row_count: i32, col_count: i32, board: Vec<Vec<i32>>, overlay: Vec<Vec<i32>>, overl...
true
e38f1ee88d5a788c781a2122575aef8ae9777d90
Rust
GothenburgBitFactory/taskwarrior
/taskchampion/lib/src/workingset.rs
UTF-8
4,517
2.765625
3
[ "MIT" ]
permissive
use crate::traits::*; use crate::types::*; use taskchampion::{Uuid, WorkingSet}; #[ffizz_header::item] #[ffizz(order = 1100)] /// ***** TCWorkingSet ***** /// /// A TCWorkingSet represents a snapshot of the working set for a replica. It is not automatically /// updated based on changes in the replica. Its lifetime i...
true
d0d271587a6214f24d5de0e940bc908e9401864b
Rust
rodrigocfd/winsafe
/src/gui/window_main.rs
UTF-8
3,598
2.5625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::any::Any; use crate::co; use crate::decl::*; use crate::gui::{*, events::*, privs::*}; use crate::kernel::ffi_types::*; use crate::prelude::*; /// Keeps a raw or dialog window. #[derive(Clone)] enum RawDlg { Raw(RawMain), Dlg(DlgMain) } //---------------------------------------------------------...
true
010fc0355b0b25d888654f19603bc3c80b7a217b
Rust
allonsy/basalt
/src/agent/private.rs
UTF-8
5,357
2.53125
3
[]
no_license
use super::public; use crate::config; use glob::glob; use serde::Deserialize; use serde::Serialize; use sodiumoxide::crypto::box_; use sodiumoxide::crypto::pwhash; use sodiumoxide::crypto::sealedbox; use sodiumoxide::crypto::secretbox; use std::fs; pub trait PrivateKey { fn decrypt(&self, ciphertext: &[u8]) -> Res...
true
7c78ec94d54cbcf8076cd22236f4fe6be3ca80c6
Rust
viquezclaudio/core-rs-albatross
/nano-zkp/src/circuits/mnt6/macro_block_wrapper.rs
UTF-8
3,982
2.625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use ark_crypto_primitives::snark::BooleanInputVar; use ark_crypto_primitives::SNARKGadget; use ark_groth16::constraints::{Groth16VerifierGadget, ProofVar, VerifyingKeyVar}; use ark_groth16::{Proof, VerifyingKey}; use ark_mnt4_753::constraints::{FqVar, PairingVar}; use ark_mnt4_753::{Fq, MNT4_753}; use ark_mnt6_753::Fr ...
true
e065df9890627f00500a52d36eea5c6608d7b04a
Rust
dcafferty/rust-notes
/src/main.rs
UTF-8
2,853
2.96875
3
[]
no_license
#[allow(dead_code)] mod sh; mod controls; mod enums; mod optionmod; mod arrays; mod vectors; use std::mem; const MEANING_OF_CAFF: u8 = 64; // no fixed address static MEANING_VAR: u8 = 54; fn simple_assignment() { let mut a: u16 = 123; println!("a = {}", a); a = 456; println!("a = {}", a); le...
true
b17d8e1a0f55e673ea0d05dcd67e99bfa9bf9773
Rust
fasterthanlime/lifeclick
/src/upgrades.rs
UTF-8
2,980
2.65625
3
[]
no_license
#![allow(non_upper_case_globals)] use super::idgen::idgen; use super::items; use super::items::ItemSpec; use super::units::*; use lazy_static::lazy_static; use indoc::indoc; use std::hash::{Hash, Hasher}; #[derive(Debug)] pub struct UpgradeSpec { pub id: i64, pub cost: Souls, pub name: &'static str, ...
true
51765ab95a8499c95a93dd74f51c80ee83b7434e
Rust
hardvain/yata
/src/indicators/example.rs
UTF-8
3,680
3.1875
3
[ "Apache-2.0" ]
permissive
//! This is an example indicator //! //! It has a **Configuration** with parameters `price`, `period` and `source`. //! //! The idea is to find signals where price of timeseries crosses this config's `price` for the last `period` frames. // Some core structures and traits use crate::core::{Action, Error, IndicatorResu...
true
92eb49d87fd100766fec538aff2e7e451bf20d6a
Rust
omprakaash/rust-gb
/src/instructions.rs
UTF-8
1,076
3.5
4
[]
no_license
use std::collections::HashMap; pub struct InstructionMap<'a>{ assemblyMap: HashMap<u8, &'a str> } impl<'a> InstructionMap<'a>{ pub fn new() -> InstructionMap<'a>{ let hashMap = [ (0x00, "NOP"), (0x01, "LD BC, u16"), (0x02, "LD (BC), A"), (0x03, "inC BC"...
true
82007c6b8669b0b6db7fbe47d5890f8cc90c9d85
Rust
beltegeuse/rustlight
/src/integrators/gradient/shiftmapping/random_replay.rs
UTF-8
3,537
3
3
[]
no_license
use crate::integrators::gradient::shiftmapping::*; use crate::paths::strategies::*; use crate::samplers::Sampler; use crate::scene::Scene; use crate::structure::Color; use cgmath::Point2; // This special random number replay // can capture the underlying sampler // in order to replay the sequence of random number // i...
true
c16a111d5372aa9e111c9650e2a81170a0e35d74
Rust
freespacesystems/keylogger
/src/system/unix.rs
UTF-8
3,953
3.015625
3
[ "MIT" ]
permissive
mod input; use std::process::Command; use std::fs::File; use std::io::Read; use std::mem; use libc; use chrono::{NaiveDateTime, DateTime, Local, Utc}; use log::debug; use crate::{Config, system::PressEvent}; use self::input::{is_key_event, is_key_press, is_key_release, is_shift, get_key_text, InputEvent}; pub fn in...
true
7275c1dea57ca3b062ba9f747cab76d2ec7d2901
Rust
tuanir/threshold-rs
/src/tests/prop_beclock.rs
UTF-8
652
2.765625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate::tests::arbitrary::Musk; use crate::*; use quickcheck_macros::quickcheck; #[quickcheck] fn add_dot(actor: Musk, event: u64, beclock: BEClock<Musk>) -> bool { let mut beclock = beclock.clone(); beclock.add(&actor, event); // prop: a newly added dot is now part of the clock beclock.contains(&a...
true
5e9a6ccc895a9b096cc8044cee576f787c63adf3
Rust
jrvidal/r5.rs
/src/vm/old_environment.rs
UTF-8
3,249
2.875
3
[]
no_license
use std::collections::hash_map::HashMap; use std::fmt::{Debug, Error as FmtError, Formatter}; use gc::{Finalize, Gc, GcCell, Trace}; use helpers::*; pub type GcShared<T> = Gc<GcCell<T>>; pub struct Environment<T: 'static> { parent: Option<GcShared<Environment<T>>>, bindings: HashMap<ImmutableString, T>, } u...
true
9567c0f1512a6a62ae767bffdca1572a1ec7eda2
Rust
xiuxiu62/engine-q
/crates/nu-cli/src/completions.rs
UTF-8
7,862
2.546875
3
[ "MIT" ]
permissive
use std::{cell::RefCell, rc::Rc}; use nu_engine::eval_block; use nu_parser::{flatten_block, parse}; use nu_protocol::{ engine::{EngineState, EvaluationContext, Stack, StateWorkingSet}, Value, }; use reedline::Completer; const SEP: char = std::path::MAIN_SEPARATOR; pub struct NuCompleter { engine_state: R...
true
57ced835040c8e34e1c22ddf095963deb177d98d
Rust
IThawk/rust-project
/rust-master/src/test/ui/new-impl-syntax.rs
UTF-8
565
3.21875
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
// run-pass use std::fmt; struct Thingy { x: isize, y: isize } impl fmt::Debug for Thingy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{{ x: {:?}, y: {:?} }}", self.x, self.y) } } struct PolymorphicThingy<T> { x: T } impl<T:fmt::Debug> fmt::Debug for PolymorphicTh...
true
07b8aff69380c141d0bd3ca1fbb8397a39bf1800
Rust
ackintosh/nand2tetris
/06/assembler/src/symbol_table.rs
UTF-8
1,931
3.09375
3
[]
no_license
use std::collections::HashMap; // 6.3.4 SymbolTableモジュール pub struct SymbolTable { // ラベル, アドレス inner: HashMap<String, u16>, next_ram_address: u16, } impl SymbolTable { pub fn new() -> Self { let mut inner: HashMap<String, u16> = HashMap::new(); // 定義済みシンボル inner.insert("SP".to...
true
194319ab14722d91576a385f7fb51aa89fdd38e7
Rust
aticu/VeOS
/kernel/src/arch/x86_64/gdt.rs
UTF-8
6,721
2.5625
3
[ "MIT" ]
permissive
//! Provides the global descriptor table used by the operating system. use super::memory::{ DOUBLE_FAULT_STACK_AREA_BASE, DOUBLE_FAULT_STACK_MAX_SIZE, DOUBLE_FAULT_STACK_OFFSET, FINAL_STACK_TOP }; use core::mem::size_of; use memory::Address; use multitasking::stack::AccessType; use multitasking::Stack; use x86...
true
4fc00adb9bdf6a23443e3a30c8ed398b07fbd804
Rust
hem6/atcoder-rs
/abc165/src/bin/c.rs
UTF-8
989
2.71875
3
[]
no_license
#![allow(unused_imports)] use itertools::Itertools; use proconio::{input, marker::*}; use std::cmp::*; use std::collections::*; use superslice::*; fn main() { input! { n: usize, m: usize, q: usize, a: [[usize;4];q], } let mut ans = 0; let vecs = dfs(n, m, vec![1]); ...
true
8c27466b562779f4c66f608bc28072eae649dd0e
Rust
WorldSEnder/rust-specialization-blog
/trait-host/src/lib.rs
UTF-8
882
2.890625
3
[]
no_license
#![feature(min_specialization)] use std::fmt; use std::fmt::Display; /// A simple trait that can be specialized and has a trivial /// default implementation using Into<U>. pub trait ShowDetails { fn fmt_details(&self, f: &mut fmt::Formatter) -> fmt::Result; } #[cfg(not(feature = "with-alternative"))] impl<T> Show...
true
d8a20d14b6f82e428322b253c880ca6a59233f0f
Rust
zvkemp/xrust
/parallel-letter-frequency/example.rs
UTF-8
2,112
3.296875
3
[ "MIT" ]
permissive
use std::collections::HashMap; use std::collections::hashmap::{Occupied, Vacant}; use std::num::div_rem; /// Compute the frequency of each letter (technically of each unicode codepoint) using the given /// number of worker threads. pub fn frequency(texts: &[&str], num_workers: uint) -> HashMap<char, uint> { assert...
true
de744fd6935c6e6e8902698f2009bb6356ac3336
Rust
syusui-s/mcnotify-rust
/src/minecraft/json_data.rs
UTF-8
2,191
2.765625
3
[ "MIT" ]
permissive
extern crate serde; extern crate serde_json; use std::fmt; use std::marker::PhantomData; use std::str::FromStr; use self::serde::de::{self, Deserialize, Deserializer, MapAccess, Visitor}; fn string_or_struct<'de, T, D>(deserializer: D) -> Result<T, D::Error> where T: Deserialize<'de> + FromStr<Err = ()>, D: ...
true
58524ad3ceaa583eb10472579623bad338926ec9
Rust
myg133/otpl-core
/src/token/mod.rs
UTF-8
1,592
3.34375
3
[ "Apache-2.0" ]
permissive
pub mod ascii; use std::str::from_utf8_unchecked; /// 标记的种类 #[derive(Debug, Clone, Eq, PartialEq)] pub enum TokenKind { /// 模板结束标志 EOF, /// 用于辅助处理,标示忽略 Ignore, ///TODO: 考虑用 Literal 代替? Data, /// 符号 Symbol, /// 字符串 String, /// 整数 Int, /// 标识符 Identifier, /// ...
true
65294c24c662a98b7f003a4fbad95f3cbb305579
Rust
wolf4ood/orientdb-rs
/orientdb-client/src/common/protocol/parser.rs
UTF-8
2,592
2.859375
3
[ "Apache-2.0" ]
permissive
use crate::common::types::rid::ORecordID; use nom::number::streaming::{be_i8, be_u8}; use nom::IResult; use nom::{do_parse, named, take, try_parse}; named!(pub parse_bool<&[u8],bool>, do_parse!( val : be_i8 >> (val == 1) ) ); named!(pub parse_optimized_identity<&[u8],ORecordID>, do_parse!(...
true
1a5ef04b5a2b34c89f36e052de3bdceb5d585fef
Rust
awelch17/paramtest
/src/utils.rs
UTF-8
315
2.796875
3
[]
no_license
fn note_frequency(note_number: i32) -> f64 { return 440f64 * 2f64.powf((note_number - 69) as f64 / 12f64); } fn period_samples(note_number: i32, sample_rate: f64) -> f64 { let freq = note_frequency(note_number); let period_seconds = 1f64 / freq; return period_seconds * sample_rate; }
true
752f1ad3fc0e7b9213498b21b3f81f9b6236256f
Rust
ivanceras/svgbob
/packages/svgbob/src/buffer/cell_buffer/span.rs
UTF-8
11,476
2.75
3
[ "Apache-2.0" ]
permissive
use crate::{ buffer::{ cell_buffer::{Contacts, Endorse}, fragment_buffer::FragmentSpan, FragmentBuffer, Property, PropertyBuffer, StringBuffer, }, fragment, fragment::Circle, map::{circle_map, UNICODE_FRAGMENTS}, Cell, Fragment, Merge, Point, Settings, }; use itertools::I...
true
cfa3fe42b19a7cf7784b8eaaa2047e9f18d8e7f7
Rust
xaviershay/voxels-bench
/src/types/world.rs
UTF-8
1,316
3.171875
3
[]
no_license
use types::*; #[derive(Debug)] pub struct World { size: V3I, cells: Vec<Cell>, pub physics_fps: f32, } impl Clone for World { fn clone(&self) -> Self { World { size: self.size, cells: self.cells.clone(), physics_fps: self.physics_fps, } } } impl...
true
adaa89d134ed6d4ebb88476c78c319ec7d5ab27d
Rust
tspiteri/clap-rs
/tests/default_vals.rs
UTF-8
10,598
2.734375
3
[ "MIT" ]
permissive
extern crate clap; extern crate regex; include!("../clap-test.rs"); use clap::{App, Arg}; #[test] fn opts() { let r = App::new("df") .arg( Arg::from_usage("-o [opt] 'some opt'") .default_value("default")) .get_matches_from_safe(vec![""]); assert!(r.is_ok()); let m = r.unwrap()...
true
8b504de89ca96a92880782f5cecd3222cdd3b66e
Rust
isgasho/em-refactor
/em-refactor-examples/lift_function_declaration/method_parent_is_impl_for.rs
UTF-8
149
2.53125
3
[ "Apache-2.0" ]
permissive
fn main() { } struct S; trait T { fn foo(&self) {} } impl T for S { fn foo(&self) { fn bar(self_: &S) { } bar(self); } }
true
ae14b8fcd64bb1aacd9720c247040560ceb1364e
Rust
davidjrichardson/aoc2020
/src/days/day_5.rs
UTF-8
1,554
2.984375
3
[]
no_license
use crate::days::Challenge; use itertools::Itertools; use std::{fs, path::Path}; pub struct Day5<'a> { data: Vec<u16>, file_path: &'a Path, part_1_ans: Option<u16>, part_2_ans: Option<u16>, } impl<'a> Day5<'_> { pub fn build(file_path: &'a Path) -> Box<Day5> { Box::new(Day5 { d...
true
fd0b4d6769b45e8b479232088651981875832daa
Rust
hockeybuggy/rust_pong
/src/main.rs
UTF-8
1,521
2.578125
3
[]
no_license
extern crate glutin_window; extern crate graphics; extern crate opengl_graphics; extern crate piston; extern crate rand; use glutin_window::GlutinWindow as Window; use opengl_graphics::OpenGL; use piston::event_loop::*; use piston::input::*; use piston::window::WindowSettings; mod pong; use pong::game::Game; use pon...
true
55321b8876b9e8a5ab95705828e49f95b6361ed2
Rust
anderslanglands/openexr-bind
/openexr-rs/src/core/preview_image.rs
UTF-8
21,690
2.953125
3
[ "BSD-3-Clause" ]
permissive
use crate::Error; use half::f16; use openexr_sys as sys; use crate::core::refptr::{OpaquePtr, Ref, RefMut}; type Result<T, E = Error> = std::result::Result<T, E>; /// A usually small, low-dynamic range image, /// that is intended to be stored in an image file's header #[repr(transparent)] pub struct Previ...
true
15b0719f56ddd9269fc1727579b3860ee84b92a2
Rust
brl/citadel-tools
/realm-config-ui/src/new_realm/verifier.rs
UTF-8
2,343
2.765625
3
[]
no_license
use std::cell::RefCell; use std::rc::Rc; use gtk::prelude::*; use gtk::subclass::prelude::*; use libcitadel::Realm; use crate::new_realm::dialog::NewRealmDialog; pub struct RealmNameVerifier { ok: gtk::Widget, infobar: gtk::InfoBar, infolabel: gtk::Label, label: gtk::Label, config: gtk::Button, ...
true
3f78bbf0051241dcb1c9ac7399eb5ded64f598e5
Rust
susliko/ext2
/src/bin/server.rs
UTF-8
5,437
2.9375
3
[]
no_license
use ::fs::Fs; use anyhow::Error; use daemonize::Daemonize; use std::env; use std::fs::File; use std::io::prelude::*; use std::io::{BufReader, BufWriter, Write}; use std::net::{TcpListener, TcpStream}; use std::str::FromStr; #[derive(Debug)] enum Command { Pwd, Ls, Help, Exit, Cd(String), Touch(String), M...
true
d2490c0dcfa2e20046c75e9448d9870fbb3f37be
Rust
drbawb/aqua
/src/util/db.rs
UTF-8
3,064
2.734375
3
[ "BSD-3-Clause" ]
permissive
use std::convert::From; use std::error::Error; use std::env; use std::fmt; use aqua_web::plug; use aqua_web::result::Error as AquaError; use diesel::result::Error as DieselError; use diesel::pg::PgConnection; use r2d2::{self, Config, Pool, PooledConnection}; use r2d2_diesel::ConnectionManager; /// The extension regi...
true
8a9b01498ab7a36f09f4de4086ac37de03ff6856
Rust
myharvestlife/advent_of_code_2020
/day13/src/main.rs
UTF-8
3,311
3.515625
4
[]
no_license
use std::env; use std::fs; use math::round; use num::integer::lcm; fn main() -> Result<(), String> { let args: Vec<String> = env::args().collect(); println!("{:?}", args); if args.len() > 2 { return Err(String::from("Too many args")); } let part: u64 = args[1].to_string().parse::<u64>()....
true
6ae26dff15ec862f1e5a27b3c2f8b88242c07b3e
Rust
GlitterIsMe/RedisServer
/src/simple_mem_db.rs
UTF-8
697
3.109375
3
[]
no_license
use crate::redis_server::DB; use crate::redis_server::DBError; use std::collections::btree_map::BTreeMap; #[derive(Clone)] pub struct SimpleMemDB{ table: BTreeMap<String, String>, } impl SimpleMemDB { pub fn new() -> Self{ SimpleMemDB{ table: BTreeMap::new(), } } } impl DB for...
true
ade403fbac18c19dcbb47745e5898da3adf10c37
Rust
jpastuszek/denim
/src/project.rs
UTF-8
2,378
2.765625
3
[ "MIT" ]
permissive
use cotton::prelude::*; mod cargo; pub use cargo::{CargoMode, Cargo}; #[derive(Debug)] pub struct Project { pub(self) name: String, pub(self) home: PathBuf, pub(self) script: PathBuf, } impl Project { pub fn new(script: PathBuf) -> PResult<Project> { let script = script.canonicalize().problem...
true
73bdd6d34516497628aea3f301108092b1aa82f7
Rust
rustkas/error-index
/main_tests/tests/e0364.rs
UTF-8
979
2.71875
3
[ "MIT" ]
permissive
/* Private items cannot be publicly re-exported. This error indicates that you attempted to pub use a type or value that was not itself public. */ // cargo test --test e0309 with_error1 // cargo test --test e0364 without_error1 #[cfg(test)] mod tests { #[allow(dead_code)] #[allow(non_snake_case)] #[allow(u...
true
03c75aa993ce31c29bf204b49ef06e3e355783f1
Rust
spriest487/uncle-pascal
/pas_syn/src/token_tree/lex.rs
UTF-8
19,183
3.015625
3
[]
no_license
use crate::{ consts::{IntConstant, RealConstant}, ident::Ident, keyword::Keyword, operators::Operator, token_tree::{DelimiterPair, Separator, TokenTree, TokenizeError, TokenizeResult}, }; use pas_common::{span::*, BuildOptions, TracedError}; use std::{path::PathBuf, rc::Rc}; use crate::operators::Co...
true
9977920154d86d225f37d4eb3cb21d57537562d5
Rust
moroso/compiler
/src/ir/constant_fold.rs
UTF-8
8,131
2.84375
3
[]
no_license
// Constant folding. use util::IntKind; use ir::util::subst; use std::collections::{BTreeSet, BTreeMap}; use mc::ast::*; use ir::*; use values::{eval_binop, eval_unop}; pub struct ConstantFolder; fn set_signedness(l: &LitNode, signed: bool) -> LitNode { match *l { NumLit(v, kind) => match kind...
true
8731b8c6b4be763c7d955e156311a1903e866f36
Rust
dwins/rocketbooth
/src/av/codec.rs
UTF-8
5,411
2.53125
3
[]
no_license
use std::ptr::null_mut; use av::sys::*; use av::format::{ Frame, }; use av::util::Packet; pub use av::sys::AVCodecID as CodecID; pub struct CodecContext(*mut AVCodecContext, *mut AVCodec); /// I promise it's ok to access the same CodecContext from multiple threads. unsafe impl Send for CodecContext {} impl Cod...
true
e12fcb47836769739c8a0cb42aaa241327d6d65b
Rust
andrew-pa/font-engine-rs
/src/truetype_loader/char_glyph_mapping_table.rs
UTF-8
7,540
2.53125
3
[]
no_license
use std::io; use std::io::prelude::*; use std::fmt; use std::fmt::{Debug}; use std::mem; use std::fs::File; use byteorder::{ByteOrder, BigEndian, ReadBytesExt}; use super::*; #[repr(C)] #[derive(Copy, Clone, Debug)] pub struct HighByteMappingSubheader { first_code: u16, entry_count: u16, id_delta: i16, ...
true
368e3378560f3594c3bbbeb332bad45de0538177
Rust
pola-rs/polars
/crates/polars-core/src/chunked_array/ops/peaks.rs
UTF-8
593
2.71875
3
[ "MIT" ]
permissive
use num_traits::Zero; use crate::prelude::*; impl<T> ChunkPeaks for ChunkedArray<T> where T: PolarsNumericType, { /// Get a boolean mask of the local maximum peaks. fn peak_max(&self) -> BooleanChunked { (self.shift_and_fill(1, Some(Zero::zero())).lt(self)) & (self.shift_and_fill(-1, S...
true
291919275c3f67a603792512ae67dae83b08c8e0
Rust
almedso/on-off-sequence-output
/src/lib.rs
UTF-8
9,568
3.53125
4
[ "MIT" ]
permissive
//! Output of a sequence of on/off states //! //! * the state sequence can be modified //! * the sequence can be repeated //! * An `update()` should be called periodically progress the output //! in time. //! //! # Implementation //! //! * The OutputLED Structure aggregates a GPIO, (bound at init) //! * Output Patter...
true
5f435e6a02c96df4428c400aa867b25e05b97079
Rust
geobeau/rustedPost
/src/record/mod.rs
UTF-8
2,412
2.859375
3
[ "Apache-2.0" ]
permissive
use itertools::free::join; use ahash::{RandomState}; use serde::{Deserialize, Serialize}; use smallstr::SmallString; use smallvec::SmallVec; use std::cmp::Eq; use std::fmt; use std::hash::{BuildHasher, Hash, Hasher}; use std::str; use std::sync::Arc; pub mod query; /////////////////////////// REGULAR RECORDS ////////...
true
ce143515cff3bafed9a97d324f4a46d1752a43ab
Rust
canndrew/future-utils
/src/first_ok.rs
UTF-8
1,342
3.265625
3
[]
no_license
use std::mem; use futures::{Async, Future, Stream}; /// Adapts a stream to a future by taking the first successful item yielded by the stream. If the /// stream ends before yielding an `Ok` then all the errors that were yielded by the stream are /// returned in a vector. pub struct FirstOk<S> where S: Stream, { ...
true
bfb765f38113e559e0c23c901d60cbdc3d379c8a
Rust
rodrimati1992/abi_stable_crates
/abi_stable/src/library/root_mod_trait.rs
UTF-8
13,244
2.90625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use super::*; use crate::{prefix_type::PrefixRefTrait, utils::leak_value}; /// The root module of a dynamic library, /// which may contain other modules,function pointers,and static references. /// /// /// # Examples /// /// For a more in-context example of a type implementing this trait you can look /// at either th...
true
5e98f08cbeb44385b2d1f96ba12f21bbd50faedf
Rust
jz4o/codingames
/rust/practice/classic_puzzle/easy/feature-extraction.rs
UTF-8
2,580
3.09375
3
[]
no_license
use std::io; macro_rules! parse_input { ($x:expr, $t:ident) => ($x.trim().parse::<$t>().unwrap()) } /** * Auto-generated code below aims at helping you parse * the standard input according to the problem statement. **/ fn main() { let mut input_line = String::new(); io::stdin().read_line(&mut input_lin...
true
29d7bd14807b2cb8eb279e395d535268e23e6175
Rust
Ben-Lichtman/advent_of_code_2020
/src/day2.rs
UTF-8
1,048
3.40625
3
[]
no_license
use parse_display::FromStr; use std::fs::read_to_string; #[derive(FromStr)] #[display(r"{num_a}-{num_b} {c}: {pw}")] struct Password { num_a: u32, num_b: u32, c: char, pw: String, } impl Password { fn is_valid_1(&self) -> bool { let count = self.pw.chars().filter(|c| *c == self.c).count() as u32; self.num_a...
true
a6bfded2ef222e571933fa4b61f4d5d955e286fa
Rust
VanillaBrooks/rust-kf
/tests/line.rs
UTF-8
995
3.203125
3
[]
no_license
use kalman_rs::geometry::trapezoid::Line; use kalman_rs::config::*; #[test] fn line1 () { let p1 = P2::new(2.0, 2.0); let p2 = P2::new(0.0, 0.0); let line = Line::new_from_points(&p1, &p2); assert_eq!(line.slope, 1.0); assert_eq!(line.yint, 0.0); } #[test] fn line2 () { let p1 = P2::new(2.0,...
true
7ef2e974cc86aabd449995d2bff1982b4da8c4e7
Rust
uutils/coreutils
/src/uucore/src/lib/mods/panic.rs
UTF-8
1,515
2.546875
3
[ "MIT", "GPL-1.0-or-later", "GPL-3.0-or-later" ]
permissive
// This file is part of the uutils coreutils package. // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. //! Custom panic hooks that allow silencing certain types of errors. //! //! Use the [`mute_sigpipe_panic`] function to silence panics c...
true
e5b932b09f5c9f0e94a9f0ecf8d3aa4d531ce232
Rust
fossabot/necsim-rust
/rust-cuda/rust-cuda-derive/src/rust_to_cuda/field_ty.rs
UTF-8
3,470
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
permissive
use syn::parse_quote; #[allow(clippy::module_name_repetitions)] pub enum CudaReprFieldTy { BoxedSlice(proc_macro2::TokenStream), Embedded(Box<syn::Type>), Eval(proc_macro2::TokenStream), Phantom(Box<syn::Type>), } pub fn swap_field_type_and_get_cuda_repr_ty(field: &mut syn::Field) -> Option<CudaReprFi...
true
5754abc94574170feb6cfe413f830c8c22ca9eb5
Rust
kodegenix/kg-syntax
/kg-syntax/src/grammar/mod.rs
UTF-8
15,441
2.90625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use super::*; pub mod parse; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Lang { JavaScript, Rust, } #[derive(Debug)] pub struct Code { pos: Position, lang: Lang, source: String, } #[derive(Debug)] pub struct Grammar { modes: Vec<Mode>, channels: Vec<Channel>, terminals: Vec...
true
5b1d1e353ef828cddab232756e536d5a37322292
Rust
TyOverby/difftest
/expectation-shared/src/filesystem.rs
UTF-8
5,073
2.953125
3
[]
no_license
use std::cell::RefCell; use std::collections::HashMap; use std::fs::{create_dir_all, File}; use std::io::{BufRead, Cursor, Result as IoResult, Seek, Write}; use std::io::{BufReader, BufWriter, Error as IoError, ErrorKind}; use std::path::{Path, PathBuf}; use std::rc::Rc; pub trait ReadSeek: Seek + BufRead {} impl<R: B...
true
1579070f0634a7ea4ac95da0eb1279bb9ab274b5
Rust
oltrep/tarmac
/packos/src/types.rs
UTF-8
2,424
3.28125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate::{geometry::Rect, id::Id}; /// An input to the rectangle packing routines. /// /// `InputItem` is just a 2D size and a Packos-generated unique identifier. It's /// expected that consumers will assign meaning to the given IDs and then use /// them to associate the packing results back to the application's own...
true
69cac9fc6e7df4cfac771f72a0bd81be35e78d02
Rust
care0717/lsm_engine
/src/memtable.rs
UTF-8
1,880
3.171875
3
[ "MIT" ]
permissive
use crate::avl::AvlTreeMap; use crate::value::Value; use crate::wal::Wal; use anyhow::Result; use log::info; use std::iter::FromIterator; pub trait Memtable: Sync + Send { fn insert(&mut self, key: String, value: Value) -> Result<()>; fn delete(&mut self, key: &String) -> Result<()>; fn search(&self, key: ...
true
775144b16bac2eec77b3943551be9783c6a0092b
Rust
onelson/destiny2-api-rs
/codegen/src/models/destiny_definitions_director_destiny_activity_graph_definition.rs
UTF-8
10,090
2.796875
3
[]
no_license
/* * Bungie.Net API * * These endpoints constitute the functionality exposed by Bungie.net, both for more traditional website functionality and for connectivity to Bungie video games and their related functionality. * * OpenAPI spec version: 2.0.0 * Contact: support@bungie.com * Generated by: https://github.com...
true