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
2c8a8d3f03f8eb005a16d97714a2aef2df9a6c85
Rust
abernix/graphql-rs
/graphql-parser/src/error.rs
UTF-8
856
2.703125
3
[]
no_license
use crate::{Result, Span}; use nom::{ error::{ErrorKind, ParseError}, Err::Error, }; #[derive(Debug, PartialEq)] pub enum ParsingError<'a> { Nom(Span<'a>, ErrorKind), } impl<'a> ParseError<Span<'a>> for ParsingError<'a> { fn from_error_kind(s: Span<'a>, kind: ErrorKind) -> Self { ParsingError:...
true
d78f345e5dca102e6ae5dc80915a5b8c34f20e76
Rust
ihrwein/actiondb
/src/matcher/result.rs
UTF-8
1,691
3.375
3
[]
no_license
use std::collections::BTreeMap; use parsers::ParseResult; use matcher::Pattern; #[derive(Debug)] pub struct MatchResult<'a, 'b> { pattern: &'a Pattern, values: BTreeMap<&'a str, &'b str>, } impl <'a, 'b> MatchResult<'a, 'b> { pub fn new(pattern: &'a Pattern) -> MatchResult<'a, 'b> { MatchResult {...
true
18071785e6f6f47775e5092d320bf612ce7c0fce
Rust
astro/pile
/ledball-impacts/src/main.rs
UTF-8
2,956
2.984375
3
[]
no_license
extern crate haversine; extern crate rand; extern crate ledball; use std::thread::sleep; use rand::{thread_rng, Rng, ThreadRng}; use std::time::Duration; use haversine::{Location, distance, Units}; use ledball::{LedBall, Color}; fn clone_location(l: &Location) -> Location { Location { latitude: l.latitu...
true
8c1c080515c1acd8c0f38b69c2bca0ae5b8fe34b
Rust
mpereira/noronha
/src/components/http_transport.rs
UTF-8
2,084
2.640625
3
[ "MIT" ]
permissive
use std::net::SocketAddr; use std::thread::{self, JoinHandle}; use actix_web::{ http::{Method, StatusCode}, server, App, Error as HttpError, HttpRequest, HttpResponse, }; use serde_json; use components::configuration::Configuration; use http_utils::{json_body, json_error, make_handler_for_request_with_body}; ...
true
80f76383515a082dafb6aed4a5be677d2f7dc409
Rust
wsgalaxy/fastxdr
/src/ast/enumeration.rs
UTF-8
4,674
3.453125
3
[ "BSD-3-Clause" ]
permissive
use super::*; #[derive(Debug, Clone, PartialEq)] pub struct Enum { pub name: String, pub variants: Vec<Variant>, } impl<'a> Enum { pub(crate) fn new(vs: Vec<Node<'a>>) -> Self { let name = vs[0].ident_str().to_string(); let mut vars = Vec::new(); for v in vs.into_iter().skip(1) { ...
true
fc7d7efa0c47de0956631cb991f28dd1259e9dfb
Rust
wez470/Rugby
/src/gpu/mod.rs
UTF-8
19,285
2.671875
3
[]
no_license
use enumflags2::BitFlags; use std::collections::BinaryHeap; use crate::interrupts::Interrupt; mod sprite; const HORIZONTAL_BLANK_CYCLES: usize = 204; // Horizontal blank phase takes 201-207 cycles. const OAM_READ_CYCLES: usize = 80; // OAM read phase takes 77-83 cycles. const VRAM_READ_CYCLES: usize = 172; // VRAM re...
true
19ca06c9b1fb192d5acef37a24dd1105763c5810
Rust
jonmsawyer/uva-online-judge
/Problem Set Volumes (100...1999)/Volume 1 (100-199)/101 - The Blocks Problem/rust/src/blocks.rs
UTF-8
41,870
4.03125
4
[ "MIT" ]
permissive
//! `blocks` module //! //! Author: Jonathan Sawyer <jonmsawyer[at]gmail.com> //! //! Date: 2020-06-04 /// The state of the `Blocks` struct during its processing. /// The state changes depending on the initial command of /// `move_a()` or `pile_a()`. If there is an invalid order /// of commands, the blocks state gets ...
true
ef025cd192e3fdc7d4ab7182f3a83f745d8f363e
Rust
run-mojo/redmod
/src/sliced/mod.rs
UTF-8
2,353
2.59375
3
[]
no_license
use rax::*; use std; use sds::SDS; //use std::mem::size_of; use stream::*; const DEFAULT_CHUNK_SIZE: u64 = 1024 * 1024 * 8; const DEFAULT_CHUNKS_PER_FILE: u64 = 8; pub struct Config { /// Size of chunk pub chunk_size: u64, /// Number of chunks per physical file-system file pub chunks_per_file: u64, ...
true
02a22143b93e79e22e55d96c84ada8f098b09ed0
Rust
pipi32167/LeetCode
/rust/src/problem_0635.rs
UTF-8
1,970
3.671875
4
[]
no_license
use std::cmp::Ordering; struct LogSystem { logs: Vec<(i32, String)>, } /** * `&self` means the method takes an immutable reference. * If you need a mutable reference, change it to `&mut self` instead. */ impl LogSystem { fn new() -> Self { Self { logs: vec![] } } fn put(&mut self, id: i32, timestamp: ...
true
0c5a806ecad463279d77bd7b6cbc28a86936dc24
Rust
Urgau/rsix
/src/io/ioctl.rs
UTF-8
2,324
2.828125
3
[ "MIT", "Apache-2.0", "LLVM-exception" ]
permissive
#[cfg(not(target_os = "wasi"))] use crate::io::{Termios, Winsize}; use crate::{imp, io}; use io_lifetimes::AsFd; /// `ioctl(fd, TCGETS)`—Get terminal attributes. /// /// Also known as `tcgetattr`. /// /// # References /// - [Linux `ioctl_tty`] /// - [Linux `termios`] /// /// [Linux `ioctl_tty`]: https://man7.org/lin...
true
b6126d0eb73cb89c298ba441e42ce986f0eb18da
Rust
Strongman86/Rust-Learning
/chapter7/7_34.rs
UTF-8
783
3.765625
4
[]
no_license
struct Circle{ x:f64, y:f64, radius:f64, } struct CircleBuilder{ x:f64, y:f64, radius:f64, } impl Circle{ fn area(&self)->f64{ std::f64::consts::PI*(self.radius*self.radius) } fn new()->CircleBuilder{ CircleBuilder{ x:0.0 ,y:0.0,radius:1.0, } } } impl CircleBuilder{ fn x(&mut self,coordinate:f64)->...
true
89ed3af65eff9a6bdd809f5a6c5af364e3b8adc1
Rust
stackcats/leetcode
/algorithms/medium/restore_ip_addresses.rs
UTF-8
1,446
2.578125
3
[ "MIT" ]
permissive
impl Solution { pub fn restore_ip_addresses(s: String) -> Vec<String> { if s.len() > 12 { return vec![]; } let s = s.as_bytes(); let mut ans = Vec::new(); for i in 1..s.len() { if i > 1 && s[0] == b'0' { break; } ...
true
4f5a8f1386fbd00e6f89e260e3cd20abfedfee35
Rust
w4tson/advent-of-code-2017-rust
/src/day10/tests.rs
UTF-8
482
3.0625
3
[]
no_license
use day10::knot_hash; use day10::knot_hash2; #[test] fn example() { let input_lengths = vec![3, 4, 1, 5]; assert_eq!(12, knot_hash(5, &input_lengths)); } #[test] fn part1() { let input_lengths = vec![227, 169, 3, 166, 246, 201, 0, 47, 1, 255, 2, 254, 96, 3, 97, 144]; assert_eq!(13760, knot_hash(256, ...
true
e9a4b035ebc227ef9290d28b749c2237c34c0a4c
Rust
biluohc/utils
/r4j/src/logfern.rs
UTF-8
4,878
2.765625
3
[ "MIT" ]
permissive
use chrono; use fern; use log::LevelFilter; use std; use std::sync::atomic::{AtomicUsize, Ordering}; use self::colors::{Color, ColoredLevelConfig}; pub fn set(warn0_info1_debug2_trace3: u64, nocolor: bool) -> Result<(), fern::InitError> { let mut base_config = fern::Dispatch::new(); base_config = match warn0...
true
edc59b1c2d13d665cd976d15d08e90dc2efd9302
Rust
hegza/serpent-rs
/src/transpile/mod.rs
UTF-8
6,734
2.625
3
[ "MIT" ]
permissive
pub mod ast_to_ast; mod codegen; mod context; mod parser_ext; pub mod python; mod rs_ast; pub mod rust; use crate::{ config::{self, TranspileConfig}, output::TranspiledFileKind, }; use crate::{ error::ApiError, output::ModPath, output::TranspiledFile, output::TranspiledModule, output::TranspiledString,...
true
8d64bf841811625c7b49c954ea58bd561cc94dd6
Rust
lulersoft/rppal
/examples/gpio_servo_softpwm.rs
UTF-8
3,736
3.03125
3
[ "MIT" ]
permissive
// Copyright (c) 2017-2019 Rene van der Meer // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge,...
true
b73a0db39090355dc325b2c1aff9715c23c0af4f
Rust
VETER1309/identity.rs
/identity_crypto/src/traits.rs
UTF-8
736
2.671875
3
[ "Apache-2.0" ]
permissive
use crate::{ error::Result, key::{KeyGenerator, KeyPair, PublicKey, SecretKey}, }; pub trait KeyGen { fn generate(&self, generator: KeyGenerator) -> Result<KeyPair>; } pub trait Sign { fn sign(&self, message: &[u8], secret: &SecretKey) -> Result<Vec<u8>>; } pub trait Verify { fn verify(&self, mes...
true
839cacc02231300e0dfb369bf9a2703748a4986f
Rust
rogervaas/gluesql
/src/executor/update.rs
UTF-8
3,454
2.671875
3
[ "Apache-2.0" ]
permissive
use futures::stream::{self, TryStreamExt}; use serde::Serialize; use std::fmt::Debug; use std::rc::Rc; use thiserror::Error; use sqlparser::ast::{Assignment, Ident}; use super::context::FilterContext; use super::evaluate::{evaluate, Evaluated}; use crate::data::{Row, Value}; use crate::result::Result; use crate::stor...
true
5620bace6d455cc79098e586e1aa283017e8702c
Rust
cfsamson/azure-jwt
/src/error.rs
UTF-8
952
2.859375
3
[ "MIT" ]
permissive
use crate::jwt; use std::{error::Error, fmt}; #[derive(Debug)] pub enum AuthErr { InvalidToken(jwt::errors::Error), ConnectionError(reqwest::Error), Other(String), ParseError(String), } impl Error for AuthErr {} impl fmt::Display for AuthErr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result ...
true
9437b6da15686b010dcf59222c56160f4b7f8da6
Rust
nvzqz/cargo-emit
/src/rustc_link_arg_bin.rs
UTF-8
2,104
3.6875
4
[ "MIT", "Apache-2.0" ]
permissive
/// Tells Cargo to pass the `-C link-arg=$flag` option to the compiler, /// but only when building the binary target with name `$bin`. /// Its usage is highly platform specific. /// It is useful to set a linker script or other linker options. /// /// This is equivalent to: /// /// ``` /// println!("cargo:rustc-link-arg...
true
1189797b5d9a10f8405ad4541be4246959a9fb7a
Rust
MirecIT/amethyst
/amethyst_assets/src/processor.rs
UTF-8
6,847
2.75
3
[ "Apache-2.0", "MIT" ]
permissive
use std::{ borrow::Cow, marker::PhantomData, sync::{Arc, Mutex}, }; use amethyst_core::{ dispatcher::System, ecs::{systems::ParallelRunnable, SystemBuilder}, }; use amethyst_error::Error; use crossbeam_queue::SegQueue; use derivative::Derivative; use distill::loader::storage::AssetLoadOp; use log::...
true
7522e3b14bd31272ac504a9ca27cbbb49fd025e1
Rust
aristotle9/qt_generator-output
/qt_3d_render/src/texture_data.rs
UTF-8
10,527
2.515625
3
[]
no_license
/// C++ type: <span style='color: green;'>```Qt3DRender::QTextureData```</span> #[repr(C)] pub struct TextureData([u8; ::type_sizes::QT_3D_RENDER_TEXTURE_DATA_TEXTURE_DATA]); impl ::cpp_utils::new_uninitialized::NewUninitialized for TextureData { unsafe fn new_uninitialized() -> TextureData { TextureData(::std::...
true
9bd96ca682d74248cd9807cd0555522740afaaf8
Rust
say3no/try_rust
/tour/src/chapter5_ownership_and_borrow/tour50_dereference.rs
UTF-8
700
3.765625
4
[]
no_license
/* &mut による参照では、 * 演算子によって参照を外す(derefereence)ことで、所有者の値を設定できます。 * 演算子によって所有者の値のコピーを取得することもできます(コピー可能な型については後述) */ fn main() { let mut foo = 42; let f = &mut foo; // borrow as mut (write lock 取得 ) // println!("{}", foo); 参照不可でコンパイルエラー println!("{}", f); // 42 let bar = *f; // 所有者の値をコピー。値だけね。 ...
true
dd87f897f059e8ef2bee1bf6eccfaa12f1d27d45
Rust
merterden98/rust_geometric
/src/data/cora.rs
UTF-8
5,633
2.8125
3
[]
no_license
use std::{collections::HashMap, convert::TryFrom, fs::File, io::BufRead, io::BufReader}; use crate::data; use ndarray::{self, Array2}; use tch::Tensor; pub struct Cora { features: Vec<(String, Tensor)>, adj_matrix: ndarray::Array2<f32>, name_to_enum: HashMap<u32, u32>, num_labels: i64, labels: Ten...
true
d37f939aa3c5f6fbdc6c4c0ada71f0fa9f6be0f0
Rust
BafDyce/adventofcode
/2019/rust/day20/src/main.rs
UTF-8
14,426
2.875
3
[ "Unlicense" ]
permissive
/* -------Part 1-------- --------Part 2-------- Day Time Rank Score Time Rank Score 20 >24h 2934 0 >24h 2301 0 BENCHMARK RESULTS test bench::bench_parsing ... bench: 19,798 ns/iter (+/- 1,833) test bench::bench_part1 ... bench: 1,304,681 ns/iter (+/- 83,979) t...
true
4299221a99aa6bc83001113bd42cb48e9a82eb90
Rust
hedgar2017/lsdiff-rs
/src/main.rs
UTF-8
989
2.515625
3
[]
no_license
//! //! The Lsdiff binary. //! use std::{fs, io}; #[derive(Debug)] enum Error { Reading(io::Error), Lsdiff(lsdiff_rs::Error), } fn main() -> Result<(), Error> { let args = clap::App::new(env!("CARGO_PKG_NAME")) .version(env!("CARGO_PKG_VERSION")) .author(env!("CARGO_PKG_AUTHORS")) ...
true
01c49666b5ef3e337988c2b31a6eb36b414d82c9
Rust
ndouglas/azymus
/src/entity/mod.rs
UTF-8
4,909
2.875
3
[ "Unlicense" ]
permissive
use tcod::map::Map as FovMap; use crate::agent; use agent::Agent; use crate::body; use body::Body; use crate::component; use component::actor::Actor; use component::field_of_view::FieldOfView; use component::light_source::{LightSource, Factory as LightSourceFactory}; use component::position::Position; use component::re...
true
691c999d4ad5171c3f10b3348bd43b112b9fa521
Rust
Samoxive/yumak
/engine/src/stdlib/types/float.rs
UTF-8
3,165
3.21875
3
[ "MIT" ]
permissive
use crate::value::{make_function, RcValue, Value}; fn verify_this(this: Option<RcValue>) -> f64 { let this = if let Some(this_val) = this { this_val } else { panic!("Float::method requires a `this` parameter.") }; if let Value::Float(ref float_value) = *this { *float_value ...
true
1162fd5498715f24d84341374644874b55bf07bb
Rust
isgasho/rsign2
/src/errors.rs
UTF-8
3,110
2.625
3
[ "ISC", "MIT" ]
permissive
extern crate base64; extern crate clap; use std; use std::error::Error as StdError; use std::fmt; use std::io; macro_rules! werr( ($($arg:tt)*) => ({ use std::io::{Write, stderr}; write!(&mut stderr(), $($arg)*).unwrap(); }) ); pub type Result<T> = std::result::Result<T, PError>; #[derive(De...
true
a5b8df4cdfa47e90647a23d5dc067bd515c6b0e3
Rust
afaber999/dicom-pipe
/dcmpipe_cli/src/app/scanapp.rs
UTF-8
2,436
2.8125
3
[ "Apache-2.0" ]
permissive
use std::fs::File; use std::path::PathBuf; use anyhow::Result; use walkdir::WalkDir; use dcmpipe_dict::dict::stdlookup::STANDARD_DICOM_DICTIONARY; use dcmpipe_lib::core::read::{Parser, ParserBuilder}; use crate::app::CommandApplication; enum ScanResult { Success, NotDicom, InvalidData(Box<dyn std::error...
true
7598f4f047eb68a17a83874a795780d409a41b33
Rust
Yoga07/quic-p2p
/examples/bootstrap_node.rs
UTF-8
3,834
2.59375
3
[ "MIT", "BSD-3-Clause" ]
permissive
// Copyright 2019 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or di...
true
20f8e87621f4890ada2ca4063737d12d5d9a1f5e
Rust
FujiHaruka/rust-shell-funcs
/src/command_manager.rs
UTF-8
3,183
3.296875
3
[]
no_license
extern crate serde; extern crate serde_json; use json_storage::JsonStorage; use serde_json::{Value}; #[derive(Serialize, Deserialize, Clone)] pub struct CommandItem { pub index: usize, pub func: String, pub desc: String, } pub struct CommandManager { pub commands: Vec<CommandItem>, storage: JsonS...
true
77e727f430e9d2aa0dcf5c94261fdcc638226a03
Rust
celo-org/celo-threshold-bls-rs
/crates/threshold-bls/src/sig/sig.rs
UTF-8
8,261
3.15625
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
pub use super::tbls::Share; // import and re-export it for easier access use crate::{ group::{Element, Point, Scalar}, poly::Poly, }; use rand_core::RngCore; use serde::{de::DeserializeOwned, Serialize}; use std::{error::Error, fmt::Debug}; /// The `Scheme` trait contains the basic information of the groups ov...
true
9410f7e371a3d034780ecf5e4deabfbd34f64628
Rust
torourk/padding-oracle-visual
/src/adversary.rs
UTF-8
5,928
3.28125
3
[ "MIT", "Apache-2.0" ]
permissive
use crate::oracle::Oracle; use crate::ui::write_line; pub struct Adversary { oracle: Oracle, iv: Vec<u8>, cipher: Vec<u8>, } impl Adversary { pub fn new(oracle: Oracle, iv: Vec<u8>, cipher: Vec<u8>) -> Self { Self { oracle, iv, cipher } } pub fn break_ciphertext_fancy(self) { ...
true
d31247f1cc2766af642977df7ce7bc0c67eed825
Rust
PurpleBooth/clap_groff
/src/generate_man.rs
UTF-8
1,552
3.234375
3
[]
no_license
use clap::App; fn generate_manpage(app: &App) -> String { let mut lines = vec![]; let version = version::version(app).unwrap(); lines.push(format!(".TH {} 1 \"{}\"", app.get_name(), version)); lines.join("\n") } #[cfg(test)] mod tests { use crate::generate_man::generate_manpage; use clap::App...
true
44ffe0735d828162cf1d709b63e34fcb03af5ad5
Rust
Daniel-B-Smith/march_madness
/src/tournament.rs
UTF-8
6,089
2.671875
3
[ "MIT" ]
permissive
extern crate rand; use std::collections::HashMap; use std::fmt; use itertools::Itertools; use self::rand::distributions::{IndependentSample, Range}; pub struct Tournament { pub first_round: Vec<&'static str>, pub second_round: Vec<&'static str>, pub sweet_sixteen: Vec<&'static str>, pub elite_eight: ...
true
5c71f928edeb8009873f899bbe29a98087ab5f64
Rust
joelmac/floptimizer
/src/lib.rs
UTF-8
1,741
2.765625
3
[]
no_license
extern crate num; use num::Float; pub mod floptimizer; #[cfg(test)] mod tests { use crate::{test_flat_fn, test_opt_fn}; use crate::floptimizer::{Floptimizer, FloptiBuilder}; #[test] fn test_floptimizer() { let floppy = Floptimizer{ range_bot:0., range_top:0., ...
true
4e64e24e2454c8605623265a5dd92571da3c376f
Rust
marriola/INI
/src/ini_format.rs
UTF-8
696
3.265625
3
[]
no_license
/// Filename: ini_format.rs /// Author: Matt Arriola /// Description: Data structures used to represent the INI file format pub mod ini_format { /// An INI file consists of a list of top-level entries. pub type IniFile = Vec<Entry>; /// A top-level entry is either a comment or a section. pub e...
true
b7c646726647a3282cc7592096586714028b7329
Rust
robohouse-delft/show-image-rs
/src/event/mod.rs
UTF-8
5,187
3.078125
3
[ "BSD-2-Clause" ]
permissive
//! Event types. pub use device::*; pub use window::*; pub use winit::event::AxisId; pub use winit::event::ButtonId; pub use winit::event::DeviceId; pub use winit::event::Force; pub use winit::event::ModifiersState; pub use winit::event::MouseScrollDelta; pub use winit::event::ScanCode; pub use winit::event::StartCau...
true
345b49d31ebe00664e36f23eb9d840aa879db2b7
Rust
ftsujikawa/rust-sample
/ch06/code6-12/src/main.rs
UTF-8
162
2.953125
3
[]
no_license
fn main() { let v = vec![10,20,30,40,50]; print!("v is "); for i in &v { print!("{} ", i); let x: i32 = *i; } println!(""); }
true
9a04e9404a0da314a69e2c4f41f75ebade9cc4a2
Rust
imsnif/netstat-rs
/src/types/error.rs
UTF-8
759
3.171875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use std; /// General error type. #[derive(Clone, Debug)] pub enum Error { /// Error originating from Rust code. InternalError(&'static str), /// Error originating from FFI calls. ForeignError { api_name: &'static str, err_code: i32, }, } impl std::fmt::Display for Err...
true
34bb932250c603d50183765b9650f6f919d7f55a
Rust
B-Curve/rust_Minecraft
/src/world/block/block_texture.rs
UTF-8
2,092
2.625
3
[]
no_license
use GL; use GL::Gl; use stb_image::stb_image::bindgen::{stbi_load, stbi_image_free}; use std::os::raw::{c_int, c_void}; use std::ffi::CString; const BLOCK_MAP: &'static str = "./assets/textures/block_map.png"; pub struct BlockTexture { id: u32, gl: Gl } impl BlockTexture { pub fn new(gl: &Gl) -> BlockTex...
true
595c7389f9abb5e82f6224bd1dbffd6b01094e42
Rust
johnameyer/hacktober-2019
/2/make.rs
UTF-8
727
2.71875
3
[]
no_license
use std::env; use std::error::Error; use std::fs::File; use std::path::Path; use std::io::{prelude::*, BufReader}; fn main() { let args: Vec<String> = env::args().collect(); let mut tasks = None; if args.len() > 1 { tasks = Some(&args[1..]); } let path = Path::new("Makefile");...
true
84bbb631cdbe6bf58261f6cb5b63214c5baa199c
Rust
gwy15/leetcode
/src/sorted-merge-lcci.rs
UTF-8
1,131
3.59375
4
[]
no_license
struct Solution; impl Solution { #[allow(unused)] pub fn merge(a: &mut Vec<i32>, m: i32, b: &mut Vec<i32>, n: i32) { use std::cmp::Ordering::*; let (mut m, mut n) = (m as usize, n as usize); let mut pos = m + n; while m > 0 && n > 0 { // compare and move ...
true
8cc468089b454302ece4df09f3af7f50445d8e6c
Rust
medakk/bvh
/src/ray.rs
UTF-8
18,806
3.484375
3
[ "MIT" ]
permissive
//! This module defines a Ray structure and intersection algorithms //! for axis aligned bounding boxes and triangles. use crate::aabb::AABB; use crate::EPSILON; use nalgebra::{Point3, Vector3}; use std::f32::INFINITY; /// A struct which defines a ray and some of its cached values. #[derive(Debug)] pub struct Ray { ...
true
7c5d2e40690d03eea34a029cae1aa5b25b7046d3
Rust
tylersouthwick/rubiks
/src/solver.rs
UTF-8
1,346
3.1875
3
[]
no_license
use crate::array_cube::Cube; use crate::cube::FaceOrientation::*; use crate::cube::Color; use crate::cube::Color::*; use crate::mover; fn move_top_cross_edge(cube : &mut Cube, color : Color) { let edge = cube.find_edge(WHITE, color); match (edge.side1.face_orientation, edge.side2.face_orientation) { (...
true
275e50f59bac2108b99284a3c43a2d2c15135365
Rust
yvt/enumflags
/enumflags_derive/src/lib.rs
UTF-8
8,695
2.671875
3
[ "Apache-2.0", "MIT" ]
permissive
#![recursion_limit = "2048"] extern crate proc_macro; #[macro_use] extern crate quote; extern crate syn; extern crate proc_macro2; use syn::{Data, Ident, DeriveInput, Variant, DataEnum}; use quote::Tokens; use proc_macro::TokenStream; use proc_macro2::Span; use std::convert::From; #[proc_macro_derive(EnumFlags, attrib...
true
ec17d7132445895b97de23df52b938032f34de2d
Rust
szopqa/AOC_2020
/src/puzzles/day_14/mod.rs
UTF-8
2,534
3.453125
3
[]
no_license
use std::collections::HashMap; use crate::puzzles::solution::Solution; #[derive(Debug)] enum Operation { Mask(String), Mem(usize, usize), } fn parse(input: &Vec<String>) -> Vec<Operation> { let mut memory_operations: Vec<Operation> = vec![]; for i in input { match &i[0..3] { "mas"...
true
7af3c20e0d11040e14a5f14a7d03ff27c2cd2dcc
Rust
IThawk/rust-project
/rust-master/src/test/ui/issues/issue-17263.rs
UTF-8
697
2.890625
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
// build-pass (FIXME(62277): could be check-pass?) #![feature(box_syntax)] struct Foo { a: isize, b: isize } fn main() { let mut x: Box<_> = box Foo { a: 1, b: 2 }; let (a, b) = (&mut x.a, &mut x.b); let mut foo: Box<_> = box Foo { a: 1, b: 2 }; let (c, d) = (&mut foo.a, &foo.b); // We explicit...
true
a927922ae47da4dc86c7996150414d01767add1a
Rust
kbluescode/rust-http-server
/src/handlers/listener.rs
UTF-8
2,049
2.546875
3
[]
no_license
use super::SharableReceiver; use std::net::{TcpListener, TcpStream}; use std::sync::{ mpsc::{self, Receiver, Sender, TryRecvError}, Arc, }; use std::time::Duration; const LISTENER_TIMEOUT_DUR: Duration = Duration::from_millis(15 * 1000); pub struct Listener { listener: Arc<TcpListener>, tcp_sender: Sender<Tcp...
true
c2a879d844d7c3ceed3d4b21acbdf70bb93766e0
Rust
killercup/assert_cmd
/src/cargo.rs
UTF-8
7,086
3.09375
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Simplify running `bin`s in a Cargo project. //! //! [`CommandCargoExt`][CommandCargoExt] is an extension trait for [`Command`][Command] to easily launch a crate's //! binaries. //! //! In addition, the underlying functions for looking up the crate's binaries are exposed to allow //! for optimizations, if needed. //...
true
d23fb88e01d8fb75cfea377142e22bf5c7980169
Rust
rogurotus/TicTacToe
/src/main.rs
UTF-8
5,098
3.28125
3
[]
no_license
use std::{fmt, str::FromStr}; #[derive(Debug, Clone, Copy, PartialEq)] enum Cell { Empty, X, O, } impl fmt::Display for Cell { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Cell::X => write!(f, "X "), Cell::O => write!(f, "O "), _ => wr...
true
75c2254bd806a34894db55c2823361b097a00ff7
Rust
drueck/advent-of-code-2020
/day-07/src/bags.rs
UTF-8
9,813
3.46875
3
[]
no_license
use std::collections::{HashMap, HashSet, VecDeque}; #[derive(PartialEq, Eq, Hash, Clone)] pub struct Bag { adjective: String, color: String, } impl Bag { pub fn new(description: &str) -> Bag { let parts: Vec<&str> = description.split(" ").collect(); return Bag { adjective: part...
true
bfc74cd0d5a05962232bde75fe5d59bf708fcd51
Rust
diegoetjoshua72/bachelorproject
/kontroli/src/scope/mod.rs
UTF-8
6,283
3.0625
3
[]
no_license
//! Scoping of parse structures to data structures with references. pub mod pattern; pub mod rterm; mod symbol; mod symbols; pub use pattern::Pattern; pub use rterm::RTerm; pub use symbol::Symbol; pub use symbols::Symbols; /// Rewrite rules with strings as bound variable identifiers, /// a top pattern (symbol applic...
true
030a28e22b63d833fa95ded073347f776a0bb9e3
Rust
flight-rs/bag
/bag/src/bags/mod.rs
UTF-8
951
2.515625
3
[ "MIT" ]
permissive
use ::{Bag, TryBag, Unbag, TryUnbag, fail}; use std::borrow::Borrow; mod map; pub use self::map::*; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct Static<U: ?Sized>(pub U); impl<T: ?Sized, U: ?Sized + Borrow<T>> Bag<T> for Static<U> { fn get(&self) -> &T { self.0.borrow() } } impl<T: ?Sized, U: ?Sized ...
true
20eb16fa80293ff68bc9e4876b41bd1064698ae9
Rust
khollbach/google-kickstart
/2021/a/a-3/src/main.rs
UTF-8
2,877
3.15625
3
[]
no_license
use std::io::{self, prelude::*}; use std::collections::BinaryHeap; use std::error::Error; use std::collections::BinaryHeap; /* - read grid - fill max-heap "peaks" with: [val, i, j] for val > 1 - while heap, pop "me": if my value in my cell is larger than me, ignore; since Ive already been dequeued ...
true
d28b3adda436580cf22ea18c325701263bbeb0f3
Rust
NicolasLagaillardie/mpst_rust_github
/examples/tcp_and_others/tcp_client.rs
UTF-8
1,240
3.234375
3
[ "Apache-2.0", "MIT" ]
permissive
use rand::random; use std::io::{Read, Write}; use std::net::TcpStream; use std::str::from_utf8; fn main() { loop { match TcpStream::connect("localhost:3334") { Ok(mut stream) => { println!("Successfully connected to server in port 3334"); // let msg = b"Hello!";...
true
36b3c20d9dc081497dbffac3d0993ea290714588
Rust
yonkeltron/cargo-appimage
/src/commands/init.rs
UTF-8
4,238
2.59375
3
[]
no_license
use color_eyre::eyre::{eyre, Result, WrapErr}; use paris::Logger; use async_std::fs; use async_std::path::{Path, PathBuf}; use std::os::unix::fs::PermissionsExt; use std::process::Command; use crate::application_definition::ApplicationDefinition; use crate::desktop_file::DesktopFile; const SIXTY_FOUR_BIT_URL: &str =...
true
fda1523a0850b9e48ef85753176dfc2cf82ff35c
Rust
jorendorff/cell-gc
/lisp/src/ports.rs
UTF-8
16,100
2.765625
3
[ "MIT" ]
permissive
use errors::*; use std; use std::fmt; use std::io::{self, BufRead, Write}; use std::marker::PhantomData; use std::sync::{Arc, Mutex}; use cell_gc::GcHeapSession; use value::Value; // Traits pub trait TextualInputPort: Send { fn read<'h>(&mut self, hs: &mut GcHeapSession<'h>) -> Result<Value<'h>>; fn read_cha...
true
c1cb33a956b93f710b7ae5cc6bd32899d2010f73
Rust
lawliet89/vault-rs
/src/secrets/aws.rs
UTF-8
7,815
2.875
3
[ "MIT" ]
permissive
//! AWS Secrets Engine //! //! See the [documentation](https://www.vaultproject.io/api/secret/aws/index.html). use crate::{Error, LeasedData, Response}; use async_trait::async_trait; use reqwest::Method; use serde::{Deserialize, Serialize}; /// Parameters for configuring the Root credentials for the AWS Secrets Engin...
true
071e8fd89914bed4c0369eabc99492bb2f335164
Rust
naominitel/RustLex-old
/src/rustlex/nfa.rs
UTF-8
10,137
2.90625
3
[]
no_license
use automata::Automata; use automata::AutomataState; use std::hashmap::HashMap; use std::hashmap::HashMapIterator; use std::hashmap::HashSet; use std::hashmap::HashSetIterator; use regex; // a non-deterministic finite automata pub struct NFA { priv states: ~HashMap<uint, ~State>, priv finals: ~HashSet<uint>, ...
true
a3e11fc408fa41e417010672d172b97374a138eb
Rust
Hirtol/Rustyboi
/core/src/io/bootrom.rs
UTF-8
638
3.09375
3
[ "Apache-2.0" ]
permissive
/// 256 bytes total for DMG pub const BOOTROM_SIZE_DMG: usize = 0x100; pub const BOOTROM_SIZE_CGB: usize = 0x900; type BootRomData = Vec<u8>; pub struct BootRom { pub is_finished: bool, data: BootRomData, } impl BootRom { pub fn new(data: Option<BootRomData>) -> Self { match data { So...
true
b3994d89808ba08d4537cd33b9411ca59022e519
Rust
wulu90/leetcode
/src/invert_binary_tree.rs
UTF-8
1,228
3.3125
3
[]
no_license
use crate::leetcode::binary_tree::TreeNode; use std::cell::RefCell; use std::rc::Rc; pub struct Solution; impl Solution { pub fn invert_tree(root: Option<Rc<RefCell<TreeNode>>>) -> Option<Rc<RefCell<TreeNode>>> { match root.clone() { Some(node) => { let invert_left = Self::inve...
true
65ed40cdce389d55756c0f96c3ad5896928fa142
Rust
franktea/leetcode-rust
/src/bin/0263.rs
UTF-8
236
2.984375
3
[]
no_license
impl Solution { pub fn is_ugly(num: i32) -> bool { let mut num = num; for x in [2, 3, 5].iter() { while num > 1 && num % x == 0 { num /= x; } } num == 1 } }
true
f64811230765e16701db635a1fd4044d84b5269d
Rust
tcr3dr/dronekit-rust
/src/parser.rs
UTF-8
13,852
2.921875
3
[ "MIT", "Apache-2.0" ]
permissive
use std::default::Default; use std::cmp::Ordering; use xml::reader::{EventReader, XmlEvent}; #[derive(Debug, PartialEq, Clone)] pub struct MavEnum { pub name: String, pub description: Option<String>, pub entries: Vec<MavEnumEntry>, } impl Default for MavEnum { fn default() -> MavEnum { MavEnu...
true
08b638e90b3ac8a3900bcfdd763cabb209408d65
Rust
likr/atcoder
/abc009/src/bin/c.rs
UTF-8
1,347
2.78125
3
[]
no_license
use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std::usize::MAX / 4; #[allow(unused)] const M: usize = 1000000007; fn...
true
c01693e185f5f2f5349aa1ea399ee885f4bd20c5
Rust
jbro885/customasm
/src/syntax/parser.rs
UTF-8
8,838
2.765625
3
[ "Apache-2.0" ]
permissive
use crate::*; use crate::diagn::RcReport; use crate::syntax::{Token, TokenKind, excerpt_as_usize}; #[derive(Clone)] pub struct Parser<'a> { pub report: Option<RcReport>, pub tokens: &'a [Token], index: usize, index_prev: usize, read_linebreak: bool, partial_index: usize } pub struct ParserState { index: usiz...
true
41defc3148f39d0e56a1d0bb41ac74578e15949b
Rust
thienpow/esm-datastore
/src/micro_services/gloader/gloader.rs
UTF-8
2,777
2.515625
3
[]
no_license
use std::convert::Infallible; use std::{fs}; use warp::{ Filter }; use bb8::Pool; use postgres_native_tls::MakeTlsConnector; use bb8_postgres::PostgresConnectionManager; use native_tls::{Certificate, TlsConnector}; mod handler; mod config; //use esm_jwk::jwk; use esm_jwk::jwk::JwkAuth; #[tokio::main] async f...
true
0f8a0a8ce08810f74ab252ec1acfbccb26f6f48d
Rust
elliottneilclark/rs-sudoku
/src/slow_index.rs
UTF-8
8,189
3.1875
3
[ "Apache-2.0" ]
permissive
use crate::index_helpers::*; use std::iter::Iterator; pub trait GenPosition { fn gen_position(&self, inc: usize) -> usize; } #[derive(Debug, Clone)] pub struct RowGenPosition { start_row: usize, start_col: usize, } impl RowGenPosition { pub fn new(row: usize) -> RowGenPosition { RowGenPosition...
true
87c4cc39d0a4029af3f7a16b7af83571ad3b0f22
Rust
iori-yja/ion
/src/parser/shell_expand/ranges.rs
UTF-8
6,182
3.25
3
[ "MIT" ]
permissive
use super::words::IndexEnd; pub fn parse_range(input: &str) -> Option<Vec<String>> { let mut bytes_iterator = input.bytes().enumerate(); while let Some((id, byte)) = bytes_iterator.next() { match byte { b'0'...b'9' | b'-' | b'a'...b'z' | b'A'...b'Z' => continue, b'.' => { ...
true
c5bc11f8d0133d0ab9afb6506de07b9321936650
Rust
yangger6/study-rust
/src/bin/guessing.rs
UTF-8
1,528
3.84375
4
[]
no_license
use std::io; // input || output use std::cmp::Ordering; use rand::Rng; // rand::Rng is thread_rng trait;using cargo doc --open to see; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); loop { println!("Please input your guess."); let mut gue...
true
62b134edd8fd0034456fc4eb1a6631d383c32212
Rust
rust-lang/rust-bindgen
/bindgen/codegen/postprocessing/mod.rs
UTF-8
1,510
2.515625
3
[ "BSD-3-Clause" ]
permissive
use proc_macro2::TokenStream; use quote::ToTokens; use syn::{parse2, File}; use crate::BindgenOptions; mod merge_extern_blocks; mod sort_semantically; use merge_extern_blocks::merge_extern_blocks; use sort_semantically::sort_semantically; struct PostProcessingPass { should_run: fn(&BindgenOptions) -> bool, ...
true
1a2ec7410e1ff226fab6a74e6f561e4a542fd12c
Rust
Schoyen/vmc
/src/main.rs
UTF-8
3,696
2.953125
3
[ "Unlicense" ]
permissive
mod hamiltonians; mod particle; mod sampler; mod solvers; mod system; mod wavefunctions; use hamiltonians::{EllipticHarmonicOscillator, HarmonicOscillator}; use particle::Particles; use solvers::{ImportanceSampling, MetropolisAlgorithm}; use system::System; use wavefunctions::{Gaussian, InteractingEllipticGaussian}; ...
true
7185dc182ded51d80c8f56f033c3f5390f9b318d
Rust
stkfd/poe-superfilter
/src/scope/string.rs
UTF-8
913
3.265625
3
[ "MIT" ]
permissive
use super::*; impl InnerScopeValue for String { fn try_add(self, other: Self) -> Result<ScopeValue> { Ok(ScopeValue::String(self + other.as_ref())) } fn try_cmp(&self, other: Self) -> Result<Ordering> { Ok(self.cmp(&other)) } fn try_eq(&self, other: Self) -> Result<bool> { ...
true
028315bae40d78a815779799fc332651b15c4b76
Rust
AndrewKvalheim/rust-exercises
/fizzy/src/lib.rs
UTF-8
413
2.703125
3
[ "MIT" ]
permissive
#![feature(trait_alias)] mod fizzy; mod matcher; pub use crate::fizzy::Fizzy; pub use crate::matcher::Matcher; use std::ops::{Add, Rem}; pub fn fizz_buzz<'a, T>() -> Fizzy<'a, T> where T: 'a + Add + From<u8> + PartialEq + Rem<Output = T>, { Fizzy::new() .add_matcher(Matcher::new(|n| n % 3.into() == 0...
true
fd7b595abdf7a6dd9bf21ee46477a1743328a85c
Rust
zhifengle/monkey-rs
/src/lexer/keyword.rs
UTF-8
1,322
3.515625
4
[]
no_license
use std::{fmt, str::FromStr}; #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub enum Keyword { Function, Let, True, False, If, Else, Return, } #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct KeywordError; impl fmt::Display for KeywordError { fn fmt(&self, f: &mut fmt::Formatter<...
true
e9352c9e8a9681df7952be40420a3798250e99ac
Rust
gKevinK/LeetCode
/1326_Minimum_Number_of_Taps_to_Open_to_Water_a_Garden.rs
UTF-8
677
2.640625
3
[]
no_license
impl Solution { pub fn min_taps(n: i32, ranges: Vec<i32>) -> i32 { let mut v = Vec::new(); for i in 0..=n { v.push((i - ranges[i as usize], i + ranges[i as usize])); } v.sort(); let mut start = 0; let mut i = 0; let mut result = 0; while st...
true
f96be726287f7d8ed3115b57cd95032a3fda2948
Rust
gnoliyil/fuchsia
/third_party/rust_crates/vendor/tui-0.16.0/examples/rustbox_demo.rs
UTF-8
1,751
2.609375
3
[ "BSD-2-Clause", "MIT" ]
permissive
mod demo; #[allow(dead_code)] mod util; use crate::demo::{ui, App}; use argh::FromArgs; use rustbox::keyboard::Key; use std::{ error::Error, time::{Duration, Instant}, }; use tui::{backend::RustboxBackend, Terminal}; /// Rustbox demo #[derive(Debug, FromArgs)] struct Cli { /// time in ms between two ticks...
true
dbd24e0019b35e5c8d625bcd814b7a4b9baedb93
Rust
cambricorp/lifeline-rs
/examples/subscription.rs
UTF-8
1,867
3.03125
3
[ "MIT" ]
permissive
use bus::SubscriptionBus; use lifeline::{prelude::*, subscription::Subscription}; use message::ExampleId; use simple_logger::SimpleLogger; use time::Duration; use tokio::time; /// The subscription service maintains a list of subscribed entries. #[tokio::main] pub async fn main() -> anyhow::Result<()> { SimpleLogge...
true
e20d1405c557eb69fe43e3bcac67f5a5d6ba8a38
Rust
bootingman/fuchsia2
/garnet/bin/pkg_resolver/src/repository_manager.rs
UTF-8
31,911
2.796875
3
[ "BSD-3-Clause" ]
permissive
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { failure::Fail, fidl_fuchsia_pkg_ext::{RepositoryConfig, RepositoryConfigs}, fuchsia_syslog::fx_log_err, fuchsia_uri::pkg_uri::RepoUri...
true
5a3441f392029b5eae2f12c3f4205943d27ccbfc
Rust
iCodeIN/advent-of-code-3
/crates/core/src/year2016/day08.rs
UTF-8
4,278
3.34375
3
[ "MIT" ]
permissive
use crate::common::character_recognition::recognize; use crate::Input; struct Screen { pixels: [bool; Screen::WIDTH * Screen::HEIGHT], } impl Screen { const WIDTH: usize = 50; const LETTER_WIDTH: usize = 5; const HEIGHT: usize = 6; const fn get_pixel(&self, x: usize, y: usize) -> bool { s...
true
9e08eb8cbbd58d3f9c3c16a9493ceda05876955a
Rust
Daspien27/Advent-of-Code-2020
/src/day8.rs
UTF-8
3,484
3.265625
3
[]
no_license
use regex::*; use std::collections::HashSet; #[derive(Debug, Clone)] enum Instruction { Acc(i64), Jmp(isize), Nop(isize), } #[derive(Debug, Clone)] pub struct Console { accumulator : i64, instruction_ptr : isize, program : Vec<Instruction>, } impl Console { fn run_part1 (&mut self) -> i6...
true
9519d985cae92af556910e3e1bf2c8d0ac6bdaea
Rust
openSUSE/rapidquilt
/src/libpatch/analysis/multiapply.rs
UTF-8
4,157
2.78125
3
[ "MIT" ]
permissive
use std::borrow::Cow; use std::io::{self, Write}; use std::ops::Range; use crate::analysis::*; use crate::modified_file::ModifiedFile; use crate::patch::{ FilePatchApplyReport, HunkApplyReport, TextFilePatch, PatchDirection, HunkPosition, }; use crate::util::Searcher; #[derive(Clone, Debug)] stru...
true
aa10fced38ae6370b65c1311bbb31bcb7ed4c040
Rust
lo48576/fbxcel-dom
/src/v7400/object/property/loaders/primitive.rs
UTF-8
5,914
3.078125
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Primitive property loaders. use std::marker::PhantomData; use anyhow::Error; use fbxcel::low::v7400::AttributeValue; use crate::v7400::object::property::{loaders::check_attrs_len, LoadProperty, PropertyHandle}; /// Primitive type value loader. /// /// This does minimal checks about `data_type` and `label`. /// ...
true
cf28185b0adad113836fe20b2cd38ebe2acad40d
Rust
Phantomical/mighty-server
/server/src/systems/collision/missile.rs
UTF-8
2,270
2.546875
3
[ "MIT" ]
permissive
use specs::prelude::*; use specs::world::EntitiesRes; use types::collision::*; use types::*; use component::channel::OnMissileTerrainCollision; use component::event::MissileTerrainCollision; use component::flag::IsMissile; #[derive(Default)] pub struct MissileTerrainCollisionSystem { terrain: Terrain, } #[derive(S...
true
913cb4a0ff2b2a3ef722476b05181594545961d8
Rust
TNorbury/Rust-Structured-Information-Sorter
/src/main.rs
UTF-8
1,749
4.1875
4
[]
no_license
use std::io; use std::io::prelude::*; use std::io::BufReader; use std::fs::File; struct Person { name: String, age: usize, //Make age of type usize for consitency with functions such as len } fn main() { //Create a vector that will contain all the people. let mut people = Vec::new(); let mut f...
true
472998c44df8e594175ac98d9715ed7c6ad13434
Rust
Wind-River/rust
/src/test/mir-opt/inline/inline-closure-borrows-arg.rs
UTF-8
1,329
2.546875
3
[ "MIT", "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause", "LicenseRef-scancode-other-permissive", "NCSA" ]
permissive
// compile-flags: -Z span_free_formats // Tests that MIR inliner can handle closure arguments, // even when (#45894) fn main() { println!("{}", foo(0, &14)); } fn foo<T: Copy>(_t: T, q: &i32) -> i32 { let x = |r: &i32, _s: &i32| { let variable = &*r; *variable }; x(q, q) } // END RUS...
true
4bfb85086d780d4b26b3712b5af7d71148d82116
Rust
anott03/linear_algebra
/src/transformation/spec.rs
UTF-8
389
3
3
[]
no_license
#[cfg(test)] mod spec { use crate::transformation::transformation; #[test] fn test() { let x: f64 = std::f64::consts::FRAC_PI_4; assert_eq!(x.tan(), x.sin() / x.cos()); } #[test] fn rotation1() { let v: Vec<f64> = vec![1.0, 0.0]; assert_eq!(transformation::rotat...
true
d9e187110bd9e34677f4f3927c891142ad1173cb
Rust
aeosynth/fetch
/rust.rs
UTF-8
1,570
2.921875
3
[ "Unlicense" ]
permissive
use std::env::var; use std::fs::{read_dir, read_to_string}; fn mem() -> (i32, i32) { let mem = read_to_string("/proc/meminfo").unwrap(); let get = |i: usize| -> i32 { mem.lines() .nth(i) .unwrap() .split_ascii_whitespace() .nth(1) .unwrap() ...
true
0ad2c467cbb336f5f7aa6b21089267a2593a2ac0
Rust
sowetocon/sowetocon.github.io
/crate/src/pages/training.rs
UTF-8
1,307
3.015625
3
[ "MIT" ]
permissive
use yew::prelude::*; use yew_styles::layouts::{ container::{Container, Direction, Wrap}, item::{Item, ItemLayout}, }; pub struct Training; impl Component for Training { type Message = (); type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Training {} ...
true
6fd423b9edd6b090da3a7ea4c73af3ee68b47f62
Rust
garyttierney/libsepolrs
/src/policydb/symtable.rs
UTF-8
1,011
2.796875
3
[]
no_license
use policydb::CompatibilityProfile; use policydb::PolicyObject; use policydb::PolicyReadError; use policydb::PolicyReader; use std::collections::btree_map::Values; use std::collections::BTreeMap; use std::io::Read; pub trait Symbol: PolicyObject { fn id(&self) -> u32; fn name(&self) -> &str; } #[derive(Debug...
true
23ab68098312d874d0647cd3ffb9a2a3c6dfea37
Rust
me-unsolicited/rust-chess
/src/engine/mod.rs
UTF-8
4,423
2.671875
3
[]
no_license
use std::collections::HashMap; use std::sync::{Arc, Mutex, mpsc}; use std::thread; use crate::engine::board::Board; use crate::engine::mov::Move; use crate::engine::search::SearchStats; pub mod mov; mod bb; mod board; mod eval; mod gen; mod hash; mod piece; mod search; mod square; #[allow(dead_code)] pub enum LogLev...
true
9d0528b0d838e47d28e93221fbb12c7f106ba3a0
Rust
ZakisM/http_lib
/src/response/mod.rs
UTF-8
3,832
3.140625
3
[]
no_license
use std::convert::TryFrom; use std::fmt::Formatter; use crate::error::ErrorExt; use crate::header_map::HeaderMap; use crate::http_item::HttpItem; use crate::response::response_header::ResponseHeader; use crate::response::response_status::ResponseStatus; use crate::Result; pub mod response_header; pub mod response_sta...
true
fdd4afcb493676943a741836e86b53d08d7f569d
Rust
jeandudey/xrb-rs
/src/protocol.rs
UTF-8
6,551
2.703125
3
[ "MIT" ]
permissive
//! Here basic protocol communication is described like requests and replies. use ::std::io; use ::std::io::Read; use ::futures::Future; use ::byteorder::NativeEndian; use ::byteorder::ReadBytesExt; use ::Client; /// An X11 Protocol request. pub trait Request { type Reply: 'static; fn encode(&mut self) -> ...
true
1140ebb2440095631b35d01f63b19abc24914f90
Rust
lise-henry/isometric
/src/wall.rs
UTF-8
1,979
3.5
4
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// (C) 2017, Élisabeth Henry // // Licensed under either of // // Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 // MIT license: http://opensource.org/licenses/MIT // at your option. // // Unless you explicitly state otherwise, any contribution intentionally submitted // for inclusion in the w...
true
8c7dabb1db09d6cfa838f1f2df86369ce0ee3961
Rust
stefanpenner/cargo-registry
/src/util/mod.rs
UTF-8
2,918
2.53125
3
[]
no_license
use std::io::{MemReader, IoError}; use std::io::process::{ProcessOutput, Command}; use std::collections::HashMap; use std::fmt::Show; use std::str; use serialize::{json, Encodable}; use url; use conduit::{Request, Response, Handler}; pub use self::errors::{CargoError, CargoResult, internal, internal_error}; pub use ...
true
82e3d25eba64b3aeb446e5dd04e5093f94afda2c
Rust
ekmartin/pdf-word-count
/src/main.rs
UTF-8
758
2.796875
3
[ "MIT" ]
permissive
extern crate clap; extern crate pdf_word_count; use clap::{App, Arg}; use pdf_word_count::Collector; use std::fs::File; use std::io; fn main() { let args = App::new("pdf-wc") .version("0.1.0") .about("Displays the number of lines, words, and characters in a PDF.") .arg( Arg::wi...
true
d8824c013a4ae58af39b8c5ef3d48c41999f8e20
Rust
seungha-kim/realtime-canvas-system
/server/src/connection_tx_storage.rs
UTF-8
998
2.8125
3
[]
no_license
use crate::connection::ConnectionEvent; use std::collections::HashMap; use system::ConnectionId; pub type ConnectionTx = tokio::sync::mpsc::Sender<ConnectionEvent>; pub struct ConnectionTxStorage { connection_txs: HashMap<ConnectionId, ConnectionTx>, } impl ConnectionTxStorage { pub fn new() -> Self { ...
true
8016c0c696567a60712bdaece771e91aaeea48b0
Rust
jiayihu/fedra-thesis
/packages/fedra-broker/src/pod.rs
UTF-8
5,756
2.8125
3
[]
no_license
use once_cell::sync::Lazy; use k8s_openapi::api::core::v1::{Pod as KubePod, Volume as KubeVolume}; use kube::api::Meta; static EMPTY_MAP: Lazy<std::collections::BTreeMap<String, String>> = Lazy::new(|| std::collections::BTreeMap::new()); /// A Kubernetes Pod /// /// This is a new type around the k8s_openapi Pod ...
true
ddbba4c64d606bd04596a0f4d908154b577ca376
Rust
altoplano/euler-rs
/problem_035/src/main.rs
UTF-8
873
2.984375
3
[ "CC0-1.0" ]
permissive
use common::input; use common::math::IsPrime; fn main() { println!("[INPUT] calculate primes until:"); let limit = u64::from_str_radix(&input::read_line(), 10).expect("Could not parse input!"); let mut count = 0; for n in 2..limit { if n.is_prime() { let mut digits = n.to_string()...
true