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
62b980e19385f26be8a6df8e3aabc3aab5d3b3aa
Rust
insipx/rsa
/src/math.rs
UTF-8
3,679
3.1875
3
[]
no_license
//! Some General Math Helper Functions //! NOTE: Fermat and Rabin-Miller used for Primality testing may be found implementede within the 'ProbableVariant' enum inside primes/gen.rs //! These functions are not exposed as public-api because their use is strictly for generating large prime numbers //! These are generally ...
true
c58ca8ba6b80586891a942ed29b8e3e248bc23ad
Rust
Eroc33/modpack_tool
/src/curseforge/release_status.rs
UTF-8
1,295
3.21875
3
[]
no_license
use serde::{Deserialize,Serialize}; use std::str::FromStr; #[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)] pub enum ReleaseStatus { Release, Beta, Alpha, } #[derive(Debug)] pub struct UnknownVariant(String); impl ReleaseStatus { pub fn value(self) -> &'static str { match ...
true
b2aaebb48712ab7a4245b2dbfe2fa1b69b67300d
Rust
Yegorov/minify-html
/rust/common/src/tests/mod.rs
UTF-8
20,493
2.625
3
[ "MIT" ]
permissive
fn eval_with_cfg(src: &'static [u8], expected: &'static [u8], cfg: &super::Cfg) { let mut code = src.to_vec(); let min = super::minify(&mut code, cfg); assert_eq!( std::str::from_utf8(&min).unwrap(), std::str::from_utf8(expected).unwrap(), ); } fn eval(src: &'static [u8], expected: &'st...
true
1455d7e089de1b9a90fceed98d9a3f5609cc8fb6
Rust
marco-c/gecko-dev-wordified
/third_party/rust/darling_core/src/from_variant.rs
UTF-8
779
2.953125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use syn : : Variant ; use crate : : Result ; / / / Creates an instance from a specified syn : : Variant . pub trait FromVariant : Sized { / / / Create an instance from syn : : Variant or return an error . fn from_variant ( variant : & Variant ) - > Result < Self > ; } impl FromVariant for ( ) { fn from_variant ( _ : & ...
true
848a6c4fd9888f7b2b918619ef70d24944c8ee3e
Rust
mkindahl/tokio-examples
/examples/fib_stream.rs
UTF-8
1,055
2.625
3
[ "Apache-2.0" ]
permissive
// Copyright 2019 Mats Kindahl // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
true
fc807d19800cdfd01c977e90608f22fc7adc7f0f
Rust
olsonjeffery/rust-encoding
/src/codec/ascii.rs
UTF-8
3,618
3.140625
3
[ "MIT" ]
permissive
// This is a part of rust-encoding. // Copyright (c) 2013, Kang Seonghoon. // See README.md and LICENSE.txt for details. //! 7-bit ASCII encoding. use std::str; use util::StrCharIndex; use types::*; #[deriving(Clone)] pub struct ASCIIEncoding; impl Encoding for ASCIIEncoding { fn name(&self) -> &'static str { "...
true
3379bb48bb87777c760299eacfb5ee5ba9f0d614
Rust
thmeek1/CS_370_resources
/krealings_code/rust_ex/write_to_file/src/main.rs
UTF-8
2,419
3.859375
4
[]
no_license
use std::fs::{write, File}; use std::io::{Error, Write, Read}; /// Note that here we're using Propagation. /// Propagation is when you tell a line of code to send its error to the /// calling function, and is denoted by the `?` syntax in place of an /// `unwrap()` or `expect()`. This makes error-prone functions, such ...
true
158e99b5e5ab4ad7eea8f165f3db2460ed9253f4
Rust
suzu-prg/Rust-parallel-experiment
/rust-parallel-benchmark/aggregating_points/src/utils.rs
UTF-8
889
3.21875
3
[]
no_license
pub fn read_vecvec(filename: String) -> Vec<Vec<i32>> { let tmp = std::fs::read_to_string(filename).unwrap(); let mut itr = tmp.split_whitespace().map(|s| s.parse::<i32>().unwrap()); let h = itr.next().unwrap() as usize; let w = itr.next().unwrap() as usize; let mut a: Vec<Vec<i32>> = Vec::new(); ...
true
6b156766976edd0d33ea751987e2072f8188f450
Rust
nwiizo/rchatwork
/src/main.rs
UTF-8
2,896
2.875
3
[ "MIT" ]
permissive
extern crate reqwest; extern crate serde; extern crate serde_json; extern crate url; #[macro_use] extern crate serde_derive; #[macro_use] extern crate hyper; use reqwest::Url; use hyper::header::Headers; header! { (XChatWorkToken, "X-ChatWorkToken") => [String] } #[derive(Serialize)] struct PostMessageRequest { ...
true
5103eb46b3650b65397e5578bb9208d311f11f1e
Rust
pnnl/lamellar-runtime
/examples/team_examples/team_am.rs
UTF-8
4,350
2.96875
3
[ "BSD-3-Clause" ]
permissive
/// ------------Lamellar Example: Team based AM ------------------------- /// this example highlights creating and using LamellarTeams /// to launch and execute active messages. ///---------------------------------------------------------------- use lamellar::{ActiveMessaging, BlockedArch, LamellarTeam, LamellarWorld, ...
true
102773c3c264b02f8b58e9787da537741fcb3f4d
Rust
cmtt/HoneyBadger
/src/grammar.rs
UTF-8
14,263
3.171875
3
[ "MIT" ]
permissive
use std::{ str, slice, fmt }; use std::ops::Deref; #[derive(Clone, Copy)] pub struct OwnedSlice { ptr: *const u8, len: usize, } impl OwnedSlice { #[inline] pub unsafe fn from_str(source: &str) -> Self { OwnedSlice { ptr: source.as_ptr(), len: source.len(), } ...
true
ab93374b1a25e51652ca8152c34d8f4ab1c76d41
Rust
scsmithr/submarine
/src/device/legacy.rs
UTF-8
460
3.0625
3
[]
no_license
use crate::memory::{Addressable, MemoryAddr, Result}; pub struct Serial {} impl Serial { pub fn new() -> Self { Serial {} } } impl Addressable for Serial { fn read(&self, buf: &mut [u8], addr: MemoryAddr) -> Result<usize> { println!("read: ({}) {:?}", addr, buf); Ok(0) } ...
true
463f82f49495e9ad6f64031961d7738383fee986
Rust
Eosis/snake
/src/print_rendering/mod.rs
UTF-8
7,424
3.328125
3
[]
no_license
pub mod printable_apples; pub mod printable_game; pub mod printable_snake; use crate::{Apple, Game}; use std::collections::HashSet; use std::io::stdin; use crate::snake::Direction; #[cfg(test)] use crate::snake::Snake; pub trait Printable { fn print(&mut self, rendered: &mut Vec<Vec<char>>); } pub fn stringy_m...
true
b9181b0954104eb34a0dd1927034c873cb9620d8
Rust
pakkunandy/solana-dice-game
/src/rejectdups-rust/src/lib.rs
UTF-8
12,258
3
3
[]
no_license
use byteorder::{ByteOrder, LittleEndian}; use num_derive::FromPrimitive; use solana_program::{ account_info::next_account_info, account_info::AccountInfo, decode_error::DecodeError, entrypoint, entrypoint::ProgramResult, msg, program_error::ProgramError, program_pack::{Pack, Sealed}, ...
true
247fc66b586a656ac71e71d999af0384b197a263
Rust
jajajasalu2/CHIP-8
/src/cpu.rs
UTF-8
11,300
2.65625
3
[]
no_license
extern crate sdl2; extern crate rand; use super::keypad::Keypad; use super::display::Display; use std::io::*; use std::io::prelude::*; use std::fs::File; use std::path::Path; use std::thread::sleep; use std::time; pub struct CPU { memory: [u8; 4096], opcode: u16, V: [u8; 16], index: u16, pc: u16, ...
true
6bb408a7e8f6f610757ca4576382d8ba0f2ddfc8
Rust
FrinkGlobal/dto-rs
/src/v1/public.rs
UTF-8
1,092
2.828125
3
[ "MIT", "Apache-2.0" ]
permissive
//! Public module. use DTO; /// Struct for signup verification #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct RegisterDTO { /// The users username pub username: String, /// The users password pub password: String, /// The users email pub email: String, /// Posible referer ...
true
4e60f211c3c7a86c7cc2035bbabaf54d5265e906
Rust
Atul9/basalt
/src/shaders/interface_fs.rs
UTF-8
3,298
2.53125
3
[ "MIT" ]
permissive
pub mod interface_fs { shader!{ ty: "fragment", src: " #version 450 layout(location = 0) in vec2 coords; layout(location = 1) in vec4 color; layout(location = 2) in flat int type; layout(location = 0) out vec4 out_color; layout(set = 0, binding = 0) uniform sampler2D tex; vec4 cubic(float v) { vec4 n ...
true
2dc688693ff92a7f992abce366518170fc449a3d
Rust
spwilson2/armos
/src/arch/armv7a/print.rs
UTF-8
881
2.640625
3
[]
no_license
use arch::drivers::uart; use core::fmt::Write; #[macro_export] macro_rules! print { ($($arg:tt)*) => ({ use core::fmt::Write; let mut writer = $crate::arch::print::UartWriter{}; writer.write_fmt(format_args!($($arg)*)).unwrap(); }); } macro_rules! println { ($fmt:expr) =...
true
568fd9fefaf071571bb9f055426c31a12d7be61f
Rust
sporksmith/aoc2020
/src/seating.rs
UTF-8
6,541
3.5625
4
[]
no_license
#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum Position { Floor, Empty, Occupied, } #[derive(Clone, Eq, PartialEq, Debug)] pub struct Grid { positions: Vec<Position>, rows: usize, cols: usize, } impl Grid { fn idx(&self, col: isize, row: isize) -> Option<usize> { if !(0..sel...
true
78866ac7382a8ce6916ecc0d651b068ae508ad21
Rust
rippinrobr/barrel
/src/tests/common/utils.rs
UTF-8
529
3.34375
3
[ "MIT", "LicenseRef-scancode-philippe-de-muyter" ]
permissive
use types; #[test] fn cloning_types() { let tt = types::text(); assert_eq!(tt, tt.clone()); } #[test] fn debugging_types() { let tt = types::text(); assert_eq!(format!("{:#?}", tt), "Type {\n nullable: false,\n unique: false,\n increments: false,\n indexed: false,\n default: None,\n ...
true
472efe6fb09f21f9e5e4f32381292594b7e102fd
Rust
galdebert/sandbox
/rust/rust-by-example/src/bin/gentle-10-pain-points.rs
UTF-8
877
3.6875
4
[ "Apache-2.0" ]
permissive
#![allow(unused_variables)] fn strings1() { let s1 = "hello".to_string(); let s2 = s1.clone(); assert!(s1 == s2); // cool assert!(s1 == "hello"); // fine //assert!(s1 == &s2); // compile error can't compare `String` with `&String` // You cannot concatenate two String values, but you can concat...
true
de2cc563cae4e92cc670fdef0283851246a05cb4
Rust
treetertot/stealer
/src/ranges.rs
UTF-8
3,632
3.078125
3
[]
no_license
use std::sync::{atomic::{Ordering, AtomicU64, AtomicBool}, Arc, RwLock}; use std::ops::Range; use std::{thread, time}; use crate::vecbuilder::{SharedVec, UnsafeVecBuilder}; pub struct MonoRange { counter: AtomicU64, offset: u64, end: u64, } impl MonoRange { pub fn new(start: u64, end: u64) -> MonoRange...
true
e7d1a2c0de81a93410de44c8e3cbbcfd5b33100c
Rust
Garvys/tensorflow-deploy-rust
/tfdeploy-tf/src/ops/array/strided_slice.rs
UTF-8
23,965
2.546875
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::marker::PhantomData; use tfdeploy::analyser::prelude::*; use tfdeploy::analyser::rules::prelude::*; use tfdeploy::ops::prelude::*; use ndarray::prelude::*; use tfdeploy::TfdResult; pub fn build(pb: &::tfpb::node_def::NodeDef) -> TfdResult<Box<Op>> { let begin_mask = pb.get_attr_opt_int("begin_mask")?.unw...
true
771bce6f5848c5917f6229626fc6d2952dbd6f99
Rust
PumpkinSeed/adventure-of-rust
/rust-by-example/types/src/main.rs
UTF-8
1,656
3.671875
4
[]
no_license
use std::mem; type NanoSecond = u64; type Inch = u64; // Attribute to silence warning. #[allow(non_camel_case_types)] type u64_t = u64; fn main() { /** * Literals */ // Suffixed literals, their types are known at initialization let x = 1u8; let y = 2u32; let z = 3f32; // Unsuffixed...
true
fa3ec712b6a857259d92d66a0a688e0b79564eea
Rust
rafaeldelboni/spritesheet-generator
/src/file_texture.rs
UTF-8
1,103
2.859375
3
[]
no_license
use file_data; use image; use std::fs; use texture_packer::importer::ImageImporter; pub struct FileTexture { pub file: file_data::FileData, pub texture: image::DynamicImage, } pub fn find_all (folder: String) -> Vec<FileTexture> { let mut file_list = Vec::new(); if let Ok(entries) = fs::read_dir(&fol...
true
cbf62c1eef256f8e0f10e172dc85755b9ae262fd
Rust
hershi/AoC2020
/day_03/src/main.rs
UTF-8
1,713
3.640625
4
[]
no_license
use std::io::prelude::*; use std::io::BufReader; use std::fs::File; #[derive(Debug, Eq, PartialEq)] enum Cell { Clear, Tree } #[derive(Debug)] struct Map { data: Vec<Vec<Cell>>, width: usize, height: usize, } impl Map { fn new(data: Vec<Vec<Cell>>) -> Map { let height = data.len(); ...
true
e2874f40a37c42e5e0bf0165cc398e4c3885126e
Rust
Tenjin0/rust-leetcode
/roman/src/lib.rs
UTF-8
1,186
3.515625
4
[]
no_license
use std::collections::HashMap; pub fn to_int(roman: String) -> String { let table : HashMap<char, i32>= [ ('M', 1000), ('D', 500), ('C', 100), ('L', 50), ('X', 10), ('V', 5), ('I', 1) ].iter().cloned().collect(); let mut s...
true
843304ee9c05a70ff0ad5a7db385120efdcc06e2
Rust
KonishchevDmitry/investments
/src/portfolio/assets.rs
UTF-8
5,998
2.890625
3
[]
no_license
use std::collections::{HashSet, HashMap}; use std::ops::DerefMut; use std::str::FromStr; use diesel::{self, prelude::*}; use crate::config::PortfolioConfig; use crate::core::{EmptyResult, GenericError, GenericResult}; use crate::currency::{Cash, MultiCurrencyCashAccount}; use crate::db::{self, schema::{AssetType, ass...
true
bf0bdcc1b33b4a6ba208236da228e706785f1ee1
Rust
whiter4bbit/milliseriesdb
/src/storage/series/series_reader.rs
UTF-8
2,114
2.84375
3
[ "MIT" ]
permissive
use super::super::data::DataReader; use super::super::entry::Entry; use super::super::env::SeriesEnv; use super::super::error::Error; use super::super::file_system::{FileKind, OpenMode}; use std::collections::VecDeque; use std::sync::Arc; pub struct SeriesReader { env: Arc<SeriesEnv>, } impl SeriesReader { pu...
true
457111dc218410cca2a342b01751867adf529b0d
Rust
YggdrasilPlatform/Midgard-Rust-Template
/stm32f7/src/stm32f7x9/ltdc/layer/pfcr.rs
UTF-8
4,298
2.890625
3
[]
no_license
///Reader of register PFCR pub type R = crate::R<u32, super::PFCR>; ///Writer for register PFCR pub type W = crate::W<u32, super::PFCR>; ///Register PFCR `reset()`'s with value 0 impl crate::ResetValue for super::PFCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } //...
true
180b6e0460b05575e5131907dc9a7c4e5e08422a
Rust
thbar/pbrt_rust
/src/main.rs
UTF-8
678
2.5625
3
[]
no_license
extern crate pbrt_rust; use pbrt_rust::scene::Scene; struct Options; impl Options { fn new() -> Options { Options } } fn parse_file(_ : &str) -> Option<Scene> { None } fn pbrt_init(_ : &Options) { } fn pbrt_cleanup() { } fn main() { let options = Options::new(); let filenames : Vec<String> = vec![]; ...
true
97d2e3051ee282cf4ba966643e84b6953a3f7373
Rust
ParRes/Kernels
/RUST/transpose/src/main.rs
UTF-8
8,221
2.703125
3
[ "BSD-3-Clause", "LicenseRef-scancode-stream-benchmark" ]
permissive
// // Copyright (c) 2013, Intel Corporation // Copyright (c) 2022, Sajid Ali // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright // notice, ...
true
2d16f447749efb9e9448d316ee84c91584ff29d8
Rust
meetparikh7/rust-shell
/src/executor.rs
UTF-8
4,737
2.890625
3
[ "MIT" ]
permissive
use signal_hook; use std::collections::HashMap; use std::process::{Child, Command, Stdio}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::env; use std::path::PathBuf; pub struct TaskManager { bg_jobs: HashMap<i64, Child>, cur_job: i64, cur_dir: PathBuf } impl TaskManager { ...
true
7ae274f15ff4e3401da0d79ec568639e3d93fd78
Rust
bitflags/bitflags
/src/tests/extend.rs
UTF-8
898
2.75
3
[ "Apache-2.0", "MIT" ]
permissive
use super::*; #[test] fn cases() { let mut flags = TestFlags::empty(); flags.extend(TestFlags::A); assert_eq!(TestFlags::A, flags); flags.extend(TestFlags::A | TestFlags::B | TestFlags::C); assert_eq!(TestFlags::ABC, flags); flags.extend(TestFlags::from_bits_retain(1 << 5)); assert_eq...
true
0c73f1594ee35d2c9f105f0cafd11e166578c699
Rust
reneeichhorn/moonwave
/crates/thirdparty/crevice/src/std140/array.rs
UTF-8
750
2.6875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
use bytemuck::{Pod, Zeroable}; use super::{AsStd140, Std140}; #[allow(missing_docs)] #[derive(Debug, Clone, Copy)] pub struct Array<T: Std140, const N: usize> { pub elements: [T; N], } unsafe impl<T: Std140, const N: usize> Zeroable for Array<T, N> {} unsafe impl<T: Std140, const N: usize> Pod for Array<T, N> {} ...
true
a363043f4b8f628fce5d6a3c8bb4503c75c0c2dc
Rust
tomaka/rustc-issue-repro
/src/scenes/mod.rs
UTF-8
602
2.765625
3
[]
no_license
/// A scene is an object that is at the foreground of the window. It is this object that chooses /// what is drawn and what is played in the speakers. It receives user input. /// /// STATUS: needs better input handling use glium::Surface; use glium::Frame; use glium::glutin::Event; use audio::AudioState; use batch::B...
true
7a6a14cc0f71b16b861bbe2e6b7f25041d9c1fea
Rust
mojzu/sso
/sso_client/request_audit_read.rs
UTF-8
5,882
3
3
[ "Unlicense" ]
permissive
#[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct RequestAuditRead { pub audit_type: Option<Vec<String>>, pub id: Option<Vec<i64>>, pub seek: crate::request_audit_read::RequestAuditReadSeek, pub subject: Option<Vec<String>>, pub user_id: Option<Vec<String>>, } #[derive(Debug, Defau...
true
cc6919d432dcd61fdd1b24b09743c17a94955e63
Rust
Hugobros3/bvh-viz
/src/display.rs
UTF-8
2,218
3.140625
3
[]
no_license
extern crate minifb; use minifb::{Key, WindowOptions, Window}; use std::time::SystemTime; use rayon::prelude::*; use std::cmp::min; pub struct Display { window: Window, buffer: Vec<u32>, pub width: i32, pub height: i32, } pub struct Color(pub f32, pub f32, pub f32); impl Display { pub fn new(wid...
true
c0e20affc3c12adf16dceda8cd925b949fadff84
Rust
mandober/rust-maybe-type
/src/maybe/default.rs
UTF-8
1,452
3.734375
4
[]
no_license
/* derivable traits - `Clone` to create `T` from `&T` via a copy. - `Copy` to give a type copy instead of move semantics - `Debug` to format a value using the `{:?}` formatter. - `Default` to create an empty instance of a data type. - `Hash` to compute a hash from `&T`. - `Eq` equality comparison - `PartialEq` partial ...
true
b95b8fb3013ae376e122b312b4fcc45f538ef6c7
Rust
maralla/pack
/src/cmd/move_cmd.rs
UTF-8
1,601
2.75
3
[ "MIT" ]
permissive
use crate::package; use crate::utils; use crate::{Error, Result}; use clap::{value_t, ArgMatches}; use std::fs; #[derive(Debug)] struct MoveArgs { plugin: String, category: String, opt: bool, } impl MoveArgs { fn from_matches(m: &ArgMatches) -> MoveArgs { MoveArgs { plugin: value_...
true
c925e0f55ebf53660095c8ce87d2bfd67c69914a
Rust
arik-so/rust-lightning-tlv
/src/big_size.rs
UTF-8
2,680
3.265625
3
[ "MIT" ]
permissive
use crate::big_size::EncodingDetails::{Length8, Length64, Length16, Length32}; use std::convert::TryInto; const MIN_16_BIT_VALUE: u64 = 0xfd; const MIN_32_BIT_VALUE: u64 = 0x10000; const MIN_64_BIT_VALUE: u64 = 0x100000000; const MAX_64_BIT_VALUE: u64 = 0xffffffffffffffff; enum EncodingDetails { Length8, Length16, ...
true
26349cc02b46aa3315765fe24cc2365053b1f529
Rust
fschutt/libloading-mini
/src/lib.rs
UTF-8
4,256
2.53125
3
[]
no_license
#[cfg(unix)] mod internal_impl { // Platform specific things use std::os::raw; use std::ffi::OsStr; use super::cstr_cow_from_bytes; extern { // syscalls fn dlopen(filename: *const raw::c_char, flags: raw::c_int) -> *mut raw::c_void; fn dlsym(handle: *mut raw::c_void, symbol: *const ...
true
34e8919066746a119e8b584901899413d958bd33
Rust
WilliamVenner/rust-analyzer
/crates/ide/src/references.rs
UTF-8
23,929
2.6875
3
[ "MIT", "Apache-2.0" ]
permissive
//! This module implements a reference search. //! First, the element at the cursor position must be either an `ast::Name` //! or `ast::NameRef`. If it's a `ast::NameRef`, at the classification step we //! try to resolve the direct tree parent of this element, otherwise we //! already have a definition and just need to...
true
31b0cb7b86c46c45e0cb75ddbe031353522d26da
Rust
jasonshieh/rust_tcp
/hello/src/main.rs
UTF-8
1,755
3.40625
3
[]
no_license
use std::thread; use std::net::{TcpListener, TcpStream, Shutdown}; use std::io::{Read, Write}; use std::str; fn handle_client(mut stream: TcpStream){ let mut data = [0 as u8; 50]; // using 50 byte buffer for receiving data while match stream.read(&mut data) { Ok(size) => { // reply to cli...
true
d5be76c92dcce5c1511b1d93425498638454514f
Rust
suspend0/aws-sdk-rust
/sdk/lookoutvision/src/client.rs
UTF-8
115,474
2.609375
3
[ "Apache-2.0" ]
permissive
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. #[derive(Debug)] pub(crate) struct Handle< C = aws_smithy_client::erase::DynConnector, M = aws_hyper::AwsMiddleware, R = aws_smithy_client::retry::Standard, > { client: aws_smithy_client::Client<C, M, R>, conf: crate::C...
true
18a3aad440b54e6023c6c8de084ed292f19aebf8
Rust
jkelleyrtp/joint-rs
/dependencies/joint_rs/src/elements/menus.rs
UTF-8
2,702
3.109375
3
[]
no_license
use yew::{html, Callback, Component, ComponentLink, Href, Html, Renderable, ShouldRender}; use yew::services::ConsoleService; // ====================== // // The scrollable sidebar // // ====================== // pub struct SidebarState { entries: Vec<SidebarListItem>, console: ConsoleService, } pub struct J...
true
87127b29ee1946f01a77f04cc002a736a2857ec6
Rust
benWindsorCode/MapLang
/src/execute/dyadic_access.rs
UTF-8
2,793
3.28125
3
[]
no_license
use super::structures::ExecuteOutput; use crate::parse::structures::Numeric; use std::collections::HashMap; pub fn execute_access(lhs: ExecuteOutput, rhs: ExecuteOutput) -> ExecuteOutput { match (lhs, rhs) { (ExecuteOutput::Array (lhs_array), ExecuteOutput::Array (rhs_array)) => execute_access_array_with_a...
true
7624fa5f721549214d786cfda674968ba0d6db5b
Rust
najamelan/async_executors
/src/exec/tokio_ct.rs
UTF-8
11,685
3.15625
3
[ "Unlicense" ]
permissive
use { crate :: { SpawnHandle, LocalSpawnHandle, JoinHandle, BlockingHandle } , std :: { fmt, rc::Rc, future::Future, convert::TryFrom } , tokio :: { task::LocalSet, runtime::{ Builder, Runtime, Handle, RuntimeFlavor } } , futures_task :: { FutureObj, LocalFut...
true
680ed3ea2be2d4b3f8bdb01c229c1acb062977dd
Rust
lemonrock/simple-http-server
/workspace/simple-http-server-epoll/src/fanotify/MarkEventFlags.rs
UTF-8
3,013
2.609375
3
[ "MIT" ]
permissive
// This file is part of simple-http-server. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/simple-http-server/master/COPYRIGHT. No part of simple-http-server, including this file, may be copied, modified, ...
true
df4ba5ccd8a2f1658e0deba47ee9ea4690eeea5b
Rust
yukinagae/scopereter
/src/main.rs
UTF-8
4,749
3.515625
4
[]
no_license
#![allow(dead_code)] use Stmt::*; use Expr::*; #[derive(Debug, Clone)] struct Ast(Vec<Stmt>); #[derive(Debug, Clone)] enum Stmt { SubStmt(String, Expr), Print(Vec<Expr>), Block(Vec<Stmt>), } #[derive(Debug, Clone)] enum Expr { Str(String), Num(isize), Var(String), } use std::ops::Drop; str...
true
20dfe67dd00e4489c01b4ddac538731e94dacd15
Rust
zatchl/kawaiifi
/src/interface/linux/interface.rs
UTF-8
6,564
2.640625
3
[ "MIT", "Apache-2.0" ]
permissive
use super::{InterfaceType, Nl80211Attr, Nl80211Cmd}; use crate::{bss::Bss, interface::ScanError}; use macaddr::MacAddr6; use neli::{ attr::Attribute, consts::nl::{NlmF, NlmFFlags, Nlmsg}, consts::socket::NlFamily, genl::{Genlmsghdr, Nlattr}, nl::{NlPayload, Nlmsghdr}, socket::NlSocketHandle, ...
true
e01d2dc88fcdbcafb6d3cd2400a3712a920b1054
Rust
rbudnar/rust-mazes
/crate/src/grid/mask.rs
UTF-8
1,213
3.296875
3
[ "MIT", "Apache-2.0" ]
permissive
use crate::cells::ICellStrong; use crate::rng::RngWrapper; #[derive(Debug)] pub struct Mask { pub rows: usize, pub columns: usize, pub bits: Vec<Vec<bool>> } impl Mask { pub fn new(rows: usize, columns: usize) -> Mask { Mask { rows, columns, bits: vec![vec![true; column...
true
0216a335a09547acf2e50928ed4f9bacc3c6751f
Rust
SilanSurfer/super-octo-engine
/src/main.rs
UTF-8
833
2.65625
3
[]
no_license
mod cli; mod data_records; mod engine; mod errors; mod operations; use engine::Engine; use std::fs::File; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let input_file_path = cli::Opt::get_input_file(); let mut engine: Engine = Engine::new(); let file = File::open(input_file_p...
true
d46b0c7734c71dfa480602fb905151995a95538e
Rust
tirr-c/hyeong-rs
/src/rational.rs
UTF-8
8,569
3.125
3
[ "Apache-2.0", "MIT" ]
permissive
use std::cmp::Ordering; use std::fmt::{self, Display, Formatter}; use std::ops::{Add, AddAssign, Mul, MulAssign, Neg}; use num_traits::{One, ToPrimitive, Zero}; #[cfg(feature = "big-rational")] use num_rational::BigRational as Rational; #[cfg(not(feature = "big-rational"))] use num_rational::Rational64 as Rational; ...
true
b353e75a9e86c76184f6a8ef2976206ddc98af15
Rust
laopo001/kelake
/packages/kelake-dom/src/lib.rs
UTF-8
3,615
2.703125
3
[]
no_license
#![allow(unused)] #[macro_use] extern crate lazy_static; use console::log_1; use js_sys::Function; use kelake::vnode::{format, Component, ComponentUpdate, PropsValue, Task, ToVNodeChild, VNode, VNodeChild}; use rand::Rng; use std::collections::HashMap; use std::sync::{Arc, Mutex}; use wasm_bindgen::prelude::*; use web_...
true
d8fb98994f668a0766eb923b90f97ded4a35cf8e
Rust
sinofp/otsoc
/fifteen-exercises/jump-game.rs
UTF-8
769
3.25
3
[ "CC0-1.0" ]
permissive
impl Solution { pub fn can_jump(nums: Vec<i32>) -> bool { let nums: Vec<usize> = nums.iter().map(|&n| n as usize).collect(); let len = nums.len(); let mut can_jump = vec![false; len]; can_jump[0] = true; for i in 0..len - 1 { if can_jump[i] { for j...
true
222f7cedbdb2252eb95aae8c0ace533e7b42be24
Rust
ogham/exa
/src/fs/feature/xattr.rs
UTF-8
7,711
2.875
3
[ "MIT" ]
permissive
//! Extended attribute support for Darwin and Linux systems. #![allow(trivial_casts)] // for ARM use std::cmp::Ordering; use std::io; use std::path::Path; pub const ENABLED: bool = cfg!(any(target_os = "macos", target_os = "linux")); pub trait FileAttributes { fn attributes(&self) -> io::Result<Vec<Attribute...
true
c536fd7a29e3a8f71028d5ca9277f0cd988e97df
Rust
dfrankland/mk20d7
/src/rcm/srs1/mod.rs
UTF-8
9,340
2.640625
3
[ "MIT" ]
permissive
#[doc = r" Value read from the register"] pub struct R { bits: u8, } impl super::SRS1 { #[doc = r" Reads the contents of the register"] #[inline] pub fn read(&self) -> R { R { bits: self.register.get(), } } } #[doc = "Possible values of the field `JTAG`"] #[derive(Clone, ...
true
664b905fe6636328b3218e568a1e57af99b2e537
Rust
tonimctoni/planet_defender
/src/actor_manager.rs
UTF-8
6,824
2.6875
3
[]
no_license
// use std; use std::f64::consts::PI; use sdl2; use satellite::Satellite; use projectile::Projectile; use meteor::Meteor; use actor::Actor; use textures::Textures; use rand::{XorShiftRng, SeedableRng, Rng}; use constants::{ProjectileKind, MeteorKind}; use constants::{ SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH_F64, ...
true
bcb33d24b8e5405970e74c423db28916c5ba747c
Rust
Blu-J/aoc2018
/problem_2/src/main.rs
UTF-8
3,112
3.265625
3
[]
no_license
extern crate im; use im::{HashMap, HashSet}; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; type Result<T> = ::std::result::Result<T, Box<::std::error::Error>>; fn input() -> Result<String> { let file = File::open("inputs/part1")?; let mut buf_reader = BufReader::new(file); let mut co...
true
fdb47b141f0a7f4ae6b50e7803cd5f70bad2f895
Rust
penland365/gh
/src/evidence.rs
UTF-8
2,140
3.390625
3
[ "BSD-3-Clause" ]
permissive
// A few commonly used wrapper functions around Serde JSON // to encapsulate common behaviour pub mod json_ops { use serde_json; use serde::de::DeserializeOwned; use serde::ser::Serialize; pub fn from_str_or_die<T: DeserializeOwned> (s: &str, error_msg: &str) -> T { let t: T = match serde_json::fro...
true
9101240788d60c071773887c69671631282842a9
Rust
stewart/rff
/src/ansi/cursor.rs
UTF-8
2,074
3.578125
4
[ "MIT" ]
permissive
use std::fmt::{Display, Formatter, Result}; /// Move the cursor to (row, col) position [(1, 1)-based] #[derive(Copy, Clone)] pub struct GoTo(pub u16, pub u16); impl Display for GoTo { fn fmt(&self, f: &mut Formatter) -> Result { debug_assert!(self.0 > 0 && self.1 > 0, "ANSI coordinates are 1-based"); ...
true
acc17eddb055f14fc7071c605a75898e71bfae79
Rust
filmor/erl_pp
/src/directive.rs
UTF-8
4,329
2.765625
3
[ "MIT" ]
permissive
use erl_tokenize::tokens::{AtomToken, SymbolToken}; use erl_tokenize::values::Symbol; use erl_tokenize::{LexicalToken, Position, PositionRange}; use std::fmt; use crate::directives; use crate::token_reader::{ReadFrom, TokenReader}; use crate::Result; /// Macro directive. #[derive(Debug, Clone)] #[allow(missing_docs)]...
true
5e4d80a6ab46c3236bf912afc2bdf24168385487
Rust
recursive-bloom/bloom-ipc
/src/nanomsg_server.rs
UTF-8
1,246
2.734375
3
[]
no_license
use nanomsg::{Protocol, Socket}; use std::thread; use std::time::Duration; use std::io::{Read, Write}; pub fn server(end_point : &str) { let mut socket = Socket::new(Protocol::Rep).unwrap(); // let mut endpoint = socket.connect(CS_URL).unwrap(); let mut ep = socket.bind(end_point).unwrap(); let mut ...
true
f237bdb8915b04fdbfb4475ea8d5d2106542c47e
Rust
alexcrichton/git2-rs
/src/util.rs
UTF-8
4,121
2.984375
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use libc::{c_char, c_int, size_t}; use std::cmp::Ordering; use std::ffi::{CString, OsStr, OsString}; use std::iter::IntoIterator; use std::path::{Path, PathBuf}; use crate::{raw, Error}; #[doc(hidden)] pub trait IsNull { fn is_ptr_null(&self) -> bool; } impl<T> IsNull for *const T { fn is_ptr_null(&self) -> b...
true
cc8e19ff713611585610c2269d139247803ee1e0
Rust
Liu-WeiHu/learn-rust
/async/learn-future/examples/learn-async-await.rs
UTF-8
1,254
3.171875
3
[]
no_license
use std::future::Future; use std::marker::PhantomPinned; use std::pin::Pin; fn main() { //futures::executor::block_on(blocks()); let mut test1 = Test::new("test1");; let mut test2 = Test::new("test2"); println!("a: {},b: {}", test1.as_ref().get_a(), test2.as_ref().get_b()); println!("a: {},b: {}",...
true
1f397bc53f35b6875d193959490575375dce4f62
Rust
AzzOnFire/simple-raytracing
/src/material.rs
UTF-8
330
2.640625
3
[]
no_license
use crate::Vec3; use num::Float; pub fn random_in_unit_sphere<T: Float>() -> Vec3<T> where f64: Into<T> { let one = Vec3::one(); let mut result; loop { result = Vec3::rand() * 2.0.into() - one; if result.squared_length() <= 1.0.into() { break; } } ...
true
d25d24570b1f14f092344033510cbe080e763470
Rust
ThermalSpan/asap
/build.rs
UTF-8
2,462
2.75
3
[]
no_license
static SHADER_DIR: &'static str = "src/_shaders"; static GLSL_VALIDATOR: &'static str = "/usr/local/bin/glslangValidator"; use std::fs; use std::process::Command; fn main() { check_glsl(); } fn check_glsl() { let shader_directory = fs::read_dir(SHADER_DIR) .expect(&format!("Could not read shader dire...
true
eeec38fa4710b0555576271d89b730a3cf9ebcdc
Rust
marco-c/gecko-dev-wordified
/third_party/rust/uuid/src/v3.rs
UTF-8
3,695
2.515625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate : : Uuid ; impl Uuid { / / / Creates a UUID using a name from a namespace based on the MD5 / / / hash . / / / / / / A number of namespaces are available as constants in this crate : / / / / / / * [ NAMESPACE_DNS ] / / / * [ NAMESPACE_OID ] / / / * [ NAMESPACE_URL ] / / / * [ NAMESPACE_X500 ] / / / / / / Note ...
true
219da0af59bad4e6171570d8885d00450251a94b
Rust
Abishek0398/hyaline-smr
/src/guard.rs
UTF-8
1,440
3.375
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::ptr::NonNull; use crate::collector::Collector; use crate::collector::Smr; use crate::node::Node; /// A RAII guard which keeps the thread active in garbage collection. /// The thread will be unpinned automatically upon guard's destruction /// # Multiple guards /// /// Pinning is reentrant and it is perfectly ...
true
7e1003ffd3f1f743478f44445665bb52413eff1a
Rust
jprendes/whasm
/whasm/src/binary/module.rs
UTF-8
7,701
2.703125
3
[]
no_license
//! This module defines the parsing of a WebAssembly module. use crate::binary::{WasmBinary, WasmBinaryParse, WasmBinaryParseProxy, Byte, Result, Error}; use crate::binary::{Sized, Consume, UnwrappingVec, CompactVec}; use crate::structure::{module, idx}; impl WasmBinaryParse for (String, Consume) { fn parse<Binar...
true
09dff75368726fd0deda0530e20c75d83ab80a51
Rust
azdavis/advent-of-code
/years/y2015/src/d02.rs
UTF-8
884
3.15625
3
[ "MIT" ]
permissive
type Dims = [u32; 3]; fn parse(s: &str) -> impl Iterator<Item = Dims> + '_ { s.lines().map(|line| { let mut parts = line.split('x'); let l: u32 = parts.next().unwrap().parse().unwrap(); let w: u32 = parts.next().unwrap().parse().unwrap(); let h: u32 = parts.next().unwrap().parse().unwrap(); asser...
true
ef4906cb0d67c2d1cae920c4e89507a5938f5069
Rust
HuaHuaY/xv6-rust
/bin/xv6_rust/src/memory/page_table.rs
UTF-8
3,451
2.6875
3
[ "MIT" ]
permissive
use core::marker::PhantomData; use core::ops::{Index, IndexMut}; use crate::memory::{Frame, PHYSICAL_MEMORY}; const ENTRY_COUNT: usize = 512; bitflags! { pub struct PageEntryFlags: u64 { const VALID = 1 << 0; const READABLE = 1 << 1; const WRITEABLE = 1 << 2; const EXECUTA...
true
adf46fc5d03ff8b55e866af4b2f70d9a8e23c509
Rust
carllerche/tokio-serde-json
/src/lib.rs
UTF-8
8,561
3.140625
3
[ "MIT" ]
permissive
#![doc(html_root_url = "https://docs.rs/tokio-serde-json/0.3.0")] //! `Stream` and `Sink` adaptors for serializing and deserializing values using //! JSON. //! //! This crate provides adaptors for going from a stream or sink of buffers //! ([`Bytes`]) to a stream or sink of values by performing JSON encoding or //! de...
true
fcac059ce55c0008b9e39343b9b2f8b64c0fb84d
Rust
bsaintjo/compbio
/src/local.rs
UTF-8
6,380
2.71875
3
[]
no_license
use std::collections::HashMap; use std::collections::HashSet; use bio::scores::pam250; use itertools::iproduct; use log::info; #[derive(Hash, Eq, PartialEq, Clone, Copy)] enum Direction { Top, TopLeft, Left, } impl Direction { fn top() -> HashSet<Direction> { let mut acc = HashSet::new(); ...
true
e5cd75b82cb5781ccde55584a3adeb15c7622d83
Rust
wenley/rust-awk
/src/expression/regex_match.rs
UTF-8
4,088
3.3125
3
[ "MIT" ]
permissive
use regex::Regex; use std::fmt::Debug; use nom::{ branch::alt, bytes::complete::tag, character::complete::multispace0, sequence::{delimited, tuple}, }; use super::{Expression, ExpressionParseResult}; use crate::{ context::MutableContext, function::Functions, printable::Printable, value...
true
4a5dc62dbfd300b412dcd2fc5271b8d2a7956423
Rust
wisest30/AlgoStudy
/source/leetcode/2288/hyo.rs
UTF-8
1,050
3.078125
3
[]
no_license
impl Solution { pub fn discount_prices(sentence: String, discount: i32) -> String { let mut words = sentence.split(' ').collect::<Vec<_>>(); let mut ret = String::new(); for word in words { let mut is_price = false; if word.len() <= 11 && word.len() > 1 { ...
true
377cf47fc66dfc6b6160d1dd46049bef403163b8
Rust
baitcenter/oak
/rust/oak_derive/src/lib.rs
UTF-8
1,812
2.625
3
[ "Apache-2.0" ]
permissive
extern crate oak; extern crate proc_macro; extern crate protobuf; extern crate syn; use proc_macro::TokenStream; use quote::quote; /// Implements the necessary bindings to make the annotated struct act as an Oak Node /// that provides the necessary global exports. /// /// May only be used on struct objects. /// /// A...
true
484b6f04c3e663d64212da0fc544a595b8ba196e
Rust
harshanavkis/vmsh
/src/kvm/hypervisor/ioevent.rs
UTF-8
1,765
2.515625
3
[ "MIT" ]
permissive
use simple_error::try_with; use std::os::unix::io::AsRawFd; use std::os::unix::prelude::RawFd; use std::sync::Arc; use vmm_sys_util::eventfd::EventFd; use super::ioeventfd::IoEventFd; use super::userspaceioeventfd::UserspaceIoEventFd; use super::Hypervisor; use crate::devices::use_ioregionfd; use crate::devices::virti...
true
b62ec436d4f6a10f8de0ed595a40529bd6007018
Rust
FuturePresentLabs/finql
/finql-data/src/quote_handler.rs
UTF-8
2,511
2.984375
3
[ "MIT", "Apache-2.0" ]
permissive
///! Data handler trait for market quotes use chrono::{DateTime, Utc}; use super::AssetHandler; use super::DataError; use crate::currency::Currency; use crate::quote::{Quote, Ticker}; /// Handler for globally available market quotes data pub trait QuoteHandler: AssetHandler { // insert, get, update and delete fo...
true
6769e90d3a2b8530e527db9473e4d92313375b61
Rust
IThawk/rust_hawk_project
/hawk_api/src/config_center/service_config.rs
UTF-8
1,973
2.875
3
[]
no_license
use crate::traits::{Random, Round}; use hawk_tools::algorithm::random::random_int; use std::collections::HashMap; #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ServiceConfig { pub project: String, pub name: String, pub vision: String, #[serde(default = "Vec::default", skip_serializing_...
true
d95cb9632c6c9336e91a70defc96f764ab313e73
Rust
r-asou/databend
/common/io/src/unmarshal.rs
UTF-8
3,285
2.65625
3
[ "Apache-2.0" ]
permissive
// Copyright 2020 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
true
c4e931b7ad55ce10b056c41aebfc54b286a02406
Rust
kuy/flex-handler
/src/extensions.rs
UTF-8
1,138
3.09375
3
[]
no_license
// Borrow from https://github.com/actix/actix-web/blob/master/actix-http/src/extensions.rs use std::any::{Any, TypeId}; use std::collections::HashMap; use std::fmt; #[derive(Default)] /// A type map of request extensions. pub struct Extensions { map: HashMap<TypeId, Box<dyn Any>>, } impl Extensions { /// Cre...
true
a4dacc10a14f01201cadebcf2a6ebbf9f3e6bc45
Rust
shwnchpl/chip8
/src/core/error.rs
UTF-8
739
2.90625
3
[ "MIT" ]
permissive
use std::error; use std::fmt; use super::op::Op; #[derive(Debug, Clone, PartialEq)] pub enum Error { BadInstruction, DataAbort, DriverMissing, LoadFailure, MalformedOp(Op), PrefetchAbort, StackOverflow, StackUnderflow, UnimplementedOp(Op), } pub type Result<T> = std::result::Resul...
true
4200a5f4798ca1a952ea21c0c6b9e0b9694fafc5
Rust
dawsongzhao/prusto
/src/types/seq.rs
UTF-8
3,154
2.765625
3
[ "MIT" ]
permissive
use std::cmp::Ord; use std::collections::*; use std::fmt; use std::hash::Hash; use std::marker::PhantomData; use serde::de::{DeserializeSeed, Deserializer, SeqAccess, Visitor}; use serde::Serialize; use super::util::SerializeIterator; use super::{Context, Presto, PrestoTy}; macro_rules! gen_seq { ($ty:ident, $i...
true
5ec263e3312d6e8077061c8ecb058666fe5e000b
Rust
cat-dev-group/meow.rs
/meowc/src/errors/location.rs
UTF-8
1,804
3.75
4
[ "MIT" ]
permissive
use std::fmt; use std::path::Path; /// A given Position in a file. These are usually used as start positions for a /// Location struct. #[derive(Clone, Copy, Debug)] pub struct Position { pub index: usize, pub line: u32, pub column: u32, } impl Position { /// The first position in a file pub fn be...
true
34c129a1f531e7bb05feef99a2134ad1e9fe51ea
Rust
igo95862/notcurses
/rust/src/cells/methods.rs
UTF-8
16,471
2.875
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
//! `NcCell` methods and associated functions. use crate::{ cstring, error, nccell_load, NcAlphaBits, NcCell, NcChannels, NcComponent, NcEgc, NcEgcBackstop, NcPaletteIndex, NcPlane, NcResult, NcRgb, NcStyle, NCRESULT_ERR, }; #[allow(unused_imports)] // for the doc comments use crate::NcChannel; /// # NcCell ...
true
244bc602b42abec11ed048bac181857a1c94975a
Rust
SuperTails/rusty-nes
/src/apu/pulse_gen/mod.rs
UTF-8
2,230
2.9375
3
[]
no_license
use super::envelope::Envelope; use super::get_length; pub mod sweep; use sweep::Sweep; pub struct PulseGen { pub envelope: Envelope, pub sweep: Sweep, duty: u8, timer: u16, period: u16, length_count: u8, step: u8, } impl PulseGen { pub fn new(second: bool) -> PulseGen { ...
true
cc81170dd920c6df12059fcaa3f5473dc14094ba
Rust
Azure/iotedge
/mqtt/edgelet-client/src/workload/models/identity_cert.rs
UTF-8
880
3.125
3
[ "MIT" ]
permissive
use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Serialize, Deserialize)] pub struct IdentityCertificateRequest { /// Certificate expiration date-time (ISO 8601) #[serde(rename = "expiration", skip_serializing_if = "Option::is_none")] expiration: Option<String>, } impl IdentityCertificateRequ...
true
c2880181721eee6e4fe0f04cf2d14ffd9b4afeb0
Rust
mshatoori/pacman
/src/world/mod.rs
UTF-8
6,740
2.90625
3
[]
no_license
pub mod pac; pub mod pellet; use std::collections::HashMap; use std::convert::{TryFrom, TryInto}; use std::io; use std::time::Instant; use crate::parse_input; use crate::world::pac::{Pac, PacProperties}; use crate::world::pellet::Pellet; #[repr(u8)] #[derive(Debug)] pub enum CellType { Wall = b'#', Floor = b...
true
531608382b158691ed4aac246c7f627f40619995
Rust
pum-purum-pum-pum/carrier
/src/server.rs
UTF-8
3,286
2.953125
3
[]
no_license
use std::collections::{HashMap, HashSet, VecDeque}; use tokio::net::TcpStream; use tokio::sync::mpsc; use tokio_util::codec::{Framed, LinesCodec}; use futures::StreamExt; use failure::{bail, Error}; use crate::user::User; pub type Tx = mpsc::UnboundedSender<String>; pub type Rx = mpsc::UnboundedReceiver<String>; ...
true
bf38187d9df0461511befd0e9757f94c471a0028
Rust
xgillard/mznlauncher
/src/matrix.rs
UTF-8
3,763
3.40625
3
[]
no_license
use core::fmt; use std::{ fmt::Display, ops::{Index, IndexMut}, }; //----------------------------------------------------------------------------- //--- Convenient definition of a 2D matrix ------------------------------------ //----------------------------------------------------------------------------- ///...
true
0c0ef97f94bbd85d4873c7bb964ca5420e9980e9
Rust
dev0x1/graphql-rust-demo
/satellites-service/src/graphql.rs
UTF-8
2,336
2.65625
3
[ "MIT" ]
permissive
use std::str::FromStr; use async_graphql::*; use chrono::NaiveDate; use strum_macros::EnumString; use crate::get_conn_from_ctx; use crate::persistence::model::SatelliteEntity; use crate::persistence::repository; pub type AppSchema = Schema<Query, EmptyMutation, EmptySubscription>; pub struct Query; #[Object] impl ...
true
42aae657d18577880f1afb08ca85887df7464009
Rust
jorian/komodorpc-rust-client
/src/chains.rs
UTF-8
993
2.515625
3
[]
no_license
use core::fmt; /// A set of predefined, known assetchains. /// `Custom(String)` exists to define your own assetchain. #[derive(Debug, Clone)] pub enum Chain { KMD , REVS , SUPERNET, DEX , PANGEA , JUMBLR , BET , CRYPTO , HODL , MSHARK , BOTS , ...
true
6b1c7fac7230a94aac3933b5dc66a3ac284ae2cb
Rust
endoli/hostinfo.rs
/src/powerinfo.rs
UTF-8
1,923
3.09375
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. /// Basic battery i...
true
9f5081d5f2fda99cdc0301dd427525a056d81677
Rust
tov/succinct-rs
/src/coding/unary.rs
UTF-8
1,484
3.3125
3
[ "MIT", "Apache-2.0" ]
permissive
use super::*; use internal::errors::*; use stream::*; /// Encodes _n_ as _n_ zeroes followed by a one. pub struct Unary; impl UniversalCode for Unary { fn encode<W: BitWrite>(&self, sink: &mut W, mut value: u64) -> Result<()> { while value > 0 { try!(sink.write_bit(false)); value =...
true
bd75b3289163ccf33cf70d97fda01626a6afdde4
Rust
insanitybit/shannon-entropy
/src/lib.rs
UTF-8
2,290
4.09375
4
[ "Apache-2.0", "MIT" ]
permissive
use std::collections::BTreeMap; pub trait ShannonEntropy { fn entropy(&self) -> f32; } impl<T: AsRef<str>> ShannonEntropy for T { fn entropy(&self) -> f32 { shannon_entropy(self.as_ref()) } } /// Calculates the shannon entropy of 's'. /// https://en.wiktionary.org/wiki/Shannon_entropy /// /// # ...
true
8a2590b0b12dabb6f7f919289a9a93c75e5fb725
Rust
jean-airoldie/libzmq-rs
/libzmq/examples/reliable_req_rep.rs
UTF-8
1,944
2.75
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use libzmq::{prelude::*, *}; use std::{thread, time::Duration}; fn main() -> Result<(), anyhow::Error> { // We use a system assigned port here. let addr: TcpAddr = "127.0.0.1:*".try_into()?; let duration = Duration::from_millis(300); let hb = Heartbeat::new(duration) .add_timeout(3 * duration...
true
e5cfebf0e0376c456dd16ef4f40e3737fd38c29e
Rust
pipi32167/LeetCode
/rust/src/problem_01_05.rs
UTF-8
1,694
3.28125
3
[]
no_license
#[derive(Debug)] struct Solution { } impl Solution { pub fn one_edit_away(first: String, second: String) -> bool { let (long, short) = if first.len() > second.len() { (first.as_bytes(), second.as_bytes()) } else { (second.as_bytes(), first.as_bytes()) }; if long.len() - s...
true
bb035e1cb596e37bab57416a14610b0f9937857b
Rust
dgu123/Cirno
/src/lib.rs
UTF-8
7,118
3.1875
3
[]
no_license
#![feature(box_syntax, box_patterns)] #[derive(PartialEq, PartialOrd, Debug, Clone)] pub enum Term { TString(String), TBool(bool), TConcat(Box<Term>, Box<Term>), TCon(Box<Term>, Box<Term>, Box<Term>), TWhen(Box<Term>, Box<Term>), TUnless(Box<Term>, Box<Term>), TPrintLn(Box<Term>), TUnit,...
true