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
65b6e6b7f5276d9548334f2af0a2e02ccf0e06c3
Rust
tdryer/immeta
/src/formats/gif.rs
UTF-8
22,302
2.953125
3
[ "MIT" ]
permissive
//! Metadata of GIF images. use std::io::{BufReader, Read, BufRead}; use std::borrow::Cow; use std::str; use byteorder::{ReadBytesExt, LittleEndian}; use types::{Result, Dimensions}; use traits::LoadableMetadata; use utils::{ReadExt, BufReadExt}; /// GIF file version number. #[derive(Copy, Clone, PartialEq, Eq, Deb...
true
c1b31a7c10d9d10175e52e3df949ef895c8b3f77
Rust
jiegec/rbl
/src/serial.rs
UTF-8
1,782
2.671875
3
[]
no_license
use core::fmt::{write, Arguments, Error, Write}; use device_tree::{util::SliceRead, Node}; use lazy_static::lazy_static; use spin::Mutex; use volatile::{ReadOnly, WriteOnly}; lazy_static! { static ref PRINT_MUTEX: Mutex<Option<&'static mut Serial16550>> = Mutex::new(None); } bitflags! { struct LineStatusRegis...
true
3ee2c00783eafec04f70cf70caf680f7360d0027
Rust
jotingen/rust-dungeoncrawler
/src/utils/mod.rs
UTF-8
6,410
3.546875
4
[]
no_license
use crossterm::terminal::{disable_raw_mode, enable_raw_mode}; use rand::Rng; use regex::Regex; use serde::{Deserialize, Serialize}; use std::fmt; use std::io::{self, stdin, stdout, Read, Write}; use unicode_segmentation::UnicodeSegmentation; ///Struct indicating a point on the game grid #[derive(Copy, Clone, Debug, De...
true
ab302dba6588ca14e496c2b9f0cb19ec87b2352a
Rust
beoboo/rustnes
/app/src/ram.rs
UTF-8
1,288
2.828125
3
[]
no_license
use iced::{Color, Column, Row}; use rustnes_lib::nes::Nes; use rustnes_lib::types::{Byte, Word}; // use log::trace; use crate::helpers::{byte_to_string, text, word_to_string}; #[derive(Debug, Clone, Default)] pub struct Ram {} impl Ram { pub fn view<'a, Message: 'a>(&mut self, nes: &'a Nes) -> Column<'a, Message>...
true
8ee227eb1920c11c735950ca063523274961b3f0
Rust
Canop/broot
/src/pattern/search_mode.rs
UTF-8
9,165
3.09375
3
[ "MIT" ]
permissive
use { crate::{ app::AppContext, errors::{ConfError, PatternError}, }, fnv::FnvHashMap, lazy_regex::regex_is_match, std::convert::TryFrom, }; /// where to search #[derive(Debug, Clone, Copy, PartialEq)] pub enum SearchObject { Name, Path, Content, } /// how to search #[d...
true
715a387dfbfb08c914fde1322514528c4a10d5f5
Rust
qkunzh/byo-linker
/src/main.rs
UTF-8
1,164
3.09375
3
[]
no_license
use std::fs::File; use std::io::Read; use std::path::PathBuf; use structopt::StructOpt; use ld_rs::elf::ElfFile64; use ld_rs::link; #[derive(StructOpt, Debug)] #[structopt(name = "basic")] struct Opt { #[structopt(name = "FILE", parse(from_os_str))] filenames: Vec<PathBuf>, } fn generic_error(action: &str) -...
true
de41cf6ff645b7904ba553bc492d1088d48c97d4
Rust
jinjagit/Rust
/sine/src/main.rs
UTF-8
713
3.5
4
[]
no_license
use std::time::Instant; fn main() { let start = Instant::now(); let x: f32 = sine_series(10000000); println!("x = {}", x); let elapsed = start.elapsed(); println!("{:?} ms", elapsed.as_millis()); } fn sine_series(n: i32) -> f32 { let mut counter = 1; let stop = n + 1; let mut result:...
true
15732c9abf53de6d2e52504e9f64161386bccd2a
Rust
domfoy/connect-four
/src/board/inner.rs
UTF-8
2,057
3.25
3
[]
no_license
use std::cmp; use super::{ Board, BOARD_HEIGHT, BOARD_WIDTH, LINE_LENGTH }; use ::cell::Cell; #[derive(Debug)] enum LineType { Vertical, Horizontal, Diagonal1, Diagonal2 } use self::LineType::*; impl Board { pub (in super) fn check_horizontal(&self, i: usize, j: usize) -> bool { self.check_stra...
true
43d10002f9ecae5186ce9a95f0921711b7d28607
Rust
BlinfoldKing/pong-rs
/src/main.rs
UTF-8
5,477
3.109375
3
[]
no_license
extern crate piston; extern crate graphics; extern crate glutin_window; extern crate opengl_graphics; use piston::window::WindowSettings; use glutin_window::GlutinWindow as Window; use piston::event_loop::*; use piston::input::*; use opengl_graphics::{ GlGraphics, OpenGL }; struct Ball { position: [i32; 2], d...
true
63b02cf742d5ac52e4d264f0a5fb890aa347cbb5
Rust
mesalock-linux/rust-protobuf-sgx
/protobuf/src/reflect/field.rs
UTF-8
14,702
2.796875
3
[ "MIT" ]
permissive
use crate::core::Message; use crate::descriptor::field_descriptor_proto; use crate::descriptor::FieldDescriptorProto; use crate::json::json_name; use crate::reflect::accessor::map::MapFieldAccessorHolder; use crate::reflect::accessor::repeated::RepeatedFieldAccessorHolder; use crate::reflect::accessor::singular::Singul...
true
57d630bf09eb7760f16c0553e73cea431c3b8c7d
Rust
Endofunctor/tectonicdb
/src/lib/postprocessing/event.rs
UTF-8
3,890
2.96875
3
[ "MIT" ]
permissive
use std::collections::{BTreeMap}; use dtf::Update; type Time = u64; enum EventType { CancelEvent, TradeEvent, CreateEvent } #[derive(Debug)] struct Events { cancelled: BTreeMap<Time, Vec<Update>>, trades: BTreeMap<Time, Vec<Update>>, created: BTreeMap<Time, Vec<Update>> } impl<'a> From<&'a[Update]> ...
true
0c9e16effda2a86017a2662876ae5cc65f843109
Rust
IlgssonBraga/rust-studies
/types/src/booleans.rs
UTF-8
433
3.28125
3
[]
no_license
pub fn run() { let value1 = true; let value2: bool = false; if value1 || value2 { println!("Some value"); } if value1 && value2 { println!("Value 1 and value 2"); } if !value1 { println!("Value 1 is false"); } else { println!("Value 1 is true"); } ...
true
8b7000575016a313d19f6b3f1204dc638f59afe9
Rust
optozorax/fopply
/src/utils/apply.rs
UTF-8
1,137
3.046875
3
[]
no_license
use std::ops::{Deref, DerefMut}; pub trait Apply { fn apply<F, R>(self, f: F) -> R where Self: Sized, F: FnOnce(Self) -> R, { f(self) } fn apply_ref<'a, F, R>(&'a self, f: F) -> R where F: FnOnce(&'a Self) -> R { f(self) } fn apply_mut<'a, F, R>(&'a mut self, f: F) -> R where Self: Deref, F: FnO...
true
d7d8d61b1672765997c5b97bdce0bd27b4c5ee2b
Rust
isgasho/fluvio
/cli/src/topic/helpers/proc_list_kf.rs
UTF-8
3,131
2.96875
3
[ "Apache-2.0" ]
permissive
//! //! # Kafka - List Topic Processing //! //! Communicates with Kafka Controller to retrieve all Topics //! use std::net::SocketAddr; use serde::Serialize; use prettytable::Row; use prettytable::row; use prettytable::cell; use crate::error::CliError; use crate::common::OutputType; use crate::common::{EncoderOutput...
true
19b82cbd3c568b356e8f33b6c26f4fe3faeec98a
Rust
leo60228/upd8r
/src/bin/debug.rs
UTF-8
458
2.578125
3
[]
no_license
use anyhow::Result; use upd8r::*; fn main() -> Result<()> { for media in MEDIA_LIST { println!("Checking for {} updates...", media); match check_for_update(media) { Ok(Some(upd8)) => { let upd8_str = upd8.to_string(); println!("{}", upd8_str); ...
true
55d873cce1db693f57028743de93e4e548c17cf9
Rust
cwilkes/wasm-blur
/src/lib.rs
UTF-8
2,724
2.796875
3
[]
no_license
use wasm_bindgen::prelude::*; use web_sys::console; use std::format; // use js_sys::buffer; use fastblur::gaussian_blur; #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; const IMAGE_SIZE_WIDTH: usize = 640; const IMAGE_SIZE_HEIGHT: usize = 426; // tim...
true
5db6f5b849e88a24dc25532363f7730315c7f72a
Rust
adarqui/small-bites
/rust/misc/closure.rs
UTF-8
112
2.953125
3
[]
no_license
fn f(f: &fn(int)) { f(10) } fn main() { do f |i| { assert!(i == 10) } do f |i| { assert!(i != 10) } }
true
61b98b77ba1b1d6b865616cebafebfd969e0d953
Rust
Arsen-chechen/vk_api
/src/lib.rs
UTF-8
5,034
3.15625
3
[]
no_license
extern crate reqwest; extern crate serde_json; use std::string::ToString; extern crate serde; pub mod long_polling; pub mod response; pub use response::Response; use response::error::ResponseError as RE; /* Черта была создана для того, чтобы удобно создавать Vec<(String, String)>. функция heh.put(1, 2) это удобная з...
true
cd92975dbee4a54719fe8f4abe20d48fc30ca3b8
Rust
Xudong-Huang/may
/src/pool.rs
UTF-8
1,685
2.875
3
[ "MIT", "Apache-2.0" ]
permissive
use std::sync::atomic::{AtomicUsize, Ordering}; use crate::config::config; use crate::coroutine_impl::CoroutineImpl; use crossbeam::queue::SegQueue; use generator::Gn; /// the raw coroutine pool, with stack and register prepared /// you need to tack care of the local storage pub struct CoroutinePool { // the pool...
true
0a34b543beb50e8f37c434b13f037f217b3f429e
Rust
garious/loom
/src/bin/loom.rs
UTF-8
4,077
2.625
3
[ "Apache-2.0" ]
permissive
extern crate data_encoding; extern crate getopts; extern crate loom; extern crate rpassword; use getopts::Options; use std::env; use std::string::String; use data_encoding::BASE32HEX_NOPAD; use loom::wallet::{EncryptedWallet, Wallet}; use loom::data; use loom::net; use loom::result::Result; struct Cfg { host: Str...
true
932188f43729183a66a7b6e0de14e0aff36c7264
Rust
MisterPeModder/AdventOfCode2019
/src/day10.rs
UTF-8
2,953
3.171875
3
[ "MIT" ]
permissive
use itertools::Itertools; use std::collections::HashMap; use std::hash::{Hash, Hasher}; use std::ops::*; pub struct Grid { size: u32, grid: Vec<bool>, } #[derive(Debug, Copy, Clone)] struct OrderedFloat(ordered_float::OrderedFloat<f64>); impl Hash for OrderedFloat { fn hash<H>(&self, state: &mut H) ...
true
a6cf0a3f4a097e1c45cc8aa649fa87e1e635ef9f
Rust
Yelp/casper
/casper-server/src/lua/metrics.rs
UTF-8
1,663
2.53125
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
use mlua::{Lua, Result, Table, UserData, UserDataMethods, Value}; use opentelemetry::metrics::Counter; use opentelemetry::{Context, KeyValue}; struct U64Counter(Counter<u64>); impl UserData for U64Counter { fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) { methods.add_method( ...
true
5d93fd12a15d0fd75b5f355153bf24d967e7c1d0
Rust
glepur/exercism-rust
/easy/matching-brackets/src/lib.rs
UTF-8
519
3.3125
3
[ "MIT" ]
permissive
use std::collections::HashMap; pub fn brackets_are_balanced(string: &str) -> bool { string.chars().fold(Vec::new(), |mut v, c| { if is_closing(&v, &c) { v.pop(); } else if "{}[]()".contains(c) { v.push(c); } v }).len() == 0 } fn is_closing(v: &Vec::<char>, c: &char) -> bool { let ma...
true
31f08dc6b1a3c70bed84bfce70794567a99f284a
Rust
jaemk/misc
/daily_programmer/uuencoding/rust_uuen/tests/uuen.rs
UTF-8
1,470
2.796875
3
[]
no_license
extern crate uuen; #[test] fn working() { assert_eq!(9, 9); } #[test] fn encodes() { let content = "Cat"; let output = vec![(3u32, "0V%T".to_string())]; assert_eq!(uuen::encode_content(content), output); } #[test] fn encodes_format() { let content = "Cat"; let output = "\ begin 644 cat.txt #0...
true
8a9eae39066b5bf8019b1077d6b22fe0499f61cb
Rust
obscuraa/leetcode_rust
/src/kids_with_the_greatest_number_of_candies.rs
UTF-8
413
3.375
3
[]
no_license
//1431 Kids With the Greatest Number of Candies pub fn kids_with_candies(candies: Vec<i32>, extra_candies: i32) -> Vec<bool> { let mut v = Vec::new(); let elements = candies.iter().max().unwrap(); for candy in 0..candies.len() { if candies[candy] + extra_candies >= *elements { ...
true
1e6d8613509208deb5331f5216c675997de83738
Rust
rapilab/jvm.rust
/src/rtda/thread.rs
UTF-8
3,387
2.875
3
[]
no_license
use crate::instructions::decoder::{decoder, Decode}; use crate::rtda::frame::Frame; use crate::rtda::heap::j_method::JMethod; use crate::rtda::heap::runtime::Runtime; use crate::rtda::jvm_stack::JVMStack; use std::borrow::Borrow; use std::sync::{Mutex, Arc}; use crate::rtda::shim_method::{new_shim_frame}; use std::cell...
true
dbd1e30c1ff186469cefc7fcd10c70ce71fdfc65
Rust
BNationsDEV/Oxygengine
/oxygengine-composite-renderer/src/mesh_animation_asset_protocol.rs
UTF-8
5,373
2.578125
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use anims::phase::Phase; use core::{ assets::protocol::{AssetLoadResult, AssetProtocol}, Ignite, Scalar, }; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, str::from_utf8}; #[derive(Ignite, Debug, Clone, Serialize, Deserialize)] pub struct MeshAnimationSequence { #[serde(default)] ...
true
75be33401d372d2df8ac3977daf40d38cc0c0547
Rust
ischeinkman/tmpas
/src/plugins/builtins/freedesktop/searching.rs
UTF-8
2,128
2.8125
3
[ "MIT" ]
permissive
use crate::utils::EitherOps; use std::fs; use std::io; use std::iter; use std::path::{Path, PathBuf}; use std::{env, ffi::OsStr}; #[allow(dead_code)] pub fn xdg_desktop_files() -> impl Iterator<Item = Result<PathBuf, io::Error>> { let base_data_dirs = xdg_data_homes().chain(xdg_data_dirs()); let application_d...
true
f23a42b107dd914b419c7cf17f20ad6c5f4db61c
Rust
Hoyt-Systems-Texas/HoytSys.Rust_Common
/a19_core/src/js.rs
UTF-8
396
2.765625
3
[]
no_license
//! Contains helpers for working with JavaScript. use rand::{thread_rng, RngCore}; /// The maximum integer in javascript is 2^54. const JS_MAX_INT_MASK: u64 = 0b00011111_11111111_11111111_11111111_11111111_11111111_11111111; /// Used to get the next javascript random number generator. pub fn next_js_rand() -> u64 { ...
true
860d3fc2774b07727aefe99d28f77eb20e5bc746
Rust
KordonDev/perfect-relay-race
/wasm/src/lib.rs
UTF-8
3,470
2.765625
3
[ "Apache-2.0", "MIT" ]
permissive
mod utils; use wasm_bindgen::prelude::*; #[macro_use] extern crate serde_derive; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; extern crate web_sys; // A macro t...
true
e35bd9695e72540ec4d2abc61fa7933cc80e1806
Rust
ehuss/raytracer
/src/output/gui.rs
UTF-8
3,424
2.9375
3
[]
no_license
use minifb::{Window, WindowOptions, Key, KeyRepeat}; use super::*; pub struct GuiOutput { settings: OutputSettings, window: Window, buffer: Vec<u32>, } impl GuiOutput { pub fn new(settings: &OutputSettings, scene: &Scene) -> Result<GuiOutput> { let window = Window::new("Raytracer - ESC to exit...
true
435a4c76e30460395bf0622ae6d0eaeb95f80363
Rust
CaulyKan/leetcode
/和为s的连续正数序列/src/lib.rs
UTF-8
945
2.875
3
[]
no_license
impl Solution { pub fn find_continuous_sequence(target: i32) -> Vec<Vec<i32>> { let mut result = Vec::new(); for n in (2..target).rev() { if n % 2 == 0 { if (target as f64 / n as f64).fract() == 0.5 { let mid = target / n; le...
true
70d7a1cd687f2cf6d02e0f6a4a7423b046d7ade5
Rust
Lokathor/fermium
/src/keyboard.rs
UTF-8
4,587
2.8125
3
[]
no_license
//! Interactions with the keyboard. use crate::{ c_char, c_int, keycode::*, rect::*, scancode::*, stdinc::*, video::*, }; /// SDL uses this for key events. /// /// Key events are for raw key events. For translated textual input you want the /// "text input" events instead. #[derive(Debug, Clone, Copy, Default, Part...
true
8e2016e512e85c7271a20288812006fe8fecde00
Rust
sfackler/rust-postgres-derive
/src/overrides.rs
UTF-8
1,466
3
3
[ "MIT", "Apache-2.0" ]
permissive
use syn::{Attribute, Meta, NestedMeta, Lit}; pub struct Overrides { pub name: Option<String>, } impl Overrides { pub fn extract(attrs: &[Attribute]) -> Result<Overrides, String> { let mut overrides = Overrides { name: None, }; for attr in attrs { let attr = mat...
true
1038883e579bac04d4ce0b6579c53e46ede99c25
Rust
RCasatta/firma
/lib/src/offline/restore.rs
UTF-8
4,441
3.03125
3
[ "MIT" ]
permissive
use crate::mnemonic::Mnemonic; use crate::Result; use crate::{MasterSecret, OfflineContext}; use bitcoin::util::bip32::ExtendedPrivKey; use serde::{Deserialize, Serialize}; use std::io; use std::str::FromStr; use structopt::StructOpt; /// Restore a master key from the secret component #[derive(StructOpt, Debug, Deseri...
true
8010c39823f8c7686ce2f0d3f1be0b6d3a8568f3
Rust
ECJ222/the-year-of-the-rustacean
/grep-lite/src/main.rs
UTF-8
640
3.015625
3
[ "MIT" ]
permissive
#![allow(unused)] extern crate regex; use std::io; use regex::Regex; fn main() { let mut word = String::new(); let text = io::stdin().read_line(&mut word).expect("Failed to read line"); let re = Regex::new(word.trim()).unwrap(); let quote = "Every face, every shop, bedroom window, public-house, and ...
true
3fb1dad115225fbcc5af6d297608c1d39ae4d23b
Rust
Irchh/piston_test_game
/src/render.rs
UTF-8
1,283
2.71875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate::App; use piston::RenderArgs; use graphics::{rectangle,Transformed}; use piston_window::PistonWindow; use piston_window::G2dTexture as Texture; pub struct PlayerAnimation { pub stand: Texture, pub walk1: Texture, pub walk2: Texture, pub walk3: Texture, pub jump: Texture, pub land: Tex...
true
e27f6e65cb0cdbc047827224f9e2008594a64e3a
Rust
sequenceplanner/r2r
/r2r/examples/parameters.rs
UTF-8
2,132
2.828125
3
[ "Apache-2.0", "MIT" ]
permissive
use futures::executor::LocalPool; use futures::prelude::*; use futures::task::LocalSpawnExt; // try to run like this // cargo run --example parameters -- --ros-args -p key1:=[hello,world] -p key2:=5.5 -r __ns:=/demo -r __node:=my_node // then run // ros2 param get /demo/my_node key2 # (should return 5.5) // ros2 param...
true
eb2b678e8e97ab5145fa5a14af776007557a1f7f
Rust
mokeshi3/study_raytracer
/src/hittable_list.rs
UTF-8
954
2.984375
3
[]
no_license
use crate::hit::{Hittable, HitRecord}; use crate::ray::Ray; struct HittableList<'a> { objects: Vec<&'a dyn Hittable>, } #[allow(dead_code)] impl<'a> HittableList<'a> { fn new() -> Self { Self { objects: Vec::new(), } } fn add<T: Hittable>(&mut self, object: &'a T) { ...
true
751f4d0172a7ac9fb5b36f6b6fce25f59ca55808
Rust
calixteman/rust-cpp-parser
/src/parser/attributes.rs
UTF-8
13,275
2.546875
3
[ "MIT", "Apache-2.0" ]
permissive
// 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 those terms. use std::hash::{Hash, Has...
true
a5345c25d7f9e47f9ba1e2873833a6124ae214d2
Rust
bbradshaw/codeadvent
/2017/codeday16/src/main.rs
UTF-8
2,701
3.375
3
[]
no_license
use std::str::FromStr; use std::fs::File; use std::io::Read; enum DanceMove { Spin(usize), Exchange(usize, usize), Partner(char, char) } #[derive(Debug)] struct DanceParseError { desc : String } impl FromStr for DanceMove { type Err = DanceParseError; fn from_str(s: &str) -> Result<Self, Self:...
true
63cb53c4145cce2ac95b5556e8bb846623abfa5d
Rust
knokko/bit-encoding-rs
/src/source/mod.rs
UTF-8
3,186
3.6875
4
[]
no_license
mod bool_slice; mod u8_slice; mod errors; pub use bool_slice::*; pub use u8_slice::*; pub use errors::*; /// A type from which bools can be read. /// /// Typical implementations would read bools from a Vec of bools or binary /// integers, but other implementations might read them from a file or socket /// connection....
true
53f9a55f108759249f1a44a7466f31869fb62e24
Rust
legends2k/advent-of-code
/2018/day_07/src/main.rs
UTF-8
7,131
3.140625
3
[ "Unlicense" ]
permissive
use std::error::Error; use std::io::{self, BufRead}; #[derive(Debug, PartialEq, Copy, Clone)] enum Status { Uninitialized, Waiting, Running, Complete, } #[derive(Debug)] struct Task { status: Status, awaiting: u8, // Inversion of control: dependants instead of dependencies // https://en.wikipedia.org/...
true
8e853ec45c976f1fdb09079d216bf0d807f7be2b
Rust
echochamber/rust_adventure_game
/src/area.rs
UTF-8
343
2.78125
3
[]
no_license
use location::Location; use std::collections::HashMap; #[derive(Clone)] pub struct Area { pub locations: HashMap<Location, GameCell> } impl Area { pub fn new() -> Area { Area { locations: HashMap::new() } } } #[derive(Copy, Eq, PartialEq, Clone, Hash, PartialOrd, Ord, Debug)] pub struct Gam...
true
d8b48f15a0203b869dbfc138537d7ad7090e5fbf
Rust
Riey/turi
/src/event.rs
UTF-8
1,307
2.78125
3
[ "MIT" ]
permissive
use crate::vec2::Vec2; pub trait MouseEventLike: Sized { fn try_left_down(&self) -> Option<Vec2>; fn try_left_up(&self) -> Option<Vec2>; fn try_drag(&self) -> Option<Vec2>; fn try_scroll_up(&self) -> Option<Vec2>; fn try_scroll_down(&self) -> Option<Vec2>; fn pos(&self) -> Vec2; fn map_pos(...
true
d4547e446ff9ff354e3b51e30b4bfa03a498fc55
Rust
qdequele/paxos-rs
/src/config.rs
UTF-8
3,419
3.078125
3
[ "MIT" ]
permissive
use rand::prelude::{thread_rng, SmallRng, Rng, SeedableRng}; use std::collections::hash_map; use std::collections::HashMap; use std::fmt; use std::net::SocketAddr; /// A `NodeId` is a unique value that identifies a node /// within the configuration. pub type NodeId = u32; /// Configuration holds the state of the memb...
true
d4ea153128e9503b7b44630e6f9020dc79f8a454
Rust
umurgdk/tiny
/src/tui/msg_area/mod.rs
UTF-8
4,460
3.125
3
[ "MIT" ]
permissive
pub mod line; use std::cmp::{max, min}; use std::mem; use std::str; use termbox_simple::Termbox; use config::Colors; pub use self::line::Line; pub use self::line::SegStyle; pub struct MsgArea { lines : Vec<Line>, // Rendering related width : i32, height : i32, /// Vertical scr...
true
77ba6dcd75dbc4445674a32a3edb5782593ab407
Rust
IThawk/rust-project
/rust-master/src/test/ui/issues/issue-47706.rs
UTF-8
484
3.3125
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
pub struct Foo { foo: Option<i32>, } impl Foo { pub fn new(foo: Option<i32>, _: ()) -> Foo { Foo { foo } } pub fn map(self) -> Option<Foo> { self.foo.map(Foo::new) } //~^^ ERROR function is expected to take 1 argument, but it takes 2 arguments [E0593] } enum Qux { Bar(i32)...
true
e274b489510a9fcacd6d162da77fa4a91adb19a2
Rust
jimrain/amy_and_the_geeks
/src/main.rs
UTF-8
13,011
2.6875
3
[]
no_license
//! Default Compute@Edge template program. use fastly::http::{header, HeaderValue, Method, StatusCode}; use fastly::{mime, Dictionary, Error, Request, Response}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; /// The name of a backend server associated with this service. /// /// This should be ch...
true
89d34fd2030e5f5086cd726486a72dffa4da260b
Rust
crlf0710/singleton-rs
/src/singleton.rs
UTF-8
5,379
3.4375
3
[ "MIT" ]
permissive
use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; use std::ptr::null_mut; use std::mem::drop; #[repr(usize)] enum SingletonState { Initial = 0, Loading = 1, Ready = 2, Finalized = 3, } /// A pointer type for holding shared global state in multi-thread environment. pub struct Singleton<T: Send...
true
65e0d967061acfea766efa4f8c3e461845491586
Rust
apache/incubator-teaclave-sgx-sdk
/sgx_tstd/src/io/cursor.rs
UTF-8
17,278
3.34375
3
[ "Apache-2.0", "BSD-3-Clause", "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
5af85df20d2373f85faa87307a7aaa91400e2102
Rust
msgflo/msgflo-rust
/examples/repeat.rs
UTF-8
681
2.609375
3
[ "MIT" ]
permissive
extern crate msgflo; use msgflo::participant::{Participant, InfoBuilder, Info}; struct Repeat { state: Option<String>, // we don't really have any state } impl Participant for Repeat { fn info(&self) -> Info { InfoBuilder::new("rust/Repeat").label("Repeats input as-is") .inport("in") ...
true
1684ed3f5c1ffb945ac0e08d7120c37ab6fd7c27
Rust
tiger1710/didactic-octo-funicular
/source/rust-code/acmicpc/2700/2751.rs
UTF-8
536
3.1875
3
[]
no_license
use std::io; use std::fmt::Write; fn main() { let mut n = String::new(); let mut output = String::new(); io::stdin().read_line(&mut n).unwrap(); // scanf let mut nums: Vec<u16> = Vec::new(); let n = n.trim().parse().unwrap(); for _i in 0..n { let mut num = String::new(); io::s...
true
6ebd9b71579321ea09671ced469ef3872c16ca00
Rust
isgasho/dotao
/file-tree/src/iter.rs
UTF-8
15,277
3.734375
4
[ "BSD-3-Clause" ]
permissive
use std::{ collections::VecDeque as Deque, ffi::OsStr, path::{Path, PathBuf}, }; use crate::file_tree::FileTree; /// An iterator that runs recursively over `FileTree` structure. #[derive(Debug, Clone)] pub struct FilesIter<'a, T> { // Pop from the front, push to front or back, it depends // Cause ...
true
6f7799d51555b3654883bab73875b5677a6937bd
Rust
RensAlthuis/AsciiMapMaker
/src/map/mod.rs
UTF-8
2,166
3.15625
3
[]
no_license
pub mod window; pub mod parser; pub use window::Window; use crate::graphics::Token; use byteorder::{ByteOrder, LittleEndian}; use byteorder::ReadBytesExt; use std::io::prelude::*; use std::cell::RefCell; use std::{ops::Deref, rc::Rc}; pub struct Map{ pub tiles : RefCell<Vec<Token>>, pub width : usize, pu...
true
11088f6aba209894959bd06d9db11a45c020dc8d
Rust
GeorgeLS/bitbucket-rs
/tests/resource_tests/repository.rs
UTF-8
2,906
2.59375
3
[]
no_license
#![allow(unused_imports)] use crate::common; use bitbucket_rs::models::{get::BitbucketErrors, post}; use httpmock::{ Method::{DELETE, GET, POST, PUT}, MockServer, }; fn get_repo() -> &'static str { r#" { "slug": "my-repo", "id": 1, "name": "My repo", "scmId": "git", ...
true
1d31d66c5382186beb4f3a79a17073ea51c163b0
Rust
efugier/d-robots
/robot/src/app.rs
UTF-8
4,697
2.796875
3
[]
no_license
use std::collections::HashSet; use std::fs::{File, OpenOptions}; use std::io::Write; use std::path::PathBuf; use std::sync::mpsc; use log; use crate::ai::AI; use crate::map::{Point, Position}; use crate::messages::{Msg, MsgContent::*, MsgId}; use crate::robot::{self, Robot}; pub type AppId = u32; use crate::events:...
true
e065803a7d09e3cfca419e4ed76f49436339d446
Rust
theonejb/advent-of-code-20
/day1/src/main.rs
UTF-8
1,175
3.484375
3
[ "MIT" ]
permissive
use std::fs::File; use std::path::Path; use std::io::{BufReader, BufRead}; fn get_input() -> Vec<i32> { let input_path = Path::new("input.txt"); let f = match File::open(input_path) { Err(why) => panic!("could not open {}: {}", input_path.display(), why), Ok(file) => file }; let lines ...
true
352d1968c6b485ae699d8b4bc8dc6349d4613dd0
Rust
johnstonskj/rust-aws-iam
/src/offline/variables.rs
UTF-8
4,524
3.296875
3
[ "MIT" ]
permissive
use crate::model::{ConditionValue, QString}; use crate::offline::request::Environment; use crate::offline::EvaluationError; use regex::Regex; use std::str::FromStr; // ------------------------------------------------------------------------------------------------ // Public Functions // -------------------------------...
true
fa52cdb897ccdb81e516d7efc613ea672e67b96e
Rust
mkjois/sandbox
/rust/bravo/src/main.rs
UTF-8
2,326
3.890625
4
[]
no_license
#![feature(rand,collections)] use std::str; use std::rand; use OptionalInt::Value; use OptionalInt::Missing; fn main() { // more strings let x: &[u8] = &[b'B', b'e', b'a', b's', b't', b' ', b'm', b'o', b'd', b'e']; let stack_str: &str = str::from_utf8(x).unwrap(); println!("stack_str is '{}'", stack_str); ...
true
87bd6c77d616730dacc1c7d497059474467622d9
Rust
hjr3/selecta-rs
/src/search.rs
UTF-8
8,462
3.359375
3
[ "MIT" ]
permissive
use config::Configuration; use score::score; use std::cmp::min; pub struct Search { config: Configuration, choices: Vec<String>, index: u64, query: String, done: bool, matches: Vec<String>, } impl Search { pub fn new(config: Configuration, choices: Vec<String>, index:...
true
fb75b32a2c37d23a142bd52652d477903c561a39
Rust
Cmdr3nder/advent-of-code-2017
/src/days/day_1.rs
UTF-8
1,446
3.515625
4
[ "MIT" ]
permissive
use util::files::read_file_to_string; pub fn main() { println!("-- Running Day 1 --"); let input = read_file_to_string("src/days/input/day_1.txt"); let checksum = next_char_checksum(&input); println!("Next Char based Checksum is {}", checksum); let checksum = half_around_checksum(&input); pri...
true
8d462cfd2feaab61e17c214f1f65e0640b99a89a
Rust
alegayndra/Compiladores
/Tarea 1/stack.rs
UTF-8
1,127
3.921875
4
[ "MIT" ]
permissive
pub const STACK_SIZE: usize = 500; pub struct Stack { values: [i32; STACK_SIZE], cant: usize } impl Stack { pub fn new(values: [i32; STACK_SIZE]) -> Stack { Stack { values: values, cant: 0 } } pub fn show_values(&self) { for n in 1..=self.cant { ...
true
9ca5bdd9bfa1d1941f00b3c037fa281649f93396
Rust
kenkoooo/programming-contest-solutions
/rust/src/bin/ddcc2017_qual_d.rs
UTF-8
1,863
3.15625
3
[]
no_license
use std::io; use std::str; use std::usize; use std::cmp; fn main() { let stone: u8 = "S".to_owned().into_bytes()[0]; let (h, w) = { let v = read_values::<usize>(); (v[0], v[1]) }; let (a, b) = { let v = read_values::<usize>(); (v[0], v[1]) }; let mut map = (0..h...
true
69c23f6a83ccb1af96a7ea3a8c80e0724904db32
Rust
tehAnswer/sport_monks
/src/ops/teams.rs
UTF-8
5,356
3.109375
3
[]
no_license
use super::super::errors::SportMonksError; use super::super::models::{Team,Wrapper}; use super::super::gateway::{Gateway,Options}; pub struct TeamGateway { gateway: Gateway } impl TeamGateway { pub fn new(gateway: Gateway) -> TeamGateway { TeamGateway { gateway } } pub fn find(&self, id:...
true
bbbacb7e7b9de6dbcbeac983313193acf4fa562b
Rust
yoshidaryou/test
/Str_to_Num.rs
UTF-8
479
3.3125
3
[]
no_license
fn main() { //let hoge = '\u{200B}'; let str1= "A"; let hoge = str1.as_bytes(); //文字列をバイト列 [65]に変換する println!("{:0b}",hoge[0]); let str2 = "A".as_bytes()[0]; println!("{}",format!("{:b}", str2)); //数値をN進数のStringに変換する format!() let huga:String = format!("{:b}", str2); let num:i32=huga.parse().unwrap(); //数...
true
8169cd2ea449f444589c00db0375525324d58de6
Rust
lideen999/v_eval
/src/value.rs
UTF-8
8,481
3.578125
4
[ "MIT", "Apache-2.0" ]
permissive
use std::{ cmp::Ordering, convert::TryInto, fmt::{self, Display, Formatter}, ops::{Add, Div, Mul, Range, Rem, Sub}, }; #[derive(Clone, Debug)] /// Wrapper for value /// implements simple operations and check types /// /// #### Panic /// Panics if operate different value types pub enum Value { Bool(...
true
5434f4a26a6a3807d13dd362c8d51f1a2f21c59a
Rust
cosmo0920/fruently
/src/record.rs
UTF-8
2,275
3.125
3
[ "MIT" ]
permissive
//! Implement record manupulation mechanisms. use crate::dumpable::Dumpable; use serde::ser::SerializeTuple; use serde::ser::{Serialize, Serializer}; use serde_json; use time; use time::Tm; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Record<T: Serialize> { tag: String, time: Tm, record: T, } impl<T...
true
7ebc3aff587ec904833c011104b78ff53780b2d9
Rust
ndrsllwngr/aussieplusplus
/src/runtime/callable/function.rs
UTF-8
2,367
2.984375
3
[]
no_license
use std::{cell::RefCell, fmt::Display, rc::Rc}; use anyhow::Result; use crate::{ ast::FnDecl, runtime::{exit::ExitKind, Environment, Interpreter, Value}, }; use super::{AussieCallable, BuiltIn}; #[derive(Clone, PartialEq, Debug)] pub enum Function { UserDefined(Box<UserDefined>), BuiltIn(BuiltIn), }...
true
746feb41f64f57423158d6e07cb1d7adf443041c
Rust
damons-git/rusty-chain
/src/tx_struct.rs
UTF-8
13,685
3.234375
3
[]
no_license
use crate::util::{type_of, hash}; use crate::wallet_struct::{Wallet}; // Enum containing transaction type(s). #[derive(Debug, Copy, Clone, PartialEq)] pub enum TxType { Data = 0x00, Financial = 0x01 } // Generalised interface for Tx structs. pub trait Tx { // Convert full transaction to bin. fn to_bin...
true
81a530e5588aa44e005002990c0fec6dacb677a0
Rust
canndrew/malk-lexer
/src/lex.rs
UTF-8
13,175
2.828125
3
[]
no_license
use token::{Token, TokenKind}; use tokens::TokensBuf; use span::TextPos; use symbol_table::{InvalidSymbolTableError, validate_symbol_table}; use std::str::pattern::Pattern; use std::borrow::Cow; use std::char; use unicode_brackets::UnicodeBrackets; #[derive(Debug, Clone, PartialEq)] pub enum LexError<'s> { Invali...
true
51d9f414e80589371914495b2b39a5b8cb185bd6
Rust
OJFord/recfiles-rs
/recfiles/src/records.rs
UTF-8
2,695
3.296875
3
[]
no_license
use crate::descriptor::Descriptor; use serde::ser::SerializeSeq; use serde::Serialize; use serde::Serializer; pub trait Record: Serialize {} pub struct RecordSet<T: Record> { descriptor: Option<Descriptor>, records: Vec<T>, } impl<T: Record> Serialize for RecordSet<T> { fn serialize<S>(&self, serializer:...
true
aea771627ecfc43a10800aee18c20e52d1f0d48c
Rust
jcdyer/rust-scratch
/examples/intohash.rs
UTF-8
332
2.8125
3
[]
no_license
use std::collections::HashMap; use std::collections::hash_map::RandomState; use std::iter::FromIterator; fn main() { let pair_vec = vec![ (1, 2), (3, 4), (5u8, 6u16), ]; let hm: HashMap<u8, u16, RandomState> = HashMap::from_iter(pair_vec.into_iter()); println!("{}", hm.get(&5).u...
true
9a260b1fbc4996c56fcbbf5ae253063eec7510b6
Rust
norman784/gaiku
/examples/heightmap.rs
UTF-8
1,333
2.5625
3
[ "MIT", "Apache-2.0" ]
permissive
use std::time::Instant; use gaiku_baker_heightmap::HeightMapBaker; use gaiku_common::{ chunk::Chunk, mesh::Mesh, prelude::*, texture::{Texture2d, TextureAtlas2d}, Result, }; use gaiku_format_png::PNGReader; mod common; use crate::common::export; fn read(name: &str) -> Result<()> { let now = Instant::now...
true
b9cfa52a8459dd202f40f59b6b2405d613309681
Rust
Roxxik/rusteezee
/src/logic/chunks.rs
UTF-8
1,156
2.90625
3
[ "MIT" ]
permissive
use std::ops::{ Index, IndexMut }; use std::collections::HashMap; use cgmath::{ Point, Point3 }; use super::chunk::Chunk; pub type ChunkPos = Point3<i32>; #[derive(Debug)] pub struct Chunks { chunks: HashMap<ChunkPos, Chunk>, empty: Chunk, } impl Chunks { pub fn new() -> Chunks { Chunks { ...
true
fe800d92ff05d98597ff87e390803c7afe4d02dd
Rust
Alexherra/tk-pool
/src/uniform/sink.rs
UTF-8
3,481
2.578125
3
[ "MIT", "Apache-2.0" ]
permissive
use std::marker::PhantomData; use futures::{Future, Async, Sink, AsyncSink}; use uniform::{FutureOk, FutureErr}; use uniform::chan::{Action, Helper}; pub(in uniform) struct SinkFuture<S, E> where S: Sink, { sink: S, task: Helper<S::SinkItem>, phantom: PhantomData<*const E>, } impl<S: Sink, E> SinkF...
true
f04ae1785c9915fd6246dcc40e5325b205149495
Rust
spring-epfl/arti-tweaks
/tor-circmgr/src/path.rs
UTF-8
5,885
2.828125
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Code to construct paths through the Tor network //! //! TODO: I'm not sure this belongs in circmgr, but this is the best place //! I can think of for now. I'm also not sure this should be public. pub mod dirpath; pub mod exitpath; use tor_chanmgr::ChanMgr; use tor_linkspec::{ChanTarget, OwnedChanTarget, OwnedCir...
true
7d75c310d88f6a9b4db681bbcd2cc470a72d2694
Rust
fewensa/telegrambot
/src/types/update.rs
UTF-8
3,871
3.015625
3
[ "MIT" ]
permissive
use std::fmt; use serde::de::{Deserialize, Deserializer, Error, MapAccess, Visitor}; use serde_value::Value; use crate::types::callback_query::CallbackQuery; use crate::types::message::RawMessage; /// This object represents an incoming update. #[derive(Debug, Clone, PartialEq, PartialOrd)] pub struct Update { /// ...
true
0b6af864d6daa4171555c37e055eb23633104e02
Rust
dezuman/narm
/tests/test_branch.rs
UTF-8
18,088
2.734375
3
[ "MIT" ]
permissive
extern crate narm; mod common; use common::*; use narm::narmvm::*; /* Integration test for Branch operators Included varieties: B <label> T2 - Branch unconditionally by label, jump size restricted to signed 11 bits B<C> <label> T1 - Branch conditionally by label, jump size restricted to signed 8...
true
0bd84c637caa5af8e10163b28e3afc4519efaff4
Rust
Globidev/twitch-player
/twitchd/src/server/state/player_pool.rs
UTF-8
2,691
2.578125
3
[ "MIT" ]
permissive
use super::stream_player::{MetaKey, PlayerSink, StreamPlayer}; use crate::{ options::Options, prelude::{ http::{http_client, HttpsClient}, runtime, }, twitch::{ mpeg_ts::SegmentMetadata, types::{PlaylistInfo, Stream}, }, }; use std::{ collections::{hash_map::Entr...
true
e414a862ad1987da8a178fb33a56f09f560e471d
Rust
eldss-rustycises/rustycises
/rocket_urlshort/src/bin/backend.rs
UTF-8
1,974
2.75
3
[]
no_license
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; #[macro_use] extern crate rocket_contrib; #[macro_use] extern crate serde; use diesel::result::Error; use rocket::response::Redirect; use rocket_contrib::{databases::diesel, json::Json}; use rocket_urlshort::db::{self, models::*}; /// Wrap...
true
e5f4c9099b86c14cb7e9e1299e77e8ef6a278f20
Rust
isgasho/add-ed
/src/buffer/vecbuffer/mod.rs
UTF-8
10,347
3.015625
3
[]
no_license
use core::iter::Iterator; use super::*; use crate::error_consts::*; //#[test] //mod test; #[derive(Clone)] pub struct Line { tag: char, matched: bool, text: String, } pub struct VecBuffer { saved: bool, // Chars used for tagging. No tag equates to NULL in the char buffer: Vec<Line>, clipboard: Vec<Line...
true
bc694c4fdf605163edfa11e74497496322371ca9
Rust
cyderize/portmidi-rs
/src/pm/result.rs
UTF-8
1,107
3.125
3
[ "MIT" ]
permissive
//! Common structs for the result and error types use std::error::Error; use std::result::Result; /// The result type used in portmidi-rs pub type PortMidiResult<T> = Result<T, PortMidiError>; /// A PortMidi error #[deriving(Clone, Show)] pub enum PortMidiError { HostError(String), InvalidDeviceId, InsufficientMe...
true
464d31ec7793c3d674cc64497dab3f12257ec759
Rust
WisartArfun/Divisionaries
/src/web_server/utils/mod.rs
UTF-8
3,392
3.65625
4
[]
no_license
//! utils for working with files and http responses use log; use actix_web::{http, HttpResponse}; use crate::file_manager; /// takes a `Vec<u8>` and a mime type and turns them into an `HttpResponse` /// /// # Arguments /// /// * content: `Vec<u8>` - the content of the `HttpResponse` /// * mime: `&str` - the mime ty...
true
ce6c1092e55b2ac0549f1106c51f2f224452645a
Rust
danclive/sincere
/src/app/group.rs
UTF-8
6,755
3.34375
3
[ "MIT" ]
permissive
/// Route group use std::collections::HashMap; use super::context::Context; use super::middleware::Middleware; use super::route::Route; use crate::http::Method; // use hyper::Method; /// Route group /// /// # Examples /// /// ``` /// use sincere::App; /// use sincere::app::Group; /// /// let mut group = Group::new("...
true
7281e05ea4f082857aa7cd3a56834b7c5919d3fb
Rust
VengeQ/categorial
/src/lib.rs
UTF-8
591
2.984375
3
[]
no_license
//! Type classes and data types for Rust //! //! This crate provides type classes and data types for Rust Language //! //! # Organization //! This module is organized by next way: //! //! * type_classes are the traits ob standart type classes (Monoid, Functors, etc). //! * data_types are some kinds of data types. //! *...
true
8e4086c0d406cc347ebc7f440ab333f430e1f181
Rust
lensvol/adventofcode
/day1.rs
UTF-8
989
3.578125
4
[]
no_license
use std::io::{self, Read}; fn read_from_stdin() -> String { let mut buffer = String::new(); io::stdin().read_to_string(&mut buffer).unwrap(); buffer } fn day1(input: &String) -> (i32, Option<i32>) { let mut floor: i32 = 0; let mut position: i32 = 0; let mut basement_position: Option<i32> = Non...
true
a037530d212823f69a97e06909acb0b1fefe4d79
Rust
MurphyKyle/apex_dma_kvm_pub
/apex_dma/memflow_lib/memflow/src/error.rs
UTF-8
7,345
3.125
3
[ "MIT" ]
permissive
/*! Specialized `Error` and `Result` types for memflow. */ use std::prelude::v1::*; use std::{convert, fmt, result, str}; #[cfg(feature = "std")] use std::error; /// Specialized `Error` type for memflow errors. #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] pub enum Error { /// Generic error type containing ...
true
e49dce68e0f61de1f3e0016bede2e0b3b8360319
Rust
rustwasm/weedle
/src/dictionary.rs
UTF-8
877
2.953125
3
[ "MIT" ]
permissive
use crate::attribute::ExtendedAttributeList; use crate::common::{Default, Identifier}; use crate::types::Type; /// Parses dictionary members pub type DictionaryMembers<'a> = Vec<DictionaryMember<'a>>; ast_types! { /// Parses dictionary member `[attributes]? required? type identifier ( = default )?;` struct Di...
true
6e8a2ef4e732968138ff5825cb47ac033c667a02
Rust
a13x5/octopod
/examples/helm-based-control-scripts/src/bin/create.rs
UTF-8
6,345
2.84375
3
[]
no_license
use clap::{App, Arg}; use rand::{ distributions::{Alphanumeric, Distribution}, thread_rng, }; use std::convert::TryFrom; use std::convert::TryInto; use std::fs; use std::path::Path; use std::path::PathBuf; use std::process::{exit, Command}; static REGISTRY: &str = "typeable"; static IMAGE: &str = "octopod-web-...
true
63d41a42aeedf2984acfc08e7ad4f29a89d296b9
Rust
OSU-CS290-Sp18/final-project-jcn
/lib/providers/download/deluge/src/rencode/decoder.rs
UTF-8
7,310
2.96875
3
[]
no_license
use std::collections::{HashMap, VecDeque}; use super::constants::*; use super::{Float, Int, Object}; use bincode::config; pub struct Decoder { data: VecDeque<u8>, } impl Decoder { pub fn new(data: Vec<u8>) -> Decoder { Decoder { data: data.into() } } pub fn decode_next(&mut self) -> Option<...
true
4b0bd996155cb0125fe0a05be3707f84b8a4de07
Rust
rafacouto/rust-shapes_2d
/src/shapes_2d/mod.rs
UTF-8
1,740
3.34375
3
[]
no_license
pub mod area; use std::f64::consts::PI; /////////////////////////////////////////////////////////////////// #[derive(Debug)] pub struct Circle { pub radius: f64, } impl Circle { pub fn new(radius: f64) -> Circle { Circle { radius } } } /////////////////////////////////////...
true
89220743e4bc57461755f040a62ec2db2249ae10
Rust
hr6134/ctchi
/src/templates/parser.rs
UTF-8
11,416
2.8125
3
[ "BSD-3-Clause" ]
permissive
use crate::core::config::get_configuration; use std::fs; use regex::Regex; use std::collections::HashMap; use std::collections::hash_map::RandomState; #[derive(Clone)] pub enum Context { BooleanValue(bool), SingleValue(String), MultiValue(Vec<String>), } pub trait WithContent { fn get_content(&self, ...
true
180cfeab8fd0c1bbc63abe4a87b56d69a61c009d
Rust
seanmonstar/reqwest
/examples/form.rs
UTF-8
843
2.90625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// Short example of a POST request with form data. // // This is using the `tokio` runtime. You'll need the following dependency: // // `tokio = { version = "1", features = ["full"] }` #[cfg(not(target_arch = "wasm32"))] #[tokio::main] async fn main() { let response = reqwest::Client::new() .post("http://ww...
true
24467c32ce94232ce020da8b8b3adbdc098e60c0
Rust
panzertime/alexctf
/cat/src/main.rs
UTF-8
1,058
2.765625
3
[ "Apache-2.0" ]
permissive
extern crate image; extern crate rustc_serialize; use image::{ GenericImage, ImageBuffer, Pixel }; use std::fs::File; use std::path::Path; use std::env; use rustc_serialize::hex::FromHex; use std::str; /* So, we want to open the image from the stream (is possible? who knows?), then we want to decode from a PNG t...
true
2220a2084d1562f04cff5e78b2768b943c0ca5b2
Rust
pantsbuild/pants
/src/rust/engine/task_executor/src/lib.rs
UTF-8
12,992
2.640625
3
[ "Apache-2.0" ]
permissive
// Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). #![deny(warnings)] // Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to...
true
5dac4376307dcf5959b67bb13a076fff6210460a
Rust
fewensa/rtdlib
/src/types/chat_member_status.rs
UTF-8
23,791
2.828125
3
[ "MIT" ]
permissive
use crate::types::*; use crate::errors::*; use uuid::Uuid; use std::fmt::Debug; use serde::de::{Deserialize, Deserializer}; /// TRAIT | Provides information about the status of a member in a chat pub trait TDChatMemberStatus: Debug + RObject {} /// Provides information about the status of a member in a chat #[...
true
c9eb5b0d552714a9b7f12203a101c0d46a883899
Rust
GromskaStrela/DN10
/main.rs
UTF-8
2,949
3.5
4
[]
no_license
mod fns; fn main() { let mut _s = String::from("Hello"); let mut _w = String::from("world!"); //println!("{}", s); //change(&mut s); //println!("{}", s); let r1 = &_s; // multiple immutable references are allowed to exist let r2 = &_s; println!("{} {}", r1, r2); let r3 = &mut _s...
true
91a9c59f811379e06b707a12efadda8610554f84
Rust
nickbabcock/fast-brotli
/src/main.rs
UTF-8
2,611
2.765625
3
[]
no_license
use fastly::http::{header, Method, StatusCode}; use fastly::{Error, Request, Response}; use std::io::{Cursor, Write}; fn main() -> Result<(), Error> { let req = Request::from_client(); if req.get_method() != Method::POST { let resp = Response::from_status(StatusCode::METHOD_NOT_ALLOWED) .wi...
true
b8fa77bfeeffc8a3bcb0efdea3d6134396030620
Rust
clauswilke/sinab
/src/sinab/src/text.rs
UTF-8
1,780
3.140625
3
[ "Apache-2.0", "MIT" ]
permissive
/* use crate::fonts::{Em, Font, FontError, GlyphId}; use crate::primitives::Length; use std::sync::Arc; #[derive(Clone)] pub struct ShapedSegment { pub(crate) font: Arc<Font>, pub(crate) glyphs: Vec<GlyphId>, pub(crate) advance_width: Length<Em>, } pub struct ShapedSegmentState { glyphs: usize, ad...
true