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
a688d0f539a716b4a7be842045e0c542b315e39a
Rust
vain0x/hsp3-ginger
/hsp3-forgery/hf_core/src/world.rs
UTF-8
1,524
2.65625
3
[ "MIT", "CC0-1.0" ]
permissive
use crate::source::*; use crate::syntax::*; use crate::token::*; use std::collections::HashMap; use std::fs; use std::rc::Rc; pub(crate) fn load_source_codes( source_files: impl Iterator<Item = SourceFile>, source_codes: &mut HashMap<SourceFile, Rc<SourceCode>>, ) { for source_file in source_files { ...
true
b60f247d4dc2f8fd13f80b01d4e620d3b36292cc
Rust
hideakitai/Sketches
/s034_wgpu_refactor/src/renderer/draw/properties/spatial/orientation.rs
UTF-8
7,507
3.453125
3
[ "MIT" ]
permissive
use nannou::geom::{self, Point3, Vector3}; use nannou::math::{ cgmath, deg_to_rad, turns_to_rad, Angle, BaseFloat, Euler, Quaternion, Rad, Zero, }; /// Orientation properties for **Drawing** a **Primitive**. #[derive(Copy, Clone, Debug, PartialEq)] pub enum Properties<S = geom::scalar::Default> { /// The orien...
true
4a96ea8311af0ff73f4316a6807dc0a22b298c60
Rust
geometryolife/goscript
/vm/src/stack.rs
UTF-8
20,379
2.515625
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
#![allow(dead_code)] use super::gc::GcoVec; use super::instruction::{Instruction, OpIndex, Opcode, ValueType}; use super::metadata::GosMetadata; use super::value::*; use std::cell::RefCell; use std::cmp::Ordering; use std::fmt::{self, Display}; use std::mem; use std::rc::Rc; const DEFAULT_SIZE: usize = 10240; macro_r...
true
91cba08959b59a3b7e02ebe69588cee6480323ae
Rust
nicolasjhampton/rust-server-framework
/http/src/protocol.rs
UTF-8
918
3.296875
3
[]
no_license
use std::fmt; #[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum Protocol { HTTP1_1, HTTP2 } impl From<&str> for Protocol { fn from(protocol: &str) -> Protocol { match protocol { "HTTP/1.1" => Protocol::HTTP1_1, "HTTP/2.0" => Protocol::HTTP2, _ => panic!("In...
true
4c4309c332473ac632acd14bcf159e4f6c4f40b3
Rust
w1ndy/leetcode-rust
/add_two_numbers.rs
UTF-8
1,507
3.515625
4
[]
no_license
use List::*; enum List { Cons(i32, Box<List>), Nil, } impl List { fn stringify(&self) -> String { match *self { Cons(a, ref tail) => format!("{}, {}", a, tail.stringify()), Nil => format!("Nil") } } } fn dissolve_number(num: i32) -> List { match num { ...
true
fadc6d343273a44ec09cb2883d7cfe7f06026512
Rust
sjinno/exercism
/raindrops/src/lib.rs
UTF-8
314
3.078125
3
[]
no_license
pub fn raindrops(n: usize) -> String { let is_factor = |factor| n % factor == 0; let mut s = String::new(); if is_factor(3) { s.push_str("Pling"); } if is_factor(5) { s.push_str("Plang"); } if is_factor(7) { s.push_str("Plong"); } if s.is_empty() { return n.to_string(); } s }
true
aed95e4d03b91a85f5485041d72ec2744d3edcb3
Rust
Corallus-Caninus/windows-rs
/crates/deps/gen/src/bstr.rs
UTF-8
5,380
2.609375
3
[]
no_license
use super::*; pub fn gen_bstr() -> TokenStream { quote! { #[repr(transparent)] #[derive(::core::cmp::Eq)] pub struct BSTR(pub *mut u16); impl BSTR { pub fn new() -> Self { Self(core::ptr::null_mut()) } pub fn is_empty(&self) -> bo...
true
a8afeb0688d34f5eb86cf08aed087734126f5924
Rust
ivanceras/ivancerust
/src/octree.rs
UTF-8
323
2.65625
3
[]
no_license
//octree.rs struct Atom{ color: Color, normal: Normal, reflectivity: f32, refraction: f32, diffuse: f32 } struct Octree{ depth: u64, children: Vec<Octree>, leaf_data: Vec<Atom>, } struct VoxelOctree{ root: Octree, } impl Octree{ fn is_leaf(&self) -> bool { self.children.len() == 0 }...
true
8ccb4a4fc5efcf999f94f601d513e3e7b0894b92
Rust
alanstoate/GrillRust
/examples/basic.rs
UTF-8
1,389
2.65625
3
[]
no_license
extern crate GrillRust; extern crate rulinalg; use GrillRust::element_properties::*; use GrillRust::structure::*; use GrillRust::element::*; use GrillRust::utils::*; use rulinalg::matrix::{Matrix, BaseMatrix}; fn main() { // Initialise Element properties let props = ElementProperties::new(426.6, 1.0, 167.1,...
true
2631ed9bcae1eef494595bd528ba5d2a312cc0b8
Rust
Yoric/liarslie
/src/play.rs
UTF-8
3,492
2.984375
3
[]
no_license
use std::path::PathBuf; use log::*; use crate::agent; use crate::conf::*; pub struct PlayArgs { pub path: PathBuf, } pub async fn play(args: &PlayArgs) -> Option<bool> { // Attempt to parse configuration. let file = std::fs::File::open(&args.path).expect("Could not open file"); let conf: Conf = serd...
true
2879ac49b25dd2f2a4da37c255bf77a1e9333dfb
Rust
aniketfuryrocks/leet_code
/src/custom_sort_string.rs
UTF-8
1,111
3.75
4
[]
no_license
use std::{cmp::Ordering, collections::HashMap}; /// 1. order has length at most 26, and no character is repeated in order. /// 2. str has length at most 200. /// 3. order and str consist of lowercase letters only. #[allow(dead_code)] fn custom_sort_string(order: String, str: String) -> String { // get chars let...
true
da3bbc73e452d462ddfb9574713271e94f834ab1
Rust
Beecallpaw/rust_practice
/mygrep/src/lib.rs
UTF-8
2,516
3.53125
4
[]
no_license
use std::env; use std::error::Error; use std::fs; pub struct Config { pub search_item: String, pub filename: String, pub case_sensitive: bool, } impl Config { pub fn new(mut args: std::env::Args) -> Result<Config, &'static str> { args.next(); let search_item = match args.next() { ...
true
96b5c738dfa58907a8fe8d98530d9178f57a1d6f
Rust
ykafia/la-rete-rs
/src/json/tests/t02.rs
UTF-8
2,313
2.640625
3
[ "MIT" ]
permissive
use crate::json::std as j; use crate::prelude::*; const LEN_EQ_0: &'static str = "len-eq-0"; const LEN_EQ_5: &'static str = "len-eq-5"; const LEN_GTE_7: &'static str = "len-gte-4"; const LEN_GT_5: &'static str = "len-gt-5"; const LEN_LTE_2: &'static str = "len-lte-2"; const LEN_LT_4: &'static str = "len-lt-4"; #[te...
true
b859b88f33691456b4715e1f910fa36c38ed3879
Rust
willmcpherson2/frac
/src/view.rs
UTF-8
2,963
2.96875
3
[]
no_license
use crate::model::State; use quicksilver::geom::Rectangle; use quicksilver::geom::Transform; use quicksilver::geom::Vector; use quicksilver::graphics::Color; use quicksilver::graphics::ResizeHandler; use quicksilver::input::Event; use quicksilver::input::Key; use quicksilver::Graphics; use quicksilver::Input; use quick...
true
b8e8c47f5bd1f84d2334af35c9a84880f7462433
Rust
bbrener1/double_tree_cut
/src/cluster.rs
UTF-8
4,629
2.921875
3
[]
no_license
use rulinalg::matrix::{Matrix,BaseMatrix,Axes}; use rulinalg::vector::Vector; use std::sync::Arc; use io::Parameters; use io::Distance; use std::iter::once; pub struct Cluster { pub id: usize, members: Vec<usize>, radius: f64, center: Vector<f64>, matrix: Arc<Matrix<f64>>, distance: Distance, ...
true
7a3cd2df22494752d4a81baf9ab3616bd2f98eec
Rust
nezdolik/reproto
/it/rust_reqwest/structures/default/rust/reproto.rs
UTF-8
1,092
2.71875
3
[ "MIT", "Apache-2.0" ]
permissive
use reqwest; use reqwest::header::parsing; use std::fmt; use std::result; #[derive(Debug)] pub enum Error { ReqwestError(reqwest::Error), UrlError(reqwest::UrlError), FormatError(fmt::Error), } pub type Result<T> = result::Result<T, Error>; impl From<reqwest::Error> for Error { fn from(value: reqwest::Error)...
true
d65d37dcef96d81be4ff82aa75ef8d03e8e41bb6
Rust
kyle-silver/advent-of-code-2017
/tests/day05.rs
UTF-8
1,014
3.015625
3
[]
no_license
#[test] fn part1() { let mut input: Vec<i32> = include_str!("res/05.txt") .lines() .map(|s| s.parse().unwrap()) .collect(); let mut cur: isize = 0; let mut count = 0; while let Some(jump) = if cur >= 0 { input.get_mut(cur as usize) } else { None } { ...
true
27018c2c54ee42ec4fdcf90d3d939da475cf0692
Rust
pop-os/intel-pstate
/src/lib.rs
UTF-8
6,126
2.875
3
[ "MIT" ]
permissive
// Copyright 2022 System76 <info@system76.com> // SPDX-License-Identifier: MIT //! Crate for fetching and modifying the intel_pstate kernel parameters. //! //! # Example //! //! ```rust,no_run //! use intel_pstate::{PState, PStateError}; //! //! fn main() -> Result<(), PStateError> { //! let pstate = PState::new()...
true
9429e398f9a37b3b970ee3597534485d3cacacc7
Rust
SGecko-Design4Green/design4green-api
/bin/import/src/main.rs
UTF-8
3,320
2.703125
3
[]
no_license
use csv_entry_storage::entry_csv::EntryCSV; use csv_entry_storage::CSVEntryStorage; use csv_entry_storage::PostalCodeCsvStorage; use sled_db_entry_storage::SledEntriesStorage; use domain::core::entry::*; use domain::storage::traits::EntryStorageTrait; use serde::de::DeserializeOwned; use std::boxed::Box; use std::coll...
true
82137144c873b8d78e9363d1f3857a7a4bba7f40
Rust
Dentosal/brain-opt
/src/target_abi/mod.rs
UTF-8
2,143
3.0625
3
[ "MIT" ]
permissive
mod linux; mod macos; use strum_macros::{EnumString, EnumVariantNames}; use crate::instruction::{Instruction, Register64}; /// Instructions for linking #[derive(Debug, Clone, PartialEq, Eq)] pub struct LinkerInfo { /// Entry point symbol name, e.g. `main` pub entrypoint: String, /// Libraries to link aga...
true
9a7e241e6bc82d54b3e1497593fa0670798cdeef
Rust
mdtusz/azul
/src/widgets/text_input.rs
UTF-8
2,755
3.078125
3
[ "MIT" ]
permissive
//! Text input (demonstrates two-way data binding) use { traits::{Layout, DefaultCallbackFn}, dom::{Dom, On, NodeType, UpdateScreen}, window::{FakeWindow, WindowEvent}, prelude::{VirtualKeyCode}, default_callbacks::{StackCheckedPointer, DefaultCallback, DefaultCallbackId}, app_state::AppStateNo...
true
57f58c18e58157630fa6a988a8e22f2af23f5e27
Rust
micahscopes/cobwebs-rs
/src/intersections.rs
UTF-8
1,797
3
3
[ "MIT", "Apache-2.0" ]
permissive
use crate::geometry::EdgeGeo; use crate::layout::GraphLayout; use geo::algorithm::intersects::Intersects; use petgraph::graph::EdgeIndex; use rstar::RTreeObject; pub fn edge_intersects_edges<'a>( edge: EdgeGeo, edges: impl Iterator<Item = (&'a EdgeIndex, &'a EdgeGeo)>, ) -> impl Iterator<Item = (&'a EdgeIndex,...
true
c40c9db38c0c1d407925cc5faa9f7110196c77cf
Rust
PacktPublishing/Rust-Programming-Cookbook
/Chapter02/mut-sharing-ownership/src/lib.rs
UTF-8
3,654
3.703125
4
[ "MIT" ]
permissive
#![feature(test)] #[cfg(test)] mod tests { extern crate test; use test::Bencher; #[bench] fn bench_regular_push(b: &mut Bencher) { let mut v = vec![]; b.iter(|| { for _ in 0..1_000 { v.push(10); } }); } #[bench] fn bench_refc...
true
e0e06b34c2b4b757d7fc783fec44ac77d32ad4a0
Rust
fralken/ray-tracing-in-one-weekend
/src/main.rs
UTF-8
3,851
2.765625
3
[]
no_license
mod ray; mod hitable; mod material; mod sphere; mod camera; use std::f32; use nalgebra::Vector3; use rand::Rng; use rayon::prelude::*; use crate::ray::Ray; use crate::material::{Lambertian, Metal, Dielectric}; use crate::hitable::{Hitable, HitableList}; use crate::sphere::Sphere; use crate::camera::Camera; fn random_...
true
4e4bbef793116e04d01c23a2d679620a38a45e74
Rust
albhaf/adventofcode-2016
/rust/src/bin/12.rs
UTF-8
3,093
3.140625
3
[]
no_license
use std::collections::HashMap; use std::io; fn main() { let mut registers = HashMap::new(); registers.insert('a', 0 as u32); registers.insert('b', 0 as u32); registers.insert('c', 0 as u32); registers.insert('d', 0 as u32); let instructions: Vec<String> = { let mut vec = Vec::new(); ...
true
1f2ef839d7cc5bcc65bda45758297e3803d570e0
Rust
drone-os/drone-core
/src/sync/spsc/ring/sender.rs
UTF-8
11,976
2.9375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use super::{ add_cursor, add_length, claim_next_if_full, get_cursor, get_length, has_close_waker, has_flush_waker, has_ready_waker, has_waker, set_close_waker, set_flush_waker, set_ready_waker, Receiver, Shared, State, CLOSED, ERR_STORED, HALF_DROPPED, RX_WAKER_STORED, }; use core::cell::UnsafeCell; use cor...
true
793497e3fab6a96927f12166931d0771f887ba2f
Rust
hmvp/rust_poc
/src/stm32f3348_discovery/button.rs
UTF-8
676
2.8125
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! User LEDs use stm32f3x4::{GPIOA, Gpioa, Rcc}; /// All the user BUTTONS pub static BUTTONS: [Button; 1] = [ Button(), ]; /// An Button pub struct Button(); impl Button { /// Turns on the LED pub fn state(&self) -> bool { // NOTE(safe) atomic write unsafe { (*GPIOA.get()).idr.read()...
true
81ed727c0f1994803ef6588e292561e84d76cff0
Rust
47ng/strava-auth-cli
/src/server.rs
UTF-8
1,385
2.890625
3
[ "MIT" ]
permissive
use rocket::config::{Config, Environment, LoggingLevel}; use rocket::http::RawStr; use rocket::State; use std::sync::{mpsc, Mutex}; #[derive(Debug)] pub struct AuthInfo { pub code: String, pub scopes: Vec<String>, } impl AuthInfo { pub fn new(code: &RawStr, scopes: &RawStr) -> Self { Self { code: Stri...
true
fe5a6bff15534160b13e9f629756debf9641b845
Rust
Nurs717/draw_rust
/src/main.rs
UTF-8
1,004
2.890625
3
[]
no_license
mod geometrical_shapes; use geometrical_shapes as gs; use gs::{Displayable, Drawable}; use raster::{Image, Color}; fn main() { let mut image = Image::blank(1000, 1000); gs::Line::random(image.width, image.height).draw(&mut image); gs::Point::random(image.width, image.height).draw(&mut image); let r...
true
27923f964c488ad77558bfb0d0b38d998ebea806
Rust
mcginty/snow
/src/params/mod.rs
UTF-8
9,860
2.703125
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! All structures related to Noise parameter definitions (cryptographic primitive choices, protocol //! patterns/names) use crate::error::{Error, PatternProblem}; use std::str::FromStr; mod patterns; pub use self::patterns::{ HandshakeChoice, HandshakeModifier, HandshakeModifierList, HandshakePattern, SUPPOR...
true
bb40aebe867cbeb54686b6bc186b9728f833f8f2
Rust
RicardoNiepel/30-days-of-code
/rust/src/day0/tests.rs
UTF-8
333
2.953125
3
[ "MIT" ]
permissive
#[test] fn it_works() { let input = b"Welcome to 30 Days of Code!\n"; let expected_output = "Hello, World.\nWelcome to 30 Days of Code!\n"; let mut output = Vec::new(); super::run(&input[..], &mut output); let output = String::from_utf8(output).expect("Not UTF-8"); assert_eq!(expected_output...
true
8dca0299537b0f5f058a7a6fbda0f37b28976fcb
Rust
MirrorBytes/slimweb
/src/client/response.rs
UTF-8
1,513
2.8125
3
[ "MIT" ]
permissive
use std::time::Instant; #[cfg(feature = "json")] use serde_json::Value; use crate::{ stream::{ self, Stream, Compressed, Chunked }, error::Error, body::Body, StatusInfo, GeneralInfo, }; #[derive(Debug)] pub struct ClientResponse { pub info: GeneralInfo, pub body: Body, } impl ClientResponse { /// Create a n...
true
f334e55ec02e81b0bc56012e262e4a10de28fd2e
Rust
alekratz/interkern
/src/memory/map.rs
UTF-8
858
2.703125
3
[]
no_license
//! The operating system's memory map. //! //! Every place in memory must be mapped in such a way that it does not overlap. This module helps //! lay out all memory regions in a single location so that conflicts are easy to spot. /// Base for user-space virtual addresses. pub const USER_BASE: usize ...
true
c6e827f4515f06ca4e28ada45d9b436e3ed04569
Rust
jvff/mock-service
/src/hash_mock_service_handle.rs
UTF-8
1,560
2.953125
3
[]
no_license
use std::collections::HashMap; use std::hash::Hash; use super::mock_action::MockAction; use super::mock_service_handle::MockServiceHandle; enum Change<A, B> { Set(A, Box<MockAction<Request = A, Response = B>>), Remove(A), } pub struct HashMockServiceHandle<A, B> where A: Eq + Hash, { changes: Vec<Cha...
true
94b40d21d4100146a366817c9aa92e9f1d708d71
Rust
veminovici/aabel
/sketches/sketch-hashing/src/my_hasher.rs
UTF-8
771
2.96875
3
[ "MIT" ]
permissive
use std::hash::{ Hash, Hasher}; use crate::HashExt; pub struct MyHasher { bytes: Vec<u8>, k: u64, q: u64, p: u64, } impl MyHasher { fn new(k: u64, q: u64, p: u64) -> Self { Self { bytes: vec![], k, q, p, } } pub fn get_hash<T...
true
fb911cfc8fb032c64279fecb9c03e21d53312bcb
Rust
pnkfelix/rust
/src/test/ui/regions/region-object-lifetime-4.rs
UTF-8
661
2.671875
3
[ "Apache-2.0", "MIT", "BSD-3-Clause", "BSD-2-Clause", "LicenseRef-scancode-other-permissive", "NCSA" ]
permissive
// Various tests related to testing how region inference works // with respect to the object receivers. // revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir trait Foo { fn borrowed<'a>(&'a self) -> &'a (); } // Here we have two distinct lifetimes, but we try to return a pointe...
true
d1bccb27fd116e2b08bb1dc9d605cf51b0b39441
Rust
dhbradshaw/ProjectEulerFastRust
/src/numberletters.rs
UTF-8
4,037
3.9375
4
[]
no_license
fn spell_under_20(n: u16) -> String { let ones = match n { 1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five", 6 => "six", 7 => "seven", 8 => "eight", 9 => "nine", 10 => "ten", 11 => "eleven", 12 => "twelve",...
true
4ab1358f91c14a7106d15285a81604dec55f0da9
Rust
manueldeval/synth
/src/synth/dsp/effects/drive.rs
UTF-8
941
2.859375
3
[]
no_license
use crate::synth::dsp::audionode::AudioNode; use crate::synth::utils::converters::non_linearized; /* ========================================= Drive ========================================= */ pub struct DriveNode { input: f32, output: f32, amount: f32 } impl DriveNode { pub const INPUT_VALUE: i32 = 0; pu...
true
9d86f1fb7042bebd3faa422089075e9444acb429
Rust
iCodeIN/cala
/src/net.rs
UTF-8
6,188
2.53125
3
[ "BSL-1.0", "MIT", "Zlib", "Apache-2.0" ]
permissive
// Cala // Copyright © 2017-2021 Jeron Aldaron Lau. // // Licensed under any of: // - Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0) // - MIT License (https://mit-license.org/) // - Boost Software License, Version 1.0 (https://www.boost.org/LICENSE_1_0.txt) // At your choosing (See accompanyi...
true
eb0c1f330a8b3d845c73b6d58837ff73d71b608b
Rust
isabella232/onefuzz
/src/agent/storage-queue/src/lib.rs
UTF-8
5,451
2.6875
3
[ "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. use anyhow::{bail, Context, Result}; use reqwest::{Client, Url}; use reqwest_retry::SendRetry; use serde::{Deserialize, Serialize}; use std::time::Duration; use uuid::Uuid; pub const EMPTY_QUEUE_DELAY: Duration = Duration::from_secs(10); #[de...
true
6f01ea9e9b3b3b53942ee8a66ffcb3dca1cea00a
Rust
harmakhis971/Rust-Duplicati-Restore
/src/database.rs
UTF-8
4,082
2.65625
3
[ "MIT" ]
permissive
use base64; use indicatif::{ProgressBar, ProgressStyle}; use rayon::prelude::*; use serde::Deserialize; use serde_json; use std::fs::File; use std::io::BufReader; use std::io::Read; use std::path::Path; use unqlite::{Transaction, UnQLite, KV}; use zip; #[derive(Deserialize)] #[allow(dead_code)] // Will use all these f...
true
d6a2f7c4461b13b6b4f2a1395dbcdb6624671b48
Rust
hzjsea/rust-echo-colored
/src/style/s_style.rs
UTF-8
543
3.03125
3
[]
no_license
use style::*; #[derive(Debug, Clone)] pub struct Style(Vec<u8>); impl Style { pub fn clear() -> Style { Style(vec![0u8]) } pub fn new(s: Styles) -> Style { Style(vec![s.to_u8()]) } pub fn glue(st: Style,s: Styles) -> Style { let mut v = st.0; v.push(s.to_u8()); ...
true
67a0d1af17afd487e2f0fc584ad97cb2cf4316b9
Rust
brdgme/cmd
/src/requester/local.rs
UTF-8
1,379
2.765625
3
[]
no_license
use failure::{Error, format_err}; use serde_json; use std::ffi::OsString; use std::io::{BufWriter, Write}; use std::process::{Command, Stdio}; use crate::api::{Request, Response}; use crate::requester::Requester; pub struct LocalRequester { path: OsString, } impl LocalRequester { pub fn new<I: Into<OsString...
true
44b6031759b82a771d6041ea1bda21dd12558f73
Rust
anlumo/cef
/src/accessibility_handler.rs
UTF-8
2,584
2.734375
3
[]
no_license
use crate::{ refcounted::{RefCountedPtr, Wrapper}, send_protector::SendProtector, values::{StoredValue, Value}, }; use cef_sys::{ cef_accessibility_handler_t, cef_value_t }; ref_counted_ptr! { /// Implement this structure to receive accessibility notification when /// accessibility events h...
true
1a3b91cea5d7c525bd63ab8dad61c42d1c4a46e7
Rust
benjomeshi/procon
/src/atcoder/abc137/c.rs
UTF-8
2,157
3.328125
3
[]
no_license
//https://atcoder.jp/contests/abc137/tasks/abc137_c #![allow(unused_imports)] use std::cmp::{max, min, Ordering}; use std::collections::*; use std::io::{stderr, stdin, BufRead, Write}; use std::iter::FromIterator; #[allow(dead_code)] fn rl() -> String { let mut buf = String::new(); stdin().read_line(&mut bu...
true
eebfca85eb3f30e58916909913a6d3c3d55734da
Rust
gan74/chess-rs
/src/moves.rs
UTF-8
8,495
2.8125
3
[ "MIT" ]
permissive
use crate::bitboard::*; use crate::board::*; use crate::piece::*; use crate::pos::*; use std::cmp; // PossibleMoveIterator has a tendency to be very slow, not sure why... pub struct PossibleMoveIterator<'a> { src_index: usize, dst_index: usize, board: &'a Board, allies: BitBoard, enemies: BitBoar...
true
1aab1429c86b676d477fe18e05925e03b6e88002
Rust
ruggeri/nedbase
/src/node/interior_node/merging.rs
UTF-8
5,722
3.15625
3
[]
no_license
// At present this is dead code because I don't support deletion in my // B-Link tree. Maybe I can add this another day. use super::InteriorNode; use btree::BTree; use node::{MergeOrRotateResult, Node}; impl InteriorNode { pub fn merge_or_rotate_children( &mut self, btree: &BTree, node1: &mut Node, ...
true
5152ac889e1feab5f8a1306b2e486da34c1d4503
Rust
drogue-iot/drogue-async-kernel
/src/led.rs
UTF-8
2,067
2.765625
3
[]
no_license
use embedded_hal::digital::v2::OutputPin; use crate::event::Event; use core::marker::PhantomData; use async_embedded::{ task::spawn, unsync::Channel, }; use core::fmt::{Debug, Formatter}; use async_embedded::task::block_on; use heapless::{ consts::*, String, }; pub struct LED<PIN: OutputPin> { pin...
true
ca0e898f1e071d7129feca09334a634b953442a1
Rust
mtx2d/lochnes
/tests/verification_roms.rs
UTF-8
4,799
2.53125
3
[ "MIT" ]
permissive
#![feature(generator_trait, exhaustive_patterns)] use std::ops::{Generator, GeneratorState}; use std::pin::Pin; use lochnes::nes::ppu::PpuStep; use lochnes::nes::NesStep; use lochnes::{input, nes, rom, video}; fn run_blargg_instr_test_with_expected_result( test_name: &str, rom_bytes: &[u8], expected_stat...
true
f35ad640628623ecf5be73ba4ce27edd8257bd25
Rust
megascrapper/ourairports-json
/src/ourairports.rs
UTF-8
15,801
3.140625
3
[]
no_license
use serde::de::{self, Unexpected}; use serde::{Deserialize, Deserializer, Serialize}; /// Contains a record of a single airport. #[derive(Deserialize, Serialize)] pub struct Airport { /// Internal OurAirports integer identifier for the airport. /// This will stay persistent, even if the airport code changes. ...
true
e9cd9e73a0339e735ba21f61babe4e883345cddd
Rust
bouzuya/rust-atcoder
/cargo-atcoder/contests/abc255/src/bin/c.rs
UTF-8
1,000
2.859375
3
[]
no_license
use proconio::input; fn main() { input! { x: i128, a: i128, d: i128, n: i128, }; if d == 0 { let ans = (x - a).abs(); println!("{}", ans); return; } if d > 0 { let min = a; let max = a + d * (n - 1); if x > max { ...
true
18775f1b20fc0adf72cbf5c9a421851b08e101e9
Rust
dimstars/cloud-kv-repo
/kv_server_1/src/storage/engine.rs
UTF-8
1,426
3.109375
3
[]
no_license
use std::collections::{BTreeMap,HashMap}; use std::sync::{Arc, RwLock}; use super::{Key, Value}; #[derive(Clone)] pub struct Engine { btree: Arc<RwLock<BTreeMap<String, String>>>, } impl Engine { pub fn new() -> Self{ Engine { btree: Arc::new(RwLock::new(BTreeMap::new())) } } pub fn get(&self, k: K...
true
1618de39a658df93ea98f6d95b3f59873f3eef09
Rust
djpnewton/rustfun
/raytrace/src/hitable.rs
UTF-8
1,954
3.328125
3
[]
no_license
use crate::{ vec3::{Vec3}, ray::{Ray}, material::{Material}, }; #[derive(Copy, Clone)] pub struct HitRecord { pub t: f32, pub p: Vec3, pub normal: Vec3, pub material: Material, } #[derive(Copy, Clone)] pub struct Sphere { pub center: Vec3, pub radius: f32, pub material: Materia...
true
bb641822409cabe21a34442aef3c096deaeda244
Rust
datariot/micro-kit
/src/lib.rs
UTF-8
2,435
2.609375
3
[ "MIT" ]
permissive
//! #Micro-Kit //! //! The Micro-Kit module is meant to be a curated collection of crates (Re-Exported) and helper //! functionality to build `RESTful` micro-services with standardized logging, healthchecking, //! metrics, and configuration //! //! The motivation for the module is from Dropwizard, a collection of java ...
true
c958648223e8a128a61f836c5ef4d18efac68f44
Rust
Wodann/adventofcode2018
/src/bin/day4.rs
UTF-8
4,071
3.203125
3
[]
no_license
extern crate chrono; extern crate regex; use chrono::prelude::*; use regex::Regex; use std::collections::HashMap; use std::cmp::Ordering; use std::fs; use std::num::ParseIntError; use std::ops::Range; use std::str::FromStr; #[derive(Debug)] enum Activity { BeginShift(usize), FallsAsleep, WakesUp } #[deri...
true
44a30c275a37fe6e6f6325ee93a5018eed7ea52d
Rust
370417/tower-defense
/backend/src/distance.rs
UTF-8
226
2.59375
3
[]
no_license
/// From Fast Approximate Distance Functions by Rafael Baptista pub fn fast_distance(dx: f32, dy: f32) -> f32 { let dx = dx.abs(); let dy = dy.abs(); 1007.0 / 1024.0 * f32::max(dx, dy) + 441.0 / 1024.0 * f32::min(dx, dy) }
true
4c2358166119843e0014811124d184bd35e81415
Rust
HuoHongbo/projects
/panic/src/main.rs
UTF-8
137
2.75
3
[]
no_license
fn main() { use std::net::IpAddr; let home = "127.0.0.1".parse::<IpAddr>().unwrap(); println!("The home is {:?}", home); }
true
4967dc29bf01d8e67cab0029ce7111f05a2b6793
Rust
tweber12/lhef-rs
/src/lib.rs
UTF-8
17,950
3.078125
3
[ "MIT", "Apache-2.0" ]
permissive
// Copyright 2018 Torsten Weber // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according t...
true
b83bc7767a3ae21c7d5ca3f16b34c98cc9b08fe2
Rust
Mec-iS/loopscape
/src/lib.rs
UTF-8
8,305
3.3125
3
[]
no_license
// These are made public as they need to be accessed from // other modules /// /// Constants: core constants for logic /// pub mod constants { // Primitive of a pattern // every primitive is assigned a sound, other settings may be add in future pub struct Primitive<'a> { path: &'a str, char...
true
a6cf67080e55044e427d7b814950df84e3d9426f
Rust
limpidchart/lc-render
/src/scale/mod.rs
UTF-8
748
3.296875
3
[ "Apache-2.0", "MIT" ]
permissive
use std::cmp::PartialEq; pub mod band; pub mod linear; /// ScaleKind represents supported scales. #[derive(Debug, PartialEq)] pub enum ScaleKind { Band, Linear, } /// Scale represents an axis scale that is used in views and chart. pub trait Scale<T> { /// Scale the provided domain value for a scale range...
true
20c369af5614ad0b88e220cc38a6b99bc98d7400
Rust
BradleyLyman/glcookbook-rs
/src/lighting.rs
UTF-8
6,407
2.71875
3
[]
no_license
use ::nalgebra::{Vec3, Mat4, Iso3, to_homogeneous, Transformation, RotationMatrix}; use ::{RenderableObj, RenderableIndices}; use ::glium::{Program, Display, DrawParameters, DepthTest, Frame, Surface, PolygonMode}; use ::glium::index::{NoIndices, PrimitiveType}; pub struct LightingRenderer { pub program : ...
true
ac6d335792bfbe1d57ac41cc0b5dedf3131c3e4d
Rust
santiagoalvarez/rust-docker
/src/unix.rs
UTF-8
1,959
2.921875
3
[]
no_license
use std; use std::io::{Read, Write}; use std::error::Error; use unix_socket; pub struct UnixStream { stream: unix_socket::UnixStream } impl UnixStream { pub fn connect(addr: &str) -> std::io::Result<UnixStream> { let stream = try!(unix_socket::UnixStream::connect(addr)); let unix_str...
true
8f99c53a84aa867196ce35f0a887495b82efc980
Rust
rhorrace/exercism
/rust/dot-dsl/src/lib.rs
UTF-8
2,587
3.265625
3
[]
no_license
use std::collections::HashMap; #[derive(Clone, Debug, PartialEq)] pub struct Node { pub name: String, pub attrs: Vec<(String, String)>, } impl Node{ pub fn new(name: &str) -> Self { Self { name: name.to_string(), attrs: Vec::new(), } } pub fn with_attrs(se...
true
8b82f7116113dc2f71528116d1c13363da802762
Rust
diegoetjoshua72/bachelorproject
/kontroli/src/kernel/subst.rs
UTF-8
2,244
3.375
3
[]
no_license
//! Substitution and shifting for terms. use super::{RTerm, Term}; use alloc::vec::Vec; impl<'s> RTerm<'s> { pub fn apply_subst<S>(self, subst: &S, k: usize) -> Self where S: Fn(usize, usize) -> RTerm<'s>, { match &*self { Term::BVar(n) if *n >= k => subst(*n, k), T...
true
7fac731428b8bfd38f5477c4cdd41d5d2301c36e
Rust
dbrodie/rex
/tests/util/bytes.rs
UTF-8
1,387
2.890625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of the Rust distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENS...
true
1c5e17678c302446d7b46fae2e08d4405742a2cb
Rust
simpoir/weesels-rs
/src/errors.rs
UTF-8
984
3.203125
3
[ "Apache-2.0" ]
permissive
use std::error::Error as ErrorTrait; use std::fmt::{Debug, Display}; #[derive(Debug)] pub enum ErrorKind { ConfigError, } #[derive(Debug)] pub struct Error { source: Option<Box<dyn ErrorTrait + 'static>>, kind: ErrorKind, } impl Error { pub fn from<E: ErrorTrait + 'static>(kind: ErrorKind, source: E)...
true
68abccc6b67b94d9b372e22ee3254e944197a8ab
Rust
isgasho/mind
/src/mind.rs
UTF-8
11,448
2.890625
3
[ "MIT" ]
permissive
use crate::{Command, Productivity, Reminder, Repeat, Task}; use chrono::Duration; use chrono::Local; use chrono_humanize::HumanTime; use std::env; use std::fmt; use std::fs; use std::fs::File; use std::io::{self, Read, Write}; use std::process; use termion::color; use termion::terminal_size; // Access it using Mind::v...
true
0eb8cac3d70e9991aac2e1cc04979356996d7d24
Rust
mateuszgiza/rust-sdl2-extras
/src/managers/font_manager.rs
UTF-8
513
2.671875
3
[ "MIT" ]
permissive
use sdl2::ttf::{ Font, Sdl2TtfContext }; use common::FontDetails; use managers::resource_manager::{ ResourceLoader, ResourceManager }; pub type FontManager<'l> = ResourceManager<'l, FontDetails, Font<'l, 'static>, Sdl2TtfContext>; // Font Context knows how to load Fonts impl<'l> ResourceLoader<'l, Font<'l, 'static>> ...
true
f5654b4952baa57f5dce532b355fd3bca3e98d30
Rust
8mamo10/the_book
/functions/src/main.rs
UTF-8
577
4
4
[]
no_license
fn main() { println!("Hello, world!"); another_function(5, 6); // NG //let x = (let y = 6); let _x = 5; let y = { let z = 3; z + 1 // no semicolon to make it as a expression }; println!("The value of y is: {}", y); let a = five(); println!("The value of a is: {...
true
8750a51e0f008c6052134199d1e19230147bd73f
Rust
nordsoyv/rust-mono
/twin-stick/src/debug_text.rs
UTF-8
1,798
2.90625
3
[]
no_license
use bevy::prelude::*; use once_cell::sync::Lazy; use std::collections::HashMap; use std::sync::Mutex; #[derive(Eq, PartialEq, Hash)] pub enum DebugTextType { Fps, GamePad, } #[derive(Component)] struct DebugText; pub struct DebugTextPlugin; impl Plugin for DebugTextPlugin { fn build(&self, app: &mut App) { ...
true
4222093374c6c8f413b0f57df43c250fbb511eeb
Rust
jasilven/ruply
/src/nrepl.rs
UTF-8
2,763
2.78125
3
[ "MIT" ]
permissive
use super::repl::Repl; use super::Result; use std::collections::HashMap; use std::io::BufReader; use std::net::TcpStream; use super::bail; use super::util::write_and_flush; use super::Response; pub struct Nrepl { name: String, namespace: String, reader: BufReader<TcpStream>, writer: TcpStream, } impl...
true
3ae57e5232c8a5626c61723fcd45c06eef2af99e
Rust
matthew-ch/cgfs
/src/components.rs
UTF-8
11,752
3.65625
4
[]
no_license
use std::ops::{Add, Div, Mul, Neg, Sub}; #[derive(Debug, Clone, Copy)] pub struct Color { pub r: f32, pub g: f32, pub b: f32, } pub type ColorPack = (u8, u8, u8); impl Color { pub const fn black() -> Self { Color { r: 0., g: 0., b: 0., } } ...
true
6cf968c645579b678ab66e77e2c6cf52e67118a1
Rust
nwtnni/advent-of-code
/aoc-15/src/day_19.rs
UTF-8
2,025
3.09375
3
[ "MIT" ]
permissive
use std::collections::HashMap; use std::collections::HashSet; use aoc::*; #[derive(Clone, Debug)] pub struct MedicineForRudolph { replacements: HashMap<String, Vec<String>>, molecule: String, } impl Fro for MedicineForRudolph { fn fro(input: &str) -> Self { let mut iter = input.trim().split("\n\n...
true
b211a8b28256d23ff0a5bf4e3c9fce8111e3b677
Rust
yizhang-yiz/dorset
/src/core/chainable.rs
UTF-8
818
2.71875
3
[ "BSD-3-Clause" ]
permissive
use std::fmt::Debug; #[allow(dead_code)] pub trait Chainable: Debug { fn chain(&mut self) {} fn init_dependent(&mut self); fn set_zero_adjoint(&mut self); // #[inline] } #[allow(dead_code)] pub struct ChainableStackStorage<'a> { var_stack_: Vec<Box<Chainable + 'a>>, // var_alloc_stack_: V...
true
2215873484fa753e9b2548831d40793f1da70e22
Rust
pola-rs/polars
/py-polars/src/series/export.rs
UTF-8
8,995
2.625
3
[ "MIT" ]
permissive
use numpy::PyArray1; use polars_core::prelude::*; use pyo3::prelude::*; use pyo3::types::PyList; use crate::error::PyPolarsErr; use crate::prelude::{ObjectValue, *}; use crate::{arrow_interop, raise_err, PySeries}; #[pymethods] impl PySeries { #[allow(clippy::wrong_self_convention)] fn to_arrow(&mut self) -> ...
true
480a8dbfcd1b74f91583b5831ec1d014ef1d824f
Rust
stjordanis/summary
/src/main.rs
UTF-8
1,718
2.53125
3
[]
no_license
#![feature(plugin)] #![plugin(rocket_codegen)] extern crate rand; extern crate regex; extern crate rocket; extern crate serde_json; #[macro_use] extern crate rocket_contrib; #[macro_use] extern crate serde_derive; use rocket::State; use rocket::response::content; use rocket_contrib::{JSON, Value}; mod summary; us...
true
cb47fda8e845edabaa004ffeed0b657e956371e3
Rust
DarkDrek/an-editor
/src/cursor.rs
UTF-8
257
2.59375
3
[ "MIT" ]
permissive
use std::convert; use termion::cursor::Goto; #[derive(Debug, Copy, Clone)] pub struct Position { pub line: u16 , pub col: u16 } impl convert::Into<Goto> for Position { #[inline] fn into(self) -> Goto { Goto(self.line, self.col) } }
true
8aa2efdec4f1c6b734a94b5ea61deed4ba0f42ce
Rust
katyo/colours-rs
/colours/src/color.rs
UTF-8
1,723
3.75
4
[ "MIT" ]
permissive
/// Something which can be treated as color pub trait IsColor { type Channel: IsColorChannel; } /// Something which can be color channel pub trait IsColorChannel: Sized + Copy + PartialOrd { const MIN: Self; const MAX: Self; #[inline] fn clamp_channel(self) -> Self { if self < Self::MIN { ...
true
a1090fafdffbc09331eb216cebdd1a3c4bcbd998
Rust
rarescosma/eldiro
/crates/trust/src/tcp.rs
UTF-8
7,212
2.8125
3
[ "MIT" ]
permissive
use std::io; pub enum State { // Listen, Closed, SyncRcvd, Estab, } pub struct Connection { state: State, send: SendSequenceSpace, recv: RecvSequenceSpace, ip: etherparse::Ipv4Header, } struct SendSequenceSpace { /// send unacknowledged una: u32, /// send next nxt: u32...
true
856c1d3de19e84970a419b1d284810f5f87553a5
Rust
ptbw/rust-talk
/trait_example/src/main.rs
UTF-8
487
4.125
4
[]
no_license
/* 1 fn is_equal<T:std::cmp::PartialEq>(a: T, b: T) -> bool { a==b } */ fn is_equal<T>(a: T, b: T) -> bool { a == b } /* 2 struct Person { name: String, } impl Person { pub fn say_hello(&self) { println!("{} says hello!", self.name); } } */ fn main() { // 1 if is_equal(10, 11) { ...
true
2908a9a0d64d5035941c50e8700bcd4556179582
Rust
marot/nakama-rs
/src/socket_adapter.rs
UTF-8
655
2.75
3
[ "Apache-2.0" ]
permissive
use std::error::Error; pub trait SocketAdapter { type Error: Error; fn on_connected<T>(&mut self, callback: T) where T: Fn() + Send + 'static; fn on_closed<T>(&mut self, callback: T) where T: Fn() + Send + 'static; // TODO: correct error type fn on_received<T>(&mut self, ca...
true
b65a53db48bd7b7e7db5bb734b6b72ceb79f3cce
Rust
srujun/aoc2020
/src/day02.rs
UTF-8
1,966
2.984375
3
[ "MIT" ]
permissive
use crate::problem::Problem; use lazy_static::lazy_static; use regex::Regex; lazy_static! { static ref LINE_PATTERN: Regex = Regex::new(r"^(?P<min>\d+)-(?P<max>\d+) (?P<letter>[a-z]): (?P<pass>[a-z]+)$").unwrap(); } #[derive(Default)] pub struct DayTwo {} impl DayTwo { fn is_valid_password_p1(line: &str) ->...
true
b50cf8ccc21ac02def3fe7043c93ef37c701c061
Rust
fisherdarling/slicing_trees
/src/main.rs
UTF-8
2,286
2.875
3
[]
no_license
use std::io::{Write, stdout}; use rayon::prelude::*; use slicing_trees::{SlicingTree, NPE, Rect}; fn p(delta_cost: f32, temp: f32) -> f32 { (-delta_cost / temp).exp() } fn simulated_annealing(npe: NPE, time: usize, k: usize, temp_epsilon: f32, temp_reduction: f32, rects: &[Rect]) -> NPE { let n = npe.count_o...
true
eb860081710e595898605d705d18079cb9f2cd48
Rust
agf46/rust--basics
/minigrep/src/main.rs
UTF-8
957
3.53125
4
[]
no_license
use std::env; use std::fs; // handle files // Basic function to grep for something in a file // fn main() { // let args: Vec<String> = env::args().collect(); // println!("{:?}", args); // } // fn main() { // let args: Vec<String> = env::args().collect(); // let query = &args[1]; // let filenam...
true
30e8edb9ee1a792b3c8e0843d788b7de53cd025d
Rust
TianyiShi2001/cs
/src/lib.rs
UTF-8
4,417
3.28125
3
[ "MIT" ]
permissive
//! # Example //! //! ``` //! use cs::longest_common_substring; //! let lcs = longest_common_substring(&[ //! "ZYABCAGB", //! "BCAGDTZYY", //! "DACAGZZYSC", //! "CAGYZYSAU", //! "CAZYUCAGF", //! ]); //! assert_eq!(lcs, "CAG"); //! ``` use suffix::SuffixTable; /// Compute the longest common substrin...
true
7c421af27e152aa2c2eaf7e2bfbba4afea2648b2
Rust
ridiculousfish/regress
/src/bytesearch.rs
UTF-8
11,988
3.40625
3
[ "Apache-2.0", "MIT" ]
permissive
use crate::insn::MAX_CHAR_SET_LENGTH; use core::fmt; extern crate memchr; #[cfg(not(feature = "std"))] use alloc::vec::Vec; /// Facilities for searching bytes. pub trait ByteSearcher { /// Search for ourselves in a slice of bytes. /// The length of the slice is unspecified and may be 0. /// \return the nex...
true
7a23d45f3d526aa3d6e7c7991679a25fa60cf9a3
Rust
kanow-algorithms/naive-string-matcher
/src/tests.rs
UTF-8
1,247
3.265625
3
[]
no_license
use crate::naive_string_matcher; #[test] fn should_find_single_pattern_match_in_single_line_text() { let text = String::from("John is a nice guy"); let pattern = String::from("nice"); let matches = naive_string_matcher(&text.chars().collect(), &pattern.chars().collect()); assert_eq!(matches[0], 10); ...
true
5ef386860079705cbf17a0a1895ebd30fee25037
Rust
laeblab/crispy
/src/args.rs
UTF-8
7,860
2.671875
3
[]
no_license
use std::io; use std::io::Write; use clap::{App, Arg, ArgMatches, SubCommand}; use crate::enzyme::Enzyme; use crate::errors::*; #[derive(Debug)] pub struct IndexArgs { pub fasta: String, pub output: Option<String>, pub enzyme: Enzyme, pub positions: bool, } #[derive(Debug)] pub struct ScoreArgs { ...
true
5d6fb7a0c23eba731169fe233d3d6fd12454a7dc
Rust
feather-rs/feather
/quill/common/src/entities/item_frame.rs
UTF-8
594
2.796875
3
[ "Apache-2.0", "MIT" ]
permissive
use bytemuck::{Pod, Zeroable}; /// Marker component for item frame entities. /// /// # Example /// A system that queries for all item frames: /// ```no_run /// use quill::{Game, Position, entities::ItemFrame}; /// # struct MyPlugin; /// fn print_entities_system(_plugin: &mut MyPlugin, game: &mut Game) { /// for (en...
true
d929c8be2798d19e50a363e4d615ba2b3adcaec6
Rust
CS490-Microservices/project
/imageprocessing/src/main.rs
UTF-8
8,055
2.71875
3
[ "MIT" ]
permissive
use { anyhow::{anyhow, ensure, Context as ErrorContext, Result}, aws_lambda_events::event::s3::{S3Bucket, S3Entity, S3Event, S3EventRecord, S3Object}, image::{imageops::FilterType, GenericImageView, ImageFormat}, lambda_runtime::{error::HandlerError, lambda, Context}, log::{debug, error, info}, ...
true
b528c79ff0125388ed7dc804c87470e3bfbb2134
Rust
pinecrew/electron-phonon-scattering-2d
/src/stats.rs
UTF-8
4,434
2.796875
3
[]
no_license
use linal::Vec2; use particle::Summary; pub struct Stats { pub current: Vec2, pub current_std: Vec2, pub optical: f64, pub acoustic: f64, pub tau: f64, pub energy: f64, pub from_theta_ac: Vec<usize>, pub to_theta_ac: Vec<usize>, pub from_theta_op: Vec<usize>, pub to_theta_op: Ve...
true
0e9e0e8cad9f81dfc626e2cdc1bfdf297e172062
Rust
SteadBytes/advent-of-code-2020
/rust/src/d23.rs
UTF-8
8,350
3.59375
4
[]
no_license
// TODO: The game state and circular list representation could be wrappeed up in // structs to ensure their respective invariants are maintained and to provide a better // API. This works though and I've spent too much time on it as is! :D /// Key points: /// - **Clockwise** circular list of cups /// - First cup in **...
true
0cfe86e91410c1a3062f2f3fb9644e6804347396
Rust
seanchen1991/sidestacker
/client/src/error.rs
UTF-8
3,255
3.078125
3
[]
no_license
use std::error::Error; use std::fmt; use std::io; use serde_json::Error as JsonError; use tokio_util::codec; /// The error types that may arise while the game is running. #[derive(Debug)] pub enum ClientError { /// Attempted to insert into a full row. FullRow, /// Attempted to fetch a non-existent row. ...
true
86536b5b40999443765bb11d7fac8ef1061916c6
Rust
Larusso/unity-version-manager
/install/uvm-install2/tests/install_tests.rs
UTF-8
3,329
2.53125
3
[ "Apache-2.0" ]
permissive
#[cfg(target_os = "macos")] mod macos_tests { use std::collections::HashSet; use tempfile; use test_env_log::test; use uvm_core::unity::{Component, Installation, Version}; #[ignore] #[test] fn installs_editor_2019_3() { let version = Version::b(2019, 3, 0, 7); let destinatio...
true
14879ecf18b2149e7876aaca02c5bd3d1eda8042
Rust
Serbis/sealrs
/src/executors/executor.rs
UTF-8
224
2.671875
3
[]
no_license
//! Basic trait for all executors use std::any::Any; pub type ExecutorTask = Box<FnMut() -> () + Send>; pub trait Executor { fn execute(&mut self, f: ExecutorTask, options: Option<Box<Any>>); fn stop(&mut self); }
true
204900307a2ab83f4aa3b042561f7360f25497d7
Rust
BafDyce/adventofcode
/2019/rust/day21/src/main.rs
UTF-8
4,776
2.890625
3
[ "Unlicense" ]
permissive
/* -------Part 1-------- --------Part 2-------- Day Time Rank Score Time Rank Score 21 10:47:19 2201 0 11:01:30 1813 0 BENCHMARK RESULTS test bench::bench_parsing ... bench: 837,502 ns/iter (+/- 76,470) test bench::bench_part1 ... bench: 5,134,821 ns/iter (+/- 627,474)...
true
219e0eb86c712af6f7e500e3439459e0da2ccac0
Rust
hadeaninc/hadean-101
/rust/simple-send-recv.rs
UTF-8
1,489
2.53125
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#![feature(asm)] // to remove #[macro_use] extern crate hadean; use hadean::{RawSender, RawReceiver, Sender, Receiver, Connection, ChannelEndpoint, Channel}; use hadean::{spawn, pid}; use std::u64; fn adder(toadd: &u64, senders: Vec<RawSender>, receivers: Vec<RawReceiver>, _connections: Vec<Connection>) { let mut ...
true
484ab1a3fcf0863a364816111d29a80289789637
Rust
GGist/bip-rs
/bip_utracker/src/request.rs
UTF-8
5,035
3.203125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
//! Messaging primitives for requests. use std::io::{self, Write}; use byteorder::{BigEndian, WriteBytesExt}; use nom::{be_u64, be_u32, IResult}; use announce::AnnounceRequest; use scrape::ScrapeRequest; // For all practical applications, this value should be hardcoded as a valid // connection id for connection req...
true
1a1099d8f2b480b23c130d58dc72eb9f6f4ae8bf
Rust
Fourfoldsquall/tari
/base_layer/p2p/src/seed_peer.rs
UTF-8
5,234
2.734375
3
[ "BSD-3-Clause" ]
permissive
// Copyright 2020, The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // di...
true
b0162d429f42ca49df5081a050293fad1a2ed9fb
Rust
nicolaszordan/chip8_emulator_rust
/src/chip8.rs
UTF-8
9,653
2.828125
3
[]
no_license
extern crate arrayvec; extern crate rand; use crate::display::{Display, DrawResult}; use crate::keypad::Keypad; use crate::ram::RAM; use arrayvec::ArrayVec; use std::{thread, time}; type Registers = [u8; 16]; pub struct Chip8 { pub ram: RAM, pub display: Display, registers: Registers, pub keypad:...
true