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
0cfcea5cad5b2476a7b01533539c467461734285
Rust
shaneutt/kube-rs
/kube/src/lib.rs
UTF-8
21,056
2.765625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Kube is an umbrella-crate for interacting with [Kubernetes](http://kubernetes.io) in Rust. //! //! # Overview //! //! Kube contains a Kubernetes client, a controller runtime, a custom resource derive, and various tooling //! required for building applications or controllers that interact with Kubernetes. //! //! Th...
true
30f7ee56813616e9ab29b0379695d8d4373b83e3
Rust
virtualgraham/wasm-graph-app
/src/graph/iterator/not.rs
UTF-8
5,155
2.703125
3
[]
no_license
use super::{Shape, Base, Index, Scanner, Costs, ShapeType}; use super::materialize::Materialize; use super::super::refs; use std::collections::HashMap; use std::rc::Rc; use std::cell::RefCell; use std::fmt; pub struct Not { primary: Rc<RefCell<dyn Shape>>, all_it: Rc<RefCell<dyn Shape>> } impl Not { pub f...
true
7676358d93f268678f7f75b705fc8c89453d6613
Rust
athk0r/net_mgr_handler
/src/device_type.rs
UTF-8
1,438
3.0625
3
[]
no_license
#[derive(Clone, Debug, PartialEq)] pub enum DeviceType { Unknown, Ethernet, WiFi, Unused1, Unused2, Bt, OlpcMesh, Wimax, Modem, Infiniband, Bond, Vlan, Adsl, Bridge, Generic, Team, Tun, IpTunnel, Macvlan, Vxlan, Veth, Macsec, Du...
true
647143e645b03dd901e7bb0228d8684a6a1ae9ab
Rust
IThawk/rust-project
/rust-master/src/test/ui/issues/issue-41888.rs
UTF-8
792
2.765625
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
// run-pass fn main() { let _ = g(Some(E::F(K))); } type R = Result<(), ()>; struct K; enum E { F(K), // must not be built-in type #[allow(dead_code)] G(Box<E>, Box<E>), } fn translate(x: R) -> R { x } fn g(mut status: Option<E>) -> R { loop { match status { Some(infix_or_postfix...
true
3f43dda51889068c9ffd123328aab5d6890a9bd2
Rust
rtalwar26/rust-server
/src/get_handlers/myenums/mod.rs
UTF-8
419
3.5625
4
[]
no_license
pub enum TimeUnit { Seconds, Minutes, Hours, ManHours(u32, u32), } impl TimeUnit { pub fn plural(&self) -> String { match self { TimeUnit::Seconds => "seconds".to_string(), TimeUnit::Hours => "hours".to_string(), TimeUnit::Minutes => "minutes".to_string(),...
true
f9f66b4c46ce727974895eaf893ab4ee54dc9539
Rust
ChinYing-Li/RustRayTracer
/src/brdf/glossyspec.rs
UTF-8
2,952
2.578125
3
[]
no_license
use cgmath::{Vector3, InnerSpace, ElementWise}; use std::f32::consts::PI; use std::ops::Mul; use std::sync::Arc; use crate::brdf::BRDF; use crate::world::shaderec::ShadeRec; use crate::sampler::{mutijittered::MultiJittered, Sampler}; use crate::utils::color::Colorf; use c...
true
5338800678205760daa2e8064036a4f5a75b01c6
Rust
petersellars/rust-workspace
/rust-gentle-intro/structs-enums-and-matching/struct.rs
UTF-8
1,789
3.890625
4
[]
no_license
use std::fmt; // Enables debug dump of Person // #[derive(Debug)] struct Person { first_name: String, last_name: String } // trait for debug - replace $[derive(Debug)] impl fmt::Debug for Person { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.full_name()) } } imp...
true
4123ee056311010f1b2b4132b66d44060b56aabd
Rust
lukesmith-bjss/advent-of-code-2019
/day_3/src/main.rs
UTF-8
2,289
3.1875
3
[]
no_license
use indexmap::set::IndexSet; fn main() { let wire1_coords: IndexSet<(i32, i32)> = calc_coords_for_input(get_data_1()); let wire2_coords: IndexSet<(i32, i32)> = calc_coords_for_input(get_data_2()); let mut dupes_coord: IndexSet<(i32, i32)> = IndexSet::new(); let mut dupes_abs: Vec<i32> = Vec::new(); ...
true
fe59163f94017eb750b385c79b0aa66a6f242a2f
Rust
markubiak/dsp.rs
/examples/spectrum.rs
UTF-8
2,531
2.984375
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#[macro_use] extern crate clap; use gnuplot::*; use clap::{Arg, App}; use dsp::signal::Signal; use dsp::generator::*; use dsp::fft::*; const SIGNAL_LENGTH: usize = 10*256; // Application params #[derive(Debug)] struct Params { gen_name: String, freq: f32 } /// Parse command line arguments fn parse_params(...
true
f156ccbebf27ecc7dc9c98de517076167a990acc
Rust
seguidor777/dcoder-solutions
/easy/find_the_eldest_brother.rs
UTF-8
533
3.421875
3
[]
no_license
use std::io; fn main() { let mut input = String::new(); io::stdin() .read_line(&mut input) .expect("cannot read input"); let ages: Vec<u32> = input .split_whitespace() .filter_map(|x| x.parse().ok()) .collect(); let eldest = find_eldest(&ages); println!("{...
true
b255f77dde58b8ef93d2b19315fff7c55ac5d744
Rust
libredrop/peer-discovery-rust
/src/proto.rs
UTF-8
27,562
3.28125
3
[]
no_license
//! Peer discovery message related facilities: serialization/deserialization to/from binary data //! on a wire, etc. use crate::error::{DeserializeError, Error}; use std::net::Ipv4Addr; use uuid::Uuid; // Current protocol version. pub const VERSION: u8 = 1; #[derive(Debug, PartialEq, Clone, Copy)] #[repr(u8)] pub enu...
true
1dd1258a7e12403fa2fc974f406e911515fc6b88
Rust
omadoyeabraham/rust-book-codealong
/chapter-4/playground.rs
UTF-8
509
3.84375
4
[]
no_license
fn main() { let s1 = String::from("hello world from here"); // let s2 = takes_ownership(&mut s1); println!("{}", first_word(&s1)); } // fn takes_ownership(s: &mut String) { // println!("I've taken ownership"); // s.push_str(" from the other side"); // } fn first_word(s: &String) -> &str { ...
true
fbcc406644ec37cd85f22b9e810f65fff5938e31
Rust
mulimoen/hdf5-rust
/hdf5-types/src/dyn_value.rs
UTF-8
31,127
2.90625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::fmt::{self, Debug, Display}; use std::mem; use std::ptr; use std::slice; use crate::h5type::{hvl_t, CompoundType, EnumType, FloatSize, H5Type, IntSize, TypeDescriptor}; use crate::string::{VarLenAscii, VarLenUnicode}; fn read_raw<T: Copy>(buf: &[u8]) -> T { debug_assert_eq!(mem::size_of::<T>(), buf.len()...
true
455edc9aae0119326cfb981434b795884eb00189
Rust
LyunKi/rust-algorithm
/src/matching_substituting.rs
UTF-8
2,428
3.03125
3
[]
no_license
use regex::Regex; use std::collections::HashMap; fn my_change(s: &str, prog: &str, version: &str) -> String { let version = format!(" {}", version).to_owned(); let prog = format!(" {}", prog).to_owned(); let mut initial = s .split('\n') .map(|item| { if let [key, value] = *item....
true
17fae0d93b7a5eeaf19dffbaa0ec4ec3c084c5a9
Rust
pormeu/openbrush-contracts
/contracts/token/psp721/src/traits.rs
UTF-8
11,844
2.625
3
[ "MIT" ]
permissive
use crate::stub::PSP721Receiver; use brush::{ declare_storage_trait, traits::{ AccountId, AccountIdExt, InkStorage, ZERO_ADDRESS, }, }; use ink_env::{ call::FromAccountId, Error as Env_error, }; use ink_lang::ForwardCallMut; use ink_prelude::{ string::String, ...
true
cdb5bf59e04f19911871821ef89e827250e43851
Rust
ZoeyR/wearte
/testing/tests/expr.rs
UTF-8
11,559
3.296875
3
[ "MIT", "Apache-2.0" ]
permissive
use std::fmt::Error; use wearte::{Result, Template}; #[derive(Template)] #[template(source = "Hello, {{ name }}!", ext = "txt")] struct HelloTemplate<'a> { name: &'a str, } #[test] fn test_hello() { let t = HelloTemplate { name: "world" }; // instantiate your struct assert_eq!("Hello, world!", t.call().un...
true
153eba107e9741cc4fa75262e6d826bcbe34647f
Rust
pguyot/snips-nlu-utils
/src/range.rs
UTF-8
608
3.28125
3
[ "Apache-2.0" ]
permissive
use std::ops; pub fn ranges_overlap(r1: &ops::Range<usize>, r2: &ops::Range<usize>) -> bool { r1.start < r2.end && r1.end > r2.start } #[cfg(test)] mod tests { use super::*; #[test] fn ranges_overlap_works() { let test_cases = vec![ (3..6, 4..7, true), (3..6, 4..5, tru...
true
8ed1833a2c4ae78fd939c7399d25972099f77cff
Rust
Fish-Soup-Dev/prime-numbers
/prime number speed test/Rust/prime_numbers.rs
UTF-8
718
3.328125
3
[]
no_license
use std::time::{Instant}; fn main() { let max:i32 = 100000; let mut prime_numbers:i32 = 0; let mut prime:i32 = 1; let i:i32 = 2; println!("starting... "); let start = Instant::now(); for x in 2..(max + 1) { if x % 2 != 0 || x % 5 != 0 || x % 3 != 0 { for i in...
true
47555f13d50e34058f879f9deaab8f224513548d
Rust
gary600/rust-game-of-life
/src/main.rs
UTF-8
4,115
3.578125
4
[]
no_license
use std::fmt::{self, Display, Formatter, Write}; use std::io::stdin; const OFFSETS: [(i32, i32); 8] = [(-1, -1), (0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0)]; struct Board<const WIDTH: usize, const HEIGHT: usize>(pub [[bool; WIDTH]; HEIGHT]); impl<const WIDTH: usize, const HEIGHT: usize> Board<WIDT...
true
aa5c49e1442c4d69e66249830d8d3b6c1527081c
Rust
numerodix/adv-prog-unix-book
/ch6-system-data-files/passwd-file/src/main.rs
UTF-8
2,298
3.1875
3
[]
no_license
use itertools::Itertools; use libc; use std::ffi::{CStr, CString}; #[derive(Debug)] struct PasswdEntry { username: String, password: String, uid: u32, gid: u32, comment: String, working_dir: String, shell: String, } fn get_cstr(ptr: *const libc::c_char) -> String { let cstr = unsafe ...
true
6020ab4a3a7bc384a7fc36da3b4d4ac52971b0ce
Rust
koehlma/momba
/engine/crates/synthsens-verify/src/main.rs
UTF-8
7,821
2.625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use hashbrown::{hash_set, HashSet}; use std::fs::File; use std::io::BufReader; use std::path::Path; use std::time::Instant; use clap::Clap; use momba_explore::*; #[derive(Clap)] #[clap( version = "0.1.0", about = "A command line tool for verifying synthetic sensors." )] struct Arguments { #[clap(subcomm...
true
c46a8ef590f5826c7d9fa54f4be9171627000a9b
Rust
mardiros/janeiro
/src/rio.rs
UTF-8
13,393
2.65625
3
[ "BSD-3-Clause" ]
permissive
use std::io; use std::net::SocketAddr; use std::str::FromStr; use std::time::Duration; use std::io::{Read, Write}; // Used for TcpStream.read, TcpStream.write use mio::{Poll, Token, Events, Event, Ready, PollOpt}; use mio::tcp::{TcpListener, TcpStream}; use slab; use interface::{ServerFactory, Protocol, Reason}; us...
true
c4a3d73f8b5578a48624f4a9820b8020c9f9cc6c
Rust
leviathanbeak/blockchain_sample
/server/src/services/mine_api.rs
UTF-8
3,151
2.640625
3
[]
no_license
use crate::AppState; use actix_web::{error, web, HttpResponse, Scope}; use blockchain::block::{Block, NonceNumber}; use blockchain::blockchain::{Blockchain, ConsensusOption}; use reqwest::Client; use serde_json::json; pub fn init_service() -> Scope { web::scope("/mine") .service(web::resource("").route(web...
true
1b2fc4b3fcbf58d19e794dd5ebc1b4507bffb118
Rust
blutooth/rust-pvss
/src/scrape.rs
UTF-8
7,766
2.671875
3
[ "MIT" ]
permissive
// implementation of SCRAPE: Scalable Randomness Attested by Public Entities // https://eprint.iacr.org/2017/216.pdf use types::*; use math; use dleq; use pdleq; use crypto::*; pub type Secret = Point; // a new escrowing context. // this contains secret values (polynomial & secret) that are newly created. // this al...
true
1ea774970494c48150f294f49ea26d2b5fe187bd
Rust
jacobmischka/adventofcode-2020
/src/bin/25.rs
UTF-8
1,226
3.09375
3
[]
no_license
use std::io::{self, BufRead}; const INITIAL_SUBJECT_NUMBER: u128 = 7; const MODULO_NUMBER: u128 = 20201227; fn main() { let stdin = io::stdin(); let mut iter = stdin.lock().lines().filter_map(Result::ok); let door_pub_key: u128 = iter.next().unwrap().parse().unwrap(); let card_pub_key: u128 = iter.nex...
true
4f34f648d08ef9b0e2ad83e935df151f3f7b53fc
Rust
germanjoey/aoc20
/day14/src/main.rs
UTF-8
1,107
3
3
[]
no_license
fn next_recipe(current_index: usize, scores: &Vec<u32>) -> usize { return ((current_index + 1 + (scores[current_index] as usize)) % scores.len()) as usize } fn main() { let input = "939601"; let mut scores = vec![3, 7]; let mut currents = vec![0, 1]; loop { let new_recipies: Vec<_> = forma...
true
ae3a35364f0934dfaf6b5842068c8dd0ab53bcb2
Rust
kprav33n/aoc17.rs
/src/day03.rs
UTF-8
2,800
3
3
[]
no_license
use std; fn num_ports(n: u64) -> u64 { let sum = (n * (n + 1)) / 2; return 2 + sum * 8; } fn ports(n: u64) -> Vec<u64> { let count = n * 8; let start = num_ports(n - 1); (0..count).map(|i| start + i).collect() } fn port_location(p: u64) -> u64 { let t = ((p - 2) / 8) * 2; let d = 1 + 4 * ...
true
90548ebc9d213e4cda40a68e98b0d7413a213dbf
Rust
rodrigovalle/crdt
/src/lib.rs
UTF-8
2,916
3.46875
3
[]
no_license
use std::collections::HashMap; use std::convert::TryInto; use std::cmp::max; /// An eventually consistent distributed counter that only grows. #[derive(Debug)] pub struct GCounter { /// Map from ReplicaID to the replica's local count. counters: HashMap<String, u64>, } impl GCounter { pub fn new() -> GCoun...
true
ec7a9575b3f92412f16a388e3a23f579799884eb
Rust
tradingeconomics/tradingeconomics
/Rust/Forecast/src/main.rs
UTF-8
4,189
2.78125
3
[]
no_license
use std::error::Error; fn main() { let client = "guest:guest"; let base = "http://api.tradingeconomics.com"; let client_key:String = String::from(client); let base_url:String = String::from(base); get_forecast_by_country(base_url, client_key); let client_key:String = String::from(client); le...
true
b90d6da64340d8dde9fc0db15c5c3b20cc3c4155
Rust
ilmoi/rust_learnings
/stdlib/src/lifetimes/milford_lifetimes.rs
UTF-8
909
3.5625
4
[]
no_license
fn main() { /* https://www.youtube.com/watch?v=1QoT9fmPYr8&list=PLLqEtX6ql2EyPAZ1M2_C0GgVd4A-_L4_5&index=14 lifetimes are about ensuring that a memory doesn't get cleaned up BEFORE A REF CAN USE IT */ //lifetime subtyping - tell the compiler that 'b will live at least as long as 'a fn some_fn<...
true
57df864cad23efce3a351353c516a605c07fc318
Rust
nushell/nushell
/crates/nu-cmd-dataframe/src/dataframe/lazy/join.rs
UTF-8
9,606
2.515625
3
[ "MIT" ]
permissive
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame}; use nu_engine::CallExt; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; use polars::prelude::{Expr, JoinType}; #[de...
true
ef647803339b502ab89884883478a9bc9f1cac28
Rust
tmsbrg/makepty
/src/main.rs
UTF-8
1,320
2.703125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::env; use std::io; use std::thread; use io_streams; use portable_pty::{CommandBuilder, PtySize, native_pty_system}; use anyhow::Result; // based on example from https://docs.rs/portable-pty/0.4.0/portable_pty/index.html // copyright Thomas van der Berg, 2021, released under MIT license fn main() -> Result<()>...
true
3f689b2fda5c2ae8ac93704af9598c0429005d64
Rust
Tembocs/rome
/website/playground/src/lib.rs
UTF-8
3,494
2.53125
3
[ "MIT" ]
permissive
#![allow(clippy::unused_unit)] // Bug in wasm_bindgen creates unused unit warnings. See wasm_bindgen#2774 use rome_diagnostics::file::SimpleFiles; use rome_diagnostics::termcolor::{ColorSpec, WriteColor}; use rome_diagnostics::Emitter; use rome_js_formatter::{format as format_code, to_format_element, FormatOptions, In...
true
e16f214cee4ba408f66a56588fe783fb9045a8d0
Rust
00mjk/stylist-rs
/packages/stylist/src/ast.rs
UTF-8
1,498
2.875
3
[ "MIT" ]
permissive
//! This module contains the semantic representation of a CSS StyleSheet. //! //! ```text //! Sheet //! └── Vec<enum ScopeContent> //! ├── Block //! │ ├── condition: Vec<Selector> //! │ │ └── fragments: Vec<StringFragment> //! │ └── content: Vec<enum RuleBlockContent> //! │ ├── StyleAt...
true
aa2ce77ab95f0b4b37965ddd036863762498c7eb
Rust
jrouaix/mws-rs
/mws/src/products/mod.rs
UTF-8
1,632
2.953125
3
[ "MIT" ]
permissive
//! Amazon MWS Products API - Version 2011-10-01 //! //! [Reference](http://docs.developer.amazonservices.com/en_US/products/Products_Overview.html) use result::MwsResult; pub mod types; pub use self::types::*; static PATH: &'static str = "/Orders/2013-09-01"; static VERSION: &'static str = "2011-10-01"; #[allow(no...
true
4f006ac8e5a1e5a8fe9ef791e6b059bb33be3219
Rust
Reachip/blockshain
/src/client_reader.rs
UTF-8
1,994
2.75
3
[]
no_license
use std::sync::Arc; use crate::client::Client; use std::io; use std::io::{Error, Write, Read}; use crate::network::node::Node; use std::os::unix::net::UnixStream; use crate::network::signal::Signal; pub trait UnixSocketReader { /// Fetch blocks provided by the network. fn fetch_blocks(&self, clients_sockets_lo...
true
460a9f65ff2bd0db83e4e8972741199a5bfd5722
Rust
storyfeet/mksvg
/src/page.rs
UTF-8
4,262
2.75
3
[]
no_license
use std::io::Write; use std::ffi::{OsStr,OsString}; use std::fs::File; use std::path::{Path,PathBuf}; use {Svg,SvgW,qcast}; use cdnum::CDNum; use std::process::Command; pub trait Card<NT:CDNum> :Clone{ fn front<S:Svg>(&self,svg:&mut S,w:NT,h:NT); } pub fn page<W:Write,NT:CDNum,C:Card<NT>>(w:W,pw:NT,ph:NT,nw:usi...
true
0be227fc05b6a457a15b0a150673dabbaf641ac2
Rust
bashhack/cyprust
/rust_core_concepts/vectors_hashmaps_casting_iflet_whilelet_result_enum/src/main.rs
UTF-8
7,527
3.75
4
[]
no_license
use natural_constants::math::apery; use std::collections::HashMap; use std::f64::consts::PI; use std::fs::File; #[derive(Debug)] enum NumTypes { Int(i32), Float(f64), Text(String), } fn main() { // ------------------------------------------------------------------------ // Vectors // ---------...
true
8cd3eb8897a50fc8187bc5d80046c40cc1df2229
Rust
1Crazymoney/wasmtime
/cranelift/codegen/src/inst_predicates.rs
UTF-8
2,882
3.203125
3
[ "LLVM-exception", "Apache-2.0" ]
permissive
//! Instruction predicates/properties, shared by various analyses. use crate::ir::{DataFlowGraph, Function, Inst, InstructionData, Opcode}; use crate::machinst::ty_bits; use cranelift_entity::EntityRef; /// Preserve instructions with used result values. pub fn any_inst_results_used(inst: Inst, live: &[bool], dfg: &Da...
true
ff6938ae8a4e757a2f337520e89f8fe1183feff7
Rust
Niedzwiedzw/minecraftrs
/mc/core/src/util/geom.rs
UTF-8
3,628
3.671875
4
[]
no_license
use std::ops::AddAssign; /// A generic rectangle. /// Coordinates order: X then Z #[derive(Clone)] pub struct Rect<T> { pub data: Vec<T>, pub x_size: usize, pub z_size: usize } impl<T> Rect<T> { pub fn new(x_size: usize, z_size: usize, def: T) -> Self where T: Clone { ...
true
3c033ae43e8b047777e0d03a7e6f872260fed432
Rust
po-gl/Raytracer
/src/bounds.rs
UTF-8
11,326
3.125
3
[ "MIT" ]
permissive
/// # Bounds /// `bounds` is a module to encapsulate a shape in a simpler shape (cube) for optimizing ray intersections use crate::tuple::{Tuple, point}; use crate::shape::Shape; use crate::shape::cone::Cone; use crate::shape::cylinder::Cylinder; use num_traits::float::Float as NumFloat; use crate::shape::triangle::Tr...
true
0cfe7956831859cbdbc596ce030d4f0e2538edba
Rust
Tiqur/Crypt
/src/main.rs
UTF-8
2,236
3
3
[ "MIT" ]
permissive
use std::env; use std::fs; use std::str; use std::io::{Cursor, Write}; extern crate base64; extern crate clap; extern crate libdeflater; use clap::{Arg, App}; use libdeflater::{Compressor, CompressionLvl, Decompressor}; mod Functions; use crate::Functions::enterDir::enterDir; use crate::Functions::decodeFile::decodeFi...
true
3d40deaa971d3f4469bc0bb723404d5da531e56a
Rust
932280190/tikv
/src/util/worker/mod.rs
UTF-8
8,875
3.140625
3
[ "Apache-2.0" ]
permissive
/// Worker contains all workers that do the expensive job in background. use std::sync::{Arc, Mutex}; use std::thread::{self, JoinHandle, Builder}; use std::io; use std::fmt::{self, Formatter, Display, Debug}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::mpsc::{self, Sender, Receiver, SendError}; us...
true
e88eb983c03c295b28e9f4a16fe703b9b76da7ce
Rust
joseluisq/rust-tspath
/src/line_replacer.rs
UTF-8
1,033
2.875
3
[]
no_license
use tspaths::TSPathsVec; pub struct LineReplacer<'a> { line: String, ts_paths_vec: &'a TSPathsVec, } impl<'a> LineReplacer<'a> { pub fn new(line: String, ts_paths_vec: &TSPathsVec) -> LineReplacer { LineReplacer { line, ts_paths_vec } } pub fn replace<F>(&self, mut fun: F) where ...
true
b5f11aa0cc31d00a70611980afd19f40a5e662d3
Rust
louiszhuang/OpenZKP
/algebra/primefield/src/rand.rs
UTF-8
573
2.78125
3
[ "Apache-2.0" ]
permissive
use crate::{Parameters, PrimeField, UInt}; use rand::{ distributions::{uniform::SampleUniform, Distribution, Standard, Uniform}, Rng, }; /// Draw from a uniform distribution over all values. /// /// Requires `UInt` to implement [`SampleUniform`]. impl<U, P> Distribution<PrimeField<P>> for Standard where U:...
true
99d962ebfe23edd4c14b146eafb245a1a63ebf3b
Rust
ilya-epifanov/heim
/heim-runtime/src/fs.rs
UTF-8
1,697
2.8125
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::io; use std::path::Path; use std::str::FromStr; use futures::{io::BufReader, AsyncBufReadExt, Stream, StreamExt, TryStreamExt}; use smol::unblock; // Public re-exports pub use smol::fs::{read, read_dir, read_link, read_to_string, File}; pub async fn path_exists<T>(path: T) -> bool where T: AsRef<Path> +...
true
3248d16f182b9a2d36b9f2a0447094be36f85c0b
Rust
kashik0i/competitive-programming-rs
/benches/treap.rs
UTF-8
557
2.671875
3
[ "CC0-1.0" ]
permissive
#![feature(test)] extern crate test; use competitive_programming_rs::data_structure::treap::treap::Treap; use rand::prelude::*; use test::Bencher; #[bench] fn bench_treap(b: &mut Bencher) { b.iter(|| { let mut treap = Treap::new(1234); let mut rng = StdRng::seed_from_u64(1234); for _ in 0....
true
e748f1be04f62aed7fb4bbd9ab4c3de9afc2e1b3
Rust
vrischmann/gitjuggling
/src/main.rs
UTF-8
4,244
2.9375
3
[ "MIT" ]
permissive
#![allow(clippy::uninlined_format_args)] use anyhow::anyhow; use colored::Colorize; use rayon::prelude::*; use std::fmt::Write as FmtWrite; use std::io::{self, Write}; use std::path::{Path, PathBuf}; use std::process; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use walkdir::WalkDir; struct Git...
true
128705daeafe798c089c919cd635d245752d9b3b
Rust
Devifish/aliyun-ddns
/src/config.rs
UTF-8
2,939
3.234375
3
[ "MIT" ]
permissive
use clap::ArgMatches; use std::env; use std::str::FromStr; /// 命令行参数 #[derive(Clone, Debug)] pub struct Options { pub access_key_id: Option<String>, pub access_key_secret: Option<String>, pub region_id: String, pub domains: Vec<String>, pub period: u32, pub ttl: u32, pub mode: Mode, } impl...
true
3749718c07f54d0d1224917eb25acc8a7a1f58b7
Rust
MarioRicalde/unbase
/crates/unbase/src/slab/slabref/mod.rs
UTF-8
4,757
3.21875
3
[ "Apache-2.0" ]
permissive
/* SlabRef intends to provide an abstraction for refering to a remote slab. Posessing a SlabRef does not confer ownership, or even imply locality. It does however provide us with a way to refer to a slab abstractly, and a means of getting messages to it. I labored a fair bit about whether this is m...
true
6cf4893fc490ae5bbd55e154f9c66e9eb3c3a3a9
Rust
isgasho/starlark-rust
/starlark/src/linked_hash_set/value.rs
UTF-8
10,781
3.0625
3
[ "Apache-2.0" ]
permissive
// Copyright 2019 The Starlark in Rust Authors // // 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 la...
true
87a6446ad0aa06f70030148b67a25086021aa51f
Rust
oknozor/m1s2_compil
/src/interpret/mod.rs
UTF-8
1,128
2.875
3
[]
no_license
use crate::token::token::Token; use crate::token::token::Token::*; use crate::token::token::Operator::*; use crate::token::token::Operator; use crate::token::token::Literal; use std::error::Error; use crate::token::token::Literal::NullLiteral; pub mod interpreter; pub mod interpret_visitor; pub fn solve_postfix(postf...
true
67831a72871ac770ca2c993255a1506fdfa99f4c
Rust
yajamon/zaif-api-rust
/src/trade_api/cancel_order.rs
UTF-8
1,124
2.75
3
[ "MIT" ]
permissive
use serde_json; use std::collections::HashMap; use crate::core::AccessKey; use crate::trade_api::TradeApi; builder!(CancelOrderBuilder => CancelOrder { access_key: AccessKey = AccessKey::new("", ""), order_id: u64 = 0, currency_pair: Option<String> = None }); impl CancelOrder { pub fn exec(&self) ->...
true
7375cb60f699a1f00fb372aa81bafa56e195ce63
Rust
data-pup/rust-conway
/src/board/board_update.rs
UTF-8
5,652
3.328125
3
[]
no_license
use board::Board; use board::position::BoardPosition; use board::validate::validate; struct UpdateCell { was_alive: bool, neighbors: u32, } impl Board { /// Updates the board. pub fn update(&mut self) { let new_living: Vec<BoardPosition> = if validate(&self) { // If the board is v...
true
b1bd308cfcc4e6817f3ad575f99807e96addd99b
Rust
nathanfaucett/rs-mat32
/src/transform.rs
UTF-8
4,622
3.234375
3
[ "MIT" ]
permissive
use core::f64::consts::FRAC_PI_2; use vec2; use num::Num; use signed::Signed; #[inline] pub fn compose<'a, 'b, T: Copy + Signed>(out: &'a mut [T; 6], position: &'b [T; 2], scale: &'b [T; 2], rotation: T) -> &'a mut [T; 6] { let sx = scale[0]; let sy = scale[1]; let c = rotation.cos(); let s = rotatio...
true
b206249bdaf7ce572a22253aca6d090e74531ab6
Rust
nreihidd/tsg
/src/fixvec.rs
UTF-8
3,664
3.21875
3
[]
no_license
use fixmath::Fixed; use std::cmp::{PartialOrd, Ord, Ordering}; use na::{Vec2, BaseNum, Absolute, Axpy}; pub trait Norm<N> { fn normalize(&self) -> Self; fn norm(&self) -> N; } fn normsq(v: &Vec2<Fixed>) -> i64 { let x = v.x.raw() as i64; let y = v.y.raw() as i64; x * x + y * y } pub struct CmpNor...
true
35b524446a6bac5308426af98fa3d3787cb2e49c
Rust
esavier/keynesis
/src/noise/pattern/n.rs
UTF-8
8,260
2.84375
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::io::Write; use crate::{ buffer::BufRead, hash::Hash, key::{ed25519::PublicKey, Dh}, noise::{CipherState, HandshakeState, HandshakeStateError}, seed::Seed, }; use rand_core::{CryptoRng, RngCore}; /// One-Way Handshake [**Noise N**] /// /// [**Noise N**]: https://noiseexplorer.com/patterns/...
true
cb8fb60bc79e57e65435d758b2ab4e2992230a91
Rust
Jeffail/spiril
/src/population.rs
UTF-8
11,913
3.0625
3
[ "MIT" ]
permissive
// Copyright (c) 2017 Ashley Jeffs // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, ...
true
053ea2d79cd8d1a1dc4a966d35bcbc03b7a7a955
Rust
0916dhkim/rookie-hacks-discord-bot
/src/commands/help.rs
UTF-8
1,026
2.8125
3
[ "MIT" ]
permissive
use serenity::prelude::*; use serenity::model::prelude::*; use serenity::framework::standard::{ CommandResult, macros::command, }; #[command] pub fn help(ctx: &mut Context, msg: &Message) -> CommandResult { // TODO: I cut !me and !merge. Do we need it? // -> `!me`: Show my team building status. // -> `!merge <fir...
true
419a457bb1a5cba67e168d9b8b8706a9f686d268
Rust
lizelive/cuel
/offtopic/all.rs
UTF-8
4,505
3.515625
4
[]
no_license
use std::ops::{Add, Div, Mul, Sub}; #[derive(Debug, PartialEq, Eq, PartialOrd)] pub enum SpecialInteger { Biggest, Smallest, } pub enum Round { NearestTiesToEven, TowardPositive, TowardNegative, TowardZero, TowardsInfinity, NearestTiesToAway, } pub trait Number: Sized + Add + Sub + Mu...
true
05d650dc164b7fb1bcedcaaf830df29e27cd37b3
Rust
sammorrell/tesys-rs
/tesys/src/astrometry/src/transform.rs
UTF-8
897
3.078125
3
[]
no_license
use crate::frame::Frame; use crate::Location; use crate::SkyCoordinate; use chrono::{DateTime, Utc}; #[derive(Clone)] pub struct CoordinateTransform<F: Frame, T: Frame> { pub coords: SkyCoordinate<F>, pub from: F, pub to: T, pub at: DateTime<Utc>, pub loc: Location, } impl<F: Frame, T: Frame> Coor...
true
ec5a3dede1f2cf72dc45d99d5311ff2e835d8711
Rust
meetuparchive/jirabars
/src/jira.rs
UTF-8
4,747
2.984375
3
[ "MIT" ]
permissive
use crate::metric::incr; use goji::{Credentials, Jira}; use lazy_static::lazy_static; use regex::Regex; struct Issue { key: String, url: String, summary: String, description: String, } pub fn body(host: String, user: String, pass: String, branch: &str, body: &str) -> Option<(Vec<String>, String)> { ...
true
ed508d3ec3bbf295ec4b448d7f07d63769d74121
Rust
Kurble/mirror
/src/client.rs
UTF-8
1,769
2.75
3
[]
no_license
use super::*; use std::ops::{Deref, DerefMut}; use std::str::FromStr; use std::marker::PhantomData; use serde_json::{Value, from_value}; use futures::*; pub struct Client<T: Reflect, R: Remote> { value: T, remote: R, } struct Connect<T: Reflect, R: Remote> { remote: Option<R>, ph: PhantomData<T>, } ...
true
2db9e0482a083fb0d667b84bca4d52c3746baf45
Rust
ktsol/karlson
/src/karlson.rs
UTF-8
10,890
2.59375
3
[]
no_license
extern crate std; use std::collections::VecDeque; use std::time::SystemTime; use core::Settings; use core::Thermometer; pub use core::Device; use dsys; use dnv; #[derive(Debug, Clone)] struct Jam { pwm_ok: usize, temp_ok: usize, temp_hot: usize, temp_crit: usize, } #[derive(Debug, Clone)] pub struc...
true
71b64fcc5e83622c0ef142950c8bd23c04d317c4
Rust
minus3theta/contest
/cargo/typical90/src/bin/051.rs
UTF-8
1,369
2.75
3
[]
no_license
#[allow(unused_imports)] use itertools::Itertools; #[allow(unused_imports)] use num::Integer; #[allow(unused_imports)] use proconio::derive_readable; use proconio::fastout; use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp; #[allow(unused_imports)] use std::col...
true
c5759213acfaaf81e1e2f7a891482d8c65ba8a9c
Rust
Disasm/rpi-os-fs
/fat32/src/mbr.rs
UTF-8
2,702
2.890625
3
[]
no_license
use std::{fmt, io}; use traits::BlockDevice; use partition::Partition; #[repr(C, packed)] #[derive(Debug, Copy, Clone)] pub struct CHS { c: u8, h: u8, s: u8, } #[repr(C, packed)] #[derive(Debug, Clone)] pub struct PartitionEntry { pub boot_indicator: u8, pub start_chs: CHS, pub entry_type: u8...
true
a4cbefe4108617ff9e2987a167f82a048ff5dd87
Rust
softsilverwind/petfall
/src/utils.rs
UTF-8
463
2.6875
3
[ "Apache-2.0" ]
permissive
use json::JsonValue; pub type Result = std::result::Result<(), Box<dyn std::error::Error>>; pub fn classname(json: &JsonValue) -> String { match json { JsonValue::Null => "Null", JsonValue::Short(_) => "String", JsonValue::String(_) => "String", JsonValue::Number(_) => "Number", ...
true
c1b585cdae01092eb5b6cec57311a0d38342d88a
Rust
Reonarudo/haft
/src/benches/tests/replication_test.rs
UTF-8
554
3.34375
3
[ "MIT" ]
permissive
#[inline(never)] fn add(x: i32, y:i32)-> i32{ return x+y; } fn main(){ let mut count=0; let mut r=-1; loop{ r=add(count-1,count); if count == 2 { break; } count+=1; } std::process::exit(r); } fn will_Throw_An_Exception(argument:i32) -> i32{ try!(argument); return 1; } fn runs_After_Exception...
true
a8a1e11e11dff3c1e8799c0365585c920094e131
Rust
soniccat/one2html
/src/page/embedded_file.rs
UTF-8
2,603
2.78125
3
[ "MIT" ]
permissive
use crate::page::Renderer; use color_eyre::eyre::{ContextCompat, WrapErr}; use color_eyre::Result; use onenote_parser::contents::EmbeddedFile; use onenote_parser::property::embedded_file::FileType; use std::fs; use std::path::PathBuf; impl<'a> Renderer<'a> { pub(crate) fn render_embedded_file(&mut self, file: &Emb...
true
d33b1543caf6bdc860ed24293d372bcc4da34fbe
Rust
norse-rs/runic
/src/filter/radial_box.rs
UTF-8
928
3.03125
3
[]
no_license
//! Analytic coverage based on distance from circle center. use crate::{RelativeBounds, Filter, math::*}; pub struct RadialBoxFilter { pub radius: f32, } impl Filter for RadialBoxFilter { fn name(&self) -> String { "RadialBox".into() } fn pdf(&self, x: f32) -> f32 { todo!() } fn cdf(&s...
true
b3961e7b3e47461866a23b0f7cdfcbf3f050fefc
Rust
awslabs/aws-lambda-rust-runtime
/lambda-events/src/event/config/mod.rs
UTF-8
2,012
2.859375
3
[ "Apache-2.0", "MIT" ]
permissive
use serde::{Deserialize, Serialize}; /// `ConfigEvent` contains data from an event sent from AWS Config #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ConfigEvent { /// The ID of the AWS account that owns the rule #[serde(default)] pub account_i...
true
8347657cd57f46ed1ada74faa469272dffa9bbba
Rust
f5io/callbag.rs
/src/operators/map.rs
UTF-8
856
2.703125
3
[]
no_license
use crate::types::{Message, Through}; pub fn map<A: 'static, B: 'static, F: 'static>(f: F) -> Through<A, B> where F: Fn(A) -> B + Send + Sync + Clone, { Box::new(move |source| { let f = f.clone(); Box::new(move |message| { if let Message::Start(sink) = message { let ...
true
f872590e2c4d14891a34236a82e8facd683441ee
Rust
arielhenryson/cheetah
/cheetah_lib/src/types/values.rs
UTF-8
444
3.015625
3
[]
permissive
use super::function::Function; pub type Value = ValueData; pub type HeapValue = Box<Value>; #[derive(Debug, Clone)] pub enum ValueData { Undefined, Integer(i32), Function(Box<Function>), Array( Vec<Value> ) } impl ValueData { pub fn is_truthy(&self) -> bool { match *self { ...
true
c10d8c853a8d6ffc43a3a76adcfa29190f2469c6
Rust
drawfish/ungoliant
/src/io/writer/writer.rs
UTF-8
8,170
2.984375
3
[ "Apache-2.0" ]
permissive
/*! Text&Metadata writer for a given language. Holds writing and rotating on both text and metadata files for a given language. Supports writing of numerous [MergedPiece], given that their identification are the same. Identification is checked too, preventing the writing of differently identified [MergedPiece] into a ...
true
22c6efffd0bbcf1b490ad67c57ce3ca27715a397
Rust
7e4/himalaya
/src/output/output_entity.rs
UTF-8
1,402
3.375
3
[]
no_license
use anyhow::{anyhow, Error, Result}; use serde::Serialize; use std::{ convert::TryFrom, fmt::{self, Display}, }; /// Represents the available output formats. #[derive(Debug, PartialEq)] pub enum OutputFmt { Plain, Json, } impl From<&str> for OutputFmt { fn from(fmt: &str) -> Self { match f...
true
1a2380daa6551c85fd711b9c8a97d0ea7687ef32
Rust
malash/codewars-solutions
/Rust/build-tower/src/main.rs
UTF-8
824
3.546875
4
[ "MIT" ]
permissive
fn main() { for line in tower_builder(6) { println!("{}", line); } } /// https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/rust fn tower_builder(n: usize) -> Vec<String> { (0..n) .map(|i| { format!( "{}{}{}", " ".repeat(n - i - 1), ...
true
b99207d18b37c71a681ddee5baf6bab8c478ecf3
Rust
jaredmcdonald/cryptopals-rs
/src/exercise_13.rs
UTF-8
3,390
3.46875
3
[]
no_license
use ascii::bytes_to_ascii_string; use std::collections::HashMap; use utils::random_bytes; use aes::{encrypt_aes_ecb_padded, decrypt_aes_ecb_padded, BLOCK_SIZE}; fn parse(s: &str) -> HashMap<&str, String> { let mut output = HashMap::new(); for pair in s.split('&') { let parsed: Vec<&str> = pair.split('=...
true
df72eda694b9d30fb5586ef72de9443eb1d23f22
Rust
donbonifacio/wwtrader
/engine/src/models/world.rs
UTF-8
2,655
3.4375
3
[]
no_license
use std::collections::HashMap; use actions::action::ActionData; use models::coordinate::Coordinate; use models::entity::Entity; #[derive(Clone)] pub struct World { current_id: i32, pub left_edge: Coordinate, pub right_edge: Coordinate, pub entities: HashMap<i32, Entity>, actions: Vec<ActionData>, ...
true
aa1e7f2fa929e99c7cdd70c335d011fcf91f659e
Rust
zprobst/diesel-rds-data
/src/transaction_manager.rs
UTF-8
2,085
2.5625
3
[]
no_license
use std::cell::Cell; use diesel::{ connection::{SimpleConnection, TransactionManager}, QueryResult, }; use crate::connection::RdsConnection; pub struct RdsTransactionManager { transaction_depth: Cell<i32>, } impl RdsTransactionManager { fn change_transaction_depth(&self, by: i32, query: QueryResult<...
true
ac090f6168ab208a8b21138842af83896ee1c41c
Rust
cmsd2/renv
/src/os/unix.rs
UTF-8
703
2.640625
3
[ "MIT", "Apache-2.0" ]
permissive
use ::fs; use ::result::*; use std::env; use std::path::{Path,PathBuf}; use std::ffi::OsString; pub fn get_xdg_config_dir() -> Result<PathBuf> { match env::var_os("HOME") { Some(os_str) => { let mut dir = Path::new(&os_str).to_path_buf(); dir.push(".config"); Ok(dir) ...
true
356bd1027e86c6b42e33a7c2ef179362554be10c
Rust
aopicier/cryptopals-rust
/challenges/src/prefix_suffix_oracles.rs
UTF-8
10,121
2.6875
3
[ "MIT" ]
permissive
use std::cell::Cell; use std::collections::HashMap; use rand::Rng; use aes::BLOCK_SIZE; use aes::{Aes128, MODE}; use serialize::from_base64; use crate::errors::*; type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync + 'static>>; use aes::random_block; pub trait Oracle { fn encrypt(...
true
9b45f3a60c6371d01512daa5c4456e24f6ec0e8f
Rust
mattlennon3/advent_of_code_2020
/day2/src/main.rs
UTF-8
4,789
3.609375
4
[]
no_license
use std::fs; use std::io; use std::io::prelude::*; use regex::Regex; #[macro_use] extern crate lazy_static; #[derive(Debug, Clone)] struct PasswordEntry { lower: u32, upper: u32, letter: char, password: String, } impl PartialEq for PasswordEntry { fn eq(&self, other: &Self) -> bool { sel...
true
472d6b99ac110d5872d5adb15b8ea38222e2fe00
Rust
fantome/advent_of_code_2019
/src/main.rs
UTF-8
2,592
2.984375
3
[]
no_license
use std::env; mod day01; mod day02; mod day03; mod day04; mod day05; mod day06; mod day07; mod day08; mod day09; mod day10; mod day11; mod day12; mod day13; mod day14; mod day15; mod day16; mod day17; mod day18; mod day19; mod day20; mod day21; mod day22; mod day23; mod day24; mod day25; macro_rules! help { ($args:e...
true
2603951eec90aee70dda1dffd389dfabb584d1db
Rust
KalinDimitrow/rust-playground
/tetris/src/tetris.rs
UTF-8
2,588
2.90625
3
[]
no_license
use crate::game_data::*; use crate::game_resources::*; use crate::main_menu_state::MainMenu; use crate::state_machine::*; use piston_window::*; use std::error; pub struct Tetris { window: PistonWindow, pub game_resources: GameResources, pub game_data: GameData, pub game_logic: StateMachine, } const GA...
true
46963b952cdc8804bb5bbff89d5540253915c56b
Rust
charles-r-earp/autograph-v0.0.3
/src/cpu.rs
UTF-8
46,291
2.875
3
[ "MIT", "Apache-2.0" ]
permissive
use super::{ Buffer, Conv2dArgs, DataMut, DataRef, Num, Pool2dArgs, Tensor2, TensorBase, TensorView1, TensorView4, TensorViewMut1, TensorViewMut4, Transpose, Unsigned, }; use cpp::*; use ndarray::{Dimension, Ix0, Ix1, Ix2, Ix4}; use num_traits::{Bounded, ToPrimitive}; use std::{ borrow::Cow, fmt::{self,...
true
6dab96eb676ae7f82480f5e649f5ad8423f77b30
Rust
rljacobson/Lesk
/lesk_specification/src/mergable.rs
UTF-8
4,848
3.6875
4
[ "MIT" ]
permissive
/*! A trait for structs that can determine if they can be merged with each other. */ use std::cmp::{min, max}; use std::fmt::{Display, Debug}; use smallvec::SmallVec; #[derive(Clone, Eq, PartialEq, Hash, Debug)] pub enum Merged<T, U> { Yes(T), No(U, U) } impl<T, U> Merged<T, U> { pub fn unwrap(self) -> T ...
true
3b85458b3a116f645908f8ac2355f935d864cea5
Rust
pipe-fun/pipe
/src/app.rs
UTF-8
5,668
2.546875
3
[ "MIT" ]
permissive
//! The root app contains initial authentication and url routes use yew::{ agent::Bridged, html, Bridge, Callback, Component, ComponentLink, Html, ShouldRender, }; use crate::routes::{ console::view::Console, user::login::Login, user::logout::Logout, user::register::Regi...
true
97bcd1e999f57ab1460913d5771625e47388c5ec
Rust
shadeops/euled-up
/Week_5_Input_w_Concurrency/asw/rust/src/substring.rs
UTF-8
1,035
3.46875
3
[]
no_license
use unicode_segmentation::UnicodeSegmentation; pub fn substring(s: &str, start: usize, end: usize) -> &str { let mut iter = s.graphemes(true); let mut offset = 0; for _ in 0..start { match iter.next() { Some(x) => offset += x.len(), None => break, } } let mu...
true
e80d46d75379dd5a2c4ce896f3d47e2406bf6e9e
Rust
nathanfaucett/rs-lisp
/runtime/src/reader.rs
UTF-8
11,748
2.578125
3
[ "Apache-2.0", "MIT" ]
permissive
use alloc::string::String; use alloc::vec; use core::num::ParseIntError; use core::str::FromStr; use gc::Gc; use super::{ new_char, new_escape, new_i16, new_i32, new_i64, new_i8, new_isize, new_keyword, new_keyword_with_meta, new_list_from_with_meta, new_map_from, new_map_from_with_meta, new_string, new_symbol_...
true
8ebe645b27965414676e91ec186f45c0ef795f74
Rust
gluon-lang/gluon_language-server
/build.rs
UTF-8
712
2.59375
3
[ "MIT" ]
permissive
use std::{env, io, path::Path, process::Command}; fn main() { let git_commit = env::var("GIT_COMMIT") .or_else(|_| -> io::Result<_> { let output = Command::new("git").args(&["rev-parse", "HEAD"]).output()?; Ok(String::from_utf8(output.stdout).unwrap()) }) .expect("Un...
true
c4b50c7ddf1a08b3fdd6511459a71fc6a84fab13
Rust
pombredanne/gitrs
/src/builtin/ls_files.rs
UTF-8
761
2.53125
3
[ "MIT" ]
permissive
use cli; use index; pub fn cmd_ls_files(flags: &[String]) { let accepted_flags = ["--stage", "-s"]; if cli::has_known_flags(flags, &accepted_flags) { let stage = cli::has_flag(&flags, "--stage", "-s"); if let Err(why) = ls_files(stage) { println!("Could not print index files: {:?}",...
true
57331d8a15c5895bfff21648810ca95f06d5064e
Rust
IThawk/rust-project
/rust-master/src/librustc_mir/build/into.rs
UTF-8
1,491
3.109375
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
//! In general, there are a number of things for which it's convenient //! to just call `builder.into` and have it emit its result into a //! given location. This is basically for expressions or things that can be //! wrapped up as expressions (e.g., blocks). To make this ergonomic, we use this //! latter `EvalInto` tr...
true
2070606e7a74c10b841cd8858a09a1b46e9fc886
Rust
gnoliyil/fuchsia
/third_party/rust_crates/vendor/hkdf-0.11.0/src/hkdf.rs
UTF-8
6,816
3.078125
3
[ "Apache-2.0", "MIT", "BSD-2-Clause" ]
permissive
//! An implementation of HKDF, the [HMAC-based Extract-and-Expand Key Derivation Function][1]. //! //! # Usage //! //! ```rust //! # use sha2::Sha256; //! # use hkdf::Hkdf; //! let ikm = hex::decode("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b").unwrap(); //! let salt = hex::decode("000102030405060708090a0b0c").unwrap...
true
1c53cf4ecfd5b22b9eb3c7848d97945ac0b7fea6
Rust
jamesmeyer1993/LearnRust
/basicmath/src/main.rs
UTF-8
2,028
3.765625
4
[]
no_license
use std::io; // read/write to io fn sum(start: u64, end: u64) -> u64 { let mut sum: u64 = 0; for i in start..end { sum += i; } return sum; } // factorial fn fac(x: u64) -> u64 { if x == 0 || x == 1 { return 1; } let mut result = x; let mut i_rev: u64 = 0; ...
true
f709d92025cf340e6e40d5fce505d4113057b5c3
Rust
rusty-horizon/nx-rs
/nx-std/src/test/ui/run-pass/issues/issue-8851.rs
UTF-8
1,086
2.5625
3
[ "BSD-3-Clause", "NCSA", "Apache-2.0", "LicenseRef-scancode-other-permissive", "BSD-2-Clause", "MIT" ]
permissive
// Copyright 2013 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
00e00a880a1a527acc61b964b5470c221d3f6e09
Rust
mamidon/newt
/newtc/src/featurez/syntax/syntax_tree.rs
UTF-8
7,644
2.875
3
[]
no_license
use crate::featurez::parse::ParseEvent; use crate::featurez::parse::{CompletedParsing, Parser}; use crate::featurez::syntax::tree_sink::TreeSink; use crate::featurez::syntax::SyntaxToken; use crate::featurez::syntax::TextTreeSink; use crate::featurez::syntax::{AstNode, StmtNode, SyntaxElement, SyntaxKind, SyntaxNode}; ...
true
337ac3abcbb81f4943f9822e2d2eda568850c696
Rust
d4wnin9/gdbs
/src/lib.rs
UTF-8
2,102
3.09375
3
[]
no_license
extern crate clap; extern crate dirs; use std::error::Error; use std::fs::File; use std::process; use std::io::prelude::*; use std::process::Command; use std::os::unix::process::CommandExt; pub fn run(args: clap::ArgMatches) -> Result<(), Box<dyn Error>> { // .gdbs, .gbdibit へのパス let mut path_to_gdbs = dirs:...
true
f0fb1221dbdba202f6958d1d8a4722e96d410135
Rust
H1d3r/serval
/src/main.rs
UTF-8
7,095
2.9375
3
[ "Apache-2.0" ]
permissive
use std::thread; use clap::{Arg, App}; use std::process::Command; use std::io::{Read, Write, ErrorKind}; use anyhow::{Result, Error}; use std::net::{TcpListener, TcpStream}; use rustyline::Editor; use rustyline::error::ReadlineError; enum ReadHandle { Main(std::io::Stdin), Child(std::process::ChildStdout) } ...
true
37c55c6387bc9f170a6fbac4c3f4f8e4fc901b33
Rust
ramsey-darling1/rust_term_text
/src/main.rs
UTF-8
1,313
3.375
3
[]
no_license
//Terminal Texting Program //@rdar extern crate hyper; use std::io; use std::io::Read; use hyper::Client; //use hyper::header::Connection; fn main() { //init vars let mut phone_number = String::new(); let mut text_message = String::new(); //greet the user println!("Hello, welcome to the termina...
true
ea2fb3c9fe7bf186368db77465e753b25bb37fbb
Rust
dai1975/fiatproof
/src/crypto/digest/helper.rs
UTF-8
2,079
2.796875
3
[ "Apache-2.0" ]
permissive
use crypto::digest::Digest; use std::borrow::{Borrow, BorrowMut}; pub fn input_hex<D:Digest, T:Borrow<str>>(d: &mut D, input: T) { d.input(crate::utils::h2b(input).unwrap().as_ref()) } pub fn input_hex_rev<D:Digest, T:Borrow<str>>(d: &mut D, input: T) { d.input(crate::utils::h2b_rev(input).unwrap().as_ref()) } ...
true