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
989a1e3b0edb43e06c1ea888fd12434b69890f34
Rust
sagiegurari/envmnt
/src/types_test.rs
UTF-8
693
2.921875
3
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
use super::*; #[test] fn list_options_new() { let options = ListOptions::new(); assert!(options.separator.is_none()); assert!(!options.ignore_empty); } #[test] fn expand_options_new() { let options = ExpandOptions::new(); assert!(options.expansion_type.is_none()); assert!(options.default_to_...
true
bc433b2c506bf7f8d00853ccf2c3754b0bd9f45c
Rust
andrewgazelka/RustOpenStreetMap
/src/bidirectional/bi_astar.rs
UTF-8
3,389
2.578125
3
[]
no_license
use std::collections::{BinaryHeap, HashMap}; use std::sync::mpsc::Sender; use crate::a_star::{HeapNode, Path}; use crate::bidirectional::middleman::Middleman; use crate::bidirectional::path_constructor::PathConstructor; use crate::osm_parser; use crate::osm_parser::{OpenStreetMap, Node}; use crate::params::Params; pu...
true
1c50d5b1bb2e48b902354744b91faefda4779fff
Rust
ARK2022020/sandbox
/rust-examples/functions/src/main.rs
UTF-8
387
3.40625
3
[ "MIT" ]
permissive
fn main() { print_number(5); print_number(add_one(5)); let mut y = 5; let x = (y = 6); let f: fn(i32) -> i32; let f = add_one; print_number(f(f(5))); oops(); } fn oops() -> ! { panic!("x_x"); } fn foo(x: i32) -> i32 { return x; x + 1 } fn print_number(x: i32) { p...
true
e8ff262750772821a541f730ee45564518f15f07
Rust
gubbu/rust_rock_paper_scissors_automata_macroquad
/src/main.rs
UTF-8
5,835
3.015625
3
[]
no_license
use macroquad::prelude::*; const ROCK: u8 = 1; const PAPER: u8 = 2; const SCISSORS: u8 = 3; const EMPTY: u8 = 0; const THRESHHOLD: usize = 3; const GAMEWIDTH: usize = 125; const GAMEHEIGHT: usize = 125; type GAME = [[u8; GAMEWIDTH]; GAMEHEIGHT]; fn winner(player1: u8, player2: u8) -> u8 { if player1 == PAPER && p...
true
6a3cb1beee2431def14f167a5ac7b72bf470e0c1
Rust
ZcashFoundation/zebra
/zebra-rpc/src/methods/get_block_template_rpcs/types/subsidy.rs
UTF-8
2,373
2.75
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
permissive
//! Types for the `getblocksubsidy` RPC. use zebra_chain::{ amount::{Amount, NonNegative}, transparent, }; use zebra_consensus::{funding_stream_recipient_info, FundingStreamReceiver}; use crate::methods::get_block_template_rpcs::types::zec::Zec; /// A response to a `getblocksubsidy` RPC request #[derive(Clon...
true
e23fd4f8fd72ae8a8098e378395b2fa9f19689fc
Rust
shigedangao/markdown
/src/tests/token.rs
UTF-8
10,409
3.25
3
[]
no_license
#[cfg(test)] mod textual { use crate::token; use crate::token::tag::{TagToken, TagOperator, TagMeta}; use crate::parser::heading; #[test] fn parse_markdown_blockquote() { let content = " > Hello my name is xiao I love eating baozi "; let res = token...
true
728e74408ae9f1d13e755f8dccc62a626d7b4277
Rust
Fludixx/gnome-osd
/src/shell.rs
UTF-8
1,714
2.578125
3
[]
no_license
use std::{error::Error, time::Duration}; use dbus::{arg::messageitem::MessageItem, blocking::Connection, Message}; const DBUS_SERVICE_NAME: &'static str = "org.gnome.Shell"; const DBUS_INTERFACE: &'static str = "org.gnome.Shell"; const DBUS_OBJECT_PATH: &'static str = "/org/gnome/Shell"; const TIMEOUT: Duration = Dur...
true
ef2b1bff6cd8b661c7b5978f7db72e97f0f038fb
Rust
soarlab/rust-benchmarks
/benchmarks/smack-regressions/functions/double_fail.rs
UTF-8
237
2.59375
3
[ "MIT" ]
permissive
// @expect error fn double(a: u32) -> u32 { a * 2 } pub fn main() { let a = verifier::nondet!(2u32); verifier::assume!(a <= std::u32::MAX / 2); // avoid overflow let b = double(a); verifier::assert_ne!(b, 2 * a); }
true
c4edd936332d1287168fad4cb2171573463d4ad4
Rust
OhadRau/rust-os
/kern/src/shell.rs
UTF-8
20,594
2.53125
3
[]
no_license
use shim::io; use shim::path::{PathBuf, Component}; use alloc::string::String; use stack_vec::StackVec; use pi::atags::Atags; use fat32::traits::{Dir, Entry, FileSystem, Metadata, BlockDevice}; use fat32::vfat::BiosParameterBlock; use fat32::mbr::MasterBootRecord; use blockdev::mount::*; use aes128::edevice::Encrypt...
true
96d71e40b3cae55809b1c209431e7431a7aca32e
Rust
cam-parra/libsovtoken
/libsovtoken/src/logic/parsers/parse_payment_response.rs
UTF-8
8,494
2.59375
3
[ "Apache-2.0" ]
permissive
//! types used for parse_payment_response_handler use utils::ErrorCode; use logic::address::add_qualifer_to_address; use logic::input::Inputs; use logic::output::Outputs; use logic::parsers::common::{ResponseOperations, UTXO, TXO, T...
true
c460c60ef284e4a98c6e4b93ae939f2fedfa5f01
Rust
Munksgaard/cryptopals
/chal17/src/main.rs
UTF-8
9,362
2.78125
3
[]
no_license
extern crate rand; extern crate base64; extern crate raes; extern crate pkcs7pad; use raes::{cbc, aes}; use rand::Rng; static ENCRYPTED_STRINGS: [&'static [u8]; 10] = [b"MDAwMDAwTm93IHRoYXQgdGhlIHBhcnR5IGlzIGp1bXBpbmc=", b"MDAwMDAxV2l0aCB0aGUgYmFzcyBraWNrZWQgaW4gYW5kIHRoZSBWZWdhJ3MgYXJlIHB1bXBpbic=", b"...
true
aa83481be9b499f3916ba52d9cc8eca312d56aad
Rust
quodlibetor/lasagna-demo
/89-multi-crate-redis-cache/src/lib.rs
UTF-8
1,439
2.6875
3
[]
no_license
#![feature(rust_2018_preview, nll)] #![warn(rust_2018_compatibility, rust_2018_idioms)] use redis::{Commands, RedisError, RedisResult}; use remote_cache::{RemoteCache, RemoteInsert}; pub struct RedisCache { conn: redis::Connection, } impl RedisCache { pub fn new(redis_url: &str) -> redis::RedisResult<RedisC...
true
447017823c0165ecb817d22003db7e069c826647
Rust
srfraser/taskchampion
/cli/src/settings.rs
UTF-8
1,376
2.546875
3
[ "MIT" ]
permissive
use config::{Config, Environment, File, FileSourceFile}; use failure::Fallible; use std::env; use std::path::PathBuf; pub(crate) fn read_settings() -> Fallible<Config> { let mut settings = Config::default(); // set up defaults if let Some(mut dir) = dirs::data_local_dir() { dir.push("taskchampion"...
true
c974da23e77f41c13d0e7decf75d8cfa0d40731e
Rust
merelvandegraaf/Scheduling_Rust
/scheduling/src/modules/task.rs
UTF-8
4,833
3.40625
3
[]
no_license
/// A task object #[derive(PartialEq, Clone, Copy, Eq)] pub struct Task { machine_id: u16, duration: u16, current_progress: u16, pub task_completed: bool, latest_start_time: u16, } impl Task { /// Returns a new Task object /// /// # Arguments /// /// * `a_machine_id` - A id...
true
007ae2ded21c253926ad3dc5bb0cd226e984bece
Rust
hyunsik/radish
/src/react/example.rs
UTF-8
1,081
2.578125
3
[ "Apache-2.0" ]
permissive
pub enum Payload<M> { Message<M>, Ask<M> } pub enum NodeProtocol { UpdateRequest UpdateResponse } pub enum NodeErr { } pub struct NodeManager { eb: &EventBus } impl NodeManager for Actor { fn on_ask(&self, msg: &NodeProtocol) -> Result<NodeProtocol, NodeErr> { match msg { Update => Ok(bu...
true
365cd62444b50bbd6a46cbea57994e0f4a813656
Rust
tomc1998/rs-proc-gen-experiment
/src/comp/visual/fx.rs
UTF-8
365
3.140625
3
[]
no_license
use specs::*; /// Apply a tint to this entity when drawing. This will apply to StaticSprite /// and AnimSprite components. #[derive(Component)] #[storage(HashMapStorage)] pub struct Tint { pub col: [f32; 4], } /// Visually rotate whatever we're rendering #[derive(Component)] pub struct Rot { /// Rotation in r...
true
5419be45b443d39402b22f14ff1f135f9d1526d9
Rust
arkada38/Rust-Design-Patterns
/examples/structural_adapter_chief.rs
UTF-8
216
2.703125
3
[ "MIT" ]
permissive
use design_patterns::structural::adapter::chief::{Chief, ChiefAdapter}; fn main() { let chief = ChiefAdapter::new(); let price = chief.get_cost(); chief.make_dinner(); chief.take_money(price + 5); }
true
b86c73a5b647768a051788e9fc5add7e62aa58fb
Rust
valarauca/dice_backend
/dice_backend/src/parser_output/operation.rs
UTF-8
1,384
3.9375
4
[]
no_license
use std::fmt; /// Operations are things we do to numbers #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Operation { Add, Sub, Mul, Div, Or, And, Equal, GreaterThan, LessThan, GreaterThanEqual, LessThanEqual, NotEqual, } impl fmt::Display for...
true
19223426da71d5a5ce59b2160e20a7c4c8dae640
Rust
astro/rust-lpc43xx
/src/ssp0/ris/mod.rs
UTF-8
3,848
3
3
[ "Apache-2.0" ]
permissive
#[doc = r" Value read from the register"] pub struct R { bits: u32, } impl super::RIS { #[doc = r" Reads the contents of the register"] #[inline] pub fn read(&self) -> R { R { bits: self.register.get(), } } } #[doc = r" Value of the field"] pub struct RORRISR { bits: ...
true
d59744a1fefc66ea67230d260d7cd1ebe1ba1683
Rust
ipetkov/conch-runtime
/conch-runtime-tests/tests/eval_concat.rs
UTF-8
4,288
2.84375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
#![deny(rust_2018_idioms)] mod support; pub use self::support::*; async fn assert_eval_equals_single(expected: &str, words: Vec<MockWord>) { assert_eval_equals_fields(Fields::Single(expected.into()), words).await; } async fn assert_eval_equals_fields(fields: Fields<String>, words: Vec<MockWord>) { let cfg = ...
true
b4b5c65e16638197046beab63ff252a63536a077
Rust
yvt/farcri-rs
/src/utils/strs.rs
UTF-8
618
3.390625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! `str` utilities /// Find the byte offset of the first scalar value before `i` in a given byte /// slice assumed to be a UTF-8 string. Returns `0` if there is no such /// scalar value. /// /// `i` must be on a scalar boundary. pub fn utf8_str_prev(s: &[u8], mut i: usize) -> usize { debug_assert!(i <= s.len()); ...
true
43315040bcd56c191d769ca543abc046517d4796
Rust
sidvishnoi/leetcode-rust
/0258-add-digits.rs
UTF-8
350
3.296875
3
[]
no_license
struct Solution; impl Solution { pub fn add_digits(num: i32) -> i32 { if num > 9 { Self::add_digits(num / 10 + num % 10) } else { num } } } fn main() { assert_eq!(2, Solution::add_digits(38)); assert_eq!(9, Solution::add_digits(999)); assert_eq!(1, S...
true
d18f98bcf1fb539dd8cc282dafd5d1d5759a6675
Rust
watashi/AlgoSolution
/codeforces/ac/16/1625/E2.rs
UTF-8
3,538
3
3
[]
no_license
use std::*; pub struct BIT<T>(Vec<T>); impl<T: Clone + Copy + Default + ops::AddAssign + ops::Sub<Output = T>> BIT<T> { pub fn new(n: usize) -> Self { Self(vec![Default::default(); n + 1]) } pub fn add(&mut self, mut i: usize, v: T) { i += 1; while i < self.0.len() { s...
true
996329cb39889e93c1afda132719671575e295ce
Rust
AndrewTweddle/CodingExercises
/AdventOfCode/aoc2021/src/bin/day5_problem1.rs
UTF-8
2,067
3.453125
3
[]
no_license
use std::fs::File; use std::io::{BufRead, BufReader}; #[derive(Copy, Clone)] struct Point { x: usize, y: usize, } #[derive(Copy, Clone)] struct Line { from: Point, to: Point, } fn main() { let lines: Vec<Line> = get_lines() .iter() .filter(|line| line.from.x == line.to.x || line.f...
true
f13abf4a5fa77cc3a0eb38314c5c767c309a243d
Rust
iancormac84/hexae
/src/lib.rs
UTF-8
1,541
2.8125
3
[]
no_license
use nalgebra::Point2; use std::f64; mod coord; mod hex; mod layout; mod orientation; pub use coord::*; pub use hex::{hex_linedraw, hex_round, FractionalHex, Hex}; pub use layout::*; pub use orientation::*; pub fn hex_to_pixel(layout: Layout, hex: Hex) -> Point2<f64> { let m: &Orientation = &layout.orientation; ...
true
88af31774eb0c7c2b7ee726dccd005be4a3fa22a
Rust
fire-lib/fire-postgres
/fire-postgres/src/table/column/mod.rs
UTF-8
5,777
2.984375
3
[ "Apache-2.0", "MIT" ]
permissive
mod column_type; pub use column_type::{ColumnType, FromDataError}; mod data; pub use data::ColumnData; #[derive(Debug, Clone, PartialEq)] pub struct Column { pub name: &'static str, pub kind: ColumnKind, pub index: IndexKind } impl Column { pub fn new<T>(name: &'static str, len: Option<usize>, index: IndexKin...
true
a728619010106215e971e371bd503e36c44318b6
Rust
EFanZh/LeetCode
/src/problem_0968_binary_tree_cameras/dynamic_programming.rs
UTF-8
1,956
3.03125
3
[]
no_license
use crate::data_structures::TreeNode; pub struct Solution; // ------------------------------------------------------ snip ------------------------------------------------------ // use std::cell::RefCell; use std::rc::Rc; struct State { directly: u32, indirectly: u32, children_only: u32, } impl Solution...
true
87dae86b47af8bfe579684c2c3474042243cbc58
Rust
EFanZh/LeetCode
/src/problem_0290_word_pattern/hash_map.rs
UTF-8
1,310
3.0625
3
[]
no_license
pub struct Solution; // ------------------------------------------------------ snip ------------------------------------------------------ // use std::collections::HashMap; impl Solution { pub fn word_pattern(pattern: String, s: String) -> bool { let mut pattern_to_word = HashMap::new(); let mut ...
true
7e83effa62dc810c8decd79fcd8d6052ba0ee186
Rust
IThawk/rust-project
/rust-master/src/test/ui/nullable-pointer-iotareduction.rs
UTF-8
2,073
3.171875
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
// run-pass #![feature(box_syntax)] // Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions, // which "says that a destructor applied to an object built from a constructor // behaves as expected". -- http://coq.inria.fr/doc/Reference-Manual006.html // // It's a little more complicated here, becau...
true
b69df38452e584498ce5f12986b894f40f3c6d98
Rust
mkb2091/msolve
/src/consts.rs
UTF-8
1,259
2.578125
3
[ "MIT" ]
permissive
use crate::*; pub const fn cells_in_house(square: usize) -> [u8; 20] { let column_start = square % 9; let row_start = square - column_start; let box_start = square / 3 % 3 * 3 + square / 27 * 27; let mut squares_to_change: u128 = 0; squares_to_change |= ((1 << 9) - 1) << row_start; squares_to_c...
true
e2fdd479d27af83807042e4a3cce9985cd577fea
Rust
eoan-ermine/X-Macro
/src/action/mod.rs
UTF-8
1,347
3.015625
3
[ "MIT" ]
permissive
use inputbot::KeySequence; use inputbot::MouseWheel; use inputbot::MouseCursor; use inputbot::MouseButton; use inputbot::KeybdKey; //use inputbot::KeySequence; pub enum Attribute { WhilePressed, } #[derive(Debug, PartialEq)] pub enum Orientation { Horizontal, Vertical, } #[derive(Debug)] pub enum MouseAction { P...
true
200f89e9e901ea4542f935eb667d60601a365422
Rust
flip1995/comprakt
/compiler-lib/src/strtab.rs
UTF-8
2,520
3.71875
4
[ "MIT", "Apache-2.0" ]
permissive
//! String table with interior mutability and O(n) insert on miss //! //! Interior mutability achived using UnsafeCell. //! //! Using `Rc` and not `Arc`, this is not thread-safe. //! //! [1]: https://users.rust-lang.org/t/get-ref-to-just-inserted-hashset-element/13021 use std::{cell::UnsafeCell, collections::HashSet, ...
true
e607cb1352a42cc77b71aa44578f466a1948c3ae
Rust
tari/rust-flac
/src/audio.rs
UTF-8
5,437
3.421875
3
[]
no_license
//! Audio data structure and compression. //! //! Audio signals are a pair of predictor and residual, where the actual //! signal is the sum of values yielded by the predictor and the residual. /// Signal predictor #[deriving(Show, PartialEq, Eq)] pub enum Predictor { /// DC, "digital silence" Constant(i32), ...
true
9c1f30b05676c564c02dcb30064143d63fd5405a
Rust
rkat0/AtCoder
/ARC102/E.rs
UTF-8
3,593
3.015625
3
[]
no_license
use io::*; use std::cmp; fn main() { let input = read_string(); let mut sc = Scanner::new(&input); let k: usize = sc.next(); let n: usize = sc.next(); let M = 998244353; let mut stair: Vec<usize> = (1..n+k).scan(1, |ac,x| {*ac = *ac * x % M; Some(*ac)}).collect(); stair.insert(0,1); let...
true
3ab0d61f18a77e100cdd2a54a2e1fa6944764858
Rust
elipmoc/RustLambda
/lambda/mixture_lambda/parser.rs
UTF-8
2,332
3
3
[]
no_license
use combine; use combine::char::{char, digit, letter}; use combine::parser::combinator::not_followed_by; use combine::{many, value, Parser, Stream}; use mixture_lambda::ast::MixtureLambdaAST; use std::result::Result; /* BNF <expr> := <apply> <apply>:= <term>{' '<term>} <def> := 'λ'<id>'.'<expr>...
true
e96f6e4d7d0064b5881e960e647985f2ea9e65ae
Rust
basiliqio/basiliq
/src/serve/errors/ciboulette2pg_errors.rs
UTF-8
3,956
2.53125
3
[ "Apache-2.0", "MIT" ]
permissive
use super::*; use ciboulette2pg::Ciboulette2PgError; use hyper::StatusCode; macro_rules! cib2postgres_err { ($status:expr, $err_id:ident, $err:expr) => { (( $status, CibouletteErrorObj { id: Some(Cow::Borrowed(BasiliqErrorId::$err_id.id())), title: So...
true
b4d8660e8af039008dc1162c6fb3b6e27598ecc0
Rust
jordansissel/experiments
/rust/web/src/main.rs
UTF-8
280
2.53125
3
[]
no_license
extern crate hyper; use hyper::Client; fn main() { let client = Client::new(); let request = client.get("http://logstash.net:333/"); match request.send() { Ok(response) => { println!("Response: {:?}", response) }, Err(err) => { println!("Error: {:?}", err) } } }
true
98bf99ef38c976e7e7dea025ff0ad8031b9eeb3b
Rust
jean-emmanuel/sdfgen
/src/main.rs
UTF-8
5,566
2.59375
3
[ "Unlicense" ]
permissive
extern crate image; extern crate getopts; extern crate byteorder; extern crate sdfgen; use std::fs::File; use std::io::Write; use image::GrayImage; use getopts::Options; use byteorder::{LittleEndian, WriteBytesExt}; use sdfgen::functions::bw_to_bits; use sdfgen::functions::bit_compressor; use sdfgen::sdf_algorithm...
true
8bbb7aa79c56651b9ed32f5f849822e49dfbb0e1
Rust
n0-computer/iroh
/iroh/src/config.rs
UTF-8
10,135
2.96875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
//! Configuration for the iroh CLI. use std::{ collections::HashMap, env, fmt, path::{Path, PathBuf}, str::FromStr, }; use anyhow::{anyhow, bail, Result}; use config::{Environment, File, Value}; use iroh_net::{ defaults::{default_eu_derp_region, default_na_derp_region}, derp::{DerpMap, DerpReg...
true
be717da3ab105d8602e87b7c43dd089ed4903f3f
Rust
blackrock/lcso
/src/opto/term.rs
UTF-8
4,886
2.703125
3
[ "Apache-2.0" ]
permissive
/* Copyright 2021 BlackRock, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
true
eedcd0456ebb61c651cd8b5d0560c2b471164325
Rust
lizlam/advent-of-code-2019
/src/day2_paul.rs
UTF-8
2,158
3.5625
4
[]
no_license
//! Advent of Code - Day 2 //! Given an array/vector of numbers (num[]), analyze every 4 numbers //! Every 4 numbers (n1, n2, n3, n4) represent a command //! If n1 == 1, then num[n4] = num[n2] + num[n3] //! If n1 == 2, then num[n4] = num[n2] * num[n3] //! If n1 == 99, then stop use std::fs::File; use std::io::{BufRead...
true
0038e996850d9aa83994cce0db5c3f1aa49d3cf8
Rust
carlosdp/plaster
/src/virtual_dom/vtag.rs
UTF-8
19,764
2.609375
3
[ "Apache-2.0", "MIT" ]
permissive
//! This module contains the implementation of a virtual element node `VTag`. use super::{Attributes, Classes, Listener, Listeners, Patch, Reform, VDiff, VNode}; use html::{Component, EventListenerHandle, Scope}; use std::borrow::Cow; use std::cmp::PartialEq; use std::collections::HashSet; use std::fmt; use wasm_bindg...
true
c6483cb8439feb995808c8d9f21061bbd2dfb807
Rust
sria91-packt/Learning-Rust
/Chapter11/close_fn_args/src/main.rs
UTF-8
187
3.1875
3
[ "MIT" ]
permissive
fn call_with_three<F>(some_closure: F) -> i32 where F: Fn(i32) -> i32, { some_closure(3) } fn main() { let answer = call_with_three(|x| x + 10); println!("{}", answer); }
true
7341317b012784f001e80dd7b936dd2cf50958ca
Rust
jgjin/cryptopals
/src/permute.rs
UTF-8
1,415
3.140625
3
[]
no_license
pub struct Permutations { cur_perm: Vec<usize>, first: bool, possibilities: Vec<Vec<u8>>, ranges: Vec<usize>, } impl Permutations { pub fn new( possibilities: Vec<Vec<u8>>, ) -> Self { Self { cur_perm: vec![0; possibilities.len()], ranges: possibilities.i...
true
af3f21afbaef0955318328f12e193d6d37ab90ae
Rust
JPMoresmau/rtext
/src/io.rs
UTF-8
2,227
2.78125
3
[]
no_license
use crate::doc::{term_frequency_aug,tokenize}; use std::io; use std::fs::{self, File}; use crate::index::Index; use std::path::{Path}; use std::collections::HashMap; use std::io::Read; use path_slash::PathExt; #[derive(Debug)] pub struct IndexedFolder { index: Index, doc_files: HashMap<u128,String>, } impl I...
true
88b50c32e0fb4f5b0474e297b8637b68c913e4d6
Rust
thomcc/almost
/src/imp.rs
UTF-8
3,606
2.921875
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
// This is gross but it's also a big pain to write this via a trait... macro_rules! impl_equals { ($fp:ident, $bits:ident, $SIGNIFICAND_SIZE:expr) => { const SIGNIFICAND_SIZE: $bits = $SIGNIFICAND_SIZE; const EXPONENT_SIZE: $bits = (core::mem::size_of::<$fp>() as $bits) * 8 - SIGNIFICAN...
true
f539ba1270212e9cf0298f19442b99f7d4c303e8
Rust
RustyYato/svec
/src/stable.rs
UTF-8
2,902
2.6875
3
[]
no_license
use super::{Heap, Inline}; use core::{marker::PhantomData, ptr::NonNull}; use std::alloc::{alloc, handle_alloc_error, realloc, Layout}; mod std_hack; use std_hack::LayoutExt; use Data::*; pub(crate) enum Data<T, A> { Inline(Inline<T, A>), Heap(Heap<T>), } impl<T, A> Data<T, A> { pub const fn new() -> Se...
true
deaeae4adb329db50b8d0b457a9d8f4f3c31261c
Rust
anchietajunior/londrina
/src/binding_def.rs
UTF-8
1,349
3.453125
3
[]
no_license
use crate::expr::Expr; #[derive(Debug, PartialEq)] pub struct BindingDef { name: String, val: Expr, } impl BindingDef { pub fn new(s: &str) -> (&str, &str) { let s = if s.starts_with("let") { &s[3..] } else { panic!("expected let") }; let (s, _) = u...
true
4f341963501139f61d21417eae961b590954d88a
Rust
kas-gui/kas
/crates/kas-core/src/event/response.rs
UTF-8
2,747
3.09375
3
[ "Apache-2.0" ]
permissive
// 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 in the LICENSE-APACHE file or at: // https://www.apache.org/licenses/LICENSE-2.0 //! Event handling: IsUsed and Scroll types use crate::geo...
true
104e6201b1dd768f45779404d2f73cf9f10233d0
Rust
i10416/ods
/chapter05/src/chainedhashtable.rs
UTF-8
4,241
3.046875
3
[ "MIT" ]
permissive
#![allow(clippy::many_single_char_names,clippy::explicit_counter_loop, clippy::redundant_closure)] use super::hashcode; use chapter01::interface::{List, USet}; use chapter02::arraystack::Array as ArrayStack; use std::hash::Hash; #[derive(Clone, Debug, Default, Eq, Ord, PartialEq, PartialOrd)] pub struct ChainedHashTab...
true
28f547582b8893247ac3cfb598515146f1c34867
Rust
BarlowDu/rust-lang
/src/module/ilifetime.rs
UTF-8
441
2.578125
3
[]
no_license
use crate::irun; //use irun; //extern crate irun; pub struct Runner{} impl Runner{ pub fn new()->Runner{ return Runner{} } } impl irun::IRunner for Runner { fn run(&self){ println!("lifetime run"); let _node=get_node(1, "head"); } } /************************ */ struct Node<'a>...
true
beeb597d1d2ba6eeb68d760ec715bcd9a847591e
Rust
dropbox/pb-jelly
/pb-jelly/src/varint.rs
UTF-8
3,443
3.171875
3
[ "Apache-2.0" ]
permissive
use bytes::Buf; use std::cmp::min; use std::io::{ self, Write, }; #[inline] pub const fn serialized_length(mut val: u64) -> usize { let mut ans = 1; while val & !0x7Fu64 != 0 { val >>= 7; ans += 1; } ans } #[inline] pub fn write<W: Write>(mut val: u64, w: &mut W) -> io::Result...
true
a16913ca31dbfc640dfdecf0bb9f59b03fbe88d8
Rust
chpatton013/rust-stratum-v2
/stratumv2/src/common/messages.rs
UTF-8
3,612
2.921875
3
[]
no_license
use crate::error::{Error, Result}; use crate::types::MessageTypes; use crate::util::ByteParser; use crate::Deserializable; use std::convert::{TryFrom, TryInto}; use std::fmt; /// Contains the error codes for the [SetupConnectionError](struct.SetupConnectionError.html) message. /// Each error code has a default STR0_25...
true
ec775d930db12fa4aab9364b46667d4649f75912
Rust
m-hilgendorf/tuix
/core/src/widgets/checkbox.rs
UTF-8
6,814
2.78125
3
[ "MIT" ]
permissive
#![allow(dead_code)] use crate::entity::Entity; use crate::mouse::*; use crate::{BuildHandler, Event, EventHandler, Propagation, WindowEvent}; use crate::{PropSet, State}; use crate::style::layout::{Align, Justify}; use crate::widgets::radio::RadioEvent; const ICON_CHECK: &str = "\u{2713}"; const ICON_DOWN_OPEN_BIG...
true
653625b22eb9056aa422cfb821c6efa9b24168c8
Rust
mitchmindtree/json_io
/examples/test.rs
UTF-8
427
2.6875
3
[]
no_license
extern crate find_folder; extern crate json_io; fn main() { let test_string = "This is a json_io test!".to_owned(); let target = find_folder::Search::Parents(1).for_folder("target").unwrap(); let path = target.join("test"); json_io::save(&path, &test_string).unwrap(); let the_string: String = json...
true
e31bf26d7fcc30290364111be075d586896efdc8
Rust
Pantoofle/AnonyBot
/src/main.rs
UTF-8
2,233
2.640625
3
[]
no_license
use serenity::model::channel::Message; use serenity::{ client::{Client, Context, EventHandler}, model::id::ChannelId, }; // use serenity::model::prelude::*; use serenity::framework::standard::{ macros::{command, group}, CommandResult, StandardFramework, }; use serenity::prelude::*; use serenity::{async_...
true
6bdd07c570a1c080c19d950c0cba566cb241b0ca
Rust
idevgames/uDevGames.com
/src/models/attachments.rs
UTF-8
3,632
3.296875
3
[ "BSD-2-Clause" ]
permissive
use crate::{ attachments::AttachmentStorage, db::DbConn, models::{last_insert_rowid, r_to_opt, ModelError}, }; use diesel::result::Error as DieselError; use std::path::PathBuf; /// An attachment, which is a file on disk. #[derive(Debug, Queryable)] pub struct Attachment { /// Unique id of this attachme...
true
f9612a491bdc4188d1009c87d64743f068c6b1ad
Rust
iCodeIN/hippo-jvm-rust
/src/runtime/code_reader.rs
UTF-8
1,117
2.90625
3
[]
no_license
use crate::runtime::method::Method; use std::sync::Arc; #[derive(Debug)] pub struct CodeReader { code: Arc<Vec<u8>>, method: Method, pc: usize, } impl CodeReader { pub fn new(method: Method) -> Self { CodeReader { code: method.code(), pc: 0, method, ...
true
a2620592bd38b11f3c0901f85a935e37950ff8b1
Rust
jblindsay/whitebox-tools
/whitebox-tools-app/src/tools/lidar_analysis/lidar_thin.rs
UTF-8
19,789
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
/* This tool is part of the WhiteboxTools geospatial analysis library. Authors: Dr. John Lindsay Created: 06/05/2018 Last Modified: 18/10/2019 License: MIT NOTES: This tool thins a LiDAR point cloud such that no more than one point exists within each grid cell of a superimposed grid of a user-specified resolution. Whe...
true
60fe6acf3daff4326e90a46a01920f020d6a856d
Rust
denismaier/citeproc-rs
/citeproc/src/db/xml.rs
UTF-8
4,015
2.96875
3
[]
no_license
use std::io; use std::str::FromStr; use std::sync::Arc; use csl::error::StyleError; use csl::{ locale::{Lang, Locale, LocaleOptions, LocaleSource}, style::{Name, Style}, }; pub trait HasFetcher { fn get_fetcher(&self) -> Arc<LocaleFetcher>; } /// Salsa interface to a CSL style. #[salsa::query_group(Style...
true
624881c5bf30788c708b5f6435a3b1424b19c636
Rust
nushell/nushell
/crates/nu-cmd-dataframe/src/dataframe/eager/append.rs
UTF-8
4,383
2.71875
3
[ "MIT" ]
permissive
use nu_engine::CallExt; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; use super::super::values::{Axis, Column, NuDataFrame}; #[derive(Clone)] pub struct AppendDF; impl Command for AppendDF { ...
true
2262512d5d52f3ffea9d74d883ca65b6b7db418a
Rust
acburdine/aoc-2016-rust
/day03/src/main.rs
UTF-8
1,343
3.296875
3
[]
no_license
use std::fs; fn parse_line(l: &str) -> Vec<usize> { l.split(" ") .filter(|v| v.trim().len() > 0) .map(|p| p.trim().parse::<usize>().unwrap()) .collect() } fn get_triangles(input: &str) -> Vec<Vec<usize>> { input.trim().lines().map(|l| parse_line(l)).collect() } fn get_triangles_v2(inp...
true
d00771f50f3b7f5333982e770d599555b76439bc
Rust
IThawk/rust-project
/rust-master/src/test/ui/existential_types/bound_reduction2.rs
UTF-8
313
2.59375
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
#![feature(existential_type)] fn main() { } trait TraitWithAssoc { type Assoc; } existential type Foo<V>: Trait<V>; //~^ ERROR could not find defining uses trait Trait<U> {} impl<W> Trait<W> for () {} fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T::Assoc> { //~ ERROR does not fully define () }
true
260d7668a498eeb4902467cfa629b1365d020e2c
Rust
sketchc89/algodesign
/rust/src/big_oh.rs
UTF-8
5,054
3.796875
4
[ "MIT" ]
permissive
/// Additional problems /// VI. /// 1. O(b), addition once for every b pub fn vi_1_product(a: i32, b: i32) -> i32 { let mut sum: i32 = 0; for _i in 0..b { sum += a; } sum } /// 2. O(b), function called once for every b pub fn vi_2_power(a: i32, b: i32) -> Option<i32> { if b < 0 { ...
true
8a5c4a171751e31acf4c9ce61ec47504d9cea1da
Rust
Teaonly/ez-mpeg1
/src/main.rs
UTF-8
2,064
2.734375
3
[ "MIT" ]
permissive
use std::env; use std::fs::File; use std::io::Read; mod bitbuf; mod pkt; mod video; mod vlc; fn main() { // file to [u8] let args: Vec<String> = env::args().collect(); let mut file = File::open(&args[1]).unwrap(); let mut data:Vec<u8> = Vec::new(); let _result = file.read_to_end(&mut data); l...
true
a42129f863d1cd5613778b9c3ab1cf8bc4b88625
Rust
bluecookies/siglus-decompile
/src/decrypt.rs
UTF-8
16,354
2.609375
3
[]
no_license
use std::io::{Seek, SeekFrom}; use std::fs::File; use byteorder::{LittleEndian, ReadBytesExt}; use ::Result; use ::Script; use ::{Variable, VariableType, Function}; use ::zip; #[derive(Debug)] pub struct HeaderPair { offset: u32, count: u32 } #[derive(Debug)] pub struct ScenePackHeader { header_size: u32, glob...
true
838ac94b762ac8ec06329e1ddd3e82f560056ec5
Rust
suhanyujie/rust-cookbook-note
/src/notes/kvs/src/error.rs
UTF-8
1,152
2.625
3
[]
no_license
//! 这里使用的是 failure crate,具体的使用指南可以参考 https://boats.gitlab.io/failure/ use std::io; use failure::Fail; #[derive(Fail, Debug)] pub enum KvsError { #[fail(display = "{}", _0)] Io(#[cause] io::Error), #[fail(display = "key not found")] KeyNotFound, #[fail(display = "serde json error")...
true
629a7b45c8f15d0c59c7e1d46188741d2b693b1d
Rust
Twinf0x/bevy-fps
/src/graphics/sprite_components.rs
UTF-8
850
2.765625
3
[ "MIT" ]
permissive
use bevy::core::Timer; use bevy::prelude::*; use bevy::utils::Duration; use std::collections::*; #[derive(Bundle)] pub struct AnimatedSpriteBundle { pub animations: HashMap<AnimationType, Animation>, pub current_animation: AnimationType, pub frame_timer: Timer, } impl Default for AnimatedSpriteBundle { ...
true
b5d9282f093b3455fcbd559ec67d08e58d8bbfe3
Rust
mich101mich/game_rs
/src/ui/mod.rs
UTF-8
591
2.625
3
[]
no_license
mod button; mod clickable; mod key; mod menu; mod mouse; pub use button::*; pub use clickable::*; pub use key::KeyCode; pub use menu::*; pub use mouse::*; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ButtonState { Up, Down, } impl Default for ButtonState { fn default() -> Self { Self::Up } } impl Into...
true
780fe0b80bb67d122960d231f33c2288739e21b0
Rust
Orange-OpenSource/hurl
/packages/hurl/src/runner/predicate.rs
UTF-8
57,422
2.65625
3
[ "Apache-2.0" ]
permissive
/* * Hurl (https://hurl.dev) * Copyright (C) 2023 Orange * * 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 ...
true
2f1651e9e3dc36e30165a42d18063cf2b3c66579
Rust
swc-project/swc
/crates/swc_ecma_minifier/src/util/sort.rs
UTF-8
506
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use std::cmp::Ordering; pub(crate) fn is_sorted_by<I, T, F>(mut items: I, mut compare: F) -> bool where I: Iterator<Item = T>, T: Copy, F: FnMut(&T, &T) -> Option<Ordering>, { let last = match items.next() { Some(e) => e, None => return true, }; items .try_fold(last, |l...
true
82c4110fe875b55791010a44d196a9245372984d
Rust
mnts26/aws-sdk-rust
/sdk/sqs/src/operation.rs
UTF-8
48,440
2.859375
3
[ "Apache-2.0" ]
permissive
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. /// <p>Adds a permission to a queue for a specific /// <a href="https://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P">principal</a>. /// This allows sharing access to the queue.</p> /// <p>When you create a queue, you have full c...
true
c3c6b87d78dc48eed57cbc1ea0c5f4c14a62a022
Rust
thanasis2028/ripgrep
/tests/excludetests_onlytests.rs
UTF-8
1,592
2.75
3
[ "MIT", "Unlicense" ]
permissive
use crate::util::{Dir, TestCommand}; const TEST_STR: &'static str = "fn main() { // comment 1 } #[test] use std::fs; // comment 2 #[test] fn test1() { // comment 3 } #[cfg(test)] mod tests { use std::fs; // comment 4 #[test] fn test1() { // comment 5 } }// comment 6"; // This ...
true
d88828bdfe97d68c1e8365e8e353574cb34041d0
Rust
Nitrokey/trussed-secrets-app
/fuzz/corpus-viewer/corpus-viewer.rs
UTF-8
1,965
2.546875
3
[ "MIT", "Apache-2.0", "CC0-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// Copyright (C) 2023 Nitrokey GmbH // // SPDX-License-Identifier: Apache-2.0 OR MIT use clap::Parser; #[derive(Parser, Debug)] #[clap(about, version, author)] struct Args { #[clap(short, long)] file_name: String, } // TODO: extract parse function fn parse(data: &[u8]) -> Vec<&[u8]> { // Parse incoming d...
true
ddf818332862afe830aaed27de099844e0ee2a28
Rust
mitchmindtree/ether-dream
/dac-emulator/src/broadcaster.rs
UTF-8
8,545
3.3125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
//! Items related to the DAC emulator's broadcasting process. use ether_dream::dac; use ether_dream::protocol::{BROADCAST_PORT, DacBroadcast, SizeBytes, WriteBytes}; use std::{io, net, thread, time}; use std::sync::{mpsc, Arc, Mutex}; use std::sync::atomic::{self, AtomicBool}; /// The broadcasting side of the DAC. //...
true
44be78fc904ec0e9f5922139e8bb3dd7f78e69f0
Rust
bcamp1/cart-ai
/src/neat.rs
UTF-8
1,128
3.046875
3
[]
no_license
use sdl2::render::WindowCanvas; #[derive(Debug)] pub enum NodeType { Input, Hidden, Output, } #[derive(Debug)] pub struct Node { pub id: i32, pub nodeType: NodeType, } impl Node { pub fn new(id: i32, nodeType: NodeType) -> Node { Node { id: id, nodeType: nodeTy...
true
e23488f88edee46dbd0549a111e2f4b8666c7c74
Rust
shashankhacker730/feroxbuster
/src/filters/regex.rs
UTF-8
1,483
3.25
3
[ "MIT" ]
permissive
use super::*; use ::regex::Regex; /// Simple implementor of FeroxFilter; used to filter out responses based on a given regular /// expression; specified using -X|--filter-regex #[derive(Debug)] pub struct RegexFilter { /// Regular expression to be applied to the response body for filtering, compiled pub compil...
true
912d7bfcf695b3266838fb66bf80e4aa5ee036b7
Rust
ernadh/schema-test
/src/json_schema/validators/dependencies.rs
UTF-8
2,021
2.578125
3
[]
no_license
use url; use value_trait::*; use super::error; use super::scope; #[derive(Debug)] pub enum DepKind { Schema(url::Url), Property(Vec<String>), } #[allow(missing_copy_implementations)] pub struct Dependencies { pub items: hashbrown::HashMap<String, DepKind>, } impl<V> super::Validator<V> for Dependencies ...
true
38bd8ae5a20954c4fe95eeb4f7a6d4e2b05b9dcc
Rust
K0R0VA/actor-examples
/src/rest_api.rs
UTF-8
2,299
2.71875
3
[]
no_license
use crate::box_office::BoxOffice; use crate::rest_api::routes::{buy_tickets, create_event}; use actix::{Actor, System}; use actix_web::web::ServiceConfig; use std::collections::HashMap; use self::routes::hello_world; pub fn configuration(config: &mut ServiceConfig) { config .service(create_event) ...
true
a937a57bc32ab8205f349f2244d25eda51e8090b
Rust
unpatched/rust-av
/src/common/timebase.rs
UTF-8
997
2.71875
3
[]
no_license
use std::os::raw::c_int; use ffi::AVRational; #[derive(Copy,Clone,Debug)] pub struct Timebase(AVRational); impl Timebase { pub fn new(num: c_int, den: c_int) -> Self{ Timebase(AVRational { num: num, den: den, }) } pub fn num(&self) -> c_int { self.0.num ...
true
ac0ddde7759a5211eb7f7f5e4a822ec744faac40
Rust
pentestbr/ptscan
/lib/src/values.rs
UTF-8
21,039
3.65625
4
[ "MIT", "Apache-2.0" ]
permissive
//! Lightweight dynamic Value storage who's exact type is determined at runtime. //! //! This modules provides a collection which behaves remarkably similar to, //! Vec<T>, where T is an enum. Except, it can store the discriminator //! separately from the data (which saves on _a lot_ of storage). //! //! T in this cas...
true
2931da32afd6a6058b59ffe71d81eb749d7e03fa
Rust
mmalek/tunein-rs
/src/reader.rs
UTF-8
6,520
2.859375
3
[]
no_license
use crate::common::{Audio, Format, Link}; use crate::error::Error; use crate::event::{Event, OutlineEvent}; use std::io::Read; use std::iter::{IntoIterator, Iterator}; pub struct Reader<R: Read> { reader: xml::reader::EventReader<R>, } impl<R: Read> Reader<R> { pub fn new(source: R) -> Reader<R> { Rea...
true
0baad199e5062d038dca7d1e5de7349ed968af9a
Rust
cdbfoster/takkerus
/tak/src/zobrist.rs
UTF-8
6,140
2.875
3
[]
no_license
use std::mem; use std::slice; use once_cell::sync::Lazy; use rand::{self, Error, Fill, Rng}; use crate::piece::{Color::*, Piece}; use crate::state::State; pub type ZobristHash = u64; struct ZobristKeys<const N: usize> { black_to_move: ZobristHash, /// 6 possible top pieces. top_pieces: [[[ZobristHash; 6...
true
0612e155d19f301f2b9b4fa4a3a36e8770e449f5
Rust
kaj/rsass
/rsass/tests/spec/core_functions/color/rgb/three_args/percents.rs
UTF-8
1,743
2.546875
3
[ "MIT", "Apache-2.0" ]
permissive
//! Tests auto-converted from "sass-spec/spec/core_functions/color/rgb/three_args/percents.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { super::runner().with_cwd("percents") } mod all { #[allow(unused)] use super::runner; #[test] fn percent() { assert_eq!( runner()....
true
7b629bc55747b7b4e1eac8957fd4b9bb08104243
Rust
winksaville/fuchsia
/third_party/rust_crates/vendor/brotli2/examples/all-read-write-roundtrips.rs
UTF-8
3,063
2.78125
3
[ "BSD-3-Clause", "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
extern crate brotli2; extern crate rand; use std::io::{Read, Write}; use brotli2::read; use brotli2::write; use brotli2::CompressParams; use brotli2::raw::{compress_buf, decompress_buf}; use rand::Rng; use rand::SeedableRng; // Used in functions as temporary storage space before producing a vec const BIGBUF_SIZE: usi...
true
a6a1ed06ccd9d41b587c77f646c018a9fc13127d
Rust
snoyberg/routetype-rs
/routetype/tests/manual.rs
UTF-8
940
2.890625
3
[]
no_license
use routetype::*; use std::borrow::Cow; #[derive(Clone, Debug, PartialEq, Eq)] struct BoringRoute; impl Route for BoringRoute { fn parse<'a, 'b>( mut path: impl Iterator<Item = PathSegment<'a>>, _query: Option<impl Iterator<Item = QueryPair<'b>>>, ) -> Result<Self, RouteError> { match ...
true
05e3ccce8be79c5e8927545d29770d59b92ec45c
Rust
acweathersby/Ruminate
/lib/src/store/container.rs
UTF-8
1,751
3.25
3
[]
no_license
use crate::primitives::NoteLocalID; use std::collections::HashSet; /// /// POD used to model the hierarchal relationship of notes /// pub struct Container { pub id: usize, pub parent_id: usize, pub name: String, pub uuids: HashSet<NoteLocalID>, pub containers: Vec<usize>, } pub struct ContainerSto...
true
e1245fec52878d5e633214d1b8d77483dd283be5
Rust
TrolledWoods/impose
/src/intrinsic.rs
UTF-8
10,344
3.078125
3
[]
no_license
use crate::operator::*; use crate::types::*; fn is_primitive_int(id: TypeId) -> bool { matches!( id, U8_TYPE_ID | U16_TYPE_ID | U32_TYPE_ID | U64_TYPE_ID | S8_TYPE_ID | S16_TYPE_ID | S32_TYPE_ID | S64_TYPE_ID ) ...
true
47f9ef3c093286cadb5f817231c4a3c94afa0864
Rust
prisma/opentls
/src/sync_io.rs
UTF-8
2,944
2.921875
3
[ "MIT", "Apache-2.0" ]
permissive
//! A synchronous TLS implementation using OpenSSL. //! //! # Supported features //! //! This crate supports the following features out of the box: //! //! * TLS/SSL client communication //! * TLS/SSL server communication //! * PKCS#12 encoded identities //! * Secure-by-default for client and server //! * Includes ...
true
aeee22f0001433e2d49aa8c85138438362dc266a
Rust
IDSCN/ids-clearing-house-core
/core-lib/src/util.rs
UTF-8
2,784
2.78125
3
[ "Apache-2.0" ]
permissive
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC}; use std::env; use std::fs::File; use std::io::prelude::*; use std::convert::TryFrom; use std::str::FromStr; use yaml_rust::yaml::Yaml; use yaml_rust::YamlLoader; use crate::api::ApiClient; use crate::db::DataStoreApi; use crate::constants::{DATABASE_URL, D...
true
8d0ace0ce94787ff11593270d982583307e84a66
Rust
viz-rs/viz
/viz-macros/tests/handler.rs
UTF-8
3,062
2.796875
3
[ "MIT" ]
permissive
#![allow(clippy::unused_async)] #![allow(clippy::unnecessary_wraps)] use viz::{async_trait, Error, FromRequest, Handler, IntoResponse, Request, Result, StatusCode}; use viz_macros::handler; #[derive(Debug)] struct Foo; #[async_trait] impl FromRequest for Foo { type Error = Error; async fn extract(_: &mut Re...
true
b16bae7c9783958e821da123dd2cfaa2951cabe1
Rust
kichristensen/k8s-openapi-codegen
/k8s-openapi/src/api/core/v1/secret_env_source.rs
UTF-8
685
2.609375
3
[]
no_license
// Generated from definition io.k8s.api.core.v1.SecretEnvSource /// SecretEnvSource selects a Secret to populate the environment variables with. /// /// The contents of the target Secret's Data field will represent the key-value pairs as environment variables. #[derive(Debug, Default, Deserialize, Serialize)] pub stru...
true
0b2aba83b78b4183d4bf24b59cdc9ebeeaf0fbd6
Rust
marco-c/gecko-dev-comments-removed
/third_party/rust/bytes/src/buf/buf_impl.rs
UTF-8
16,257
2.671875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#[cfg(feature = "std")] use crate::buf::{reader, Reader}; use crate::buf::{take, Chain, Take}; use core::{cmp, mem, ptr}; #[cfg(feature = "std")] use std::io::IoSlice; use alloc::boxed::Box; macro_rules! buf_get_impl { ($this:ident, $typ:tt::$conv:tt) => {{ const SIZE: usize = mem::size_of::<$typ>(); ...
true
5a9356a9836e58e03696a4638d4581d12f9d8c5e
Rust
hello-rust/hello
/src/platforms/hackernews.rs
UTF-8
2,052
2.84375
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0" ]
permissive
use failure::Error; use fantoccini::{Client as FantocciniClient, Locator}; use futures::future::Future; use std::process::Command; use tokio_core; pub struct Credentials { pub username: String, pub password: String, } pub struct Client { credentials: Credentials, } impl Client { pub fn new(credential...
true
3563a47c393acdffcd3732d755758b87c98b57fd
Rust
magiclen/enum-ordinalize
/tests/tests_128.rs
UTF-8
969
2.765625
3
[ "MIT" ]
permissive
#![cfg(all(RUSTC_IS_NIGHTLY, feature = "nightly-test"))] #![allow(incomplete_features)] #![feature(repr128)] #[macro_use] extern crate enum_ordinalize; #[test] fn create_ordinalized_enum_4_3() { #[derive(Debug, PartialEq, Eq, Ordinalize)] #[repr(i128)] enum MyEnum { A = 2i128, B = 4, ...
true
354d71c2402d565d7c4612ffef02c5c61337017e
Rust
gs-akhan/learning-rust
/src/command.rs
UTF-8
344
3.265625
3
[ "MIT" ]
permissive
use std::process::Command; fn main() { println!("Executing a command"); let mut cmd = Command::new("ssh"); cmd.arg(""); match cmd.output() { Ok(o) => unsafe { println!("{}", String::from_utf8_unchecked(o.stdout)); }, Err(_e) => { println!("There was err...
true
f1a0371d2377506f65434a49af47eb6f6adb4eb3
Rust
cjschneider2/ream
/core/src/file_types/beam/chunk/compiler_info.rs
UTF-8
253
2.515625
3
[ "Apache-2.0" ]
permissive
pub struct CompilerInfoChunk { pub name: &'static str, pub data: Vec<u8>, } impl CompilerInfoChunk { pub fn new() -> CompilerInfoChunk { CompilerInfoChunk { name: "CInf", data: Vec::new(), } } }
true
1ab29f579e0389aafc23276d0bc019045fda9da9
Rust
aidenybai/i.zephyr
/i-cli/src/main.rs
UTF-8
1,144
2.9375
3
[]
no_license
use clap::Clap; use std::io::ErrorKind::NotFound; use std::{path::PathBuf, process::Command}; // curl -X POST -F upload=@database/funny-hqw.jpeg http://127.0.0.1:8080 #[derive(Clap, Debug)] struct Opts { #[clap(short, long, default_value = "https://i.zephyr/")] url: String, store: String, files: Vec<P...
true
c35f4cae803b10fea1fb14c0bad5db716bbf57bf
Rust
ear7h/lang2
/src/bin/lambda.rs
UTF-8
2,642
2.671875
3
[]
no_license
#![feature(bindings_after_at)] use std::io::{self, BufRead}; use peg::error::ParseError; use lang2::types::{Type, Env}; use lang2::parser::{self, Ident}; #[derive(Default)] struct Repl { defs : Vec<(Ident, Type<Ident>)>, } fn main() { let mut repl : Repl = Default::default(); for line in io::stdin().loc...
true
b964a4cfd53ab7a24d1b550a4638d72ae470253d
Rust
PaulL48/comp442-compiler
/code_gen/src/preamble.rs
UTF-8
9,092
2.75
3
[]
no_license
//! Code that will be at the top of the generated assembl pub const PREAMBLE: &str = r#" % A Simple MOON Library % Author: Peter Grogono % Last modified: 27 Jan 1995 % Conventions % r14 is the Stack Pointer % -4(r14) is used to store the link, if necessary. % -8(r14) contains the first argument. % -12(r14) c...
true