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
1d48c9402426d3cbc3229a3d03d7024fc0beea26
Rust
heilhead/city-connection-test
/src/main.rs
UTF-8
2,702
3.359375
3
[]
no_license
use std::collections::hash_map::HashMap; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; enum ReaderState { Connection, Request, } type ConnectionList = Vec<(String, String)>; fn parse_line(s: String) -> Option<(String, String)> { // Line length will never be 0, as it will always have...
true
a1a94092a0ca63dabc7ac4001effed46c114cfaf
Rust
fathens/hexcect
/hardware/src/i2c/mpu6050/register/attributes/tests.rs
UTF-8
4,969
2.75
3
[ "MIT" ]
permissive
use super::*; use embedded_time::{duration::*, rate::*}; use num_traits::FromPrimitive; #[test] fn flags_xyz_from_booleans() { assert_eq!(FlagsXYZ::new(false, false, false), FlagsXYZ(0)); assert_eq!(FlagsXYZ::new(false, false, true), FlagsXYZ(1)); assert_eq!(FlagsXYZ::new(false, true, false), FlagsXYZ(2));...
true
398a2724ac10c12d591fc13201b5784b654b68db
Rust
davidOSUL/ContextSwitch
/src/main.rs
UTF-8
3,786
2.59375
3
[]
no_license
mod curr_time_fetcher; mod parser; mod runner; mod scheduler; mod website; mod website_blocker; use app_dirs::*; use std::error::Error; use std::fs::File; use std::path::PathBuf; use std::str::FromStr; use std::time::Duration; use std::{env, thread}; const APP_INFO: AppInfo = AppInfo { name: "ContextSwitch", ...
true
48b17dec2890e760d2caad42fe2c899cdf1b214a
Rust
styrowolf/autolink-lib
/src/private.rs
UTF-8
4,938
2.9375
3
[ "MIT" ]
permissive
extern crate serde; pub extern crate chrono; extern crate serde_json; extern crate clap; use std::process::Command; use std::convert::AsRef; use std::fmt; use std::path::{Path, PathBuf}; use std::fs::File; use std::fs::OpenOptions; use std::io::{Read, Write}; use std::env; use serde::{Serialize, Deserialize}; use chron...
true
1635b42aff002109dd8ae4cb3c20d7f9ca8367ed
Rust
ikkerens/fake_haproxy
/src/error.rs
UTF-8
953
2.53125
3
[ "MIT" ]
permissive
use std::fmt::{self, Debug, Display, Formatter}; #[derive(Fail)] pub(super) enum Error { #[fail(display = "{}", usage)] Arguments { usage: String }, #[fail(display = "Could not parse forwarder input: {}", input)] Argument { input: String }, #[fail(display = "Could not parse bind address: {}", input)] AddressPars...
true
23987e29b2e36274046c1dba2748a8baa604e302
Rust
ajbowen249/PlusPlusTime
/2017-03-03_primality-test/prime/src/main.rs
UTF-8
1,334
3.59375
4
[]
no_license
use std::env; fn is_prime(number: u64) -> i8 { if number == 1 { return 0; } else if number == 2 { return 1; } let mut maybe_factor = 2; loop { if number % maybe_factor == 0 { return -1; //I couldn't find a way of finding the square root of a u64 in ...
true
93bf9cc819a3ac9482dc46d5447005a9521ac758
Rust
saibatizoku/ezo-common-rs
/src/lib.rs
UTF-8
10,570
2.890625
3
[ "MIT" ]
permissive
//! Shared code for EZO sensor chips. These chips are used for sensing aquatic //! media. //! //! > Currently, only __I2C Mode__ is supported. #[macro_use] extern crate failure; extern crate i2cdev; #[macro_use] mod macros; pub mod command; pub mod errors; pub mod response; use std::ffi::{CStr, CString}; use std::th...
true
13821acf148d9d92c66ea3870100dbc114eacad6
Rust
jTitor/leek2
/src/open-source/engine/modules/src/graphics/factory/internal/glutin.rs
UTF-8
2,004
2.578125
3
[]
no_license
/*! Builds a Device and Window via Gfx and Glutin. */ use gfx_hal::Instance; use gfx_hal::format::{Rgba8Srgb, AsFormat}; use gfx_backend_gl; use graphics::GraphicsPayload; use super::FactoryDispatcher; use graphics::window::internal::glutin_window::GlutinWindow; use graphics::device::internal::gl::GLDevice; use math::...
true
aaa3c2d2a8f686d819c3ec46c9883bc566f7e2f9
Rust
RustCrypto/AEADs
/aes-siv/src/lib.rs
UTF-8
8,832
3.15625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#![no_std] #![cfg_attr(docsrs, feature(doc_cfg))] #![doc = include_str!("../README.md")] #![doc( html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg", html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg" )] #![warn(missing_docs, rust_2018_idioms, ...
true
7c9601e53c0a4a951de5572bf11d13f1f6b23c3b
Rust
matklad/webassembly-test
/webassembly-test-runner/src/main.rs
UTF-8
2,191
2.6875
3
[ "Apache-2.0", "MIT" ]
permissive
use anyhow::{bail, Result}; use wasmtime::*; fn main() -> Result<()> { let file = match std::env::args().nth(1) { Some(it) => it, None => { bail!("usage: webassembly-test-runner tests.wasm"); } }; // Modules can be compiled through either the text or binary format le...
true
822bbe9316e21adbc8d00346cdf9f1d3bdc84f9d
Rust
EikeSchulze/Rust-Trie
/src/lib.rs
UTF-8
1,606
3.328125
3
[ "Unlicense" ]
permissive
#![feature(entry_or_default)] #[derive(Debug)] struct TrieNode<K: std::cmp::Eq + std::hash::Hash, V> { data: Option<V>, children: std::collections::HashMap<K, TrieNode<K, V>> } impl <K: std::cmp::Eq + std::hash::Hash, V> std::default::Default for TrieNode<K, V> { fn default() -> Self { TrieNode { ...
true
d4ab211513bae579c944f480e42406bb83acd236
Rust
estelendur/rusoto
/rusoto/credential/src/environment.rs
UTF-8
10,450
2.890625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! The Credentials Provider to read from Environment Variables. use chrono::{FixedOffset, Utc, DateTime}; use futures::{Future, Poll}; use futures::future::{FutureResult, result}; use {AwsCredentials, CredentialsError, ProvideAwsCredentials, non_empty_env_var}; const AWS_ACCESS_KEY_ID: &str = "AWS_ACCESS_KEY_ID"; ...
true
9454de031cdd60df831e11d1aeb2217d3eea451c
Rust
panghongye/Learn
/Rust/myblog/src/utils/github_information.rs
UTF-8
3,238
2.734375
3
[ "MIT" ]
permissive
pub async fn get_github_token(code: &str) -> Result<String, String> { let client = reqwest::Client::new(); let params = serde_urlencoded::to_string([ ("client_id", "52b10cd3fff369999cd9"), ("client_secret", "212d9729ead001da8844c1dcc79d45240166bd4f"), ("code", code), ("accept", "...
true
81b1f70e6958713fb8af5bf520205cefe9fecdc5
Rust
jamiereid/advent-of-code2018
/aoc01/src/main.rs
UTF-8
1,752
3.25
3
[]
no_license
#[macro_use] extern crate failure; use failure::ResultExt; use std::collections::HashSet; use std::env; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; fn read_in_file(file: &str) -> Result<String, failure::Error> { let f = File::open(file).context(format!("Failed to open file {}", file))?; ...
true
0fd0e7299720dc3a3d12dde23df6b8011083dac3
Rust
hydrosquall/nes
/src/bus.rs
UTF-8
5,721
2.6875
3
[ "Apache-2.0" ]
permissive
use crate::common::{Addressable, Shared, shared, join_bytes}; use crate::apu::Apu; use crate::controllers::Controllers; use crate::memory::PpuMem; // TODO: this and PPUSCROLL status are somehow the same thing, but I'm really confused about how. enum AddressLatchStatus { Empty, HoldingHighByte(u8), } pub type ...
true
aff17a7a630c92183761f3407533683376a84af4
Rust
Electron-libre/autoroute
/src/spec.rs
UTF-8
4,395
2.625
3
[]
no_license
use std::{ collections::BTreeMap, fmt::{self, Display, Formatter}, slice::Iter, }; use http::Method as httpMethod; use openapi::{ v3_0 as orig, v3_0::{PathItem, Value}, }; use proc_macro2::{Punct, Spacing, TokenStream}; use proc_macro_error::abort_call_site; use quote::{quote, ToTokens, TokenStream...
true
8460f7919b6e7f9d64b9c2a89d8da8a61ba82115
Rust
Richard70NL/dialogue
/src/tests/server_tests.rs
UTF-8
5,491
2.71875
3
[ "MIT" ]
permissive
/************************************************************************************************/ use crate::server::Server; use crate::tests::test_client::TestClient; use std::net::SocketAddr; use std::net::TcpStream; use std::str::FromStr; use std::thread::spawn; use std::time::Duration; /*************************...
true
39fb03af38ea0dc1336a4162a5f70f063716c20a
Rust
ijt/fum
/src/main.rs
UTF-8
1,327
2.9375
3
[ "Apache-2.0" ]
permissive
use ignore::Walk; use std::fs::metadata; use trigram::find_words_iter; use std::fs::File; use std::io::{prelude::*, BufReader}; fn main() { let args: Vec<String> = std::env::args().collect(); if args.len() != 1+1 { eprintln!("Usage: ff pattern This will search for pattern in files in the current direct...
true
bfefa4fc2bc124b46cd351d315cb1ebd5e65737f
Rust
mmai/webtarot
/tarotgame/src/pos.rs
UTF-8
4,502
3.96875
4
[]
no_license
//! Player position in the table use serde::{Deserialize, Serialize}; /// A position in the table #[derive(PartialEq,Clone,Copy,Debug,Serialize,Deserialize)] pub struct PlayerPos { pub pos: AbsolutePos, pub count: u8, } /// A position in the table #[derive(PartialEq,Clone,Copy,Debug,Serialize,Deserialize)] p...
true
562682c8c3e6fbb503207c49cba5aa3a088ee3b3
Rust
yaa110/nomino
/src/errors/sort.rs
UTF-8
404
2.90625
3
[ "Apache-2.0", "MIT" ]
permissive
use std::error::Error; use std::fmt; #[derive(Debug)] pub struct SortOrderError(String); impl fmt::Display for SortOrderError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "invalid sort order: {}", self.0) } } impl Error for SortOrderError {} impl SortOrderError { pub fn...
true
8abe89c768bfbb208122fa1ad5bff9c5f81d6c44
Rust
PSeitz/rust_string_hashmap
/src/stacker/expull.rs
UTF-8
4,655
3.171875
3
[ "MIT" ]
permissive
use super::heap::{Heap, HeapAllocable}; use std::mem; #[inline] pub fn is_power_of_2(val: u32) -> bool { val & (val - 1) == 0 } #[inline] pub fn jump_needed(val: u32) -> bool { val > 3 && is_power_of_2(val) } #[derive(Debug, Clone)] pub struct ExpUnrolledLinkedList { len: u32, end: u32, val0: u32...
true
a63f8eb40e41a73602fc8feff7c6e17f2655b706
Rust
jsvana/async-minecraft-ping
/src/protocol.rs
UTF-8
11,578
3.15625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! This module defines various methods to read and //! write packets in Minecraft's //! [ServerListPing](https://wiki.vg/Server_List_Ping) //! protocol. use std::io::Cursor; use std::time::Duration; use async_trait::async_trait; use thiserror::Error; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt...
true
f97a1822f0db0a210bb53933a767dcbe3bbfef2c
Rust
adrianchitescu/aoc2019-rs
/int_computer/src/lib.rs
UTF-8
9,166
3.296875
3
[]
no_license
pub mod computer { use std::collections::{HashMap, VecDeque}; #[derive(PartialEq, Debug, Clone)] pub enum InstructionType { Add, Multiply, Input, Output, JumpIfTrue, JumpIfFalse, LessThan, Equals, AdjustBase, Exit, } #...
true
35903276277316ccef4a5e9bde902546f0044011
Rust
kdy1/ratel-core
/ratel-transformer/src/es2015/arrow.rs
UTF-8
2,321
2.890625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
use ratel::ast::{NodeList, ExpressionNode, Function, Name, OptionalName, Block, Loc, Node}; use ratel::ast::expression::{ArrowExpression, ArrowBody, ThisExpression, CallExpression, MemberExpression}; use ratel::ast::statement::ReturnStatement; use ratel_visitor::{Visitor, Visitable}; use TransformerCtxt; pub struct T...
true
617cb5e427217397f2fbaf55f26b4e25b142a838
Rust
lloydmeta/chase-rs
/src/lib.rs
UTF-8
3,793
3.546875
4
[ "MIT" ]
permissive
#![doc(html_playground_url = "https://play.rust-lang.org/")] //! Chase: File following //! //! Chase a file through thick and thin: //! //! * Provide line numbers with each line yielded //! * Ability to exit the watch loop programmatically //! * Deals with file rotations automatically //! * Cross-platform async...
true
802bdf6794cc34dec434d2dd3d0469b945cbce4f
Rust
amyvmiwei/rg3d
/rg3d-core-derive/src/inspect/utils.rs
UTF-8
5,356
2.78125
3
[ "MIT" ]
permissive
use darling::ast; use proc_macro2::TokenStream as TokenStream2; use quote::*; use syn::*; use convert_case::*; use crate::inspect::args; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum FieldPrefix { /// `&self.` + field_ident /// /// This is for struct fields Self_, /// `f` + field_id...
true
85111eac0884d6e50608db9f60106714475b09ec
Rust
rnbguy/oopsla21artifact
/oltp/src/dis_kv.rs
UTF-8
35,983
2.625
3
[ "MIT" ]
permissive
use std::collections::{HashMap, HashSet}; use rand::seq::IteratorRandom; use rand::Rng; use super::kv::{KVStoreT, OpId, SessionId, SetId, TxnId, Value, VarId}; use serde::ser::SerializeStruct; use serde::{Serialize, Serializer}; use std::fs::File; use std::io::BufWriter; use std::collections::hash_map::DefaultHash...
true
7c0a3c9c50b1a05d6e31380a2c91ac174c1cae87
Rust
baurine/leetcode
/exercism/rust/sieve/src/lib.rs
UTF-8
333
2.765625
3
[]
no_license
pub fn primes_up_to(upper_bound: u64) -> Vec<u64> { let mut primes: Vec<u64> = (0..=upper_bound).collect(); for i in 2..=upper_bound { if primes[i as usize] > 0 { for j in (i * 2..=upper_bound).step_by(i as usize) { primes[j as usize] = 0; } } } primes.into_iter().filter(|&p| p >= 2)...
true
5c9097a5517be3106a5a4a36654936f8fabbffbd
Rust
mluts/rust-game-of-life
/src/game.rs
UTF-8
2,998
2.90625
3
[]
no_license
use crate::grid; use rand::{prelude::*, Rng}; use std::collections::HashSet; #[derive(Clone)] pub struct Game { grid: HashSet<u32>, width: u32, height: u32, initial_cells: u32, } impl Game { pub fn new(width: u32, height: u32, initial_cells: u32) -> Game { let mut game = Game { ...
true
5634f69474717602d13cdeb64ffcd3878107109d
Rust
lholznagel/rust-ssh
/src/version.rs
UTF-8
3,280
3.828125
4
[ "MIT" ]
permissive
use failure::{format_err, Error}; /// Represents a SSH Version string /// /// Example pattern: /// `SSH-2.0-billsSSH_3.6.3q3 <CR> <LF>` /// /// or /// /// `SSH-2.0-billsSSH_2.6.3q3 <SP> comment <CR> <LF> /// /// Using `Version::default()` returns a pattern for this library. /// The pattern is: `SSH-2.0-rssh_{CURRENT_P...
true
1efec0f607b134890cf611c62ef584b587d19c54
Rust
brobzilla/hangups-rs
/src/decoder.rs
UTF-8
4,836
3.625
4
[ "MIT" ]
permissive
use std::str; pub struct UnicodeDecoder { buffer: Vec<u8>, } impl UnicodeDecoder { pub fn new() -> Self { UnicodeDecoder { buffer: vec![] } } pub fn push_bytes(&mut self, v: &[u8]) -> String { self.buffer.extend_from_slice(v); match String::from_utf8(self.buffer.clone()) { ...
true
e6a2492fde7093fd4a8867958686de6ca5d2be08
Rust
UnHumbleBen/serde-tutorial
/serialize-enum-as-number/src/main.rs
UTF-8
893
3.515625
4
[]
no_license
/// Derive `Serialize` and `Deserialize` that delegate to the underlying /// repr of a C-like enum. use serde_repr::*; /// A C-like enum which discriminants are the smallest prime numbers. /// /// It derives the `Serialize_repr` and `Deserialize_repr` traits. #[derive(Serialize_repr, Deserialize_repr, PartialEq, Debug...
true
235ade52bc38e8e8a31d51e3de4664864f9a4a25
Rust
jokva/advent
/2018/13-cart/src/bin/cart.rs
UTF-8
3,701
3.359375
3
[]
no_license
use std::io; use std::io::prelude::*; use std::collections::HashSet; use std::cmp::Ordering; #[derive(Eq, Clone, Copy)] struct Cart { x: usize, y: usize, dir: char, turn: char, } impl Ord for Cart { fn cmp(&self, other: &Cart) -> Ordering { if self.x == other.x { self.y.cmp(&ot...
true
8a8bcb1f2f527d5420ec8e187d856d42d76403d0
Rust
mookid/trimcolor
/src/main.rs
UTF-8
2,410
3.21875
3
[]
no_license
use std::io; use std::io::BufRead; use std::io::Write; /// Returns the number of bytes of escape code that start the slice. fn skip_all_escape_code(buf: &[u8]) -> usize { // Skip one sequence fn skip_escape_code(buf: &[u8]) -> Option<usize> { if 2 <= buf.len() && &buf[..2] == b"\x1b[" { // ...
true
1aaba56bd43142a22bf51325fd043702112464c9
Rust
Firstyear/purplecon_state_machines
/rust_microwave_diy/src/lib.rs
UTF-8
1,075
2.953125
3
[]
no_license
use microwave_common::MicrowaveOps; /* * DIY Microwave! Just fill in the blanks, then run "cargo test" from this directory. * * Good Luck! */ struct Microwave {} impl MicrowaveOps for Microwave { fn new() -> Self { // Hint: When you get a microwave and unbox it, the door is closed, and no // ...
true
34732d204c11592b40f71292696267b1605bd83d
Rust
magurotuna/atcoder-submissions
/abc146/src/bin/d.rs
UTF-8
1,313
2.59375
3
[]
no_license
use libprocon::*; use std::collections::{HashMap, HashSet}; fn main() { input! { N: usize, ab: [(usize1, usize1); N-1], } let orig_ab = ab.clone(); let mut ab = ab .into_iter() .map(|(x, y)| if x > y { (y, x) } else { (x, y) }) .collect::<Vec<_>>(); ab.sort_...
true
1e67e8308db013763fae92bba474ad61bc03ec60
Rust
bradurani/rust-iterator-to-hash-map
/src/lib.rs
UTF-8
666
3.203125
3
[ "MIT" ]
permissive
use std::collections::HashMap; use std::hash::Hash; pub trait ToHashMap<T,K,V, FK, FV> where K:Hash, K:Eq, FK:Fn(&T)->K, FV:Fn(&T)->V { fn to_hash_map(self, key_func: FK, value_func: FV) -> HashMap<K, V>; } impl<T, K, V, FK, FV, I> ToHashMap<T, K, V, FK, FV> for I where K: H...
true
c8f5ced5f9690a1a5e3a09cbdf91ff6d907d297f
Rust
codinaut/statsd-prober
/src/args.rs
UTF-8
3,055
3.0625
3
[]
no_license
use clap::{crate_authors, crate_description, crate_name, crate_version, App, Arg}; use humantime::{parse_duration, DurationError}; use itertools::Itertools; use snafu::{ResultExt, Snafu}; use std::ffi::OsString; use std::time::Duration; pub struct Configuration { pub interval: Duration, pub targets: Vec<ProbeT...
true
f425a8cee3b22b8eee799040dd9d7e3bff59ac46
Rust
mmstick/appstream-cache
/src/lib.rs
UTF-8
2,738
2.703125
3
[]
no_license
#[macro_use] extern crate anyhow; #[macro_use] extern crate serde; pub mod appstream; pub mod dep11; pub mod yaml; pub use self::appstream::AppstreamPackage; use std::path::Path; pub enum PackageEvent { AppStream { origin: String, info: AppstreamPackage, }, MediaUrl { origin: St...
true
d131912e4a7e23c6eefc33b6e430db6d275f3770
Rust
kkpoon/exercism-rust
/hello-world/src/lib.rs
UTF-8
185
3.0625
3
[]
no_license
pub fn hello(name: Option<&str>) -> String { match name { None => return "Hello, World!".to_string(), Some(n) => return format!("Hello, {}!", n).to_string() } }
true
268786a569f0dfd1c306ab5de82969941d122fb4
Rust
ijanos/advent2016
/rust/day22/src/main.rs
UTF-8
1,533
3.0625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
extern crate itertools; use std::io; use std::str; use std::io::prelude::*; use itertools::Itertools; #[derive(Debug)] struct Node { x: isize, y: isize, size: u32, used: u32, } impl Node { fn from_line(line: String) -> Node { let line: Vec<&str> = line.split_whitespace().collect(); ...
true
341f41ed218c7fd09d9deffd03bc5c388e8a65db
Rust
explooosion/actix-web-router-example
/routes-example/src/main.rs
UTF-8
3,365
2.640625
3
[]
no_license
extern crate actix_web; #[macro_use] extern crate log; extern crate env_logger; #[allow(unused_imports)] use actix_web::middleware::Logger; #[allow(unused_imports)] use actix_web::{ http, http::Method, server, App, HttpRequest, HttpResponse, Json, Path, Responder, Result, }; #[macro_use] extern crate serde_deriv...
true
ec249c2ffcd03bc3de1966fb254e200b919c1586
Rust
IThawk/rust-project
/rust-master/src/test/ui/consts/const_let_eq_float.rs
UTF-8
5,946
3.328125
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(const_fn)] struct Foo<T>(T); struct Bar<T> { x: T } struct W(f32); struct A { a: f32 } const fn basics((a,): (f32,)) -> f32 { // Deferred assignment: let b: f32; b = a + 1.0; // Immediate assignment: let c: f32 = b + 1.0; // Muta...
true
dc229d01b55568fa826f4350a1f2276f23e6a669
Rust
andjo403/Interner
/tests/integration.rs
UTF-8
5,842
2.90625
3
[ "MIT" ]
permissive
use fxhash::FxBuildHasher; use interner::Interner; use rayon::prelude::*; use std::sync::Arc; const ITER: u64 = 32 * 1024; #[test] fn drop_empty() { let interner: Interner<&i32> = Interner::new(); drop(interner); } #[test] fn intern_ref() { let value1: i32 = 42; let value2: i32 = 0; let value3: i3...
true
af98877c2fa285e37e164ca37c78a92f71c10c0a
Rust
nrf-rs/nrf52832-pac
/src/pwm0/mode.rs
UTF-8
2,898
2.5625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
#[doc = "Reader of register MODE"] pub type R = crate::R<u32, super::MODE>; #[doc = "Writer for register MODE"] pub type W = crate::W<u32, super::MODE>; #[doc = "Register MODE `reset()`'s with value 0"] impl crate::ResetValue for super::MODE { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
true
6380fdcbe27c63ed30aa09045ae74eca2a9b28d5
Rust
karataliu/showenv
/src/main.rs
UTF-8
561
2.671875
3
[ "MIT" ]
permissive
extern crate nickel; extern crate serde_yaml; use std::collections::BTreeMap; use nickel::{Nickel, HttpRouter, Request, Response, MiddlewareResult}; fn main() { let mut server = Nickel::new(); server.get("**", handle); server.listen("0.0.0.0:8080").unwrap(); } fn handle<'mw>(_req: &mut Request, res: Resp...
true
599e794fd93a636e009850b503e768ed69b9307f
Rust
ShaabanM/aoc2020
/day3/src/main.rs
UTF-8
1,658
3.453125
3
[]
no_license
use std::io::prelude::*; use std::{fs::File, io::BufReader}; fn main() -> Result<(), Box<dyn std::error::Error>> { let name = "input.dat"; let f = File::open(name).expect("problems"); let f = BufReader::new(f); let lines = read_file(f)?; let c1 = get_tree_num(&lines, 1, 1); let c2 = get_tree_n...
true
d5e1cff75bc323ca095dfe69f8595ac826cea1b6
Rust
ngthanhtrung23/CompetitiveProgramming
/codeforces/101383/C.rs
UTF-8
4,211
3.0625
3
[]
no_license
use std::cmp::min; use std::borrow::BorrowMut; use std::io; use std::str; use io::Write; #[derive(Default)] pub struct Scanner<R> { reader: R, buffer: Vec<String>, } impl<R: io::BufRead> Scanner<R> { pub fn new(reader: R) -> Self { Self { reader, buffer: Vec::new(), } } /// Use "tu...
true
5794217eb9aca310a4d70a88b4ba9580c524b18a
Rust
BraydenNeale/rust_exercism
/clock/src/lib.rs
UTF-8
2,592
3.640625
4
[]
no_license
// use std::fmt; // pub struct Clock { // hours: i32, // mins: i32, // } // impl Clock { // pub fn new(hours: i32, mins: i32) -> Clock { // Clock { // hours, // mins, // } // } // pub fn add_minutes(&self, mins: i32) -> Clock { // Clock::new(self.hours, self.mins + mins) // } // pub fn normali...
true
5347ce9f8be16a0deb3f6515c6ef25665b428626
Rust
sigp/lighthouse
/beacon_node/beacon_chain/src/head_tracker.rs
UTF-8
6,608
3.09375
3
[ "Apache-2.0" ]
permissive
use parking_lot::RwLock; use ssz_derive::{Decode, Encode}; use std::collections::HashMap; use types::{Hash256, Slot}; #[derive(Debug, PartialEq)] pub enum Error { MismatchingLengths { roots_len: usize, slots_len: usize }, } /// Maintains a list of `BeaconChain` head block roots and slots. /// /// Each time a new ...
true
1f8ec3df4ae100a52e1062644e2a785bd692b021
Rust
delneg/bitcoin-address-generator-api
/src/api/views/generate.rs
UTF-8
1,717
2.71875
3
[ "MIT" ]
permissive
extern crate secp256k1; use jelly::prelude::*; use jelly::Result; use std::fmt::Write; use jelly::serde::{Deserialize, Serialize}; use jelly::actix_web::{HttpRequest, HttpResponse}; use bitcoin::secp256k1::Secp256k1; use rand::thread_rng; const ADDRESS_LENGTH: usize = 40; const ADDRESS_BYTES: usize = ADDRESS_LENGTH /...
true
2e721bf0d5eef3d1f95460824d17c71aa1f0719c
Rust
Jimskapt/rust-book-fr
/FRENCH/listings/ch03-common-programming-concepts/no-listing-03-shadowing/src/main.rs
UTF-8
203
3.65625
4
[ "Apache-2.0", "MIT", "Unlicense", "BSD-3-Clause", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-other-permissive", "NCSA" ]
permissive
fn main() { let x = 5; let x = x + 1; { let x = x * 2; println!("La valeur de x dans la portée interne est : {}", x); } println!("La valeur de x est : {}", x); }
true
34098d6651de2a3239cf64927c9d38f0424f3548
Rust
JosephCatrambone/compute
/benches/benchmark_distributions.rs
UTF-8
1,893
2.765625
3
[ "MIT" ]
permissive
use compute::distributions::*; use criterion::{criterion_group, criterion_main, Criterion}; pub fn generate(c: &mut Criterion) { c.bench_function("generate 1e6 standard normals", |b| { b.iter(|| Normal::new(0., 1.).sample_vec(1e6 as usize)) }); c.bench_function("generate 1e6 gammas", |b| { ...
true
df055683f0bf0561fdecf86ec64015507f9c5741
Rust
jpsheehan/go.rs
/src/main.rs
UTF-8
7,771
2.734375
3
[]
no_license
mod go_core; use std::path::Path; use std::time::Duration; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::pixels::Color; use sdl2::rect::Point; use sdl2::rect::Rect; use sdl2::surface::Surface; use go_core::Point as GPoint; use go_core::*; const BOARD_SIZE: u32 = 13; enum SpriteSheet { Cross, ...
true
433c45dd11761d812a32269a7306431a0484236c
Rust
osaut/rustic_cells
/observer.rs
UTF-8
3,876
2.75
3
[ "BSD-2-Clause" ]
permissive
use agent::Crowd; use std::io::fs::File; use std::io::{Write, Truncate}; mod agent; // Type Observer pub trait Observer { fn see(&self, time: f64, crowd: &Crowd); fn request_at(&self, time: f64, dt: f64) -> bool; // fn request_at(&self, time: f64, dt: f64) -> bool { // let inter_size = self.tmax / ...
true
ee8b730485f57355b6c75be70ada10e6af4c73f6
Rust
mkrzywda/cleora
/tests/snapshot.rs
UTF-8
4,486
2.59375
3
[ "MIT" ]
permissive
use cleora::configuration::{Column, Configuration, FileType, OutputFormat}; use cleora::embedding::{calculate_embeddings, calculate_embeddings_mmap}; use cleora::persistence::embedding::EmbeddingPersistor; use cleora::persistence::entity::InMemoryEntityMappingPersistor; use cleora::pipeline::build_graphs; use insta::as...
true
9ecec7131fb3fe96cd0c257a192b02ef398c9183
Rust
nbrendler/rust-breakout
/src/resources/input_state.rs
UTF-8
301
2.65625
3
[ "MIT" ]
permissive
pub struct InputState { pub left: bool, pub right: bool, pub up: bool, pub down: bool, } impl Default for InputState { fn default() -> Self { InputState { left: false, right: false, up: false, down: false, } } }
true
eb1fecea03d2b803984c94fa2a080550af17a774
Rust
emirayka/nia_server
/src/protocol/response/remove_device_by_path_response.rs
UTF-8
4,898
2.578125
3
[ "MIT" ]
permissive
use std::sync::MutexGuard; use nia_interpreter_core::Interpreter; use nia_interpreter_core::NiaInterpreterCommand; use nia_interpreter_core::NiaInterpreterCommandResult; use nia_interpreter_core::{ EventLoopHandle, NiaRemoveDeviceByPathCommandResult, }; use crate::error::{NiaServerError, NiaServerResult}; use cr...
true
037e52ee9e318bb99805b0e1886ae8b5cb56020c
Rust
SamHSmith/svdag
/src/dense.rs
UTF-8
8,466
2.6875
3
[]
no_license
use crate::allocate; use crate::clamp; use crate::oct_byte_to_vec; use crate::VoxelNode; use crate::VoxelTree; use cgmath::Vector3; use std::ops::Deref; use std::ops::Index; use std::ops::IndexMut; pub struct DenseVoxelData { pub size: usize, depth: usize, pub data: Vec<VoxelNode>, } impl DenseVoxelData {...
true
05be709de86b7ba0f817c186ecc1332d12319872
Rust
ACRONYM-Group/ACIRustServer
/src/server/tests.rs
UTF-8
18,739
2.625
3
[]
no_license
//! Somewhere Between Unit and Integration Tests use crate::server; use crate::commands; use crate::args; use structopt::StructOpt; use serde_json::json; #[test] pub fn test_read_write_disk() { let mut opt = args::Arguments::from_args(); opt.path = std::path::PathBuf::from("test-databases"); let server...
true
8132d0e43e939e687cb56ed3c74829c94e8764ed
Rust
DrGodCarl/AdventOfCode
/2021/src/bin/day02.rs
UTF-8
1,310
3.3125
3
[]
no_license
use anyhow::Result; use utils::read_lines; #[derive(parse_display::FromStr, PartialEq, Debug, Clone, Copy)] #[display("{} {0}")] #[display(style = "snake_case")] enum Instr { Forward(isize), Up(isize), Down(isize), } fn part1(numbers: &[Instr]) -> isize { let point = numbers.iter().fold((0, 0), |(x, y...
true
b76c87ab651e913804b4cc700d6aa18d15b2691c
Rust
Kryndex/rust-zipkin
/zipkin/src/span.rs
UTF-8
5,879
2.6875
3
[ "Apache-2.0" ]
permissive
// Copyright 2017 Palantir Technologies, Inc. // // 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 applicabl...
true
fc2e925a875d790eb35fe85ef3eecbb5e11d264c
Rust
u-03c9/sctp
/src/chunk/chunk_heartbeat.rs
UTF-8
3,128
3.015625
3
[ "MIT" ]
permissive
use super::{chunk_header::*, chunk_type::*, *}; use crate::param::{param_header::*, param_type::*, *}; use bytes::{Bytes, BytesMut}; use std::fmt; ///chunkHeartbeat represents an SCTP Chunk of type HEARTBEAT /// ///An endpoint should send this chunk to its peer endpoint to probe the ///reachability of a particular de...
true
fd1f0bcd2b9fe286e8e92deb267de0b890e66ef6
Rust
bwbeach/advent-of-code-2020
/day25-rust/src/main.rs
UTF-8
1,089
3.140625
3
[ "CC0-1.0" ]
permissive
fn transform(subject_number: usize, loop_size: usize) -> usize { let mut value = 1; for _ in 0..loop_size { value = value * subject_number; value = value % 20201227; } value } fn find_loop_size(subject_number: usize, public_key: usize) -> usize { let mut loop_size = 0; let mut ...
true
7750b42c3d7913a7f2a42a617246d20127a1ffc9
Rust
JasonBock/LearningRust
/collatz_conjecture/collatz_app/src/main.rs
UTF-8
664
2.890625
3
[]
no_license
extern crate collatz; extern crate rand; use rand::Rng; use std::env; fn main() { let arguments: Vec<String> = env::args().collect(); let value = if arguments.len() > 1 { match arguments[1].trim().parse::<u64>() { Ok(num) => num, Err(_) => panic!("You did not enter in a valid unsigned 64-bit in...
true
a2a1b6daeec4ec1634de324096b75f9b9df59565
Rust
kov/play
/rust/multi-output/src/main.rs
UTF-8
3,260
3.46875
3
[]
no_license
use bus::Bus; use dashmap::DashMap; use std::sync::Arc; struct JobManager { map: DashMap<String, Bus<String>>, } impl JobManager { fn new() -> Arc<Self> { Arc::new(JobManager { map: DashMap::<String, Bus<String>>::new(), }) } fn do_work(&self, s: String) { println!...
true
c6e4ecae944f560d378183d75c8bf74643a201e0
Rust
brabadu/vagga
/src/container/util.rs
UTF-8
7,087
2.609375
3
[ "MIT" ]
permissive
use std::io; use std::fs::{read_dir, remove_file, remove_dir}; use std::fs::{symlink_metadata, read_link, hard_link}; use std::os::unix::fs::{symlink, MetadataExt}; use std::path::{Path, PathBuf}; use libc::{uid_t, gid_t}; use super::root::temporary_change_root; use file_util::{create_dir_mode, shallow_copy, set_owne...
true
b7b3e5c7542aaf597642438d5c22ac9abef3ad0a
Rust
the-sporkening/Sporkbot-Rust
/src/menu/builders.rs
UTF-8
8,702
2.609375
3
[]
no_license
use serenity::{builder::CreateEmbed, utils::Colour}; use urbandictionary::model::Definition; use crate::commands::anilist::utils::synopsis; use crate::models::anilist::{ activity::Activity, character::Character, media::{Media, MediaType}, staff::Staff, studio::Studio, user::User, }; use crate::...
true
f82852ffb29112588483069d71f1cb32b86960a9
Rust
chinanf-boy/gentle-intro
/code/add1.rs
UTF-8
117
3
3
[ "MIT" ]
permissive
// add1.rs fn main() { let sum = 0; for i in 0..5 { sum += i; } println!("sum is {}",sum); }
true
370d74ce08b1c3e6a07b3d57324c3b8348036aa4
Rust
nolanderc/glace
/src/frame.rs
UTF-8
4,312
2.75
3
[]
no_license
use gfx::{ traits::FactoryExt }; use pipeline::*; use draw::{ Draw, DrawCommand, }; use trap::Matrix4; use color::Color; use projection::{ Projection, View }; use vertex::Vertex; use vertex_array::VertexArray; pub struct Frame { factory: ::Factory, encoder: ::Encoder, pipeline: :...
true
73bc46f058ca0518face0dc9cbc83f93e90136c2
Rust
thecristidima/AdventOfRust
/2019/src/Day 4/main.rs
UTF-8
311
2.796875
3
[ "MIT" ]
permissive
use code::Code; mod code; fn main() { let start = 347312; let end = 805915; let mut code = Code::new(start); let mut valid_code_count = 0; while code.as_u32() <= end { if code.is_valid() { valid_code_count += 1; } code.increment(); } println!("Valid codes in range: {}", valid_code_count); }
true
ee2f912f651800c4517d7a683c0d9993eb940485
Rust
jasonish/dumpy
/src/export.rs
UTF-8
9,138
2.578125
3
[ "MIT" ]
permissive
// SPDX-License-Identifier: MIT // // Copyright (C) 2022 Jason Ish use anyhow::Result; use clap::Parser as ClapParser; use lazy_static::lazy_static; use regex::Regex; use std::collections::HashMap; use std::ffi::OsStr; use std::path::{Path, PathBuf}; use std::time::UNIX_EPOCH; use tracing::{debug, error, Level}; use t...
true
c02a8424ae00d56808a20673385b9b34798fc848
Rust
mengsuenyan/leetcode
/leetcode-rs/tests/medium/p1.rs
UTF-8
9,492
3.21875
3
[]
no_license
use leetcode_rs::easy::p1::ListNode; use leetcode_rs::medium::p1; use std::collections::HashSet; #[test] fn test_add_two_numbers() { let cases = vec![ (vec![2, 4, 3], vec![5, 6, 4], vec![7, 0, 8]), (vec![0], vec![0], vec![0]), ( vec![9, 9, 9, 9, 9, 9, 9], vec![9, 9, ...
true
612fa7790091664b43688ecba7d155fa50d98cbc
Rust
thlorenz/bevy-gl
/src/libs/util.rs
UTF-8
1,864
2.6875
3
[]
no_license
use bevy::{prelude::*, render::shader::ShaderStage}; use std::{env, error::Error, fs, io, str::from_utf8}; pub fn vert_frag_shaders( vertex_path: &str, frag_path: &str, ) -> Result<(Shader, Shader), Box<dyn Error>> { let vert_buffer = std::fs::read(&vertex_path)?; let frag_buffer = std::fs::read(&frag...
true
608916beb19241ec38af1013e5f45e3b152c3b2b
Rust
covercash2/broca
/src/main.rs
UTF-8
2,198
2.640625
3
[]
no_license
//! Natural Language Processing functions and features //! based on the rust-bert library use async_std::sync::RecvError; use log::*; use async_std::{sync::{channel, Sender, Receiver}, task}; use tide::Request; use tide::prelude::*; use rust_bert::pipelines::generation_utils::{GPT2Generator, GenerateConfig, Language...
true
9cddeb7fb6f904363aa5a7a3cbe7fda32061a5d5
Rust
vmx/forest
/blockchain/chain/src/store/tip_index.rs
UTF-8
3,665
2.796875
3
[ "MIT", "Apache-2.0" ]
permissive
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use super::errors::Error; use async_std::sync::RwLock; use blocks::{Tipset, TipsetKeys}; use cid::Cid; use clock::ChainEpoch; use std::collections::hash_map::{DefaultHasher, HashMap}; use std::hash::{Hash, Hasher}; use std::sync::Arc; ///...
true
bdb8c4a3247db73221561fe3f16850594a91b8ca
Rust
edunham/liquid-rust
/src/text.rs
UTF-8
308
3.21875
3
[ "MIT" ]
permissive
use Renderable; use context::Context; pub struct Text{ text: String } impl Renderable for Text { fn render (&self, _context: &mut Context) -> Option<String>{ Some(self.text.to_string()) } } impl Text { pub fn new(text: &str) -> Text { Text{text: text.to_string()} } }
true
264e364a0122ed0f42cfd6f0388d5a56707a8e16
Rust
sonos/tract
/libcli/src/tensor.rs
UTF-8
16,620
2.84375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
permissive
use std::collections::HashSet; use std::io::{Read, Seek}; use std::ops::Range; use std::str::FromStr; use std::sync::Mutex; use crate::model::Model; use tract_hir::internal::*; #[derive(Debug, Default, Clone)] pub struct TensorsValues(pub Vec<TensorValues>); impl TensorsValues { pub fn by_name(&self, name: &str)...
true
e8dca8d678787a11f1efdb79afe8a54924e3fa7e
Rust
markmelix/take-breath
/src/main.rs
UTF-8
2,047
2.59375
3
[ "MIT" ]
permissive
#![windows_subsystem = "windows"] mod lib; #[cfg(not(feature = "config"))] use lib::config::*; use lib::counter::*; fn main() { #[cfg(feature = "config")] let config = get_config(); #[cfg(not(feature = "config"))] let config = Config::default(); let work = Work::new( config.work_time.duration,...
true
e111a2a32df8370443c43263070100c840c7526f
Rust
cronokirby/ludus
/src/cart.rs
UTF-8
4,494
3.609375
4
[ "MIT" ]
permissive
use std::convert::TryFrom; /// Represents the possible errors when decoding a Cart #[derive(Clone, Copy, Debug)] pub enum CartReadingError { UnrecognisedFormat, UnknownMapper(u8), } /// Represents the type of mirroring present on a cartridge #[derive(Clone, Copy, Debug, PartialEq)] pub enum Mirroring { //...
true
ad36f54e423bf800237ebad5b600af9fd5cea3e5
Rust
alanamarzoev/srmap
/src/inner.rs
UTF-8
13,322
2.515625
3
[]
no_license
/// Just give me a damn terminal logger // fn logger_pls() -> slog::Logger { // use slog::Drain; // use slog::Logger; // use slog_term::term_full; // use std::sync::Mutex; // Logger::root(Mutex::new(term_full()).fuse(), o!()) // } pub mod srmap { use evmap; use std::collections::HashMap; ...
true
dbf7cb402e82901123f110c38699e355e2221418
Rust
klvnptr/rayt
/src/world/geometry/rectangle.rs
UTF-8
15,152
2.984375
3
[ "MIT" ]
permissive
use crate::camera::Ray; use crate::data::assets::Assets; use crate::data::vector::Vector; use crate::pdf::uniform_between; use crate::world::geometry::axis_aligned_bounding_box::AxisAlignedBoundingBox; use crate::world::geometry::{Geometry, HitResult, Hittable}; use crate::world::materials::Material; #[derive(Debug, P...
true
2befea4e7d936ab2bf9d85896c479db1d2e5ff3c
Rust
say3no/try_rust
/tour/src/chapter5_ownership_and_borrow/tour43_ownership.rs
UTF-8
514
3.34375
3
[]
no_license
struct Foo { x: i32, } /* 方のインスタンスを作成して変数に束縛すると、 メモリリソースが作成された、そのすべてのライフタイムに渡って Rust コンパイラが **検証** します。 束縛された変数はリソースの所有者と呼ばれます。 */ fn main() -> Result<(), String> { // 構造体をインスタンス化し、変数に**束縛**してメモリリソースを作成 let foo = Foo { x: 42 }; // foo は所有者 Ok(()) }
true
6c786a7a04fd545b0a479d167353a30c768835f6
Rust
youhavethewrong/rust_playground
/demp/src/main.rs
UTF-8
2,441
3.140625
3
[]
no_license
#![feature(drain_filter)] extern crate regex; use regex::Regex; use std::collections::HashMap; use std::io; fn main() { println!("Main screen turn on."); let re = Regex::new(r"(?P<cmd>\w+)\s+(?P<name>\w+)?(\s+\w+\s+)?(?P<dept>\w+)?").unwrap(); let mut data: HashMap<_, _> = HashMap::new(); data.insert...
true
693d6fe42188e4329e66dab938171e1ed2e202be
Rust
Diggsey/tenorite
/src/components/latches.rs
UTF-8
1,313
2.921875
3
[]
no_license
use crate::{Voltage, Component, ComponentInterface}; // SR-NOR latch #[derive(Debug, Copy, Clone)] pub struct SrNorLatch { s: bool, r: bool, } impl SrNorLatch { pub fn new() -> Self { Default::default() } } impl Component for SrNorLatch { fn update(&mut self, interface: &mut ComponentInt...
true
d9f421b36e789617b02daf0af22a4d8734812aa7
Rust
task-rs/task-rs
/crates/task-rs/src/components/task_item/view.rs
UTF-8
1,693
2.5625
3
[ "MIT" ]
permissive
use super::super::super::{data::Status, sizes::main::SUB_TASK_INDENT}; use super::{Message, TaskItem}; use iced::*; use pipe_trait::*; impl TaskItem { pub fn view(self) -> Element<'static, Message> { let TaskItem { tags, summary, address, .. } = self;...
true
75d19f5d469db59c0e59501288e6251f9975937a
Rust
jackyzha0/rs-openai
/src/gpt/domain/completion.rs
UTF-8
3,597
2.953125
3
[ "MIT" ]
permissive
use serde::{Deserialize, Serialize}; use std::collections::HashMap; #[derive(Serialize, Deserialize, Debug)] #[serde(default)] pub struct Options { /// The prompt(s) to generate completions for, encoded as a string pub prompt: Option<String>, /// The maximum number of tokens to generate. Requests can use ...
true
c8276a8f6d00d887f9624f70c52d09b4dbf3494b
Rust
sbosnick/luther
/luther-derive/src/generate.rs
UTF-8
5,418
2.71875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
// Copyright 2018 Steven Bosnick // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE-2.0 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 accord...
true
ea7f5d7051cabf393664c89c9f8ab74d359f2d12
Rust
ascjones/sconar
/src/scon/display.rs
UTF-8
4,467
2.875
3
[]
no_license
// Copyright 2018-2020 Parity Technologies (UK) Ltd. // This file is part of scale-dynamic. // // cargo-contract is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at you...
true
73de61b5f1e1c83c377bca8bdd2c640c1a4cd433
Rust
oll3/bita
/src/info_cmd.rs
UTF-8
3,036
2.59375
3
[ "MIT" ]
permissive
use anyhow::Result; use log::*; use tokio::fs::File; use crate::human_size; use bitar::{ archive_reader::{ArchiveReader, HttpReader, IoReader}, chunker, Archive, }; pub async fn print_archive_reader<R>(reader: R) -> Result<()> where R: ArchiveReader, R::Error: std::error::Error + Send + Sync + 'static...
true
2a7ec905182a8aed85999af11cb382face1d072e
Rust
kirillt/coins-change
/src/minimal_number.rs
UTF-8
1,111
2.9375
3
[]
no_license
//todo: tinyset pub fn calculate(amount: usize, coins: &Vec<usize>) -> Option<usize> { let mut table: Vec<Option<usize>> = vec![None; amount + 1]; table[0] = Some(0); fn recursive(amount: usize, coins: &Vec<usize>, table: &mut Vec<Option<usize>>) -> Option<usize> { match table[amount] { ...
true
a91b6ddf90c40ea1fa85b8b6f4fbd998f145d62b
Rust
theduke/rust
/src/test/ui/span/issue-24690.rs
UTF-8
823
2.578125
3
[ "MIT", "NCSA", "ISC", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-3-Clause", "BSD-2-Clause", "Unlicense", "LicenseRef-scancode-other-permissive" ]
permissive
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this 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 // <LICENSE-MIT or ...
true
c19d84fcff29bd3bdadf7beeac8f0480234981d1
Rust
davisvansant/the_rust_programming_language
/10/lifetimes/src/main.rs
UTF-8
2,936
3.71875
4
[]
no_license
// fn ten_seventeen() { // let r; // // { // let x = 5; // r = &x; // } // // println!("r: {}", r); // } // fn ten_eighteen() { // let r; // // { // let x = 5; // r = &x; // } // // println!("r: {}", r); // } fn ten_nineteen() { let x = 5; let r ...
true
c1164b5db27798f53f0a11e3c183ea8785870aa7
Rust
definedD4/my-ui
/src/render.rs
UTF-8
6,402
2.921875
3
[]
no_license
use primitives::*; use glium; use glium::glutin; use std::collections::LinkedList; pub struct Renderer<'a> { surface: &'a mut glium::Frame, rendering_context: &'a RenderingContext, size: Size, viewport_stack: Vec<Rect>, } #[derive(Copy, Clone)] struct Vertex { position: [f32; 2], } implement_vert...
true
66989593992bbfa940b04ffa036dddaf01b6edca
Rust
montrehack/challenges
/2020-02-19/src/bin/reactivate.rs
UTF-8
1,163
2.71875
3
[]
no_license
use serde::{Deserialize, Serialize}; use std::convert::Infallible; use warp::Filter; use rand::prelude::*; use rand::SeedableRng; use base64::{encode}; const FLAG: &str = "FLAG-XXXXXXXXXXXXXXXXXXXXXXXXX"; const BIND: ([u8; 4], u16) = ([0, 0, 0, 0], 3000); #[derive(Serialize, Deserialize)] pub struct License { pu...
true
3cb13a63f919dee84bf581050e226e6f2fbbc9c4
Rust
wilfriedschmidt/adventofcode2019
/src/day11.rs
UTF-8
2,289
3.078125
3
[ "MIT" ]
permissive
use std::collections::HashMap; use crate::util::*; use crate::intcode::*; extern crate num_bigint; extern crate num_traits; fn robot(program:&mut Program, inputvalue:i64) -> usize { // initialize inputs let mut input = Vec::new(); input.push(fi64(inputvalue)); let mut x=0; let mut y=0; let mut panels = ...
true
759cd4cd83e15f7435e1142c654ba912abf77411
Rust
t-ob/aoc
/aoc2022/src/bin/y22d15.rs
UTF-8
4,632
2.796875
3
[]
no_license
use std::{collections::{BinaryHeap, HashSet}, sync::{Arc, Mutex}, thread}; use common::complex::Complex; fn main() { let data = common::io::map_stdin_lines_to_vec(|line| { let mut nums = [0; 4]; let groups = line.split('='); for (idx, group) in groups.skip(1).enumerate() { let...
true
2f05db804ba3a6e8baf2b4b7346de04d750df1bd
Rust
gianlucamazza/proofmarshal
/proofmarshal-core/src/bitcoin/state.rs
UTF-8
2,552
3.296875
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::collections::BTreeMap; use std::sync::RwLock; use super::*; use crate::validate::Valid; #[derive(Debug,Clone,Copy,PartialEq,Eq)] pub struct BlockHeight { height: u32, hash: BlockHash, } impl BlockHeight { pub fn new(height: u32, hash: BlockHash) -> Self { Self { hash, ...
true
4226aecafaeb5c061199b29f903ea4a9e210cdc0
Rust
akmalds/portus
/src/lib.rs
UTF-8
21,600
2.640625
3
[ "ISC" ]
permissive
//! Welcome to CCP. //! //! This crate, portus, implements a CCP. This includes: //! 1. An interface definition for external types wishing to implement congestion control //! algorithms (`CongAlg`). //! 2. A [compiler](lang/index.html) for datapath programs. //! 3. An IPC and serialization [layer](ipc/index.html) fo...
true
b65c64b085ec388e07f1ad9ba72ec8f53bca9888
Rust
rohankumardubey/Panther
/rust/src/gitignore.rs
UTF-8
1,793
2.859375
3
[ "Apache-2.0" ]
permissive
use ignore::gitignore::{Gitignore, GitignoreBuilder}; use std::path::Path; use std::ptr; use std::os::raw::c_char; use std::ffi::CStr; #[allow(non_snake_case)] #[no_mangle] pub extern "C" fn PGCreateGlobForDirectory(directory: *const c_char) -> *mut Gitignore { let cstr = unsafe { CStr::from_ptr(directory) }; let ...
true