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
7c8b9f8edff12667e1e01241778cd1b3dd67aad1
Rust
thejohncrafter/projets-2020
/ir/src/hir/printing.rs
UTF-8
7,128
3.09375
3
[ "MIT" ]
permissive
use super::types::*; impl std::fmt::Display for Type { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Type::Int64 => { write!(f, "Int64") }, Type::Bool => { write!(f, "Bool") }, T...
true
339386439ff7ab3cdbd2d549b9934f5462a00dd1
Rust
Babkock/unix
/head/src/main.rs
UTF-8
3,031
2.734375
3
[ "MIT" ]
permissive
/* * head/main.rs * Babkock/unix * * Copyright (c) 2019 Tanner Babcock. * MIT License. */ use std::{env, io, process}; use std::io::prelude::*; use std::io::{Read, stdin, stderr}; //use std::fs::File; enum Mode { Lines(i32), Bytes(i32) } struct Options { mode: Mode } impl Default for Options { f...
true
8d7f5161a10c77401ec99f732ace6607138e6c5d
Rust
jonfast565/price-tracker
/price-scraper/src/main.rs
UTF-8
1,161
2.5625
3
[]
no_license
extern crate scraper; extern crate price_db; extern crate logger; mod price_finder; mod utilities; use futures::future::join_all; use price_finder::PriceFinder; use tracing::instrument; use tracing_subscriber; #[tokio::main] #[instrument] async fn main() -> Result<(), Box<dyn std::error::Error>> { setup_logging(...
true
808fe88889d067d41303badcbd7ced0a80ccb428
Rust
mtso/Rocket
/core/lib/src/handler.rs
UTF-8
2,752
3.75
4
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! The types of request and error handlers and their return values. use data::Data; use request::Request; use response::{self, Response, Responder}; use error::Error; use http::Status; use outcome; /// Type alias for the `Outcome` of a `Handler`. pub type Outcome<'r> = outcome::Outcome<Response<'r>, Status, Data>; ...
true
25a05252ed01a7246f9903ecfdcd4ce22ac9f7fd
Rust
gdepuydt/HMRender
/fnd/src/alloc/allocator.rs
UTF-8
497
2.71875
3
[]
no_license
use core::ffi::c_void; use super::Layout; /// More information about [the Option type](https://doc.rust-lang.org/core/option/enum.Option.html) /// More information about [unsafe Rust](https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html) /// More information about [c_void enum type](https://doc.rust-lang.org/...
true
bfd9009e4634d53324113f6339113166b0b90395
Rust
bpeel/advent2016
/2021/day8/src/main.rs
UTF-8
9,010
2.84375
3
[]
no_license
const PAT_A: u8 = 1u8 << 0; const PAT_B: u8 = 1u8 << 1; const PAT_C: u8 = 1u8 << 2; const PAT_D: u8 = 1u8 << 3; const PAT_E: u8 = 1u8 << 4; const PAT_F: u8 = 1u8 << 5; const PAT_G: u8 = 1u8 << 6; const N_SEGMENTS: usize = 7; static DIGIT_PATTERNS: [u8; 10] = [ PAT_A | PAT_B | PAT_C | PAT_E | PAT_F | PAT_G, PAT...
true
6f32e32a4f7f5a9f82bb164e9c1d6e13449c8154
Rust
Devolutions/gfwx-rs
/src/processing/overlapping_chunks_iterator.rs
UTF-8
1,926
3.34375
3
[ "MIT", "Apache-2.0" ]
permissive
use std::mem; pub struct OverlappingChunksIterator<'a, T> { head: &'a [T], remainder: &'a mut [T], } impl<'a, T> OverlappingChunksIterator<'a, T> { pub fn from_slice(slice: &'a mut [T], step: usize) -> OverlappingChunksIterator<'a, T> { if slice.len() <= step { // valid, but no element...
true
ac91da842a809bf6211a66d865a73a7f0d9787a6
Rust
livexia/algorithm
/algorithms-mit6006/problem_set/matching_DNA_sequences/dna_seq_rust/tests/test.rs
UTF-8
1,821
2.6875
3
[]
no_license
mod test { use dna_seq_rust::dnaseqlib::RollingHash; use dna_seq_rust::ExactSubMatchesIterator; use dna_seq_rust::Multidict; use dna_seq_rust::SubSequenceHashIterator; #[test] fn test_rolling_hash() { let mut rh1 = RollingHash::new(&"CTAGC".as_bytes()); let rh2 = RollingHash::ne...
true
1e8b935e082dfe403a75b9b59af6bc85112e83f4
Rust
mangolang/compiler
/src/parsing/partial/qualified_name.rs
UTF-8
3,903
3.203125
3
[ "Apache-2.0" ]
permissive
use crate::lexeme::{FQIdentifierLexeme, Lexeme}; use crate::parsing::util::cursor::{End, ParseCursor}; use crate::parsing::util::{NoMatch, ParseRes}; //TODO @mark: tests for FQNs /// Parse a qualified name, which is (identifier + period)* + identifier /// /// Note that field access for a record has the same structure,...
true
b478cfd7853813c849d82b20c7bedc8a0fc484e7
Rust
robjtede/async-graphql
/tests/field_features.rs
UTF-8
4,249
2.734375
3
[ "Apache-2.0", "MIT" ]
permissive
#![allow(dead_code)] use async_graphql::*; use futures::{Stream, StreamExt}; use std::pin::Pin; #[async_std::test] pub async fn test_field_features() { #[derive(SimpleObject)] struct MyObj { value: i32, #[field(feature = "bson")] value_bson: i32, #[field(feature = "abc")] ...
true
853ff2f01fbc67c393c3cfefe820e5a223074c9f
Rust
Nugine/nuclear-router
/src/router/captures.rs
UTF-8
1,271
2.984375
3
[ "MIT" ]
permissive
use std::fmt::{self, Debug}; use std::ops::Deref; use std::str::FromStr; use smallvec::SmallVec; pub struct Captures<'a> { path: &'a str, buf: SmallVec<[(&'a str, &'a str); 8]>, } impl Captures<'_> { pub fn get(&self, name: &str) -> Option<&str> { self.buf .iter() .find_ma...
true
3237459e2d8769f210b63aeff8bd612084ee34cb
Rust
huangjiahua/publio
/src/protocol.rs
UTF-8
3,780
2.859375
3
[]
no_license
#![allow(unused)] use std::sync::Arc; use std::io::ErrorKind; use std::io; use tokio::net::TcpStream; use tokio::prelude::*; use tokio::io::{AsyncBufReadExt, BufReader}; use crate::util::*; use crate::channel::Message; #[derive(Clone)] pub enum Action { SubStream, SubPacket, PubStream, PubPacket(Arc<M...
true
2fdbb95140e228fd27b82bf5d478703ef6b9ce4c
Rust
ChaosStudyGroup/rust-web-demo
/src/utility/db.rs
UTF-8
3,849
2.5625
3
[]
no_license
pub mod mysql { use std::time::Duration; use once_cell::sync::OnceCell; use sqlx::{MySqlConnection, MySqlPool, pool::PoolConnection, Transaction}; static MYSQL_POOL: OnceCell<MySqlPool> = OnceCell::new(); pub async fn create_pool() -> MySqlPool { MySqlPool::builder() .min_size...
true
31a7bce36110a8b6f9803a73fb1d6cf81712c9f4
Rust
emirayka/nia_interpreter_core
/src/interpreter/library/read/read_as_function_id.rs
UTF-8
1,930
3.25
3
[ "MIT" ]
permissive
use crate::interpreter::error::Error; use crate::interpreter::value::FunctionId; use crate::interpreter::value::Value; pub fn read_as_function_id(value: Value) -> Result<FunctionId, Error> { let function_id = match value { Value::Function(function_id) => function_id, _ => { return Error...
true
c190c09cfbb500951a03d468507464a5139c78ed
Rust
GH2005/simple-rust-game
/src/physics.rs
UTF-8
2,930
2.90625
3
[]
no_license
use specs::prelude::*; use sdl2::rect::Rect; use crate::components::*; pub type CanvasRegion = Rect; pub type FrameDuration = std::time::Duration; pub struct Physics; fn shift(mut pos: Rect, vel: &Velocity, dur: FrameDuration) -> Rect { match vel.direction { Direction::Left => pos.offset((-vel...
true
2f86f70acda39afc022b7eea19ce6697de980aff
Rust
morph027/mdcat
/src/terminal/osc.rs
UTF-8
5,615
2.796875
3
[ "Apache-2.0" ]
permissive
// Copyright 2018-2019 Sebastian Wiesner <sebastian@swsnr.de> // 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 applicab...
true
c6848d612e19d962e2dff23952fdfb90cd96ba89
Rust
msiemens/RusTiny
/src/back/machine/mod.rs
UTF-8
2,136
2.96875
3
[ "MIT" ]
permissive
//! The `RusTiny` machine description //! use std::fmt; pub mod cconv; #[macro_use] pub mod asm; pub type Word = u64; #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub enum MachineRegister { // General purpose registers RAX, RBX, RCX, RDX, RSI, RDI, R8, R9, R10, R11,...
true
3f89799a6ed86494452271b61c36d7c615838cfe
Rust
guccyon/rust_risc_emu
/src/cpu_emu/register.rs
UTF-8
1,206
3.609375
4
[]
no_license
use num_derive::FromPrimitive; use num_traits::FromPrimitive; #[derive(Debug, Copy, Clone, PartialEq, Eq, FromPrimitive)] pub enum Slot { Reg0, Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, } impl From<u16> for Slot { fn from(from: u16) -> Slot { FromPrimitive::from_u16(from).u...
true
822a0e166e23e167c5f0e38ba4e3719f650d6910
Rust
oshunter/fuchsia
/third_party/rust_crates/vendor/tokio/src/future/pending.rs
UTF-8
901
3.125
3
[ "MIT", "BSD-3-Clause" ]
permissive
use sdt::pin::Pin; use std::future::Future; use std::marker; use std::task::{Context, Poll}; /// Future for the [`pending()`] function. #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"] struct Pending<T> { _data: marker::PhantomData<T>, } /// Creates a future which never resolve...
true
80d81b5d249327ab536fe5d18d27e84724ec63b8
Rust
lhutyra/0dmg
/zerodmg-codes/src/roms/blargg_tests/cgb_sound/mod.rs
UTF-8
924
2.703125
3
[ "MIT" ]
permissive
use crate::assembled::AssembledRom; const CGB_SOUND: &[u8; 0x10000] = include_bytes!("./cgb_sound.gb"); /// Blargg's CGB Sound Test ROM pub fn cgb_sound() -> AssembledRom { let rom = AssembledRom::from_bytes(&CGB_SOUND.to_vec()); if cfg!(debug_assertions) { verify(&rom); } rom } /// A sanity-...
true
7d4d615a06122112959f794e55551d3748c3f7ea
Rust
influxdata/flux
/internal/cmd/headless_repl/src/processes/invoke_go.rs
UTF-8
3,706
2.6875
3
[ "MIT" ]
permissive
use crate::invoke_go::OutputError::InvalidMethod; use crate::processes::process_completion::process_completions_response; use crate::CommandHint; use once_cell::sync::Lazy; use regex::Regex; use serde_json::Value; use std::collections::HashSet; use std::io::Read; use std::process::{Child, ChildStdout, Command, Stdio};...
true
1be089e1f183b21a21f56731936dff865747abb8
Rust
noyez/pueue-lib
/src/network/mod.rs
UTF-8
576
2.546875
3
[ "MIT" ]
permissive
/// Used by the daemon to initialize the TLS certificats. pub mod certificate; /// This contains the main [Message](message::Message) enum and all its structs used to /// communicate with the daemon or client. pub mod message; /// Platform specific code regarding sockets mod platform; /// This is a higher-level abstrac...
true
2f6cf4cb7a3c4d28825c9b232849d48e95af4042
Rust
Azure/azure-sdk-for-rust
/services/mgmt/mpcnetworkfunction/src/package_2023_05_15_preview/models.rs
UTF-8
31,053
2.6875
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 resource management error additional info."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub stru...
true
adb3ab9d044b9e469ea483ba770c09587c53c2b9
Rust
spenserblack/favlist
/src/query_builder.rs
UTF-8
4,430
3.234375
3
[ "Apache-2.0", "MIT" ]
permissive
use std::fmt::{self, Display}; pub struct Sub<'a> { table_name: &'a str, filter_names: Vec<&'a str>, } pub struct Edit<'a> { table_name: &'a str, /// This *should* always be an int, but, for now, will just let `rustqlite` /// handle an invalid value. id: &'a str, column_names: Vec<&'a str>...
true
ba5fc55ed467addfa7c79f11cc834fe209b65a05
Rust
tyleo/libflo
/dep/libflo_module/src/serialization/module_mapper_serde.rs
UTF-8
479
2.6875
3
[ "MIT" ]
permissive
use std::collections::HashMap; #[derive(Clone, Debug, Serialize, Eq, PartialEq)] pub struct ModuleMapperSerde<'a, 'b> { module_map: &'a HashMap<String, usize>, module_list: &'b Vec<String> } impl <'a, 'b> ModuleMapperSerde<'a, 'b> { pub fn new( module_map: &'a HashMap<String, usize>, modul...
true
fa9015c8c8c1d3e40fb2879418e7b4d099324231
Rust
niuez/rust-data-structures
/src/bbstree/splay_tree_array.rs
UTF-8
7,743
2.984375
3
[]
no_license
use std::cmp::Ordering::{ Equal, Greater, Less }; use std::mem; use std::ptr::{ NonNull, self }; use std::alloc::{ Layout, alloc }; pub trait Monoid { fn ope(&self, r: &Self) -> Self; fn ide() -> Self; } pub struct SplayTree<T: Monoid> { root: Link<T> } type Link<T> = Option<NonNull<Node<T>>>; struct No...
true
ced051f2dfe37d282dcde83189b7032d3495a46e
Rust
teraxl/vkrs
/src/lib.rs
UTF-8
3,924
2.59375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
permissive
//! Vkontakte API Rust client library //! //! [![Join the chat at https://gitter.im/kstep/vkrs](https://badges.gitter.im/kstep/vkrs.svg)](https://gitter.im/kstep/vkrs) //! [![Travis CI build status](https://img.shields.io/travis/kstep/vkrs.png)](https://travis-ci.org/kstep/vkrs) //! [![Downloads](https://img.shields.io...
true
5569139ad644d690b11be1d60f31899b2c22baae
Rust
sammyne/encoding-rs
/crates/pem/tests/decode.rs
UTF-8
15,968
2.703125
3
[]
no_license
use std::collections::HashMap; use std::str; use pem::Block; #[test] fn bad_decode() { struct Test { name: &'static str, input: String, } fn new<S>(name: &'static str, input: S) -> Test where S: Into<String>, { Test { name, input: input.into...
true
d504108ec9d2a075ff933e0ab672b03574ed2be5
Rust
WildStriker/advent_of_code_2019_rust
/src/days/day09/mod.rs
UTF-8
1,126
2.90625
3
[]
no_license
use std::error; use std::io; use crate::shared::intcode; pub fn part01<T>(reader: T) -> Result<String, Box<dyn error::Error>> where T: io::BufRead, { let mem = intcode::parse_mem(reader)?; let mut computer = intcode::Computer::new(&mem); let mut last_output = 0; loop { match computer.run(...
true
e57d7f2a42e313a5d51b4db2fe55e12f5a931b17
Rust
VenkatTeja/libra
/ol/types/src/fullnode_counter.rs
UTF-8
1,770
2.6875
3
[ "Apache-2.0" ]
permissive
//! fullnode counter for system address use libra_types::{ access_path::AccessPath, account_config::constants:: CORE_CODE_ADDRESS, }; use anyhow::Result; use move_core_types::{ language_storage::{ResourceKey, StructTag}, move_resource::MoveResource, }; use serde::{Deserialize, Serialize}; use move_core...
true
dc17387f541dfb78d0062cc52cb08cbdc0bda10d
Rust
Coyate/gamedev-notes
/Playground/Rust/hello-rust/src/TRPL/ch14_cargo/Workspace/adder/src/main.rs
UTF-8
122
2.671875
3
[]
no_license
use add_one; use add_two; fn main() { println!("Hello, world! {}", add_one::add_one(1) + add_two::add_two(2)); }
true
1f52e93c105be5bcdc2367c2e9361f928f7bb60e
Rust
DiveFish/utils
/rust2vec-old/src/embeddings.rs
UTF-8
11,406
3.484375
3
[ "Apache-2.0" ]
permissive
use std::cmp::Ordering; use std::collections::hash_map::Entry; use std::collections::{BinaryHeap, HashMap, HashSet}; use std::iter::Enumerate; use std::slice; use failure::Error; use ndarray::{Array1, Array2, ArrayView1, ArrayView2, Axis}; /// A word similarity. /// /// This data structure is used to store a pair con...
true
2036552b5c114eb0102849dd56d4a2e163d2faab
Rust
mefool/euler
/rust_euler/20-40/p027.rs
UTF-8
2,050
3.125
3
[]
no_license
/* Project Euler - Quadratic Primes - Problem 27 rustc p027.rs ./p027 notes: redo using primes package and compare performance references: https://docs.rs/primes/latest/primes/index.html https://docs.rs/primes/latest/src/primes/lib.rs.html#448-453 */ fn main() { if true { println!(...
true
7a57e0b0de0d4c7ae1587af472ce11045fe4a90d
Rust
crossterm-rs/crossterm-winapi
/examples/console.rs
UTF-8
545
2.515625
3
[ "MIT" ]
permissive
#[cfg(windows)] use std::io::Result; #[cfg(windows)] use crossterm_winapi::ConsoleMode; #[cfg(windows)] fn change_console_mode() -> Result<()> { let console_mode = ConsoleMode::new()?; // get the current console mode: let _mode: u32 = console_mode.mode()?; // set the console mode (not sure if this i...
true
f4fec69d38712e169929339b68d14b74fa9dda63
Rust
IThawk/rust-project
/rust-master/src/test/ui/monad.rs
UTF-8
1,200
3.109375
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-other-permissive", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
// run-pass #![allow(non_camel_case_types)] trait vec_monad<A> { fn bind<B, F>(&self, f: F ) -> Vec<B> where F: FnMut(&A) -> Vec<B> ; } impl<A> vec_monad<A> for Vec<A> { fn bind<B, F>(&self, mut f: F) -> Vec<B> where F: FnMut(&A) -> Vec<B> { let mut r = Vec::new(); for elt in self { ...
true
521df30cb558351310211b4919ec11ec1b355af6
Rust
k0nserv/rusttracer
/src/light/mod.rs
UTF-8
947
2.890625
3
[ "MIT" ]
permissive
use color::Color; use intersection::Intersection; use material::Material; use ray::Ray; pub mod directional; pub mod point; pub use self::directional::Directional; pub use self::point::Point; #[derive(Deserialize, Debug, Copy, Clone)] pub enum Falloff { // Light falls off with the inverse square of the distance ...
true
250ad9d11ce3ab934b860866b9a1e25a36a805c4
Rust
petrs/proofmarshal
/hoard/src/load.bak/de/mod.rs
UTF-8
3,274
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
//! Deserialization of pointer-containing types. use core::any::Any; use core::convert::TryFrom; use core::fmt; use core::mem::{self, MaybeUninit}; use core::slice; use owned::Owned; use crate::zone::*; use crate::pointee::*; use super::Freeze; use super::blob::*; use super::en::{Save, Encode}; use super::primitive:...
true
7f11a3f81d271c9ba807af21ac2c62c0e474f6ce
Rust
coinexchain/athena-rust-api
/src/params.rs
UTF-8
3,798
2.609375
3
[ "BSD-2-Clause" ]
permissive
//! Functions related to Route & Params. use super::{native, HostData, HostStr}; pub fn get_route() -> HostStr { unsafe { let mut len: i32 = 0; let ptr = native::sci_get_route_string(&mut len); let bytes: HostData = std::slice::from_raw_parts(ptr, len as usize); let s: HostStr = st...
true
e95b2b28a8b7612eb76b9bd260875e865e96043e
Rust
BurntSushi/aho-corasick
/src/packed/pattern.rs
UTF-8
12,204
3.375
3
[ "Unlicense", "MIT" ]
permissive
use core::{cmp, fmt, mem, u16, usize}; use alloc::{string::String, vec, vec::Vec}; use crate::packed::api::MatchKind; /// The type used for representing a pattern identifier. /// /// We don't use `usize` here because our packed searchers don't scale to /// huge numbers of patterns, so we keep things a bit smaller. p...
true
fadbf6d9cdfc81cb256eb5ef17670c0777f193c3
Rust
vigdail/wizard-wars
/wizardwars_client/src/camera.rs
UTF-8
1,166
2.703125
3
[ "MIT" ]
permissive
use bevy::prelude::*; pub struct CameraTarget; pub struct FollowCamera { pub target: Vec3, pub vertical_offset: f32, pub distance: f32, } pub struct CameraPlugin; impl Plugin for CameraPlugin { fn build(&self, app: &mut AppBuilder) { app.add_system_to_stage( CoreStage::PostUpdate, ...
true
243e6bc4d9f312d7528adf303989afd9b67f5d9f
Rust
michaltakac/bergen-math-simple
/src/main.rs
UTF-8
3,794
2.609375
3
[]
no_license
extern crate tectonic; use std::error::Error; use std::fs::File; use std::io::prelude::*; use std::path::Display; use std::path::Path; #[derive(Debug)] struct Greeting { status: String, content: String, } fn main() { let greeting = Greeting { status: "test".to_string(), content: "another test".to_strin...
true
e5e3f639c9ce2cc74f940d99df519c1387ba3d5d
Rust
namuol/racy
/src/main.rs
UTF-8
8,021
2.5625
3
[]
no_license
#[macro_use] extern crate impl_ops; extern crate rayon; extern crate sdl2; use core::f64::consts::PI; use rand::prelude::thread_rng; use rand::seq::SliceRandom; use rayon::prelude::*; use sdl2::event::Event; use sdl2::keyboard::Keycode; pub mod camera; pub mod material; pub mod plane; pub mod ray; pub mod scene; pub ...
true
10fbad48cab7adf1733579038495a9c7f7c30b6a
Rust
Nemo157/http-service
/src/lib.rs
UTF-8
4,349
3.1875
3
[ "MIT", "Apache-2.0" ]
permissive
//! Types and traits giving an interface between low-level http server implementations //! and services that use them. The interface is based on the `std::futures` API. #![forbid(future_incompatible, rust_2018_idioms)] #![deny(missing_debug_implementations, nonstandard_style)] #![warn(missing_docs, missing_doc_code_ex...
true
04e25a3e99fb60e81678988a9381af36eb43358f
Rust
monkin/rwgl
/src/gl/texture.rs
UTF-8
5,298
2.875
3
[]
no_license
use std::rc::Rc; use std::cell::Cell; use super::gl::{ Gl }; use super::settings::{ Settings }; use web_sys::{ HtmlImageElement, WebGlTexture, WebGlRenderingContext as Context, }; use num_enum::{ TryFromPrimitive, IntoPrimitive, }; #[repr(i32)] #[derive(Clone, Copy, Debug, TryFromPrimitive, IntoPr...
true
8d363d693d6577789dd34ab3a51a88a6d8e4735f
Rust
devil-k/gluesql
/src/executor/execute.rs
UTF-8
9,706
2.65625
3
[ "Apache-2.0" ]
permissive
use { super::{ alter::{create_table, drop_table}, fetch::{fetch, fetch_columns}, select::{select, select_with_labels}, update::Update, validate::{validate_unique, ColumnValidation}, }, crate::{ ast::{Query, SetExpr, Statement, Values}, data::{get_name,...
true
cb2b0f4d67ab2231982e27fef882fad2636f57f0
Rust
astral-engine/astral
/src/math/src/num/prim_unsigned_int.rs
UTF-8
1,909
2.59375
3
[ "Apache-2.0", "MIT" ]
permissive
// Copyright (c) Astral Developers // // 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 t...
true
077e1aa2a3b454b06dee58cf852380c708d78508
Rust
mayflower/xmas-elf
/src/bin/checksec.rs
UTF-8
2,920
2.984375
3
[ "MIT", "Apache-2.0" ]
permissive
extern crate xmas_elf; use std::path::Path; use std::env; use std::process; use xmas_elf::ElfFile; use xmas_elf::dynamic; use xmas_elf::program; use xmas_elf::sections; use xmas_elf::symbol_table::Entry; #[derive(Debug)] enum Relro { None, Partial, Full, } // Note if running on a 32bit system, then readi...
true
df7d9e00b2297baf6905e2347ffd7fd3841bf690
Rust
obsidiansystems/ckb
/ckb-bin/src/subcommand/migrate.rs
UTF-8
1,683
2.640625
3
[ "MIT" ]
permissive
use ckb_app_config::{ExitCode, MigrateArgs}; use ckb_launcher::DatabaseMigration; use crate::helper::prompt; pub fn migrate(args: MigrateArgs) -> Result<(), ExitCode> { let migration = DatabaseMigration::new(&args.config.db.path); if args.check { if migration.migration_check() { return Ok...
true
7f8c8a61b3c15d0e8e16fde0e566e2acbf645930
Rust
jswalden/generate-unicode-data
/tests/generate_unicode_tables_macro.rs
UTF-8
11,022
2.515625
3
[ "MIT" ]
permissive
use generate_unicode_data::generate_unicode_tables; #[cfg(test)] use unicode_info::constants::{ COMBINING_ACUTE_ACCENT, COMBINING_DIAERESIS, COMBINING_MACRON_BELOW, GREEK_CAPITAL_LETTER_IOTA, GREEK_SMALL_LETTER_IOTA_WITH_DIALYTIKA_AND_TONOS, GREEK_SMALL_LETTER_UPSILON_WITH_PSILI, LATIN_CAPITAL_LETTER_H, LAT...
true
e2b8554c11b7c6077f980c6cfb9986630fec2950
Rust
solidsnack/rust-postgres-named-parameters
/examples/parsing.rs
UTF-8
1,746
2.515625
3
[]
no_license
use std::collections::HashMap; extern crate postgres; use postgres::types::ToSql; extern crate postgres_named_parameters; use postgres_named_parameters::*; #[macro_use] extern crate stderr; macro_rules! errhd { ($arg:tt) => (errln!("+-{:->77}", format!(" {}", $arg))); } fn main() { let mut expansions: Hash...
true
0cb17c43204e001791e7f00e659e38c05bdda629
Rust
gzbakku/fdb
/hashcode/src/lib.rs
UTF-8
771
3.375
3
[ "MIT" ]
permissive
pub fn one_is_bigger(one:String,two:String) -> bool { let one_as_num = convert_to_num(one); let two_as_num = convert_to_num(two); if one_as_num.len() > two_as_num.len(){ return true; } if one_as_num.len() < two_as_num.len(){ return false; } let one_as_bytes = one_as_num.into_...
true
0f2351176c8a7233d78ea14514c862a8652c38a9
Rust
andy-hanson/rs
/crates/value/src/shape.rs
UTF-8
2,629
2.90625
3
[]
no_license
use util::arena::{Arena, NoDrop}; use util::dict::{Entry, MutDict}; use model::class::{ClassHead, InstClass, SlotsData}; pub struct ShapeGetter<'model: 'shapes, 'shapes> { arena: &'shapes Arena, class_to_shape: MutDict<InstClass<'model>, Shape<'shapes>>, } impl<'model: 'shapes, 'shapes> ShapeGetter<'model, 'shapes>...
true
89653f04893289ccf0519c4dea31f25e2213e040
Rust
alfavre/caa_encrypted_vault
/src/vault.rs
UTF-8
22,110
2.921875
3
[]
no_license
use super::*; use file_n_metadata::{EncryptedFile, MetaData}; use sodiumoxide::base64::*; use sodiumoxide::crypto::{hash, pwhash, secretbox}; use std::fs::File; use std::io::{BufRead, BufReader, Error, ErrorKind, Write}; ///this should control all access to db #[derive(Debug)] pub struct Vault { metadata_table_pat...
true
aa0157e5105871776528771ca16770883101696a
Rust
timvisee/advent-of-code-2017
/src/main.rs
UTF-8
9,090
2.9375
3
[ "MIT" ]
permissive
extern crate clap; extern crate day01; extern crate day02; extern crate day03; extern crate day04; extern crate day05; extern crate day11; extern crate day12; extern crate day13; mod app; mod arg_handler; mod selection; use std::fs::File; use std::io::prelude::*; use std::io::stdin; use std::path::PathBuf; use std::s...
true
038d59f094ba569d45289d46fdd28d18716e6a78
Rust
UrkelLabs/rsd
/primitives/src/address.rs
UTF-8
10,496
2.96875
3
[]
no_license
use bech32::{u5, FromBase32, ToBase32}; use extended_primitives::Buffer; use handshake_encoding::{Decodable, DecodingError, Encodable}; use std::fmt; use std::str::FromStr; #[cfg(feature = "json")] use encodings::ToHex; #[cfg(feature = "json")] use serde::de::{self, Deserialize, Deserializer, MapAccess, SeqAccess, Vis...
true
704a902c2abc4a676393def6eca08ab133091e0c
Rust
AlexanderFarrell/BuriedPeaceRustWeb
/src/engine_old/realm/mod.rs
UTF-8
3,372
3.15625
3
[]
no_license
use std::collections::{HashMap, HashSet}; use std::fmt::{Debug, Display}; use std::sync::{Arc, Mutex}; use crate::engine_old::data::id_map::IdMap; use crate::engine_old::data::kind_map::KindMap; use crate::wasm_bindgen::__rt::core::any::{Any, TypeId}; use crate::wasm_bindgen::__rt::core::fmt::Formatter; use crate::was...
true
95d5e3b1c007b4fee2030ac1fa0e840483898ff0
Rust
abhishekkr/tutorials_as_code
/talks-articles/languages-n-runtimes/rust/rust-by-example/c02-primitives-N-03custom-types/eg-literals-operators.rs
UTF-8
850
3.59375
4
[ "MIT" ]
permissive
fn main() { println!("1 + 2 = {}", 1u32 + 2); // int addition println!("1 + 2 = {}", 1i32 - 2); // println!("1 + 2 = {}", 1u32 - 2); // can result into overflow println!("hex: {}, octal {}, binary: {}", 0xf, 0o77, 0b1000); // short-circuit boolean println!("true AND flase is {}", true && false...
true
0f6c3863f987b86f16c8c9730f58d133329a7e15
Rust
liljencrantz/crush
/src/lib/stream/count.rs
UTF-8
1,152
2.640625
3
[ "MIT" ]
permissive
use crate::lang::errors::{argument_error_legacy, CrushResult}; use crate::lang::state::contexts::CommandContext; use crate::lang::value::Value; use signature::signature; use crate::lang::value::ValueType; use crate::lang::command::OutputType::Known; #[signature( count, short = "Count the number of rows in the ...
true
df55c4032ff8be7428f3041668eb5a9c453f859e
Rust
scottschroeder/advent_of_code_2019
/src/challenges/day21/mod.rs
UTF-8
1,497
2.828125
3
[ "MIT" ]
permissive
use crate::intcode::run_intcode; use crate::util::parse_intcode; use anyhow::{anyhow as ah, Result}; use std::fmt; const PROG_PT1: &str = include_str!("part1"); const PROG_PT2: &str = include_str!("part2"); pub fn part1(input: &str) -> Result<String> { let score = run_program(input, PROG_PT1)?; Ok(format!("{}...
true
ea7d8dd7bbbbb50d9905b23a8c700d708485e951
Rust
Roybie/VL-interpreter
/tests/arithmetic.rs
UTF-8
3,541
3.359375
3
[ "MIT" ]
permissive
use std::process::Command; #[test] fn int_plus() { let output = Command::new("./target/debug/vl") .arg("-s") .arg("i2;2+w") .output() .unwrap_or_else(|e| { panic!("failed to execute process: {}", e) }); assert!(output.stderr.len() == 0, "stderr shouldn't exist"); assert_eq!(...
true
515021fbbb3ea84c84682ac0ce5d80d8b065b8d5
Rust
neil-lobracco/tracker
/src/server/src/leagues_routes.rs
UTF-8
2,990
2.59375
3
[]
no_license
use super::interface_types::*; use super::models::*; use super::schema::*; use super::*; #[get("/leagues")] pub fn get_leagues(conn: DbConn) -> QueryResult<Json<Vec<responses::League>>> { leagues::table .inner_join(sports::table.on(leagues::sport_id.eq(sports::id))) .select((leagues::all_columns, s...
true
0914fa01a7eec29854e8c8c734d4cb48599790c4
Rust
fdumontmd/adventofcode
/2022/day05/src/main.rs
UTF-8
4,059
3.40625
3
[]
no_license
use itertools::Itertools; use lazy_static::lazy_static; use regex::Regex; static INPUT: &str = include_str!("input.txt"); lazy_static! { static ref MOVE: Regex = Regex::new(r"move (\d+) from (\d+) to (\d+)").unwrap(); } #[derive(Copy, Clone, Debug)] struct Move { count: usize, from: usize, to: usize,...
true
ab49cf95c3d20c1072403b2645de612f8ffb92ea
Rust
microsoft/DiskANN
/rust/diskann/src/model/scratch/concurrent_queue.rs
UTF-8
8,323
3.0625
3
[ "MIT" ]
permissive
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ #![warn(missing_debug_implementations, missing_docs)] //! Aligned allocator use std::collections::VecDeque; use std::ops::Deref; use std::sync::{Arc, Condvar, Mutex, MutexGuard}; use std::time::Duration; use crate:...
true
a5f066b4b56aee9599143b35c1ea1f607378d0e7
Rust
manpat/wasm-toys
/src/string_arena.rs
UTF-8
2,880
2.9375
3
[]
no_license
#![allow(unused_attributes)] use std::{fmt, ops, str, slice}; use crate::*; const INVALID_STRING_SIZE: usize = 0xFFFF_FFFF; struct StringArena { buffer: Vec<u8>, used: usize } impl StringArena { fn new() -> Self { StringArena { buffer: Vec::with_capacity(1024), used: 0 } } fn allocate(&mut self, size: usize)...
true
ba69fdfda82a30b4ad710d653b56187f069643a5
Rust
whitfin/bytelines
/src/util.rs
UTF-8
793
3.203125
3
[ "MIT" ]
permissive
//! Module exposing utility handlers across read types. use std::io::Result; /// Handles a line of input and maps into the provided buffer and returns a reference. pub fn handle_line(input: Result<usize>, buffer: &mut Vec<u8>) -> Option<Result<&[u8]>> { match input { // short circuit on error Err(e...
true
f06133c2822551167278dc8fc827f99c6d8f9936
Rust
Aceeri/amethyst
/src/ecs/resources/broadcaster.rs
UTF-8
2,185
3.421875
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! This module contains `Broadcaster` struct which allows publishing and //! polling specs entities. It is primarily used for event handling. //! //! # Example: //! ``` //! extern crate amethyst; //! //! use amethyst::ecs::{Component, VecStorage, Join}; //! use amethyst::ecs::resources::Broadcaster; //! //! struct Use...
true
3b18cb13fa47cf7aae7797738ff064bc80a15125
Rust
rosie-home-automation/garage_rfid
/src/configuration.rs
UTF-8
1,530
2.71875
3
[ "MIT" ]
permissive
use config::{ Config, ConfigError, File }; #[derive(Debug, Deserialize)] pub struct DatabaseConfiguration { pub url: String } #[derive(Debug, Deserialize)] pub struct LoggingConfiguration { pub level: String, pub log_file_path: String } #[derive(Debug, Deserialize)] pub struct GarageDoorConfiguration { pub o...
true
f0e770f671f20ee23134e4143e3badd3fba4e1bf
Rust
robwil/actix-todo
/src/db.rs
UTF-8
2,220
2.640625
3
[]
no_license
use crate::models::{TodoItem, TodoList}; use deadpool_postgres::Client; use std::io; use tokio_pg_mapper::FromTokioPostgresRow; pub async fn get_todos(client: &Client) -> anyhow::Result<Vec<TodoList>> { let statement = client .prepare("select * from todo_list order by id desc") .await?; let lis...
true
2bd14023d5d3e9b66b08f316c99d9ca7d705108c
Rust
ZcashFoundation/zebra
/zebra-consensus/src/primitives/groth16/params.rs
UTF-8
8,443
2.765625
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
permissive
//! Downloading, checking, and loading Groth16 Sapling and Sprout parameters. use std::path::{Path, PathBuf}; use bellman::groth16; use bls12_381::Bls12; use zcash_proofs::SaplingParameterPaths; use crate::BoxError; /// The timeout for each parameter file download, in seconds. /// /// Zebra assumes that it's runnin...
true
951ce2aeedcf2dd1c60f6deb148159069d42015f
Rust
JoowonYun/hycon-rust
/src/common/transaction.rs
UTF-8
1,193
2.53125
3
[ "MIT" ]
permissive
use std::error::Error; use crate::common::address::{Address, ValidAddress}; use crate::util::hash::hash; use secp256k1::{Error as SecpError, Message, RecoverableSignature, RecoveryId, Secp256k1}; pub fn verify_tx( encoding: Vec<u8>, signer: Address, signature: RecoverableSignature, ) -> Result...
true
9a768c111f53e3ef611d10b0cf47945c54ec1e81
Rust
martinsotirov/access_control
/src/macros.rs
UTF-8
1,174
3.03125
3
[ "MIT", "Apache-2.0" ]
permissive
#[macro_export] macro_rules! check_rights { ($roles:expr => $rights:tt) => ( for right in &$rights { let right = Right::from_pattern(right); if !$roles.execute_right(right) { return Err(Status::Unauthorized) } } ) } #[cfg(test)] mod tests { ...
true
92e898bd69c9e311016ad865a45361034ed32286
Rust
esovm/esolangs-guricerin
/whitespace-rs/src/instruction.rs
UTF-8
369
2.65625
3
[ "MIT" ]
permissive
#[derive(Debug, Clone)] pub enum Instruction { Push(i64), Dup, Copy(i64), Swap, Discard, Slide(i64), Add, Sub, Mul, Div, Mod, HeapWrite, HeapRead, Label(String), Call(String), Jump(String), JumpZero(String), JumpNeg(String), Return, Exit, ...
true
e07d29f6b698b7c54d50c6ec0a53a4a9ef2956f6
Rust
Elinvynia/portion-rs
/src/impls.rs
UTF-8
879
2.765625
3
[ "Apache-2.0", "MIT" ]
permissive
use std::fmt::Display; pub trait Item: Sized + Ord + Copy + Display { fn next(self) -> Self { unimplemented!() } fn next_ref(self) -> Self { unimplemented!() } fn prev(self) -> Self { unimplemented!() } fn minimum(self) -> Self { unimplemented!() } ...
true
3ef63290ebf19214724b641f09db6862a0dd81fe
Rust
HerringtonDarkholme/leetcode
/src/1790_are_almost_equal.rs
UTF-8
879
2.859375
3
[]
no_license
impl Solution { pub fn are_almost_equal(s1: String, s2: String) -> bool { let mut mismatch1 = -1; let mut mismatch2 = -1; if s1.len() != s2.len() { return false; } let s1 = s1.as_bytes(); let s2 = s2.as_bytes(); for i in 0..s1.len() { i...
true
4576a420cd887aa73a1ffb117fac957084d5ba4d
Rust
Herschel/AdventOfCode2016
/day18/src/main.rs
UTF-8
1,849
3.21875
3
[]
no_license
#![feature(conservative_impl_trait)] extern crate bit_vec; use bit_vec::BitVec; fn main() { let args = std::env::args().collect::<Vec<_>>(); let input_row = args.get(1).expect("Need input parameter"); let num_rows = args.get(2).unwrap().parse::<usize>().unwrap(); let mut row_a = BitVec::from_fn(input_...
true
61a3bf8b5c24a9a4f2c57341f6277d3bfddf84c0
Rust
federicomenaquintero/idchoppers
/src/map.rs
UTF-8
14,585
2.953125
3
[ "MIT" ]
permissive
use super::BareDoomMap; use super::geom::{Coord, Point, Rect, Size}; use std::collections::HashMap; use std::marker::PhantomData; use std; // TODO // map diagnostics // - error: // - info: unused vertex // - info: unused side // - info: sector with no sides // - info: thing not in the map (polyobjs excluded) /// A...
true
7d0e0581aa1b9d6cbe99ce254ba1a10c2a950f4b
Rust
ckuenzi/AoC
/aoc_2018/aoc_9_2/src/main.rs
UTF-8
1,063
2.75
3
[ "Unlicense" ]
permissive
fn main() { let players = 428; let marbles = 7082500; let mut id_getter = (1..).into_iter(); let mut player = 0; let mut scores: Vec<u64> = vec![0; players]; let mut circle = vec![(0, 0, 0); marbles]; let mut id = 0; for marble in 1..=marbles { if marble % 23 == 0 { ...
true
ee1544bc098c5016dd27c8df6724917b7a0c14fc
Rust
gterzian/libra
/secure/storage/src/storage.rs
UTF-8
1,462
3
3
[ "Apache-2.0" ]
permissive
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{Error, Permissions, Value}; /// Libra interface into storage. Create takes a set of permissions that are enforced internally by /// the actual backend. The permissions contain public identities that the backend can transla...
true
7e7708410adf41be01b2d1406f158a96d720ac67
Rust
CarlosLanderas/igdb-rs
/examples/game_media_download.rs
UTF-8
2,054
2.8125
3
[ "Apache-2.0", "MIT" ]
permissive
use async_std::task; use igdb_rs::client::IGDBClient; use igdb_rs::media_quality::MediaQuality; fn main() { task::block_on(async { // All media clients like screenshots, covers, artworks, etc can be downloaded to disk // by using download_by_id method // Yoy can also read them as a bytes bu...
true
47de1dbd4ca257cdaf9a9e192454577f9046d21b
Rust
vedantprajapati/VDatabase
/Concurrent Database/packet.rs
UTF-8
13,629
3.015625
3
[]
no_license
/* * packet.rs * * Implements packet sending and receiving * * University of Toronto * 2019 */ use std::mem; use std::io; /* The foreign key is a reference to a row id in a separate table */ #[derive(Debug, PartialEq, PartialOrd)] pub enum Value { Null, Integer(i64), Float(f64), Text(String), ...
true
fc6f4713fc06dc5f03a19362c141f44a0637ae63
Rust
valarx/raytracer
/src/ray_tracing.rs
UTF-8
6,125
3.046875
3
[ "MIT" ]
permissive
use crate::material::Material; use crate::vec_math::{Color, Point3, Vec3}; use rand::prelude::ThreadRng; pub struct Ray { pub origin: Point3, pub direction: Vec3, } pub trait Hittable { fn hit(&self, ray: &Ray, t_bounds: (f64, f64)) -> Option<HitRecord>; } //#[derive(Clone, Copy)] pub struct HitRecord { ...
true
fe54c1d75eb36bc8d2208feca060494c968b754f
Rust
bartfrenk/sandbox
/advent-of-code-2018/rust/day14/src/main.rs
UTF-8
1,812
3.40625
3
[]
no_license
use std::env; #[derive(Debug)] struct State { score: Vec<u8>, elves: [usize; 2], } fn digits(n: u8) -> Vec<u8> { let mut rem = n; let mut ds: Vec<u8> = Vec::new(); if rem > 0 { while rem > 0 { ds.push(rem % 10); rem = rem / 10; } } else { ds.push...
true
f8ac8b2502da85aa58baeb55be72a4fd0934b87b
Rust
RutgerMoons/ggez_snake
/src/main.rs
UTF-8
2,007
2.546875
3
[]
no_license
// based on https://github.com/ggez/ggez/blob/master/examples/04_snake.rs // Imports use ggez; use ggez::event::{KeyCode, KeyMods}; use ggez::{event, graphics, Context, GameResult}; use std::time::{Duration, Instant}; // mod mod game_entity; use crate::game_entity::{grid,types}; mod renderer; use crate::renderer::r...
true
8dbb546c4c4c94b5e1a907d552539570040a3ab9
Rust
pimeys/opentelemetry-test
/src/main.rs
UTF-8
3,346
2.578125
3
[]
no_license
use std::{collections::HashMap, convert::Infallible, net::SocketAddr, thread, time::Duration}; use hyper::{ server::Server, service::{make_service_fn, service_fn}, Body, Client, Request, Response, Uri, }; use opentelemetry::global; use opentelemetry_jaeger::{Propagator, Uninstall}; use structopt::StructOpt...
true
707eed0147adeb50650c723e726e2d1a60b1b760
Rust
heartyhardy/aoc-2016-day-8-rust-wasm
/src/lib.rs
UTF-8
5,000
3.171875
3
[ "MIT", "Apache-2.0" ]
permissive
mod data; mod utils; use wasm_bindgen::prelude::*; // 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; #[wasm_bindgen] #[repr(u8)] #[derive(Copy, Clone, PartialEq, Eq, ...
true
eb9691db8617fe0353e08888f58d5e2467fd8892
Rust
eugene-shiyanov/rust
/data_structures/lafore/ch3/object_sort/src/main.rs
UTF-8
617
2.828125
3
[]
no_license
mod person; mod array_in_ob; fn main() { let mut arr = array_in_ob::ArrayInOb::new(); arr.insert("Evans", "Patty", 24); arr.insert("Smith", "Lorraine", 37); arr.insert("Yee", "Tom", 43); arr.insert("Adams", "Henry", 63); arr.insert("Hashimoto", "Sato", 21); arr.insert("Stimson", "Henry", 2...
true
3402ae3b86283015bbfc52ce2a632b71b97087a4
Rust
ammarfaizi2/wana_kana_rust
/src/utils/is_char_kana.rs
UTF-8
634
3.6875
4
[ "MIT" ]
permissive
use crate::utils::is_char_hiragana::*; use crate::utils::is_char_katakana::*; /// Tests a character. Returns true if the character is [Hiragana](https://en.wikipedia.org/wiki/Hiragana) or [Katakana](https://en.wikipedia.org/wiki/Katakana). /// pub fn is_char_kana(char: char) -> bool { is_char_hiragana(char) || is...
true
6cec4c99533796b3c45cdcdceb2a60f31616b10e
Rust
PurpleMyst/lazyminer
/mcserver/src/coder/de.rs
UTF-8
5,632
2.765625
3
[]
no_license
use std::{io::Read, mem::size_of}; use serde::de::{self, Deserialize, Visitor}; use super::{ super::objs::VarInt, error::{Error, Result}, }; pub struct Deserializer<R: Read>(R); impl<R: Read> Deserializer<R> { pub fn new(r: R) -> Self { Self(r) } } macro_rules! de_int { ($($name:ident: ...
true
a4e82cce03fb9c9b41fb9714e6682b3140fc137b
Rust
Comcast/Bynar
/src/test_hardware.rs
UTF-8
6,108
2.640625
3
[ "Apache-2.0" ]
permissive
use crate::ConfigSettings; use helpers::{error::BynarError, error::BynarResult, error::HardwareError}; use libredfish::{ common::Status, manager::Manager, power::Power, storage::ArrayController, storage::DiskDrive, storage::Hardware, storage::StorageEnclosure, thermal::Thermal, *, }; use log::debug; use reqwest...
true
4c4e98024da278c7635b380207f210e9a82be074
Rust
wg/rusoto
/rusoto/core/src/proto/json/payload.rs
UTF-8
920
2.75
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use bytes::Bytes; use log::*; use serde::de::DeserializeOwned; use serde_json::from_slice; use super::super::super::request::BufferedHttpResponse; use super::super::super::RusotoError; pub struct ResponsePayload { body: Bytes, } impl ResponsePayload { pub fn new(res: &BufferedHttpResponse) -> Self { ...
true
7e56d74055c3c3836698d77088012cebf5962c6f
Rust
sabartheman/Rust_huffman_parallel
/src/main.rs
UTF-8
16,368
3.625
4
[]
no_license
extern crate time; extern crate crossbeam; use time::*; use std::fs::File; use std::fs::OpenOptions; use std::path::Path; use std::error::Error; use std::io::prelude::*; use std::collections::HashMap; use std::io::{Write,BufWriter}; ////////////////////////////////////////////////////////////////////////////////////...
true
5e0f12469702d63ff3a0383b3e6ae8cc75155585
Rust
totorowechat/leetcode_rust
/src/n0007_reverse_integer.rs
UTF-8
1,457
3.46875
3
[ "MIT" ]
permissive
// pub fn reverse(x: i32) -> i32 { // let mut x = x; // let mut rev: i32 = 0; // // if (rev > INT_MAX/10 || (rev == INT_MAX / 10 && pop > 7)) return 0; // // if (rev < INT_MIN/10 || (rev == INT_MIN / 10 && pop < -8)) return 0; // while x != 0 { // let pop = x % 10; // x /= 10; // ...
true
0a15a2b00e5400fd942497d5d9b60c78508fc3b8
Rust
arch-yzk/Rust
/ch5/ch5-3/move2.rs
UTF-8
318
3.78125
4
[]
no_license
fn main() { let name = String::from("Alice"); println!("関数を呼び出す"); introduce(name);//所有権の移動 println!("関数処理が終了しました"); } fn introduce(myname: String) { println!("私の名前は{}です", myname); //終了しても所有権は再移動しない }
true
03252d9ba5271c7e88e2c5a42253b8f835a32a58
Rust
LucFauvel/recover-rs
/src/recover.rs
UTF-8
1,126
3.03125
3
[ "MIT" ]
permissive
use std::io; use crate::utils::message_consts::WELCOME_MESSAGE; pub struct Recover { term: console::Term, } impl Recover { pub fn new() -> Self { Recover { term: console::Term::stdout(), } } pub fn run(&self) -> io::Result<()> { self.show_welcome_mes...
true
00c4f01c54306fc40d073983f5b1252c2812b4c7
Rust
bhaibel/constellation_bot
/src/color.rs
UTF-8
1,189
3.59375
4
[ "MIT" ]
permissive
pub struct Rgb { r: u8, g: u8, b: u8 } pub struct Hsl { pub h: u16, pub s: u8, pub l: u8 } impl Rgb { pub fn as_hex(&self) -> String { format!("#{:x}{:x}{:x}", self.r, self.g, self.b) } } impl Hsl { pub fn as_rgb(&self) -> Rgb { // add special case later for 0-sat...
true
874e26eba0b104fd1c4b7471e2ff381cfb37e4a2
Rust
theduke/rust
/src/test/run-pass/issue-14229.rs
UTF-8
687
2.5625
3
[ "MIT", "NCSA", "ISC", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-3-Clause", "BSD-2-Clause", "Unlicense", "LicenseRef-scancode-other-permissive" ]
permissive
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
true
cebe52271c2a376e63baa1a21ed813c6b5ae301e
Rust
snapcraft-docs/xsv
/src/cmd/sample.rs
UTF-8
4,126
3.078125
3
[ "Unlicense", "MIT" ]
permissive
use std::io; use csv; use rand::Rng; use CliResult; use config::{Config, Delimiter}; use index::Indexed; use util; static USAGE: &'static str = " Randomly samples CSV data uniformly using memory proportional to the size of the sample. When an index is present, this command will use random indexing if the sample siz...
true
40c2a3f77d1d7d2816f4764e4dcf10951f044b61
Rust
LuisTessaro/Rust-Dump
/Enum/Enums with implemented funcs.rs
UTF-8
320
3.140625
3
[]
no_license
#[derive(Debug)] enum IpAddr { V4(String), V6(String), } impl IpAddr { fn print_self(&self) { println!("{:?}", self); } } fn main() { let home = IpAddr::V4(String::from("127.0.1.15")); let loopback = IpAddr::V6(String::from("::1")); home.print_self(); loopback.print_self(); }
true
6ea3e1633fc2c4cd93718902aa135686f97ac385
Rust
svmk/rust-chrono-utils
/src/formatter/format_w3c.rs
UTF-8
853
3.140625
3
[ "MIT" ]
permissive
use chrono::DateTime; use chrono::FixedOffset; use chrono::Timelike; /// Returns an W3C date and time string such as `1996-12-19T16:39:57Z`. pub fn format_w3c(datetime: &DateTime<FixedOffset>) -> String { let mut format = String::from("%FT%T"); let offset = datetime.timezone().local_minus_utc(); if datetime...
true
7261a094ebeb0d05606924917398f7b69923dfc4
Rust
newsboat/newsboat
/rust/libnewsboat-ffi/src/fslock.rs
UTF-8
988
2.546875
3
[ "MIT", "CC-BY-4.0" ]
permissive
use libnewsboat::fslock; use std::path::Path; // cxx doesn't allow to share types from other crates, so we have to wrap it // cf. https://github.com/dtolnay/cxx/issues/496 struct FsLock(fslock::FsLock); #[cxx::bridge(namespace = "newsboat::fslock::bridged")] mod bridged { extern "Rust" { type FsLock; ...
true