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
e67320c3120d73b1a2bd68c58ff17b1fa52fa0ec
Rust
0x1DA117/broot
/src/conf.rs
UTF-8
12,517
3.03125
3
[ "MIT" ]
permissive
//! manage reading the verb shortcuts from the configuration file, //! initializing if if it doesn't yet exist use { crate::{ errors::ConfError, keys, skin::SkinEntry, tree::*, verb::VerbConf, }, crossterm::style::Attribute, directories::ProjectDirs, std::{ ...
true
781a602bd2b51a300ed8fd92ce54ea3b0dd07b3a
Rust
victor-zed/tink-rust
/signature/src/signer_factory.rs
UTF-8
3,675
2.59375
3
[ "Apache-2.0" ]
permissive
// Copyright 2020 The Tink-Rust Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
true
4f661c5df0a6bd84138826ee95bb373a3a1c286e
Rust
mackenziestarr/opl3
/src/port.rs
UTF-8
3,633
3
3
[]
no_license
use core; use volatile::Volatile; use bit_field::BitField; pub enum PortName { A, B, C, D, E } #[repr(C,packed)] pub struct Port { pcr: [Volatile<u32>; 32], gpclr: u32, gpchr: u32, reserved_0: [u8; 24], isfr: u32, } #[repr(C,packed)] pub struct Pin { port: *mut Port, p...
true
3c066a5d33f2b2307729be5d865ab3f6a8953229
Rust
llasram/euler-rust
/src/e14.rs
UTF-8
541
3.484375
3
[]
no_license
pub struct Collatz(usize); impl Iterator for Collatz { type Item = usize; fn next(&mut self) -> Option<usize> { match *self { Collatz(0) => None, Collatz(1) => { self.0 = 0; Some(1) }, Collatz(n) => { self.0 = if n % 2 == 0 { n / 2 } else { 3 * n + 1...
true
f73aab8c1ae4aa655d00206c3fcd46d5d9a89814
Rust
hoangpq/naia
/shared/src/entities/property.rs
UTF-8
1,164
3.421875
3
[ "Apache-2.0", "MIT" ]
permissive
use std::{cell::RefCell, rc::Rc}; use super::entity_mutator::EntityMutator; /// A Property of an Entity, that contains data which must be tracked for /// updates, and synced to the Client #[derive(Clone)] pub struct Property<T: Clone> { mutator: Option<Rc<RefCell<dyn EntityMutator>>>, mutator_index: u8, p...
true
2e7437fb9dea71ff5ee12637afe9c2b7e5eb3936
Rust
jam1garner/binwrite
/src/writers.rs
UTF-8
1,055
2.921875
3
[ "MIT" ]
permissive
use super::*; /// A built in writer for null terminated utf8 strings. Use `#[binwrite(cstr)]` as a shortcut for /// this. pub fn null_terminated_string<S: std::fmt::Display, W: Write>(string: S, writer: &mut W, options: &WriterOption) -> Result<()> { BinWrite::write_options(&format!("{}", string), writer, options)...
true
61f864450108d74e891251db533ede071a3b57db
Rust
vbo/nnrs
/src/timing.rs
UTF-8
2,211
3.4375
3
[]
no_license
use std::collections::BTreeMap; use std::collections::hash_map::Entry; use std::fmt; use std::time; pub struct Timing { sections: BTreeMap<String, SectionTimer>, } struct SectionTimer { start: time::Instant, duration: time::Duration, } impl Timing { pub fn new() -> Self { Timing { ...
true
5f8a6113aa5547a0455b0b68b2dab7b1712afc61
Rust
Telixia/leetcode-3
/Medium/0967-Numbers With Same Consecutive Differences/Solution.rs
UTF-8
522
2.59375
3
[]
no_license
impl Solution { pub fn nums_same_consec_diff(n: i32, k: i32) -> Vec<i32> { let mut nums = (1..10).collect(); for _ in 1..n { let mut nums_ = vec![]; for x in nums { let y = x % 10; if y + k < 10 { nums_.push(x * 10 + y + k...
true
703c39d30018eb1ec1b3f051d051f4ba363f9b44
Rust
nwtnni/advent-of-code
/aoc-21/src/day_20.rs
UTF-8
2,635
2.96875
3
[ "MIT" ]
permissive
use std::cmp; use std::collections::HashMap; use aoc::*; #[derive(Clone, Debug)] pub struct TrenchMap { grid: HashMap<Pos, bool>, enhance: Vec<bool>, } impl Fro for TrenchMap { fn fro(input: &str) -> Self { let mut iter = input.trim().split("\n\n"); let enhance = iter .give()...
true
aec7d263114a7d451aefe7c54662ef01b5387790
Rust
AdamWhitehurst/roguie
/src/map.rs
UTF-8
6,991
2.921875
3
[]
no_license
use rltk::{Algorithm2D, BaseMap, Point, Rltk, SmallVec, RGB}; use serde::{Deserialize, Serialize}; use specs::prelude::*; use std::collections::HashSet; pub const MAP_WIDTH: usize = 80; pub const MAP_HEIGHT: usize = 43; pub const MAP_COUNT: usize = MAP_HEIGHT * MAP_WIDTH; #[derive(PartialEq, Copy, Clone, Serialize, D...
true
b08f7c9535a6418c8be5722c4d31e0773f664309
Rust
benjione/learn-rust-algorithms
/src/thread_pool.rs
UTF-8
3,902
3.53125
4
[]
no_license
use std::thread; use std::sync::mpsc; use std::sync::mpsc::{Sender, Receiver}; use std::sync::Arc; use std::sync::Mutex; pub struct ThreadPool { max_threads: usize, thread_handle_queue: Vec<Worker>, sender: mpsc::Sender<Job>, } struct Worker { id: usize, thread: thread::JoinHandle<()>, } trait F...
true
8ae2e8b5c6ba0bfb141edce5b093c9a98acf7aa8
Rust
typst/typst
/crates/typst/src/ide/tooltip.rs
UTF-8
6,515
2.734375
3
[ "Apache-2.0", "Bitstream-Vera", "CC-BY-4.0", "OFL-1.1", "LicenseRef-scancode-gust-font-1.0", "BSD-3-Clause", "LicenseRef-scancode-ubuntu-font-1.0", "0BSD", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain", "MIT", "LicenseRef-scancode-public-domain-disclaimer" ]
permissive
use std::fmt::Write; use ecow::{eco_format, EcoString}; use if_chain::if_chain; use super::analyze::analyze_labels; use super::{analyze_expr, plain_docs_sentence, summarize_font_family}; use crate::doc::Frame; use crate::eval::{CastInfo, Tracer, Value}; use crate::geom::{round_2, Length, Numeric}; use crate::syntax:...
true
3d8bbf5c44731fb4485404170c3d2a6f44d935b3
Rust
arch-yzk/Rust_Practice
/Chapter4/src/ch04_08_reference1.rs
UTF-8
816
3.875
4
[]
no_license
fn main() { // 関数f1は呼び出し元の値のコピーを引数nに束縛し、1に変更する fn f1(mut n: u32) { n = 1; println!("f1: n = {}", n); } // 関数f2は呼び出し元の値を指すポインタを受け取る // ポインタが指す場所に2を格納する fn f2(n_ptr: &mut u32) { println!("f2: *n_ptr = {:p}", n_ptr); // *をつけると参照先にアクセスできる。これを参照外し(deref...
true
93a4912392c640d9d77d397437d2df28e023173b
Rust
MadonnaMat/mbta_with_friends
/src/controllers/config.rs
UTF-8
676
2.703125
3
[]
no_license
use std::env; use crate::models::user::*; use rocket_contrib::Json; #[derive(Serialize)] pub struct Config { api_key: String, user: Option<JsonUser> } #[get("/config", rank=1)] pub fn config_logged_in(current_user: User) -> Result<Json<Config>, ()> { let api_key = env::var("MBTA_API_KEY").expect("MBTA_AP...
true
09746e9ce2704610b6934078ac2987df3e8547b5
Rust
EmbarkStudios/winit
/examples/web.rs
UTF-8
2,890
2.953125
3
[ "Apache-2.0" ]
permissive
#![allow(clippy::single_match)] use winit::{ event::{Event, WindowEvent}, event_loop::EventLoop, window::WindowBuilder, }; pub fn main() { let event_loop = EventLoop::new(); let window = WindowBuilder::new() .with_title("A fantastic window!") .build(&event_loop) .unwrap();...
true
ac7b040b32ce4956c5a7bfa931f1305adc45a198
Rust
coriolinus/adventofcode-2016
/day10/src/lib.rs
UTF-8
10,176
3.671875
4
[]
no_license
//! Advent of Code - Day 10 Instructions //! //! Balance Bots //! //! You come upon a factory in which many robots are zooming around handing small microchips //! to each other. //! //! Upon closer examination, you notice that each bot only proceeds when it has two microchips, //! and once it does, it gives each one to...
true
1eb87c7b75bb818ae70a8467359f8c5d4f711f00
Rust
tamamu/algonote
/atcoder-abc063a.rs
UTF-8
338
2.875
3
[]
no_license
use std::io; fn main() { let stdin = io::stdin(); let mut buf = String::new(); stdin.read_line(&mut buf).unwrap(); let ab: Vec<usize> = buf.split_whitespace().map(|n| n.parse().unwrap()).collect(); let n = ab[0] + ab[1]; if n >= 10 { println!("error"); } else { println!(...
true
58a4a3031d71b3d7bb9f5ea4553df4df7b60db88
Rust
Irchh/rust-riscv-emu
/src/bus/mod.rs
UTF-8
893
3.109375
3
[ "MIT" ]
permissive
use crate::dram::DRAM; pub const DRAM_BASE: usize = 0x8000_0000; pub trait Device { fn write(&mut self, addr: usize, size: usize, val: u64) -> Result<(), ()>; fn read(&self, addr: usize, size: usize) -> Result<u64, ()>; } #[derive(Debug)] pub struct BUS { dram: DRAM, // Box<[u8]> doesn't wanna work } i...
true
bed0da68dd9b7429daa306f56eb41080883ca013
Rust
psaia/rust-protobuf
/protobuf/src/coded_input_stream.rs
UTF-8
26,444
2.578125
3
[ "MIT" ]
permissive
use std::io; use std::io::BufRead; use std::io::Read; use std::mem; use crate::buf_read_iter::BufReadIter; #[cfg(feature = "bytes")] use crate::bytes::Bytes; #[cfg(feature = "bytes")] use crate::chars::Chars; use crate::enums::ProtobufEnum; use crate::enums::ProtobufEnumOrUnknown; use crate::error::ProtobufError; use ...
true
a879e3caaafc8032fb7dfbe21d7890b8cee03fc1
Rust
robertmmarek/rust-practice
/chapter_3/task_1/src/main.rs
UTF-8
733
3.5625
4
[]
no_license
use std::vec; #[derive(Debug)] struct Student{ id: u32, name: String, surname: String, age: i32, marks: vec::Vec<u32> } fn build_user(id: u32, name: String, surname: String, age: i32, marks: vec::Vec<u32>) -> Student { Student{ id, name, surname, age, m...
true
0a27effc913bd3db05e4f834a5b11d08bef797f2
Rust
Nalleyer/SudokuSolver
/src/solver.rs
UTF-8
4,338
2.890625
3
[]
no_license
use crate::sudoku::{Sudoku, Value, View}; use std::collections::HashSet; use std::iter::FromIterator; pub struct Solver<'s> { sudoku: &'s mut Sudoku, sudoku_last: Option<Sudoku>, } impl<'s> Solver<'s> { pub fn new(sudoku: &'s mut Sudoku) -> Solver<'s> { Solver { sudoku, su...
true
f4f7105ef891643ae37279124ec7062b8842d7aa
Rust
Atul9/crush
/src/lib/types/glob.rs
UTF-8
2,181
2.578125
3
[ "MIT" ]
permissive
use crate::lang::errors::{CrushResult}; use crate::lang::{value::Value, execution_context::ExecutionContext}; use crate::lang::execution_context::{ArgumentVector, This}; use std::collections::HashMap; use lazy_static::lazy_static; use crate::util::glob::Glob; use crate::lang::command::CrushCommand; use crate::lang::com...
true
fdd56fe4c9cad046ba88363468216469e1b05e07
Rust
s992/everything
/note/src/util.rs
UTF-8
3,554
3.078125
3
[ "MIT" ]
permissive
use std::fs::{File, read_dir, read_to_string}; use std::io::{Result, prelude::*}; use std::env::{home_dir, temp_dir, var_os}; use std::path::PathBuf; use std::process::{Command, ExitStatus}; #[derive(Debug)] pub struct Note { pub path: PathBuf, pub index: usize, pub contents: String, } impl Note { pub...
true
ab77167afe5a7cb1bfdf1836d11be38edb30f123
Rust
aleksander/knight_move
/src/main.rs
UTF-8
7,993
2.890625
3
[]
no_license
extern crate libc; fn print_array (arr: &[[usize; 10]; 10]) { for y in 0..10 { for x in 0..10 { print!("{:2} ", arr[x][y]); } println!(); } } /* fn have_unreachable_points (arr: &[[usize; 10]; 10], neighbors: &[[usize; 10]; 10]) -> bool { let mut single_neighbor_point =...
true
9bd8871abab8e566521c3aa7f569e038ef543eda
Rust
ricardohbin/some-dream
/src/onboarding.rs
UTF-8
17,404
2.671875
3
[]
no_license
use rand::Rng; use rand::rngs::ThreadRng; use std::collections::HashMap; use super::player::*; use super::interaction; use super::render; use super::itens; use super::attributes::{Stats, VitalPoints}; // used implictly by strum... use std::str::FromStr; use std::string::ToString; pub struct Onboarding { rng: Thr...
true
54a459bed516f9768333f6f01cd0763357d2e619
Rust
rust-lang/rustc-perf
/site/src/interpolate.rs
UTF-8
6,823
3.625
4
[ "MIT" ]
permissive
//! Provides an "interpolating" iterator atop of another iterator. //! //! This does not do linear interpolation but rather just keeps the last seen //! value going until the next point and so forth. For perf's purposes, we //! mostly want to avoid dropping or improving summary performance when data //! points are miss...
true
93182c6be9da096f696490b607c8865c48251934
Rust
yaoshuyin/broot
/src/display/col.rs
UTF-8
3,020
3.578125
4
[ "MIT" ]
permissive
use { crate::{ errors::ConfError, }, std::str::FromStr, }; // number of columns in enum const COLS_COUNT: usize = 8; /// One of the "columns" of the tree view #[derive(Debug, Clone, Copy, PartialEq)] pub enum Col { /// selection mark, typically a triangle on the selected line Mark, //...
true
4442c95f2da9626ce4f6c0b3bc41dbed17b5031d
Rust
sooxt98/doboom
/src/endpoints/auth/mod.rs
UTF-8
4,064
2.796875
3
[]
no_license
use time; mod facebook; mod twitter; mod google; use diesel::prelude::*; use models::users::User; use schema::users::dsl::*; use config::Config; use rocket::{State, Response}; use rocket_contrib::{JSON, Value}; use endpoints::helpers::*; use endpoint_error::EndpointResult; use endpoints::pagination::Pagination; u...
true
a305e0e6465526da0a47410e0e95242fcedba55a
Rust
gystar/HelloRust
/learn-Rust-the-hard-way-lectures/src/exercises/ex45.rs
UTF-8
910
3.015625
3
[]
no_license
use std::env; use std::io::prelude::*; use std::net::{Ipv4Addr, SocketAddrV4, TcpStream}; fn main() -> std::io::Result<()> { let mut args = Vec::new(); for arg in env::args() { args.push(arg); } assert_ne!(args.len(), 3, "USAGE: netclient host port\n"); //learncodethehardway.org:80 todo:直接使...
true
99a0fc9fa0a4355751056c8b2c2eeffd629ccd87
Rust
cfoust/byt
/src/byt/io/file/mod.rs
UTF-8
28,286
3.140625
3
[ "MIT" ]
permissive
//! byt - io //! //! Implements a piece table to abstract over accessing and //! modifying a file on disk. // EXTERNS // LIBRARY INCLUDES use std::fmt; use std::fs::{File, OpenOptions}; use std::io::{ BufReader, Error, ErrorKind, Read, Result, Seek, SeekFrom, Write }; use std::io; use ...
true
1d5d2da8e635b563c55bfe9b877e2194ab9ff6f8
Rust
svitebskiy/lined_paper_pdf
/src/seyes_lines_gen.rs
UTF-8
2,515
2.828125
3
[ "MIT" ]
permissive
use crate::geometry_def::{LineDef, PointDef, PaperSize, SeyesLineSet, CmykDef}; use crate::geometry_def::coord::Coord; use thiserror::Error; pub fn create_seyes_lines(line_set: &SeyesLineSet, paper_size: &PaperSize, result: &mut Vec<LineDef>) -> Result<(), Error> { if paper_size.width <= 0.0 { return E...
true
221ff5c64b26648a2dfe359e7b8c4f28e411ab9c
Rust
KlasafGeijerstam/Kattis
/rust/dictionaryattack.rs
UTF-8
4,061
3.390625
3
[]
no_license
mod fast_input; use fast_input::{FastInput}; use std::collections::HashSet; const S: u8 = '*' as u8; fn main() { let inp = FastInput::new(); let n: usize = inp.next(); let mut words = HashSet::with_capacity(6000000); let mut one_digit = HashSet::with_capacity(500000); let mut two_digit = HashSet::w...
true
0f1efe1d57d716d2052c11bd4c36460b5098b5d5
Rust
pksunkara/reign
/reign_view/src/parse/mod.rs
UTF-8
2,512
2.640625
3
[ "Apache-2.0", "MIT" ]
permissive
use proc_macro2::TokenStream; use quote::ToTokens; use syn::{ punctuated::{Pair, Punctuated}, Ident, Member, }; mod attribute; mod code; mod comment; mod consts; mod doctype; mod element; mod error; mod expr; mod node; mod parse_stream; mod pat; mod string_part; mod text; mod view_fields; use attribute::Attri...
true
6a751b684030fdcc3cd0292bc57b62101e01e486
Rust
MTBorg/D7050E
/tests/samples/if_a_eq_2.rs
UTF-8
73
2.828125
3
[]
no_license
fn main() { let a = 2; if a == 2 { return 11; } return 12; }
true
9d16f05eef7bcfc75ff551f6d394b6fd1838be14
Rust
erikdesjardins/redirected
/src/routes.rs
UTF-8
2,538
2.640625
3
[ "MIT" ]
permissive
use hyper::client::HttpConnector; use hyper::{Body, Client, Request, Response, StatusCode}; use hyper_rustls::HttpsConnector; use tokio::fs::File; use crate::file; use crate::redir::{Action, Rules}; pub struct State { client: Client<HttpsConnector<HttpConnector>>, rules: Rules, } impl State { pub fn new(...
true
0d9f39a428d58911fcdfa664dbf70aacfd4a9290
Rust
ErikNatanael/daily-sketches
/20200319/src/son.rs
UTF-8
4,952
2.953125
3
[]
no_license
use nannou_audio as audio; use nannou_audio::Buffer; use std::f64::consts::PI; pub const NUM_SINES: usize = 1000; pub struct AudioInterface { stream: audio::Stream<Audio>, next_free_sine: usize, amp_changes: Vec<(usize, f32)>, freq_changes: Vec<(usize, f64)>, } impl AudioInterface { pub fn new() -> Self { ...
true
9c53dcda711b97d5f2c3d2156fa6c4266ba14af5
Rust
mmihira/rocket_rc
/rc_signal/src/feed/bitfinex.rs
UTF-8
2,366
2.828125
3
[ "MIT" ]
permissive
use std::string::FromUtf8Error; use serde_json; use curl::easy::Easy; use models; use super::PollTrades; use timestamp::{ TimeStamp }; use std::str::FromStr; pub struct Public { } #[derive(Clone, Serialize, Deserialize, Debug)] struct Trade { #[serde(rename="type")] pub _type: String, pub timestamp: TimeStamp...
true
b533dc9bced45996878b8db401fe3a594877cceb
Rust
mgeisler/rust-hdbconnect
/tests/test_utils/mod.rs
UTF-8
2,383
2.578125
3
[ "MIT" ]
permissive
// advisable because not all test modules use all functions of this module: #![allow(dead_code)] use flexi_logger::{opt_format, Logger, ReconfigurationHandle}; use hdbconnect::{ConnectParams, IntoConnectParams}; use hdbconnect::{Connection, HdbResult}; use std::fs::read_to_string; // Returns a logger that prints out ...
true
439d653f6941a0c11279eba5909c893268cf9d97
Rust
ry/tokio
/src/util/mod.rs
UTF-8
393
2.53125
3
[ "MIT" ]
permissive
//! Utilities for working with Tokio. //! //! This module contains utilities that are useful for working with Tokio. //! Currently, this only includes [`FutureExt`] and [`StreamExt`], but this //! may grow over time. //! //! [`FutureExt`]: trait.FutureExt.html //! [`StreamExt`]: trait.StreamExt.html mod future; mod st...
true
dfa1045714855c9eb516928cedefc8c2444c6293
Rust
simonsan/problems
/roman-numeral/roman-numeral/src/lib.rs
UTF-8
9,709
3.140625
3
[ "MIT", "WTFPL" ]
permissive
#![cfg_attr(feature="clippy", feature(plugin))] #![cfg_attr(feature="clippy", plugin(clippy))] extern crate num; #[macro_use] extern crate num_derive; extern crate itertools; #[macro_use] extern crate error_chain; mod errors; use errors::*; use itertools::Itertools; use std::str::FromStr; use num::traits::{CheckedS...
true
1b8edb1da932ef7cac9f476807552d979f3e38e8
Rust
mjm/advent-of-code-2020
/src/bin/day10/main.rs
UTF-8
1,798
3.421875
3
[]
no_license
use std::env; use std::fs; use std::num::ParseIntError; use nom::lib::std::collections::HashMap; fn main() { let args: Vec<String> = env::args().collect(); let input_path = &args[1]; println!("Reading input from {}", input_path); let contents = fs::read_to_string(input_path) .expect("Somethin...
true
96332f7a95e2d153f5ae5b9961f720cc2c6d0b03
Rust
paulgb/webgl2-glyph-atlas
/src/error.rs
UTF-8
1,042
2.75
3
[]
no_license
pub enum GlyphAtlasError { WebGlError(String), WebGlShaderInfoLog(String), WebGlProgramInfoLog(String), DomError(String), InternalError(String), } impl std::fmt::Display for GlyphAtlasError { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match &self { Self...
true
1e2c7dec961de2c053f33dcf7aeb0c29ceb51937
Rust
mordak/test_headers
/src/headers.rs
UTF-8
13,972
3.078125
3
[]
no_license
use nom::{ branch::alt, bytes::complete::tag as complete_tag, bytes::streaming::{tag, take_till}, character::streaming::{space0, space1}, combinator::{map, not, peek}, sequence::tuple, IResult, }; #[derive(Debug, PartialEq)] pub struct Name { pub name: Vec<u8>, pub flags: u8, } #[d...
true
3102b31076468aeb2ef1519dd72022b0503ad922
Rust
gridbugs/advent-of-code-2019
/day24-2/src/main.rs
UTF-8
5,262
2.953125
3
[]
no_license
use std::io::Read; const NUM_CELLS: u8 = 25; const ROW_SIZE: u8 = 5; fn parse(s: &str) -> u32 { s.chars() .filter(|&c| c != '\n') .enumerate() .map(|(i, ch)| if ch == '#' { 1 << i } else { 0 }) .sum() } #[derive(Clone, Copy, Default)] struct Level { cells: u32, } const INNER_...
true
e142f37707cefa481b554d6ff65698817993c259
Rust
ducaale/xh
/src/formatting.rs
UTF-8
4,699
2.640625
3
[ "MIT" ]
permissive
use std::io::{self, Write}; use syntect::dumps::from_binary; use syntect::easy::HighlightLines; use syntect::highlighting::ThemeSet; use syntect::parsing::SyntaxSet; use syntect::util::LinesWithEndings; use termcolor::WriteColor; use crate::{ buffer::Buffer, cli::{FormatOptions, Theme}, }; pub fn get_json_fo...
true
c7640f74e0d8a3dcda17c3b5b5c3527ebe061e81
Rust
zzeroo/xMZ-Mod-Touch-Prototypes
/xmz-server/src/sensor_no2/sensor_no2.rs
UTF-8
418
2.703125
3
[]
no_license
use sensor::Sensor; use exception::HasException; #[derive(Debug)] pub struct SensorNO2; impl SensorNO2 { pub fn new() -> Self { SensorNO2 { } } } impl Sensor for SensorNO2 { fn update(&mut self) { println!("Update NO2 Sensor"); } } impl HasException for SensorNO2 { fn c...
true
33b274597fc7a3dce29c87c26e0c03025aceade7
Rust
Kowalevskaja/nalgebra
/src/geometry/transform.rs
UTF-8
11,504
2.765625
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
use std::any::Any; use std::fmt::Debug; use std::marker::PhantomData; use approx::ApproxEq; #[cfg(feature = "serde-serialize")] use serde::{Serialize, Serializer, Deserialize, Deserializer}; use alga::general::Field; use core::{Scalar, SquareMatrix, OwnedSquareMatrix}; use core::dimension::{DimName, DimNameAdd, DimN...
true
a080d61613458286ba4df8d585e6c79afd273685
Rust
samsieber/subgit-sync
/declarative/src/tree.rs
UTF-8
7,277
2.828125
3
[]
no_license
use std::path::PathBuf; use std::collections::HashMap; use std::path::Path; use std::prelude::v1::Vec; use crate::git::InternalGit; use std::ops::Deref; use std::collections::HashSet; #[derive(Clone, Debug)] pub enum FileChange { Deleted, Content(String) } #[derive(Debug, Clone)] pub struct ChangeSet { pu...
true
b69efd356fa92742a8c9032071e76c3f0750aee1
Rust
ml47-srl/b.3-libsrl
/src/parse/tokenize.rs
UTF-8
6,218
3.03125
3
[]
no_license
use error::SRLError; use super::*; // splits string into tokens, fix_whitespaces has to be called prior. Defined behaviour only for chars in VALID_CHARS without \n \t and . pub fn tokenize(mut string : String) -> Result<Vec<String>, SRLError> { let mut tokens : Vec<String> = Vec::new(); #[allow(non_camel_case_types...
true
fd832fc28c186d486f220deda21f40ce50ce3dd1
Rust
grissiom/pyxlsx.rs
/src/lib.rs
UTF-8
4,548
2.71875
3
[]
no_license
#![feature(specialization, const_fn)] extern crate pyo3; use pyo3::prelude::*; use pyo3::exceptions; extern crate calamine; use calamine::{Sheets, Range, DataType, Reader}; fn to_py_err(err: calamine::Error) -> pyo3::PyErr { PyErr::new::<exceptions::ValueError, _>(format!("{}", err).to_string()) } #[pyclass] s...
true
660285d87f7a74f230dd9a1dba8d53ae7c705c50
Rust
LukaszDargiewicz/rust-native-tls
/src/test.rs
UTF-8
2,102
2.75
3
[ "Apache-2.0", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
use openssl::ssl::{SslMethod, SslConnectorBuilder}; use std::io::{Read, Write}; use std::net::{TcpStream, TcpListener}; use std::thread; use super::*; #[test] fn connect_google() { let builder = TlsConnector::builder().unwrap().build().unwrap(); let s = TcpStream::connect("google.com:443").unwrap(); let m...
true
ad1b1e15ca074e75a447e86bb2114f99f54f8ed5
Rust
aristotle9/qt_generator-output
/qt_widgets/src/tool_box.rs
UTF-8
25,113
2.546875
3
[]
no_license
/// C++ type: <span style='color: green;'>```QToolBox```</span> #[repr(C)] pub struct ToolBox(u8); impl ToolBox { /// C++ method: <span style='color: green;'>```QToolBox::addItem```</span> /// /// This is an overloaded function. Available variants: /// /// /// /// ## Variant 1 /// /// Rust arguments:...
true
d31f1d67885184ca8d6588c146a898cb75237ecf
Rust
Mackiovello/advent_of_code
/src/nine/players.rs
UTF-8
1,683
3.875
4
[]
no_license
use std::cell::Cell; // TODO: Make this into an Iter pub struct Players { items: Vec<Player>, current: Cell<usize>, } impl Players { pub fn new(number_of_players: u32) -> Players { Players { items: (0..number_of_players).map(Player::new).collect(), current: Cell::new(0), ...
true
64a4c6e54155e8e444f298d21dc9aed6a19d42f8
Rust
fanxu1218/tdengine
/src/utils/file_utils.rs
UTF-8
2,701
3.09375
3
[ "Apache-2.0", "MIT" ]
permissive
use std::io; use std::io::prelude::*; use std::path::{Path}; use std::env; use std::fs::{self, File}; static mut ins : *mut FileUtils = 0 as *mut _; pub struct FileUtils { search_paths : Vec<String>, } impl FileUtils { pub fn instance() -> &'static mut FileUtils { unsafe { if ins == 0 as...
true
2021bdb7a58de4ecc028e881a70b7855b6a93371
Rust
natanaeljr/gerlib
/src/projects.rs
UTF-8
2,206
2.734375
3
[]
no_license
//! Projects related REST endpoints. //! //! See [ProjectEndpoints](trait.ProjectEndpoints.html) trait for the REST API. use crate::changes::WebLinkInfo; use serde_derive::{Deserialize, Serialize}; use serde_with::skip_serializing_none; use std::collections::HashMap; // ///////////////////////////////////////////////...
true
bc6c4c239cc862f05dbae75358f19077113b5575
Rust
lightsing/eoss-fuse
/src/fs.rs
UTF-8
1,479
2.9375
3
[]
no_license
use crate::id::ID_LENGTH; pub struct RawChunk; pub struct MetaChunk; pub struct TinyFileChunk; enum ChunkType { /// Chunk holds raw data (file part) Raw, /// Chunk holds a directory metadata DirMeta, /// Chunk holds tiny files TinyFiles, /// If a provider does not known the type, leave it ...
true
433078e2adea925dc4f31edae1b03fc107dc0c5a
Rust
steamroller-airmash/airmash-protocol-rs
/src/v5/protocol.rs
UTF-8
14,119
2.703125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use bstr::{BStr, BString, ByteSlice}; use super::Result; use crate::types::VectorExt; use crate::v5::{Error, ErrorExt as _, ErrorKind}; use crate::Vector2; struct ScalarSpec { shift: i32, mult: f32, } impl ScalarSpec { pub const fn new(shift: i32, mult: f32) -> Self { Self { shift, mult } } fn de(&sel...
true
aeefe7de1a023f01c68133dfdd635ffbdc9e573c
Rust
wowiwj/story-rs
/src/db/src/models/users.rs
UTF-8
1,760
2.9375
3
[]
no_license
use sqlx::types::chrono::{DateTime, Utc}; use sqlx::{FromRow, MySqlPool}; use serde::Serialize; use quaint::prelude::*; use crate::builder::builder::QueryX; use common::jwt::jwt::AuthUser; #[derive(sqlx::Type, Debug)] #[sqlx(rename_all = "lowercase")] pub enum Gender { None = 0, Male = 1, Female = 2, } #...
true
edd1251f9d86137af5f27f4ffaadf5f0e5152b9f
Rust
nilq/ko
/src/main.rs
UTF-8
700
2.953125
3
[ "MIT" ]
permissive
extern crate colored; mod ko; use ko::source::*; use ko::lexer::*; use ko::parser::*; fn main() { let file = "foo.ko"; let content = r#" window: width = 100 height = 100 title = " a window " "#; let source = Source::from(file, content.lines().map(|x| x.into()).collect::<Vec<String>>()); let...
true
14b5bdd273e6ef527fa6fa104e120159480e49e9
Rust
DaviRain-Su/raingrep
/src/lib.rs
UTF-8
818
3.3125
3
[ "MIT" ]
permissive
pub mod pattern { use std::io::Write; pub fn find_matches(content: &str, pattern: &str, mut writer : impl Write) -> Result<(), std::io::Error>{ for (_line_no, line) in content.lines().enumerate() { if line.contains(pattern){ // writeln!(writer, "{} : {}", _line_no, line)?; writeln!...
true
1aef2baffdebd056573a338c6178bc05228876d6
Rust
argmin-rs/argmin
/argmin-math/src/vec/signum.rs
UTF-8
3,184
2.6875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
// Copyright 2018-2022 argmin developers // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://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...
true
66473835a2581923c0f685d6e9b52dc15a2f5e3d
Rust
wangchao0502/rust-leetcode
/src/p5210_find_ball.rs
UTF-8
2,463
3.296875
3
[]
no_license
#![allow(dead_code)] // use mods pub struct Solution {} // problem description // 用一个大小为 m x n 的二维网格 grid 表示一个箱子。你有 n 颗球。箱子的顶部和底部都是开着的。 // 箱子中的每个单元格都有一个对角线挡板,跨过单元格的两个角,可以将球导向左侧或者右侧。 // 将球导向右侧的挡板跨过左上角和右下角,在网格中用 1 表示。 // 将球导向左侧的挡板跨过右上角和左下角,在网格中用 -1 表示。 // 在箱子每一列的顶端各放一颗球。每颗球都可能卡在箱子里或从底部掉出来。 // 如果球恰好卡在两块挡板之间的 "V" 形图案,或者...
true
b906d8af2c7e0c94046e26dec2937b7454e28def
Rust
sflanaga/du2
/src/tstatus.rs
UTF-8
2,882
3
3
[]
no_license
use std::sync::{Arc, Mutex}; use std::thread; use std::time::Duration; use anyhow::{Context, anyhow, Result}; #[cfg(target_os = "windows")] pub fn gettid() -> usize { unsafe { winapi::um::processthreadsapi::GetCurrentThreadId() as usize } } #[cfg(any(target_os = "linux", target_os = "android"))] pub fn gettid() -...
true
b9294591a7fe1cbc27b57e871a96a7a9da3db462
Rust
bsurmanski/cookies_rs
/src/cookie.rs
UTF-8
2,328
2.765625
3
[ "MIT" ]
permissive
use crate::collision::*; use crate::entity::*; use crate::draw_context::*; use crate::man::*; use nalgebra::{Vector3, Matrix4, zero}; use rockwork::mesh::*; use rockwork::texture::*; use lazy_static::*; lazy_static!{ static ref TEXTURE: Texture = rockwork::include_png_texture!("../res/cookie.png"); static re...
true
de686d2378ae6762ccb82e63dcebc0541d5ed81c
Rust
apache/incubator-teaclave-sgx-sdk
/sgx_tstd/src/sync/mpsc/mod.rs
UTF-8
55,391
3.4375
3
[ "BSD-3-Clause", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
true
53b286aa290d0d956d68c3f869ed32cb02a074d2
Rust
geraldstanje/rust-cc
/src/parse/parsing.rs
UTF-8
12,850
2.6875
3
[]
no_license
/* */ use parse::lex; use parse::ParseResult; struct ParseState<'ast> { ast: &'ast mut ::ast::Program, lex: ::parse::preproc::Preproc, } pub fn parse(ast: &mut ::ast::Program, filename: &str) -> ParseResult<()> { let mut self_ = ParseState { ast: ast, lex: try!(::parse::preproc::Preproc::new(filename)) }; ...
true
1218d6bb3c5d7e4e3fa83cb2c09ff3abcea4a5d9
Rust
rodrimati1992/structural_crates
/structural/src/docs/structural_macro.rs
UTF-8
29,084
3.390625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
/*! The Structural derive macro implements the Structural trait, as well as accessor traits. The accessor traits are [`GetField`]/[`GetFieldMut`]/[`IntoField`] for structs, and [`GetVariantField`]/[`GetVariantFieldMut`]/[`IntoVariantField`] for enums. Every instance of `<DerivingType>` in the documentation is the n...
true
2cddbdb49277b7ac74409ef9087105cf82e46379
Rust
RensAlthuis/rust-engine
/src/ecs/entity.rs
UTF-8
136
2.578125
3
[]
no_license
use typemap::TypeMap; pub struct Entity(pub TypeMap); impl Entity { pub fn new() -> Entity { Entity(TypeMap::new()) } }
true
811ff7524670588cc02660a7319e925319452825
Rust
balena-io-modules/balena-temen
/tests/parser/function.rs
UTF-8
808
2.734375
3
[ "Apache-2.0" ]
permissive
use balena_temen::ast::*; use crate::test_parse_eq; #[test] fn without_arguments() { test_parse_eq!( "UUID()", Expression::new(ExpressionValue::FunctionCall(FunctionCall::new("UUID", vec![]))) ); } #[test] fn with_positional_arguments() { test_parse_eq!( "UUID(1)", Express...
true
059729dd3f8516551d9ed4b9c92a168cb46a4eac
Rust
hotiket/sumorucc
/src/token_stream.rs
UTF-8
9,301
3.328125
3
[ "MIT" ]
permissive
use std::rc::Rc; use super::src::Source; use super::tokenize::{Loc, Token, TokenKind}; pub struct TokenStream<'vec> { token: &'vec [Rc<Token>], current: usize, } impl<'vec> TokenStream<'vec> { pub fn new(token: &'vec [Rc<Token>]) -> Self { Self { token, current: 0 } } fn get_src(&self) -...
true
b16980185b1f218a08c2f8d5dfe821b924aa3851
Rust
clarfonthey/bitvec
/src/slice/tests.rs
UTF-8
8,369
2.890625
3
[ "MIT" ]
permissive
//! Unit tests for bit-slices. #![cfg(test)] use core::cell::Cell; use rand::random; use crate::{ order::HiLo, prelude::*, }; mod api; mod iter; mod ops; mod traits; #[test] #[allow(clippy::many_single_char_names)] fn copying() { let a = bits![mut u8, Lsb0; 0; 4]; let b = bits![u16, Msb0; 0, 1, 0, 1]; a.clon...
true
f81c2e88f2d719b21fbd95859e364679f1e763bb
Rust
pkgw/drorg
/src/colors.rs
UTF-8
1,893
2.921875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
// Copyright 2018 Peter Williams <peter@newton.cx> // Licensed under the MIT License. //! The color palette for the command line interface. use tcprint::{Color, ColorSpec, ReportType, ReportingColors}; /// The CLI color palette. #[derive(Clone, Debug, Eq, PartialEq)] pub struct Colors { /// Bold green. pub g...
true
db5e06a0237c516f8447913a47a486528591068b
Rust
nimiq/core-rs-albatross
/primitives/mmr/src/mmr/position.rs
UTF-8
9,166
3.671875
4
[ "Apache-2.0" ]
permissive
use std::cmp::Ordering; use crate::mmr::utils::bit_length; /// Structure to hold a node's position. /// This structure contains and caches additional information that normally would need to be computed /// from the index. #[derive(Copy, Clone, Debug)] pub(crate) struct Position { pub(crate) index: usize, pub(...
true
0cef59927d12aaf71995b21e3a9a0e6634362171
Rust
abhyuditjain/leetcode_30_day_challenge
/src/number_of_islands.rs
UTF-8
1,762
3.578125
4
[]
no_license
/* 200. Number of Islands Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example 1: Input: 11110 11010 11000...
true
559f6c4201923d28dafc31e60cb054ef70038018
Rust
mgsloan/mzr
/src/utils.rs
UTF-8
4,196
3.171875
3
[]
no_license
use crate::colors::*; use failure::{Error, Fail, ResultExt}; use nix::unistd; use std::ffi::CString; use std::ffi::OsStr; use std::fmt::Display; use std::fs::File; use std::io::{self, Read, Write}; use std::os::unix::process::ExitStatusExt; use std::path::{Path, PathBuf}; use std::process::{exit, ExitStatus}; use std::...
true
bf16c9fa7acf1cfb4614760e56eb9c745bb2bc35
Rust
Terkwood/hello-pi
/pi_service/examples/simple.rs
UTF-8
1,292
3.390625
3
[ "MIT" ]
permissive
extern crate wiringpi; use std::thread; use std::time::Duration; fn main() { // Setup wiringPi in GPIO mode (with original BCM numbering order) let pi = wiringpi::setup_gpio(); let red_led = pi.soft_pwm_pin(12); let green_led = pi.soft_pwm_pin(16); let blue_led = pi.soft_pwm_pin(20); // clea...
true
7f88ec678c42f4b4fae05d42235d2e6d2c454a0a
Rust
madgene/tube
/src/settings.rs
UTF-8
1,185
3.015625
3
[]
no_license
use std::env; use config::{ ConfigError, Config, File, Environment }; #[derive(Debug, Deserialize)] pub struct Files { pub path: String } #[derive(Debug, Deserialize)] pub struct Settings { pub files: Files } impl Settings { pub fn new() -> Result<Self, ConfigError> { let mut s = Config::new(); ...
true
2bfe76a8261b94b909413c2f634db9223b90d3a2
Rust
ankurhimanshu14/novarche_web
/src/grades/grade_handlers.rs
UTF-8
2,989
2.625
3
[]
no_license
#[path = "../schema.rs"] mod schema; #[path = "../utils.rs"] mod utils; use super::grade_models::{NewGrade, Grade}; use crate::schema::grades::dsl::*; use crate::utils::Pool; use diesel::QueryDsl; use diesel::RunQueryDsl; use actix_web::{web, Error, HttpResponse}; use diesel::dsl::{delete, insert_into}; use serde::{D...
true
150f66ea4bdeec61e2c63cc539d24d854f6c6dcf
Rust
Adoliin/move-links
/src/cli_utils.rs
UTF-8
1,832
2.875
3
[ "MIT" ]
permissive
use crate::Config; use std::process; pub fn move_link(src_path: &String, dest_path: &String, config: &Config) { let _output_mv = process::Command::new("mv") .arg(src_path) .arg(dest_path) .output() .expect("Failed to execute mv"); verbose_msg(config, format!( "Executed:...
true
df52848a07bf60342a21e13a517675aa645664b4
Rust
reitermarkus/lndir
/src/bin/lndir.rs
UTF-8
2,266
2.5625
3
[]
no_license
#![cfg_attr(test, allow(dead_code))] extern crate lndir; use std::vec::Vec; use std::path::PathBuf; use std::env; use lndir::lndir; use lndir::options::Options; use lndir::argument_error::ArgumentError; fn parse_args() -> Result<(Options, Vec<PathBuf>, PathBuf), ArgumentError> { let mut options = Options::new(); ...
true
b26d2b4f37cb836c63f6174c425dcc46f3d1673b
Rust
k124k3n/competitive-programming-answer
/exercism/rust/proverb/src/lib.rs
UTF-8
360
2.609375
3
[ "MIT" ]
permissive
pub fn build_proverb(list: &[&str]) -> String { let verses = list.windows(2).map(|x| format!("For want of a {} the {} was lost.\n", x[0], x[1]) ).collect::<String>(); let closing = match list.len() { 0 => String::from(""), _ => format!("And all for the want of a {}.", list[0]) };...
true
0f4cab3eda90095e3076a63931627b373a35fcf5
Rust
muffinista/matasano
/src/set2_9.rs
UTF-8
982
3.5
4
[]
no_license
#[cfg(test)] mod test { // Implement PKCS#7 padding // // A block cipher transforms a fixed-sized block (usually 8 or 16 // bytes) of plaintext into ciphertext. But we almost never want // to transform a single block; we encrypt irregularly-sized // messages. // // // One way we ac...
true
8560e979771992ae2a6d9a2348f4a40f86cdd399
Rust
nilsso/challenge-solutions
/leetcode/problems/islands/src/main.rs
UTF-8
1,309
3.6875
4
[]
no_license
pub struct Grid { pub h: isize, pub w: isize, pub cells: Vec<Vec<char>>, } impl Grid { fn is_land(&self, x: isize, y: isize) -> bool { x >= 0 && x < self.w && y >= 0 && y < self.h && self.cells[y as usize][x as usize] == '1' } fn sink_island(&mut self, x: isize, y: isize) { if ...
true
b61579c45a3f9bacf188bf83aaa87807254d4ca3
Rust
Vengarioth/rust-vulkan-renderer
/rvrc/src/builder/shader/attributes.rs
UTF-8
3,984
2.71875
3
[ "MIT" ]
permissive
use rvr_assets::{ Format, shader::VertexAttribute, }; #[derive(Debug, Clone, Eq, PartialEq)] #[allow(non_camel_case_types)] pub enum BuiltinAttribute { gl_VertexID, gl_InstanceID, gl_DrawID, gl_BaseVertex, gl_BaseInstance, gl_Position, gl_PointSize, gl_ClipDistance, gl_Patch...
true
d093e9bcec250e3865d8e3627555512778a58707
Rust
pythias/leetcode
/algorithms/rust/src/s0665_check_possibility.rs
UTF-8
1,162
3.484375
3
[]
no_license
// 665. 非递减数列 // https://leetcode-cn.com/problems/non-decreasing-array/ impl Solution { pub fn check_possibility(nums: Vec<i32>) -> bool { let mut c = 0; for i in 1..nums.len() { if nums[i - 1] > nums[i] { c += 1; if c >= 2 { return fal...
true
139d8392922902d582779f90bf02e92a1fa5fc14
Rust
Teln0/SysControl
/rust/src/memory/frame_allocator/mod.rs
UTF-8
6,873
2.671875
3
[]
no_license
use crate::utils::{ceil_div_usize}; use stivale::memory::MemoryMapIter; use stivale::memory::MemoryMapEntryType::Usable; use crate::memory::paging::{EntryTable, PageInfo, EntryFlags, TableAccess}; pub const FRAME_SIZE: usize = 4096; #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)] pub struct FrameInfo { ...
true
49d847f17faf2fcda890ba3a7922c6ccd2f62405
Rust
riscv-rust/e310x-hal
/src/device.rs
UTF-8
4,630
2.640625
3
[ "ISC" ]
permissive
//! Device resources available in FE310-G000 and FE310-G002 chip packages use crate::core::CorePeripherals; use crate::gpio::{gpio0::*, GpioExt, Unknown}; use e310x::{ Peripherals, AONCLK, BACKUP, GPIO0, OTP, PMU, PRCI, PWM0, PWM1, PWM2, QSPI0, QSPI1, RTC, UART0, WDOG, }; #[cfg(feature = "g002")] use e310x::{I...
true
6557b2885bcec64e17c85d30c64364b79020b5fa
Rust
aGiant/robust_trading.icml2019
/rsrl/src/prediction/gtd/tdc.rs
UTF-8
2,514
2.546875
3
[ "BSD-3-Clause", "MIT" ]
permissive
use crate::core::*; use crate::domains::Transition; use crate::fa::{Approximator, Parameterised, Features, VFunction}; use crate::geometry::{Space, MatrixView, MatrixViewMut}; pub struct TDC<F> { pub fa_theta: F, pub fa_w: F, pub alpha: Parameter, pub beta: Parameter, pub gamma: Parameter, } impl...
true
a030f437a263105e4ca064ed2e11b8be069f0354
Rust
shenshing/b-project
/database/src/product_db_op.rs
UTF-8
688
2.890625
3
[]
no_license
use crate::structure::Product; use diesel::PgConnection; use diesel::sql_query; use diesel::prelude::*; pub fn insert_new_product(pro: Product, connection: &PgConnection) -> Result<String, String> { let statement = format!("Insert Into products Values ('{}', '{}', '{}', '{}');", pro.pro_id, pro.pro_type, ...
true
4bdc99a88d9b3e2c09a622169fc1001cd39f743e
Rust
broadwaylamb/find-program-by-name-rs
/src/unix.rs
UTF-8
2,589
3.140625
3
[]
no_license
use std::env; use std::ffi::CString; use std::fs; use std::io; use std::os::unix::ffi::OsStrExt; use std::path::{Path, PathBuf}; /// Find the first executable file `name` in `paths`. /// /// This does not perform hashing as a shell would but instead stats each `PATH` /// entry individually so should generally be avoid...
true
1c91f18b7af965524765c59fcd6ac06071769e9d
Rust
JD557/nelder-mead.rs
/src/bounds.rs
UTF-8
519
3.265625
3
[]
no_license
pub struct Bounds { pub min: Vec<f64>, pub max: Vec<f64>, } impl Bounds { pub fn none(n: usize) -> Bounds { let mut min = Vec::new(); let mut max = Vec::new(); for _ in 0..n { min.push(std::f64::MIN); max.push(std::f64::MAX); } Bounds { min, m...
true
a82f4765bce85e47e6815b564584980ce7ec9d0f
Rust
davidrusu/bft-crdts
/src/at2_impl.rs
UTF-8
14,603
2.765625
3
[ "MIT", "BSD-3-Clause" ]
permissive
// IMPLEMENTATION OF https://arxiv.org/pdf/1812.10844.pdf // TODO: remove unused derives use std::collections::{BTreeSet, HashMap}; // TODO: can we replace HashMap with BTreeMap use std::mem; type ProcID = u8; type Money = i64; #[derive(Debug)] pub struct Proc { id: ProcID, initial_balances: HashMap<ProcID, ...
true
2d89f195c3f7b5f1ca6df4a5e31cbc937d7ea7e2
Rust
makotokato/gecko-dev
/third_party/rust/wasmparser/src/readers/core/elements.rs
UTF-8
10,667
2.84375
3
[ "LLVM-exception", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
/* Copyright 2018 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
true
fff1092803aab4a920477b34e8fd28c57e65bf30
Rust
bonega/advent2020
/src/bin/day14/main.rs
UTF-8
1,895
3.1875
3
[]
no_license
use std::collections::HashMap; use regex::Regex; mod part2; #[derive(Debug)] struct Mask { zero: usize, one: usize, } impl Mask { fn mask(&self, v: usize) -> usize { (v | self.one) & self.zero } fn new() -> Self { Self { zero: 0, one: 0 } } } impl From<&str> for Mask { ...
true
aa3eaed0692776104f132f1d2370fe54b0959f8e
Rust
DzenanJupic/progros
/src/vga/mod.rs
UTF-8
1,894
2.875
3
[]
no_license
use core::fmt::Write; pub use writer::Writer; pub mod buffer; pub mod writer; #[macro_export] macro_rules! println { () => ( $crate::print!("\n"); ); ($($arg:tt)*) => ( $crate::print!("{}\n", format_args!($($arg)*)); ); } #[macro_export] macro_rules! print { ($($arg:tt)*) => ( $crate::vga::_print(format...
true
45e29355e9231c0ece6a532bbfa6dd25416c09b9
Rust
snarkyboojum/sha_hash
/src/bin/test-sha512.rs
UTF-8
631
3.203125
3
[ "Apache-2.0" ]
permissive
use sha_hash::{sha256, sha512}; fn main() { println!("Welcome to the SHA-2 implementation in Rust!"); let msg = "Look again at that dot. That's here. That's home. That's us. On it everyone you love, everyone you know, \ everyone you ever heard of, every human being who ever was, lived out the...
true
9127997f174886181a4e22991794d4eaa00dd778
Rust
hershi/cryptopals_rust
/ex_20_crack_ctr_statistically/src/main.rs
UTF-8
1,458
2.8125
3
[]
no_license
#[macro_use] extern crate lazy_static; use std::io::prelude::*; use std::io::BufReader; use std::fs::File; use utils::*; use utils::encoding::*; use utils::encryption::*; use utils::repeating_xor_cracker::*; use data_encoding::BASE64; const KEY_SIZE : usize = 16; lazy_static! { static ref KEY: Vec<u8> = random_b...
true
cf717b18779b37c74e73f710c0756b5e8ea40782
Rust
N4rr34n6/reg_hunter
/src/main.rs
UTF-8
21,770
2.578125
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
/* Author: Brian Kellogg Purpose: Operational triage of Windows registry. I try to continue through all errors to allow the analysis to complete. But, no doubt, I missed some corner cases. Compiling: x32: cargo build --release --target i686-pc-windows-msvc x64: cargo build --relea...
true
989d8744def7a420533c42f82cee6ef9e5257497
Rust
mdsherry/neweatskw-rs
/src/facility.rs
UTF-8
2,396
2.859375
3
[]
no_license
use anyhow::Error; use encoding::{all::ISO_8859_1, DecoderTrap, Encoding}; use serde::Deserialize; use std::path::Path; #[derive(Debug, Deserialize)] pub struct Facility { #[serde(rename = "SUBCATEGORY")] pub typ: String, #[serde(rename = "CITY")] pub city: String, #[serde(rename = "ADDR")] pub...
true
d6038d026900f5ccfbe45e49ba35918d8251e938
Rust
platinummonkey/adventofcode
/year_2020/puzzles/p_11/src/main.rs
UTF-8
8,269
3.125
3
[]
no_license
use crate::Location::{EmptySeat, Floor, OccupiedSeat}; #[allow(unused_imports)] use util::*; const DEBUG_WITH_IMAGES: bool = true; fn main() { println!("part 1 = {}", part_1("puzzles/p_11/data/input")); println!("part 2 = {}", part_2("puzzles/p_11/data/input")); } fn num_adjacent(seats: Vec<Vec<Location>>, r...
true