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
12237c1eb877cee1263f6daa3d576a9473c6a735
Rust
ftilde/rust-x86asm
/src/test/instruction_tests/instr_vpcmpuw.rs
UTF-8
7,723
2.515625
3
[ "MIT" ]
permissive
use instruction_def::*; use test::run_test; use Operand::*; use Reg::*; use RegScale::*; use RegType::*; use {BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; #[test] fn vpcmpuw_1() { run_test( &Instruction { mnemonic: Mnemonic::VPCMPUW, ope...
true
6dfdae725ea80946c3397319042a3ad5dd7317f6
Rust
madmax28/aoc2019
/src/day11/mod.rs
UTF-8
3,085
2.953125
3
[]
no_license
use crate::day09::{Iss, StopReason, Value}; use std::cmp::{max, min}; use std::collections::HashMap; use std::convert::{From, TryFrom, TryInto}; #[derive(Debug)] enum Error { InvalidColor, InvalidTurn, } #[derive(Debug, Clone, Copy)] enum Color { Black, White, } impl From<Color> for Value { fn f...
true
9d0036313a182345714a7cac5d9057bb0b92267b
Rust
sibolwolf/rust_self
/ownership/src/main.rs
UTF-8
189
2.890625
3
[ "MIT" ]
permissive
fn main() { let x = 10; foo(); copy(); } fn foo() { let v = vec![1, 2, 3]; let v2 = v; } fn copy() { let v = 1; let v2 = v; println!("v is {}", v); }
true
d03339e9fba95c2d1689ef813c324586a96932b5
Rust
aag/eagle-eye
/src/main.rs
UTF-8
3,935
2.828125
3
[ "MIT" ]
permissive
extern crate docopt; extern crate notify; #[macro_use] extern crate serde_derive; extern crate toml; pub mod actions; pub mod config; pub mod files_watcher; use std::path::PathBuf; use std::process; use actions::command::CommandAction; use actions::print::PrintAction; use actions::Action; use config::SettingsConfig;...
true
e56eaebc0ab47b994d1c15b7281496ba2169ad2a
Rust
Luminic/render-engine
/src/vertex.rs
UTF-8
1,467
2.8125
3
[]
no_license
use super::point::Point; #[repr(C)] #[derive(Copy, Clone, Debug)] pub struct Vertex { pub position: Point, // If the texture binding is negative, tex_coords_or_color is color and no texture is used // Otherwise, tex_coords_or_color is texture coordinates and color is not used pub texture_binding: i32, ...
true
81943ef33f97a53ec49542b1959f867d26fef32c
Rust
pklazy/lpc54628-rust
/src/ctimer0/ccr.rs
UTF-8
15,225
2.609375
3
[]
no_license
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::CCR { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w ...
true
ab2332cedf15c87f9e2e5357c3fc8bbffdaa884d
Rust
vangroan/vuur
/crates/vuur_compile/src/func.rs
UTF-8
803
3.0625
3
[ "MIT" ]
permissive
use std::num::NonZeroU32; #[derive(Debug, Clone, Copy)] #[repr(transparent)] pub struct FuncId(pub(crate) NonZeroU32); impl FuncId { #[inline(always)] pub(crate) fn new(id: u32) -> Option<Self> { NonZeroU32::new(id).map(Self) } pub fn to_usize(self) -> usize { self.0.get() as usize ...
true
71ea6b1dff1406abe74948742bca5d8e74edbbd5
Rust
vi/mal-rust-vi
/step1/src/lib.rs
UTF-8
1,767
2.765625
3
[ "MIT" ]
permissive
#![feature(try_blocks)] #![allow(unused)] extern crate pest; #[macro_use] extern crate pest_derive; #[macro_use] extern crate pest_deconstruct; #[macro_use] extern crate failure; pub type Result<T> = ::std::result::Result<T, failure::Error>; #[cfg(test)] mod tests; pub mod parse; use ::std::rc::Rc; use pest::Par...
true
7a0ed9652169dd5ce7239f91ec3c9c1359a0cc22
Rust
rick68/rust-trace
/libcore/iter/struct_Repeat/idx.rs
UTF-8
1,223
3.1875
3
[ "MIT" ]
permissive
#![feature(core)] extern crate core; #[cfg(test)] mod tests { use core::iter::RandomAccessIterator; use core::iter::Repeat; use core::iter::repeat; use core::clone::Clone; struct A<T> { index: T } impl Clone for A<T> { fn clone(&self) -> Self { A { index: self.index } } } ...
true
4d445dc9d2263ce246409e7f62ce4c34b5f3b2e2
Rust
pnlybubbles-gomibako/rust-sandbox
/functor.rs
UTF-8
79
2.78125
3
[]
no_license
trait Functor<T> { fn fmap<F, S>(self, F) -> Self<S> where F: Fn(T) -> T; }
true
b3c4a6389add7c15fd01cf5787122caca333cc23
Rust
rlfagan/erlang-tc
/native/pk.rs
UTF-8
1,344
2.59375
3
[ "Apache-2.0" ]
permissive
use crate::bin::Bin; use crate::ciphertext::{CiphertextArc, CiphertextRes}; use crate::lazy_binary::LazyBinary; use crate::sig::SigArc; use rustler::{Env, ResourceArc}; use threshold_crypto::PublicKey; /// Struct to hold PublicKey pub struct PkRes { pub pk: PublicKey, } pub type PkArc = ResourceArc<PkRes>; pub f...
true
66e705780650c8bec216260235314ab21730b51c
Rust
fjctp/fibonacci_number
/rust/v1/src/main.rs
UTF-8
353
3.53125
4
[ "MIT" ]
permissive
// compute the N fibonacci_number using array fn main() { const N: usize = 10 + 2; let mut numbers: [i32; 12] = [0; 12]; numbers[1] = 1; // note: (a..b) is inclusive (a) and exclusive (b) for i in (2..N) { numbers[i] = numbers[i-1] + numbers[i-2]; println!("{}", numbers[i]); } println!(""); ...
true
2779626c5d628eda5c22ff4f86be9de10f0b1349
Rust
alula/tokenizers
/tokenizers-lib/src/pre_tokenizers/bert.rs
UTF-8
5,896
3.125
3
[]
no_license
use crate::tokenizer::{PreTokenizer, Result}; use std::collections::HashSet; use unicode_categories::UnicodeCategories; use unicode_normalization::UnicodeNormalization; /// Extremely simple tokenization on whitespaces fn whitespace_tokenize(s: &str) -> Vec<&str> { s.trim() .split(char::is_whitespace) ...
true
bf9e881a238414dfba607a07b322d72e65dda468
Rust
TyOverby/httproxy
/src/bin.rs
UTF-8
4,305
3.203125
3
[]
no_license
use std::io; use std::net; use std::thread; use std::io::Result as IoResult; use std::net::Shutdown; use std::ascii::AsciiExt; #[derive(Debug)] enum RequestType { Regular, Connect } // Returns the request type and the host, if they can be found fn gather_info<'a, I: Iterator<Item = &'a str>>(headers: I) -> Op...
true
204c397779cbefae569a8354583a8f188428f86c
Rust
pavilbezpravil/rtracer
/rtracer_core/src/triangle.rs
UTF-8
1,022
3.109375
3
[]
no_license
use crate::Vec3; use crate::ray::Ray; use crate::aabb::Aabb; use crate::intersect::Intersect; use crate::intersection::ray_triangle_intersection; use crate::bounded::Bounded; #[derive(Copy, Clone, Debug)] pub struct Triangle { pub v0: Vec3, pub v1: Vec3, pub v2: Vec3, } impl Triangle { pub fn new(v0: ...
true
b0bf7b624f6e1eb7d3c246d906f5c666f78e4199
Rust
tomaka/asset_store
/src/multi_store.rs
UTF-8
5,317
2.921875
3
[]
no_license
use std::collections::hashmap::HashMap; use super::AssetStore; #[deriving(Show)] pub enum MultiStoreError<E> { NoSplit, StoreNotFound(String), WrappedError(E) } struct StoreWrapper<B, E, T> { store: B, trans: fn(E) -> T } impl <E, T, B: AssetStore<E>> StoreWrapper<B, E, T> { fn new(st: B, tr...
true
dc651ad35c6de87160cf46ec68f8ae991c236c42
Rust
ageiersbach/cmdr-log-cli
/src/events/cargo.rs
UTF-8
490
2.546875
3
[]
no_license
use chrono::{DateTime, Utc}; #[derive(Serialize, Deserialize, Debug)] pub struct Cargo { pub timestamp: DateTime<Utc>, pub event: String, #[serde(rename(deserialize = "Count"))] pub count: i32, #[serde(rename(deserialize = "Type"))] pub commodity: String, } #[derive(Serialize, Deserialize, D...
true
a7644afd36a0ff9e839efcb44ecb55c3b4147638
Rust
fritzprix/rust_study
/gameoflife/src/main.rs
UTF-8
335
2.75
3
[]
no_license
extern crate csv; extern crate clap; extern crate rand; use clap::Parser; #[derive(Debug, Parser)] struct Args { input: String } fn fill_random(map: &mut [u8]) -> usize { 0 } fn main() { let height = 40usize; let width = 40usize; let mut map = vec![0u8; height * width]; println!("Hell...
true
762ee1305a06726516d44eeb64e4f6185cdb1f77
Rust
ksmoore17/baseball-trajectory
/src/environment.rs
UTF-8
1,710
3.015625
3
[]
no_license
use crate::util::{f_to_c, in_hg_to_mm_hg}; use nalgebra::{Vector2}; const BETA: f32 = 0.0001217; pub struct Environment { // F pub temperature: f32, // ft pub elevation: f32, // 29.92 pub pressure: f32, // % pub relative_humidity: f32, // mph pub wind_speed: f32, // clockwi...
true
abd560464b0eaffc7d4fedc6bd7cb28898414421
Rust
letheka/euphonium
/src/midi.rs
UTF-8
4,972
2.78125
3
[ "MIT" ]
permissive
use ghakuf::messages::*; use ghakuf::reader::*; use std::collections::HashMap; struct PlayingNote { channel: u8, program: u8, note: u8, velocity: u8, start_time: u64, } #[derive(Clone)] pub struct Note { pub channel: u8, pub program: u8, pub start_time: u64, pub end_time: u64, ...
true
f780b4abef139ed1262d1127d39e1c98b593748b
Rust
frxstrem/git-corun
/src/main.rs
UTF-8
8,467
2.953125
3
[ "MIT" ]
permissive
mod git; use std::error::Error; use std::fmt::Display; use std::fs; use std::io::{self, Write}; use std::path::{Path, PathBuf}; use std::process::{self, Command, ExitStatus, Stdio}; use chrono::{prelude::*, Duration, Local}; use structopt::{clap, StructOpt}; #[derive(Clone, Debug, StructOpt)] struct Options { #[...
true
3f199f918b07aa9f177e72287605a020c0ef530b
Rust
procuteboy/inko
/vm/src/gc/profile.rs
UTF-8
2,828
3.25
3
[]
no_license
use gc::trace_result::TraceResult; use timer::Timer; #[derive(Debug, Eq, PartialEq)] pub enum CollectionType { /// A young generation collection. Young, /// A young + full collection. Full, /// A mailbox collection. Mailbox, } pub struct Profile { /// The type of garbage collection that ...
true
6e9e6be96afe2ea15a4e0722d790f1f6050a662c
Rust
gmh5225/classfile-rs
/src/field.rs
UTF-8
3,088
2.71875
3
[ "MIT" ]
permissive
use crate::Serializable; use crate::access::FieldAccessFlags; use crate::constantpool::{ConstantPool, ConstantPoolWriter}; use crate::attributes::{Attributes, Attribute, AttributeSource, SignatureAttribute}; use crate::version::ClassVersion; use crate::error::Result; use crate::utils::{VecUtils}; use std::io::{Read, Wr...
true
d334c1d2b8b3682dfc6d2e1daecdc83cfa872e9c
Rust
LebranceBW/KvStore
/src/engine/kvstore/file_operators.rs
UTF-8
5,761
2.78125
3
[]
no_license
use std::fs::{File, OpenOptions}; use std::io::Write; use std::io::{BufRead, BufReader, Seek, SeekFrom}; use std::path::PathBuf; use anyhow::Context; use crate::engine::kvstore::kvstore::CommandPosition; use crate::engine::kvstore::Command; use super::Result; pub type FileID = usize; pub type FileOffset = u64; //...
true
40d303e80f81344f081131cd590902d745312ea4
Rust
lfn3/shippy
/src/git_lab.rs
UTF-8
4,221
2.84375
3
[]
no_license
use crate::err::CliError; use reqwest::{Client, Response}; use serde::export::fmt::Error; use serde::export::Formatter; use serde::Deserialize; use std::fmt::Display; use std::collections::HashSet; use std::iter::FromIterator; pub struct Project { base_url: String, project_id: u64, api_token: String, c...
true
ec612d0a3ff727b7980786ddbe2d2e1ace50ef23
Rust
friedm/binunit
/src/lib/parse.rs
UTF-8
3,583
3.3125
3
[ "MIT" ]
permissive
use regex; pub fn parse_testfn_list(files: &Vec<String>) -> Vec<String> { let parser = Parser::new(); files.iter() .map(|file| parser.parse_labels(file)) .fold(Vec::new(), |mut a, b| { a.extend(b); a }) } struct Parser { fn_label_regex: regex::Regex } impl Parser { pub fn new() -> Pa...
true
985b3c325665a042abf0209a862d36bb5547bf38
Rust
blawesom/rust-url
/src/main.rs
UTF-8
968
2.671875
3
[]
no_license
extern crate clap; // extern crate indicatif; // extern crate console; extern crate reqwest; // https://github.com/mattgathu/duma use clap::{Arg, App}; // use indicatif::{HumanBytes, ProgressBar, ProgressStyle}; // use reqwest::{Client}; fn main() { let matches = App::new("rust-get") .version("0.1.0") ...
true
6bfdf4859d84f4de9b562f79e5396010a26521ce
Rust
ksdputra/memoization-x-rust
/fibonacci/src/lib.rs
UTF-8
820
3.453125
3
[]
no_license
use std::collections::HashMap; // fn main() { // // println!("Hello, world!"); // // println!("{}", fibonacci(40)) // // println!("{}", fib_memo(&mut HashMap::new(), 40)) // } // #[no_mangle] // pub extern fn fibonacci(n: i32) -> i32 { // match n { // 1 => 1, // 2 => 1, // _...
true
0bde169e00a86854442351a8825b52d344599a33
Rust
raviqqe/ssf
/ssf/src/ir/case.rs
UTF-8
1,669
3.0625
3
[ "Apache-2.0" ]
permissive
use super::{algebraic_case::AlgebraicCase, primitive_case::PrimitiveCase}; use crate::types::Type; use std::collections::{HashMap, HashSet}; /// Case expressions match values of algebraic data types with their /// constructors deconstructing them. /// /// Their alternatives do not have to be exhaustive. See also optio...
true
80b8985c354c29beb3b8a83c11b6fef0a7f83c4f
Rust
shaneutt/coreutils
/src/od/od.rs
UTF-8
4,111
2.6875
3
[ "MIT" ]
permissive
#![crate_name = "uu_od"] /* * This file is part of the uutils coreutils package. * * (c) Ben Hirsch <benhirsch24@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ extern crate getopts; use std::fs::File; use std::io::Re...
true
c7abdf5c8a866aa6f52f64117ed05cf22836a144
Rust
billythedummy/simpleurlshortener
/src/main.rs
UTF-8
1,492
2.578125
3
[]
no_license
mod create; mod db; mod err; mod hit; mod macros; mod viz; use actix_web::{App, HttpServer}; use std::env; use create::*; use db::create_db_pool; use err::Error; use hit::*; use viz::*; #[actix_web::main] async fn main() -> std::io::Result<()> { let pool = create_db_pool(); HttpServer::new(move || { ...
true
23fa46d4f024a2aa26635f60de376b4392d35393
Rust
Azure/azure-sdk-for-rust
/services/mgmt/logic/src/package_2018_07_preview/models.rs
UTF-8
221,919
2.578125
3
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
permissive
#![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::de::{value, Deserializer, IntoDeserializer}; use serde::{Deserialize, Serialize, Serializer}; use std::str::FromStr; #[doc = "The AS2 agreement acknowledgement connection settings."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struc...
true
e990583047c4872a8d56457cd65398d355f74a00
Rust
sahwar/svgtypes
/src/lib.rs
UTF-8
5,231
3.171875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
/*! *svgtypes* is a collection of parsers, containers and writers for [SVG 1.1](https://www.w3.org/TR/SVG11/) types. Usage is simple as: ```rust use svgtypes::Path; let path: Path = "M10-20A5.5.3-4 110-.1".parse().unwrap(); assert_eq!(path.to_string(), "M 10 -20 A 5.5 0.3 -4 1 1 0 -0.1"); ``` You can also use a lo...
true
9e78b9620880f32b1f8966d5b861413b0495bedb
Rust
eigenein/my-iot-rs
/src/core/si.rs
UTF-8
338
2.890625
3
[ "MIT" ]
permissive
/// [SI] constants. /// /// [SI]: https://en.wikipedia.org/wiki/International_System_of_Units /// Amount of [Joule]s in 1 [watt-hour]. /// /// [Joule]: https://en.wikipedia.org/wiki/Joule /// [watt-hour]: https://en.wikipedia.org/wiki/Kilowatt-hour pub const JOULES_IN_WH: f64 = 3600.0; pub const WH_IN_JOULE: f64 = 1....
true
f82cbf9087f307bc14fe87e013e0a7debf17eb1d
Rust
onelson/advent-of-code-2017
/src/captcha.rs
UTF-8
4,311
3.734375
4
[]
no_license
//! Day 1: Inverse Captcha //! //! The night before Christmas, one of Santa's Elves calls you in a panic. "The printer's broken! //! We can't print the Naughty or Nice List!" By the time you make it to sub-basement 17, there are //! only a few minutes until midnight. "We have a big problem," she says; "there must be al...
true
5d81fd8bc6db3d224b0cbb67f79c87aa46ee594b
Rust
justanotherdot/inc
/src/runtime-rust/src/main.rs
UTF-8
13,306
2.65625
3
[ "MIT" ]
permissive
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(unused_must_use)] #![allow(unused_variables)] include!("bindings.rs"); use std::os::raw::c_char; use std::io::Write; use std::os::unix::io::FromRawFd; use std::os::unix::io::IntoRawFd; use std::io::Read; #[derive(Pa...
true
c52aebf4dbce616762d747631addb73b7afab8fd
Rust
nulldatamap/fw
/src/main.rs
UTF-8
411
2.84375
3
[]
no_license
use std::char; use std::env; fn main() { let args : Vec<String> = env::args().skip( 1 ).collect(); let input = args.join( " " ); let mut output = String::new(); for chr in input.chars() { if chr >= '!' && chr <= '~' { output.push( char::from_u32( 0xff00 + (chr as u32) - 32 ).unwrap() ); ...
true
70dafc1c240805fbdbed083399d9c70c370ae2bf
Rust
chrisduerr/wayland-rs
/wayland-server/src/client.rs
UTF-8
2,261
2.515625
3
[ "MIT" ]
permissive
use std::sync::Arc; use wayland_backend::{ protocol::ProtocolError, server::{ClientId, DisconnectReason, InvalidId}, }; use crate::{dispatch::ResourceData, Dispatch, DisplayHandle, Resource}; #[derive(Debug)] pub struct Client { pub(crate) id: ClientId, pub(crate) data: Arc<dyn std::any::Any + Send +...
true
1bddab92d567ef9a8b3a93dfabfc259396142384
Rust
stefan-k/regex
/src/nfa.rs
UTF-8
6,505
2.625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// Copyright 2018 Stefan Kroboth // // 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 to thos...
true
9f9d7c2b9820c08833d6858504ec901c552b3033
Rust
JackStade/tensor_transforms_rs
/src/tests/mod.rs
UTF-8
2,035
2.828125
3
[]
no_license
use SymmetryObject; use {Transform, TransformVector, Transformable}; #[test] fn transform_math_add() { let (transform1, transform2) = get_test_transforms(); let test1 = transform1.transform(&transform2); let test2 = transform1 + transform2; assert_eq!(&test1.transform[..], &test2.transform[..]); } #[t...
true
85d79cd39e18fc218b432855dea89f8a465a2d3f
Rust
ervitis/rust-learn
/ch07/modules/src/main.rs
UTF-8
582
2.53125
3
[]
no_license
mod lib; use lib::front_of_house; mod back_of_house { pub struct Breakfast { pub toast: String, seasonal_fruit: String, } impl Breakfast { pub fn summer(toast: &str) -> Breakfast { Breakfast { toast: String::from(toast), seasonal_fruit: ...
true
dd8ce298d3d5fcb14c0e4d84e74dd49a0384239a
Rust
ia7ck/competitive-programming
/AtCoder/abc277/src/bin/e/main.rs
UTF-8
1,398
2.609375
3
[]
no_license
use std::collections::VecDeque; use proconio::{input, marker::Usize1}; fn main() { input! { n: usize, m: usize, k: usize, edges: [(Usize1, Usize1, usize); m], switches: [Usize1; k], }; let mut switch = vec![false; n]; for s in switches { switch[s] = tru...
true
b2003d7d0551db905f99b334cd099d61ff8548db
Rust
jrobar/Fibonacci
/src/main.rs
UTF-8
636
3.625
4
[]
no_license
use std::io; fn main() { // prints the requested number of fibonacci sequence elements println!("How many fibonacci numbers?"); let mut i = get_num(); let mut n = 1; let mut a = 0; let mut b = 1; let mut c = 0; while n <= i { println!("fib {}: {}", n, a); c = a + b; ...
true
f848e3a52740de07a58206d580c0cf4bc18d0123
Rust
Tim-Zhang/rust-protobuf
/test-crates/protobuf-test-common/src/interop.rs
UTF-8
1,233
2.84375
3
[ "MIT" ]
permissive
use std::io::Read; use std::io::Write; use std::process; /// Invoke `interop` binary, pass given data as stdin, return stdout. pub fn interop_command(command: &str, stdin: &[u8]) -> Vec<u8> { let mut interop = process::Command::new("../test-crates/interop/cxx/interop") .args(&[command]) .stdin(proc...
true
30d24e3c66dd3635de09cddbf35bc3c6b3ce4240
Rust
Irwin1985/writing-an-interpreter-in-rust
/src/lexer/lexer.rs
UTF-8
7,951
3.46875
3
[]
no_license
use token::*; #[derive(Debug, Clone)] pub struct Lexer { input: String, position: usize, read_position: usize, ch: Option<char>, } impl Lexer { pub fn new(input: String) -> Lexer { let mut l = Lexer { input: input, position: 0, read_position: 0, ...
true
15918061e6a6033cabfdc5ecbabb2892dbd99e92
Rust
dinfuehr/dora
/dora-runtime/src/os/page.rs
UTF-8
1,688
3.0625
3
[ "MIT" ]
permissive
static mut PAGE_SIZE: usize = 0; static mut PAGE_SIZE_BITS: usize = 0; pub fn page_size() -> usize { let result = unsafe { PAGE_SIZE }; if result != 0 { return result; } init_page_size(); unsafe { PAGE_SIZE } } pub fn page_size_bits() -> usize { let result = unsafe { PAGE_SIZE_BITS ...
true
7e11a2c26b4d3f580ab89fb6695eef0608c90e3b
Rust
lythesia/leet
/rs/src/quests/binary_tree_level_order_traversal.rs
UTF-8
1,992
3.484375
3
[]
no_license
/** * [102] Binary Tree Level Order Traversal * * Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).   Example 1: Input: root = [3,9,20,null,null,15,7] Output: [[3],[9,20],[15,7]] Example 2: Input: root = [1] Output: [[1]] Example 3: ...
true
da737134c2b014353e59cf18262b4dca176e2ef7
Rust
gnosis/dex-services
/pricegraph/src/api/price_source.rs
UTF-8
4,715
3.15625
3
[]
no_license
//! This module implements price source methods for the `Pricegraph` API so that //! it can be used for OWL price estimates to the solver. use crate::encoding::{TokenId, TokenPair, TokenPairRange}; use crate::{OrderbookError, Pricegraph, FEE_TOKEN}; const OWL_BASE_UNIT: f64 = 1_000_000_000_000_000_000.0; impl Priceg...
true
abb84ec6a52bfc0b37d359fa524e16851d716782
Rust
ailjushkin/fizzbuzz-rust
/src/main.rs
UTF-8
347
3.234375
3
[ "MIT" ]
permissive
fn main() { let max = 100; for num in 1..max + 1 { if num % 15 == 0 { print!(" fizzbuzz"); } else if num % 3 == 0 { print!(" fizz"); } else if num % 5 == 0 { print!(" buzz"); } else { print!(" {}", num.to_str...
true
4038eb12cb23285f03e61e72e0a1f47bde50be9f
Rust
acidburn0zzz/ruffle
/core/src/avm1/object/xml_idmap_object.rs
UTF-8
8,093
2.65625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! AVM1 object type to represent the attributes of XML nodes use crate::avm1::activation::Activation; use crate::avm1::error::Error; use crate::avm1::object::{ObjectPtr, TObject}; use crate::avm1::property::Attribute; use crate::avm1::{Object, ScriptObject, Value}; use crate::avm_warn; use crate::xml::{XMLDocument, X...
true
a79de3b81c09c77d4f76ae2290aee5673534868f
Rust
nakat-t/nlp100
/q52/src/main.rs
UTF-8
371
2.59375
3
[ "MIT" ]
permissive
use failure; use rust_stemmers; use std::io; use std::io::prelude::*; fn main() -> Result<(), failure::Error> { let stemmer = rust_stemmers::Stemmer::create(rust_stemmers::Algorithm::English); let r = io::BufReader::new(io::stdin()); for line in r.lines() { let line = line?; println!("{}\t{...
true
05549dda333371dc13d1a280f67f671213e3500b
Rust
IThawk/rust-project
/rust-master/src/test/ui/suggestions/missing-assoc-type-bound-restriction.rs
UTF-8
692
2.5625
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
// Running rustfix would cause the same suggestion to be applied multiple times, which results in // invalid code. trait Parent { type Ty; type Assoc: Child<Self::Ty>; } trait Child<T> {} struct ChildWrapper<T>(T); impl<A, T> Child<A> for ChildWrapper<T> where T: Child<A> {} struct ParentWrapper<T>(T); im...
true
38e1a4818aef1c18c71c0bf51e5d5ddb9d9d71f7
Rust
notryanb/nu_plugin_testing
/src/main.rs
UTF-8
1,591
2.59375
3
[]
no_license
use nu_errors::ShellError; use nu_plugin::{serve_plugin, Plugin}; use nu_protocol::{ CallInfo, ReturnSuccess, ReturnValue, Signature, SyntaxShape, Value, }; struct TestPlayground; impl TestPlayground { fn new() -> TestPlayground { TestPlayground } } impl Plugin for TestPlayground { fn confi...
true
e4fdebf08a8df1b3e0187f3ab1a84280477afed2
Rust
GeoffClements/slim-client-protocol-rs
/slimproto/src/status.rs
UTF-8
4,650
3.09375
3
[ "MIT" ]
permissive
/// A convenience module for working with client status data. /// /// The Logitech Media Server requires regular status messages from /// the client. This module provides convenience types for this. use std::{ fmt, time::{Duration, Instant}, }; use crate::ClientMessage; /// A struct to hold the status data as...
true
fbde85f885a700f35594d8795d5c4555d1b32460
Rust
PG-MANA/Methylenix
/src/kernel/file_manager/vfs.rs
UTF-8
4,406
2.953125
3
[ "Apache-2.0" ]
permissive
//! //! Virtual File System //! use super::FileError; use crate::kernel::memory_manager::data_type::{MOffset, MSize, VAddress}; #[derive(Copy, Clone, Eq, PartialEq)] pub enum FileSeekOrigin { SeekSet, SeekCur, SeekEnd, } pub const FILE_PERMISSION_READ: u8 = 1; pub const FILE_PERMISSION_WRITE: u8 = 1 << ...
true
ff8a07ff0d0107df7a80114fa9d26bb5929e146c
Rust
brundonsmith/rust_lisp
/tests/parser.rs
UTF-8
2,069
3.296875
3
[]
no_license
use rust_lisp::{ model::{IntType, Value}, parser::{parse, ParseError}, }; #[macro_use] extern crate rust_lisp; #[test] fn parse_basic_expression() { let ast = parse( " (list (* 1 2) ;; a comment (/ 6 3 \"foo\"))", ) .next() .unwrap() .unwrap(); assert_eq!( ...
true
9dc85c036593fd596b99a0df862011667bb26d66
Rust
laarmen/duplicate
/src/parse.rs
UTF-8
10,370
2.828125
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate::{ parse_utils::*, substitute::{substitute, Substitution}, SubstitutionGroup, }; use proc_macro::{token_stream::IntoIter, Ident, Span, TokenStream, TokenTree}; use std::{collections::HashSet, iter::Peekable}; /// Parses the attribute part of an invocation of duplicate, returning /// all the substitutions ...
true
7e872563d5e10a67e7223ebb41a81f4c0249e2f1
Rust
paulsouche/adventofcode2019
/src/bin/day14-space-stoichiometry/main.rs
UTF-8
11,708
2.921875
3
[ "MIT" ]
permissive
use regex::Regex; use std::cmp; use std::collections::HashMap; use std::{fs::read_to_string, io}; fn main() -> io::Result<()> { let file = read_to_string("src/bin/day14-space-stoichiometry/input.txt")?; println!("{}", part1(&file)); println!("{}", part2(&file)); Ok(()) } fn part1(input: &str) -> usi...
true
da7b1cdb6552f89679c9cf2412230c7ad0b53dff
Rust
oil-lang/oil-rs
/data_bindings/src/context/manager.rs
UTF-8
6,669
3.09375
3
[ "MIT" ]
permissive
use std::collections::HashMap; use { StoreValue, Store, PropertyAccessor, AttributeSetResult, AttributeGetResult, AttributeMutResult }; use store::StoreValueStatic; use super::Context; use store::AssignFromCast; use DataBindingsContext; /// The `ContextManager` is templated by a class impleme...
true
9eaf4185cb85a8022c68342344e56f3fb0807808
Rust
wotsushi/competitive-programming
/abc/112/a.rs
UTF-8
757
2.890625
3
[ "MIT" ]
permissive
#![allow(non_snake_case)] #![allow(unused_variables)] fn main() { let N: i64 = { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim().parse().unwrap() }; if N == 1 { let ans = "Hello World"; println!("{}", ans); } else...
true
f6568fce32b349c06bf6607bac4a59fd6ed098c9
Rust
tonnylyz/geometry-sketchpad
/src/utilities/aabb.rs
UTF-8
421
3.1875
3
[]
no_license
use super::Vector2; #[derive(Debug, Copy, Clone)] pub struct AABB { pub x: f64, pub y: f64, pub width: f64, pub height: f64, } impl AABB { pub fn new(x: f64, y: f64, width: f64, height: f64) -> Self { Self { x, y, width, height } } pub fn contains(&self, p: Vector2) -> bool { let Vector2 { x, y...
true
7f1adead744751e3d561eb67e42d383f3ae2ecb8
Rust
ebar0n/microservice-qr-codes
/api/src/main.rs
UTF-8
4,818
2.671875
3
[]
no_license
use actix_files::NamedFile; use actix_web::{middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer, Result}; use chrono::prelude::Utc; use chrono::SecondsFormat; use image::Luma; use json::JsonValue; use qrcode::QrCode; use serde::{Deserialize, Serialize}; use std::env; use uuid::Uuid; #[derive(Serialize, ...
true
1704a511adbc23a9754aa7cc812eb736e3f36c54
Rust
bz10bis/rust_roguelike
/src/object.rs
UTF-8
4,141
3
3
[]
no_license
// Object.rs use tcod::colors::*; use tcod::console::*; use serde::{Deserialize, Serialize}; use crate::game::Game; #[derive(Debug, Serialize, Deserialize)] pub struct Object { pub x: i32, pub y: i32, pub char: char, pub color: Color, pub name: String, pub blocks: bool, pub alive: bool, ...
true
79223678d209017af8b8cd0b1f6b4c50c7155711
Rust
Khobalt/oily
/rust/problem_0003/src/main.rs
UTF-8
757
3.40625
3
[]
no_license
/* The prime factors of 13195 are 5, 7, 13 and 29. * * What is the largest prime factor of the number 600851475143 ? * */ fn main() { //find a big factor, test it for primality, repeat until half-way down let num: i64 = 600851475143; for i in (0..((num as f64).sqrt() as i64)).rev() { //If we h...
true
62235169d38238d927554dbad3e31ecd5f7987d7
Rust
xurtis/tiny-eval
/examples/simple.rs
UTF-8
773
2.71875
3
[]
no_license
use tiny_eval::*; type Result<T> = ::std::result::Result<T, Box<dyn ::std::error::Error>>; fn main() -> Result<()> { let mut context = Context::new(); context.extend("a", value(6.2))?; context.extend("b", value(9.8))?; context.extend("plus", lambda("x", lambda("y", add("x", "y"))))?; apply_expr!...
true
8b5de58cb442f0f8e5d386ad9f6f4284a0ea4ee8
Rust
vpranckaitis/advent-of-code
/y2019-rust/src/day07.rs
UTF-8
5,399
3.109375
3
[]
no_license
use std::fs::File; use std::io::{BufRead, BufReader}; use Command::*; use Param::*; use State::*; use std::convert::TryInto; use std::cmp::max; type Program = Vec<i32>; pub fn solve() { println!("{}\n{}", solve1(), solve2()); } const AMP_COUNT: usize = 5; fn solve1() -> i32 { let program = read(); gene...
true
0e8be2dd068f7e66d3b87f7eb066c2f752fb9f86
Rust
mrnix/rust_d3_geo
/src/projection/stream_node.rs
UTF-8
576
2.53125
3
[]
no_license
use std::cell::RefCell; use std::rc::Rc; use geo::CoordFloat; use crate::stream::Stream; /// Stream node is a internal to projection and clip. /// /// The stream node processor is the /// /// raw: the proto-node. /// sink: the next streamNode in the chain. /// /// T is required because SINK: Stream<T=T> #[derive(Clo...
true
81af526e82990a3d1eb9e6c855600ce9c90fee00
Rust
nilq/JazzML
/src/jazzml/frame.rs
UTF-8
15,041
2.8125
3
[]
no_license
use super::builtins; use super::opcodes::Opcode; use super::value::*; use super::vm::VirtualMachine; use fnv::FnvHashMap; use std::cell::RefCell; pub struct Frame<'a> { pub code: Vec<Opcode>, pub locals: &'a mut FnvHashMap<String, Value>, pub pc: usize, pub stack: Vec<Value>, pub vm: &'a mut Virtu...
true
12390368f1c60bb26b0c3ac54a73eb4241e9e91d
Rust
dradtke/neovim-rs
/src/lib.rs
UTF-8
2,961
2.75
3
[ "MIT" ]
permissive
#![allow(dead_code, unused_variables)] //! `neovim` is a crate that enables building Neovim plugins with Rust. //! //! Neovim is a fork of Vim that enables fully asynchronous communication //! with plugins that run as external programs, communicating via Msgpack-RPC. //! This crate provides facilities for connecting to...
true
eeb65e2208eff5046fb74f5b0eaf9cf619982e4d
Rust
zhenfeizhang/poly_mul
/src/ring_element.rs
UTF-8
5,550
3.296875
3
[]
no_license
//! implements the polynomial arithmetics use rand::Rng; use zeroize::Zeroize; pub(crate) const N: usize = 8; pub(crate) const Q: u64 = 64; // #[cfg(feature = "degree512")] // pub(crate) const N: usize = 256; // #[cfg(feature = "degree512")] // pub(crate) const N: usize = 512; // #[cfg(feature = "degree1024")] // p...
true
a0218aa4b50eb1e468cb7d224b49daa2483f5bef
Rust
lpeterse/rsynth
/src/signal/factor.rs
UTF-8
280
2.671875
3
[]
no_license
use crate::*; use std::fmt::Debug; pub trait Factor: Clone + Copy + Debug + Default { fn factor(&self) -> f32; } impl Factor for f32 { fn factor(&self) -> Self { *self } } impl Factor for Voltage { fn factor(&self) -> f32 { self.0 + 1.0 } }
true
a637ef7943732981f7a7b083231115d76af0f527
Rust
vaibhavantil2/third-party-api-clients
/slack/src/oauth_v_2.rs
UTF-8
1,739
2.84375
3
[ "MIT" ]
permissive
use anyhow::Result; use crate::Client; pub struct OauthV2 { pub client: Client, } impl OauthV2 { #[doc(hidden)] pub fn new(client: Client) -> Self { OauthV2 { client } } /** * This function performs a `GET` to the `/oauth.v2.access` endpoint. * * Exchanges a temporary OAut...
true
af32172fb2afd38c3c7ab3da7a11f4bd7104e480
Rust
tkonid/forester
/forester-examples/src/profile1.rs
UTF-8
1,850
2.703125
3
[ "Apache-2.0", "MIT" ]
permissive
extern crate forester; extern crate rand; pub fn main() { #[cfg(feature = "cpuprofiler")] { extern crate cpuprofiler; use std::f64::consts::PI; use rand::{thread_rng, Rng}; use forester::traits::Predictor; use forester::api::extra_trees_regressor::{ExtraTreesRegressor, Sam...
true
ab0c9d2d46c0687d8201a0212ba4ba1be2c6c04d
Rust
stadust/pointercrate
/pointercrate-demonlist/src/record/delete.rs
UTF-8
676
2.703125
3
[ "MIT" ]
permissive
use crate::{error::Result, record::FullRecord}; use log::info; use sqlx::PgConnection; impl FullRecord { pub async fn delete(self, connection: &mut PgConnection) -> Result<()> { info!("Deleting record {}", self); FullRecord::delete_by_id(self.id, connection).await } /// `FullRecord::delet...
true
b5ba402836581f362547a888cace70e51dc44a41
Rust
kodsnack/advent_of_code_2019
/johan-oelrich-rust/icc/src/input.rs
UTF-8
1,457
3.25
3
[ "Apache-2.0" ]
permissive
use std::collections::HashSet; pub fn find_cent(computer: &super::Computer, target: i64) -> Option<i64> { let mut tested = HashSet::new(); while let Some(input) = Input::get_next(&mut tested) { if run(computer, Some(input.clone())) == target { return Some(input.cent()); } } None } pub fn run(comp...
true
e2d7cbeed93bb7d69581692be24668c659652747
Rust
stonylohr/float-diff
/src/diff_part_summary.rs
UTF-8
1,195
3.1875
3
[ "MIT" ]
permissive
// Summary of count of times a condition occurs for DiffSummary, // and information about a sample occurrence (first for sign // difference, worst for numeric difference). pub struct DiffPartSummary { pub sample_x: f64, pub sample_y: f64, pub sample_index: usize, pub count: usize, } impl Copy for DiffP...
true
3c967c04b5a4c483a68e274dbe91916af809d991
Rust
cmudrc/CISAT-rs
/src/utilities/randomness.rs
UTF-8
3,023
3.84375
4
[ "MIT" ]
permissive
//! This contains some randomization functions that are useful use rand::thread_rng; use rand_distr::{Distribution, Normal, Uniform, WeightedIndex}; /// This is a function for generating a random vector from a Gaussian distribution pub(crate) fn random_gaussian_vector( length: usize, mean: f64, standard_d...
true
e6d11148191813858703b39c5a73f13a0a91f1e7
Rust
zhangyut/r53
/examples/dig.rs
UTF-8
2,259
2.6875
3
[]
no_license
use std::net::{SocketAddrV4, UdpSocket}; extern crate r53; extern crate clap; use clap::{App, Arg}; use r53::{Name, Message, RRType, MessageRender}; fn main() { let matches = App::new("dig") .arg(Arg::with_name("port") .help("target port") .short("p") .long("port")...
true
727be08310d2ff919344736a023eee82fa32f2fc
Rust
senrust/algorithm
/chapter_17/coin_problem/src/main.rs
UTF-8
748
2.84375
3
[]
no_license
fn main() { let input_info: Vec<usize> = input::read_numline(); let target_value = input_info[0]; let coins: Vec<usize> = input::read_numline(); let mut coin_count: Vec<usize> = vec![100000000000000; target_value + 1]; coin_count[0] = 0; for coin in coins { let mut try_value = 1; ...
true
e3dce819694c25f7929e4bcc26ac9ef88a69a91c
Rust
tpayne84/proxide
/src/session.rs
UTF-8
4,869
3
3
[ "MIT", "Apache-2.0" ]
permissive
use bytes::BytesMut; use chrono::prelude::*; use http::{HeaderMap, Method, Uri}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::net::SocketAddr; use uuid::Uuid; pub mod events; pub mod serialization; #[derive(Serialize, Deserialize, Default)] pub struct Session { pub connections: Ind...
true
37457a0048665da00e0814da841383a42e339d76
Rust
nsedler/LearningRust
/DiceRoller/src/main.rs
UTF-8
971
3.4375
3
[]
no_license
use rand::Rng; use std::io; use std::string::String; #[allow(non_snake_case)] fn main() { let mut diceNotation = String::new(); println!("Please enter correct dice notation. (Ex: 4d12)"); io::stdin().read_line(&mut diceNotation).expect("Couldn't read line"); if diceNotation.contains("d") { l...
true
3b7ff4372c7433e7f881013fbc50fc45bd22246c
Rust
geext-dk/improc-petrsu-gtk
/src/gtk_ui/app_state.rs
UTF-8
4,110
2.640625
3
[]
no_license
// app_state.rs - Struct with application widgets and state // Copyright (C) 2019 Denis Karpovskiy // // This program 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 // (a...
true
1fe749b4a9703ce3cf44ac9828c8fb167842c63e
Rust
davidszotten/advent-of-code-2020
/src/bin/day13.rs
UTF-8
2,513
3.25
3
[]
no_license
use anyhow::{anyhow, Result}; use aoc2020::dispatch; use aoc2020::mod_arith::mod_div; fn main() -> Result<()> { dispatch(part1, part2) } fn parse(input: &str) -> Result<(i64, Vec<i64>)> { let mut lines = input.split('\n'); let earliest = lines.next().ok_or(anyhow!("too few lines"))?.parse()?; let bus_...
true
1a422203914b4cf12094a829a33b9f27ff5da0c3
Rust
caputomarcos/black-hat-rust
/ch_12/shellcode/hello_world/src/main.rs
UTF-8
2,682
2.515625
3
[]
no_license
#![no_std] #![no_main] #![feature(asm)] #[panic_handler] fn panic(_: &core::panic::PanicInfo) -> ! { loop {} } #[cfg(target_arch = "x86_64")] const SYS_WRITE: u64 = 1; #[cfg(target_arch = "x86_64")] const SYS_EXIT: u64 = 60; #[cfg(target_arch = "aarch64")] const SYS_WRITE: u64 = 64; #[cfg(target_arch = "aarch64"...
true
d2b34dc4a780d7ba25b6418fa233f6a398056bf8
Rust
andrensegura/projects
/rust/dragoninja/chat_index/src/main.rs
UTF-8
580
2.96875
3
[]
no_license
use std::io::prelude::*; use std::fs::File; use std::error::Error; fn main() { try_main().unwrap(); } fn try_main() -> Result<(), Box<Error>>{ println!("Content-type: text/html; charset=iso-8859-1\n"); //header stuff try!(print_file("/home/andre/domains/drago.ninja/header.html")); //body stuff ...
true
7bc0c5ebcf2caabff6d79cfede5c126767d1f8fb
Rust
tinaun/mastodon-rs
/src/mastodon.rs
UTF-8
6,016
2.859375
3
[ "MIT" ]
permissive
use std::env; use std::io::Read; use hyper::Client; use hyper::net::HttpsConnector; use hyper::client::response::Response; use hyper::header::{self, Authorization, Bearer}; use hyper_native_tls::NativeTlsClient; use serde_json; use entities::*; use errors::*; macro_rules! parse_response { ($reader:ident) => { {...
true
fd0f193804b8b32d33dfcc1eb131a016a22c7887
Rust
dirvine/bn
/benches/api.rs
UTF-8
6,053
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
#![feature(test)] extern crate test; extern crate rand; extern crate bn; extern crate bincode; use bn::*; use bincode::SizeLimit::Infinite; use bincode::rustc_serialize::{encode, decode}; #[bench] fn g1_deserialization(b: &mut test::Bencher) { const SAMPLES: usize = 1000; let rng = &mut rand::thread_rng(); ...
true
78c6c2f953e41826115c48b95927fe016cc52c9f
Rust
yskszk63/chrome-remote-interface-rs
/src/browser.rs
UTF-8
7,275
2.765625
3
[ "MIT", "Apache-2.0" ]
permissive
use std::env; use std::io; use std::path::{Path, PathBuf}; use std::time::SystemTime; use dirs::home_dir; use tempfile::TempDir; use tokio::fs::{create_dir_all, metadata}; use which::which; use crate::process::{Process, ProcessBuilder, ProcessStdio}; /// Operate browser error. #[derive(Debug, thiserror::Error)] pub ...
true
084cb8dc7f1287e493ae6a402f678ee5bcaf84e7
Rust
nushell/nushell
/crates/nu-command/tests/commands/any.rs
UTF-8
2,301
2.90625
3
[ "MIT" ]
permissive
use nu_test_support::{nu, pipeline}; #[test] fn checks_any_row_is_true() { let actual = nu!(pipeline( r#" echo [ "Ecuador", "USA", "New Zealand" ] | any {|it| $it == "New Zealand" } "# )); assert_eq!(actual.out, "true"); } #[test] fn checks_any_column_of_a_table_i...
true
624fe11b7bd7ae8f33f41d44661ef0f42f269f86
Rust
Masterchef365/iced
/glow/src/widget/progress_bar.rs
UTF-8
446
2.625
3
[ "MIT" ]
permissive
//! Allow your users to perform actions by pressing a button. //! //! A [`Button`] has some local [`State`]. //! //! [`Button`]: type.Button.html //! [`State`]: struct.State.html use crate::Renderer; pub use iced_graphics::progress_bar::{Style, StyleSheet}; /// A bar that displays progress. /// /// This is an alias o...
true
732aadbf1cb7986afcf6632f234711fe93ce8e42
Rust
Jack-Ansley/farnans-farming-game
/src/population.rs
UTF-8
2,328
3.140625
3
[ "MIT" ]
permissive
use crate::crop::Crop; use crate::tile::Tile; use crate::TILE_SIZE; //Struct used to combine tile and crop structs into one for easy storage into the vector pub struct CropTile<'a> { pub tile: Tile<'a>, pub crop: Crop<'a>, } impl<'a> CropTile<'a> { pub fn new(tile: Tile<'a>, crop: Crop<'a>) -> CropTile<'a...
true
6f358d6d88a8dff569288a58035fefc86220d485
Rust
viktorfrom/rtic_f4xx_nucleo
/examples/timing_resources.rs
UTF-8
9,913
2.671875
3
[]
no_license
//! examples/timing_resources.rs // #![deny(unsafe_code)] #![deny(warnings)] #![no_main] #![no_std] use cortex_m::{asm, peripheral::DWT}; use panic_halt as _; use stm32f4::stm32f411; #[rtic::app(device = stm32f411)] const APP: () = { struct Resources { dwt: DWT, #[init(0)] shared: u64, /...
true
6af7e6bfab45d8ca7b88784530e125188bca8ad4
Rust
seanmonstar/reqwest
/src/dns/trust_dns.rs
UTF-8
3,210
2.53125
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! DNS resolution via the [trust_dns_resolver](https://github.com/bluejekyll/trust-dns) crate use hyper::client::connect::dns::Name; use once_cell::sync::Lazy; use tokio::sync::Mutex; pub use trust_dns_resolver::config::{ResolverConfig, ResolverOpts}; use trust_dns_resolver::{ lookup_ip::LookupIpIntoIter, system_...
true
7d7c8b39e2b291d097e49a872128db03bd12c7c6
Rust
timando/rsip
/src/message/request.rs
UTF-8
5,865
3.1875
3
[ "MIT" ]
permissive
#[doc(hidden)] pub use tokenizer::Tokenizer; use crate::{ common::{ method::{self, Method}, uri::{self, Uri}, version::{self, Version}, }, headers::{header, Headers}, Error, SipMessage, }; use std::convert::{TryFrom, TryInto}; /// Request reprsents a SIP request message, which ...
true
678758a7214a5895719044c669b4e4edd5b472c2
Rust
ansable/genre_classification_in_rust
/src/eval.rs
UTF-8
5,710
3.203125
3
[]
no_license
// Course: Efficient Linear Algebra and Machine Learning // Assignment: Final Project // Authors: Anna Soboleva, Marko Ložajić // // Honor Code: We pledge that this program represents our own work. /// Module containing classifier evaluation metrics, namely precision, recall and F1 score. use std; use std::...
true
2a4787ccda7a3360d4f450382606ca37e781f8ad
Rust
NASLXTO/train
/rust/variables/src/main.rs
UTF-8
728
3.453125
3
[]
no_license
fn main() { let mut x = 5; println!("The value of x is :{}", x); x = 6; println!("The value of x is :{}", x); const MAX_POINTS: u32 = 100_000; println!("The value of MAX_POINTS is :{}", MAX_POINTS); let y = 5; let y = y+1; let y = y*2; println!("The value of y is :{}", y); ...
true
a2316389ffd75f55fd3538463372a785cbedb380
Rust
ShaswatPrabhat/rustProjects
/rectangle/src/main.rs
UTF-8
765
3.875
4
[]
no_license
#[derive(Debug)] struct Rectangle { width: u32, height: u32, } impl Rectangle { fn area(&self) -> u32 { println!("Rectangle info {:#?}", self); self.height * self.width } fn square(size: u32) -> Rectangle { Rectangle { width: size, height: size, ...
true
150c1e219a4c33748cc1842e085792ee85e72101
Rust
pema99/based
/src/asm.rs
UTF-8
1,728
3.0625
3
[]
no_license
use crate::compile::*; use crate::ast::*; use std::collections::HashMap; pub fn print_asm(blob: Blob) { let mut rev_label_map = HashMap::new(); for (label, val) in blob.labels { rev_label_map.insert(val, label); } for (idx, instr) in blob.instructions.iter().enumerate() { if rev_label_...
true
21d93701069a26d8faf839903ca9766a849d0b0e
Rust
IThawk/rust-project
/rust-master/src/test/ui/lint/lint-unused-mut-variables.rs
UTF-8
4,490
2.921875
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
// edition:2018 // Exercise the unused_mut attribute in some positive and negative cases #![deny(unused_mut)] #![feature(async_closure)] async fn baz_async( mut a: i32, //~^ ERROR: variable does not need to be mutable #[allow(unused_mut)] mut b: i32, ) {} fn baz( mut a: i32, //~^ ERROR: variable ...
true
aad1c70721488dd1abe60aca89fbb65b381b871f
Rust
ex1stgames/rokumon
/rokumon_wasm/src/lib.rs
UTF-8
2,307
2.78125
3
[ "MIT" ]
permissive
mod utils; use wasm_bindgen::prelude::*; use rokumon_core::ai::AlphaBetaAI; use rokumon_core::board::Layout; use rokumon_core::card::Deck; use rokumon_core::coord::Coord; use rokumon_core::game::{Game, GameMove, Rules}; use rokumon_core::play::Strategy; #[wasm_bindgen] pub struct Opts { enable_fight: bool, h...
true