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
f7485aea34a7a007b2799dfbd496fc876cea7e62
Rust
ilai-deutel/kibi
/src/config.rs
UTF-8
9,702
3.453125
3
[ "Apache-2.0", "BSD-2-Clause", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! # Configuration //! //! Utilities to configure the text editor. use std::io::{BufRead, BufReader}; use std::path::{Path, PathBuf}; use std::{fmt::Display, fs::File, str::FromStr, time::Duration}; use crate::{sys::conf_dirs as cdirs, Error, Error::Config as ConfErr}; /// The global Kibi configuration. #[derive(De...
true
da219d031ffdf35ebb167ccc81dea5de836e976d
Rust
HaojunRen/pea2pea
/src/protocols/reading.rs
UTF-8
11,159
2.671875
3
[ "CC0-1.0" ]
permissive
use crate::{protocols::ReturnableConnection, Pea2Pea}; use async_trait::async_trait; use tokio::{ io::{AsyncRead, AsyncReadExt}, sync::mpsc, time::sleep, }; use tracing::*; use std::{io, net::SocketAddr, time::Duration}; /// Can be used to specify and enable reading, i.e. receiving inbound messages. /// ...
true
ad82c4926f93ccd880edc78605b1f2ea453c54ea
Rust
lukasz223968/RustChess
/src/gen_iter.rs
UTF-8
2,161
2.59375
3
[]
no_license
#![feature(generators, generator_trait)] // slightly modified gen-iter crate by tinaun: https://github.com/tinaun/gen-iter use std::ops::{Generator, GeneratorState}; use std::iter::Iterator; use std::marker::Unpin; use std::pin::Pin; /// a iterator that holds an internal generator representing /// the iteration st...
true
b94a18b5733aeec8191ad7862a7b061e4d4efec1
Rust
kerryeon/n3
/n3-parser/src/token.rs
UTF-8
3,757
2.828125
3
[ "MIT" ]
permissive
//! Many of this code is from: https://github.com/RustPython/RustPython //! Different token definitions. //! Loosely based on token.h from CPython source: use std::fmt::{self, Write}; /// Python source code can be tokenized in a sequence of these tokens. #[derive(Clone, Debug, PartialEq)] pub enum Tok { Name { nam...
true
e53127bb6690b4821904b9cab9a92be4735be75a
Rust
carllerche/eventual_io
/src/net/listener.rs
UTF-8
4,371
3.0625
3
[]
no_license
use core::{self, async, Async, Bytes, Pair, Sender}; use mio::{NonBlock, Token}; use mio::tcp::TcpListener; use net::{Action, Stream}; use reactor::Notify; use std::{fmt, mem}; // ## Implementation notes // // It's important that a listener is never dropped while in the Waiting // state as the reactor may receive even...
true
08b72a4af4b090de7dc8382ba92a85d16f3e8469
Rust
qbeightol/sound
/src/sound/mod.rs
UTF-8
880
3.109375
3
[]
no_license
/// A library for generating primitive waves pub mod wave { pub mod sine; } // // /// Ways to combine sounds into new sounds // mod combinator { // // } /// An abstract sound. pub trait T { /// Convert the sound into a sequence of 32 bit samples. fn samples(&self) -> samples::T; } pub mod samples { ...
true
06671c9342d6eb10732d707cdf69cbbd684895df
Rust
martingul/simplechain
/src/net/server.rs
UTF-8
1,706
2.734375
3
[]
no_license
use rouille::{Server, Request, Response}; use super::handlers; use errors::ServerError; // route incoming requests to matching handler fn route(req: &Request) -> Result<Response, ServerError> { router!(req, (GET) (/) => { handlers::get_index(req) }, (POST) (/transaction) => { handlers::post_transa...
true
2180cdcb39bbe48e2a9972e115a9b900aaabdeb5
Rust
ericdeansanchez/kvs
/src/kvs/util/errors.rs
UTF-8
1,027
3.15625
3
[ "MIT" ]
permissive
//! Primary error structures for kvs. use std::io; /// Error types for the key-value store. #[derive(Debug)] pub enum KvsError { /// IO Error indicating that an IO error occurred /// during an IO process. Io(io::Error), /// Serde Error indicating that an error occurred /// during the (de)serializat...
true
42f32babf89bf06645adf9f1598c1274fd0b3285
Rust
qbox/rust-sdk
/qiniu-rust/src/utils/crc32.rs
UTF-8
2,389
2.890625
3
[ "Apache-2.0" ]
permissive
use crc::crc32::{Digest, Hasher32, IEEE}; use getset::CopyGetters; use std::{ fs::File, io::{copy, sink, Read, Result}, path::Path, }; use tap::TapResultOps; #[derive(CopyGetters)] pub struct Reader<'io, IO> where IO: Read, { io: &'io mut IO, #[get_copy = "pub"] crc32: Option<u32>, have...
true
bf9c050861a4efeae6a23335d2b34f45782dc2ea
Rust
mzmcbride/database-reports
/dbreps2/src/general/uncattemps.rs
UTF-8
1,223
2.59375
3
[ "LicenseRef-scancode-public-domain" ]
permissive
use anyhow::Result; use dbreps2::{dbr_link, str_vec, Frequency, Report}; use mysql_async::prelude::*; use mysql_async::Conn; pub struct Row { page_title: String, } pub struct UncatTemps {} #[async_trait::async_trait] impl Report<Row> for UncatTemps { fn title(&self) -> &'static str { "Uncategorized t...
true
d4bdb5e49d5d365f93bb9baa7d5c3d2d97a19c55
Rust
tempbottle/playform
/server/terrain/texture_generator.rs
UTF-8
2,748
2.671875
3
[ "MIT" ]
permissive
use common::color::Color3; use opencl; use opencl::hl::{Program, Kernel}; use opencl::mem::CLBuffer; use opencl_context::CL; const INCLUDE_PERLIN: &'static str = " double perlin( double amplitude, double frequency, const double persistence, const double lacunarity, const uint octaves, co...
true
43cf30900c85439d3b2685cbc1f39cab46c9f165
Rust
vladvasiliu/intellij_ramdisk_target
/src/main.rs
UTF-8
4,111
2.984375
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
extern crate clap; use clap::{Arg, App, crate_authors, crate_version}; use log::{info, warn, error}; use std::os::unix::fs::symlink; use std::fs; use std::path::PathBuf; mod error; use crate::error::{Result, Error}; use std::process::exit; fn main() { setup_logger().unwrap(); let mut config = Config::fro...
true
4ad795b8677ea44b62cb7f390ad1b92193fbe60d
Rust
superben2010/shadowsocks-windows-gui-rust
/src/config.rs
UTF-8
1,430
2.609375
3
[]
no_license
use std::fs; use std::path::Path; use std::path::PathBuf; use serde::{Deserialize, Serialize}; use anyhow::{Context, Result}; use crate::utils; #[derive(Serialize, Deserialize, Debug)] pub struct Server { pub name: String, pub server: String, pub password: String, pub method: String, pub timeout...
true
acfaf710cddb2f8a5766677c71f77cc1faa41658
Rust
rust-gjk/rustgrade
/src/server/new.rs
UTF-8
852
2.53125
3
[]
no_license
use rustgrade::packets::Packet; use rustgrade::database::{Index, User}; use std::process::exit; use std::net::ToSocketAddrs; use AUTH_TOKEN; use SOCKET; pub fn new<A: ToSocketAddrs + Clone>(packet: Packet, addr: A) { let mut index = match Index::read() { Ok(i) => i, Err(e) => {println!("fatal err...
true
1e1aa248b20c1b34da186bbab5ff5e7b3eab03ea
Rust
jkbbwr/xsd-to-rs
/src/xsd/element.rs
UTF-8
540
2.984375
3
[]
no_license
use roxmltree::Node; #[derive(Debug)] pub enum Element { Element { name: String, value: String }, Any, } impl<'a, 'input> From<Node<'a, 'input>> for Element { fn from(node: Node<'a, 'input>) -> Self { if node.has_tag_name("any") { Element::Any } else { let name = no...
true
3a442eae015f7c1ab6da292520444fc3860ded80
Rust
mjedwabn/aoc2020
/day2/src/lib.rs
UTF-8
5,572
3.640625
4
[]
no_license
pub mod day2 { use std::collections::HashMap; pub fn is_password_valid(policy: &PasswordPolicy, password: &String) -> bool { let letters: HashMap<char, i32> = password.chars().fold(HashMap::new(), |mut hm, c| { *hm.entry(c).or_insert(0) += 1; hm }); let occurrenc...
true
730c619b05289b355894c8d0bdead79c7266668d
Rust
rkanati/voxel
/src/math/mod.rs
UTF-8
1,580
2.671875
3
[]
no_license
pub mod iter; pub use iter::*; pub mod linear; pub use linear::*; pub mod planar; pub use planar::Plane; pub mod box3; pub use box3::Box3; pub use nalgebra as na; pub trait Intersect<With> { type Intersection; fn intersect(&self, other: &With) -> Option<Self::Intersection>; } #[derive(Clone, Copy, Partia...
true
0e9ed8c20e84393a6313f83e2b270b75f1e2482a
Rust
e42s/kernel
/src/reactors/tokio/split.rs
UTF-8
1,168
2.734375
3
[]
no_license
use std::cell::RefCell; use std::io::{self, Read, Write}; use reactors::tokio::io_token::Io; use abstractions::poll::Async; use abstractions::tasks::task_rc::TaskRc; pub struct ReadHalf<T> { handle: TaskRc<RefCell<T>>, } pub struct WriteHalf<T> { handle: TaskRc<RefCell<T>>, } pub fn split<T: Io>(t: T) -> (Re...
true
02f71953905217765acd2fee8eb1fb7bbad172e3
Rust
T-parrish/Rust_book
/src/collections.rs
UTF-8
6,130
4
4
[]
no_license
// Like tuples and arrays, collections can take multiple values. The difference // is that collections point to data on the heap rather than the stack // this means that collections do not need to have a fixed size at compile time and // are free to grow or shrink as the program runs. pub mod col_notes { // Allows ...
true
a64134c2620f72a947f63b62304836791a2a9a35
Rust
jcmorrow/advent2019
/two/src/lib.rs
UTF-8
6,390
3.34375
3
[]
no_license
extern crate four; use four::int_parts; use std::io; #[derive(Debug, Copy, Clone)] enum ParameterMode { Position, Immediate, } struct ParameterModes { modes: Vec<ParameterMode>, } impl ParameterModes { fn get(&self, i: i32) -> ParameterMode { match self.modes.get(i as usize) { So...
true
c9dd82552b92a9b700e1927810f3219afbf7f77e
Rust
mrrbrilliant/pmgnt
/source-repo/src/main.rs
UTF-8
4,718
2.84375
3
[]
no_license
use lib::structs::{Package, SourceRepo}; use serde_yaml::{from_reader, to_writer}; use std::{ env, fs::{copy, create_dir_all, File}, io::{Error, ErrorKind}, path::{Path, PathBuf}, result::Result, }; fn main() { let args: Vec<String> = env::args_os() .map(|a| a.to_str().unwrap().to_strin...
true
97591d4d3e64459595c88e8266d96af593fdbcd6
Rust
yehohanan7/ledgers
/src/ledger.rs
UTF-8
5,412
3.296875
3
[]
no_license
use crate::files::*; use crate::segment::*; use crate::types::*; use std::collections::HashMap; use std::sync::Arc; use tokio::io::AsyncWrite; use tokio::sync::RwLock; use uuid::Uuid; pub struct LedgerRepository { ledgers: Arc<RwLock<HashMap<String, Ledger>>>, } impl LedgerRepository { pub fn new() -> LedgerR...
true
5eca4991f7704f74b80c96f2e99a175ca0ace833
Rust
Fronox/StreamAggregator
/src/main.rs
UTF-8
3,913
2.71875
3
[]
no_license
extern crate kafka; extern crate csv; extern crate json; extern crate num_traits; extern crate eventual; use std::fs; use std::time::Duration; use kafka::producer::{Producer, Record, RequiredAcks}; use kafka::Error; use json::JsonValue; use json::number::Number; const ROW_COUNT: usize = 1; fn produce_message(data: S...
true
847f8f9751ae910a51485d375b1cd91523fb9d8f
Rust
ferrum-rs/ferrum-router
/src/recognizer/tests.rs
UTF-8
4,037
3.046875
3
[ "MIT" ]
permissive
use super::*; #[test] fn parse_glob_direct() { let types = Store::<String, String>::default(); let (regex, params) = Recognizer::parse_glob("", &types).unwrap(); assert!(!regex.is_match("test")); assert!(regex.is_match("")); assert!(regex.is_match("/")); assert!(!regex.is_match("//")); ass...
true
44d7c57b5a89d5f8a9ba8918ac15420d179ddba1
Rust
TheMrIron2/hnefatafl-psp
/src/main.rs
UTF-8
4,125
2.53125
3
[]
no_license
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; #[macro_use] extern crate serde_derive; use rocket::{ http::Status, response::{NamedFile, Redirect}, request::{FromRequest, Outcome}, State, Request, }; use rocket_contrib::templates::Template; use rocket_contrib::{json:...
true
eb1a76dda0ac7e3f91b2ac7706b713711f0b9e6b
Rust
Emoun/graphene
/src/algo/bfs.rs
UTF-8
6,097
3.703125
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate::core::{property::HasVertex, Graph}; use std::collections::VecDeque; /// Performs [breadth-first traversal](https://mathworld.wolfram.com/Breadth-FirstTraversal.html) /// of a graph's vertices. /// /// Even though the 's' in its name implies a search, this struct only performs /// traversal, delegating the s...
true
0b78be5634ab4d2ecca9e63bb81f0f2a94e370c4
Rust
Justin-Schmitz/git-mit
/mit-commit-message-lints/src/external/in_memory.rs
UTF-8
1,810
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "CC0-1.0" ]
permissive
use crate::external::{Error, Vcs}; use glob::Pattern; use std::{collections::BTreeMap, string::String}; pub struct InMemory<'a> { store: &'a mut BTreeMap<String, String>, } impl InMemory<'_> { #[must_use] pub fn new(store: &mut BTreeMap<String, String>) -> InMemory { InMemory { store } } } im...
true
a0736d58a7d025c4b8fb2680b3014579bea868ff
Rust
mesalock-linux/parity-scale-codec-sgx
/sgx/parity-scale-codec-sgx-test/enclave/src/encode_append.rs
UTF-8
2,073
2.9375
3
[ "Apache-2.0" ]
permissive
use parity_scale_codec::{ Input, Encode, Error, Decode, EncodeLike, EncodeAppend }; use std::{ vec::Vec, boxed::Box }; pub fn vec_encode_append_works() { let max_value = 1_000_000; let encoded = (0..max_value).fold(Vec::new(), |encoded, v| { <Vec<u32> as EncodeAppend>:...
true
16d15e2c057fc4436e25496ced3416916ac8bc08
Rust
rust-bitcoin/rust-lightning-invoice
/src/de.rs
UTF-8
31,251
2.734375
3
[ "Apache-2.0" ]
permissive
use std::error; use std::fmt; use std::fmt::{Display, Formatter}; use std::num::ParseIntError; use std::str; use std::str::FromStr; use bech32; use bech32::{u5, FromBase32}; use bitcoin_hashes::Hash; use bitcoin_hashes::sha256; use num_traits::{CheckedAdd, CheckedMul}; use secp256k1; use secp256k1::recovery::{Recov...
true
551864e500dfab8fd8433873517c0e4cc5a03c61
Rust
XuShaohua/nc
/src/calls/unlinkat.rs
UTF-8
919
3.0625
3
[ "Apache-2.0" ]
permissive
/// Delete a name and possibly the file it refers to. /// /// # Example /// /// ``` /// let path = "/tmp/nc-unlinkat"; /// let ret = unsafe { nc::openat(nc::AT_FDCWD, path, nc::O_WRONLY | nc::O_CREAT, 0o644) }; /// assert!(ret.is_ok()); /// let fd = ret.unwrap(); /// let ret = unsafe { nc::close(fd) }; /// assert!(ret....
true
b1d8080f6bdc7d693d0a24d3923d1e2f4c2585e0
Rust
masonium/grr-util
/grr-util/src/screenshot.rs
UTF-8
2,864
2.953125
3
[]
no_license
//! Capture screenshots from a framebuffer or texture to disk. use std::path::Path; /// Save the color information for the default framebuffer to disk. pub fn save_framebuffer_rgba<P: AsRef<Path>>( src_framebuffer: grr::Framebuffer, device: &grr::Device, region: grr::Region, path: P, ) -> Result<(), st...
true
7b0daa4f50c06db8f266ef60772efef73dddd805
Rust
rbatis/rbatis
/rbdc/src/error.rs
UTF-8
2,429
2.953125
3
[ "Apache-2.0" ]
permissive
use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; use std::num::{ParseFloatError, ParseIntError, TryFromIntError}; use std::str::Utf8Error; #[derive(Debug, Serialize, Deserialize)] pub enum Error { E(String), } impl Error { #[allow(dead_code)] #[inline] pub fn protocol(err: impl...
true
e042d3350722280f364594d61aea912ff5c58d1d
Rust
BlockCat/rust-sudoku-solver
/src/main.rs
UTF-8
4,256
3.140625
3
[]
no_license
extern crate sudokusolver; use sudokusolver::Graph; use sudokusolver::CellCoord; use std::collections::VecDeque; use std::io::stdin; fn main() { let graph = read_test(); graph.pretty_print(); #[cfg(feature = "z3s")] { match sudokusolver::z3s::start(graph.clone()) { Some(solution) ...
true
b6a1eda3923c7c2d25e3f937aee0d856991db6c2
Rust
TigerInYourDream/bitcoin_p2p
/src/message.rs
UTF-8
4,597
3.328125
3
[]
no_license
use bitcoin::consensus::serialize; #[macro_use] pub mod version; pub mod address; pub mod command; pub mod filterload; pub mod getdata; pub const MAINNET: u32 = 0xF9BEB4D9; pub const TESTNET: u32 = 0xFABFB5DA; /// 消息最终发出去的形态 /// https://en.bitcoin.it/wiki/Protocol_documentation#Message_structure /// /// Message struc...
true
7f67a9682f6e5d671b05a67cd44b49aacab87398
Rust
Tanmay-V22315/Competitive-Coding-Questions-and-My-Solutions
/1044. Lucky Tickets./rust/src/main.rs
UTF-8
673
3.90625
4
[ "MIT" ]
permissive
fn main() { let mut counter = 0; //Counting let number_of_digits = 8; //Number of digits, this is supposed to be the user input let w = i32::pow(10,number_of_digits>>1); let upnum = i32::pow(10,number_of_digits); let begnum = i32::pow(10,number_of_digits>>1)-1; let stepnum = 2; for i in ...
true
1a5048729cfe08b59649aab6ba41da7828a19419
Rust
infinyon/fluvio
/crates/fluvio-channel-cli/src/cli/switch.rs
UTF-8
4,824
3.046875
3
[ "Apache-2.0" ]
permissive
use std::path::PathBuf; use clap::{Parser, CommandFactory}; use tracing::debug; use anyhow::{anyhow, Result}; use fluvio_channel::{ FluvioChannelConfig, FluvioChannelInfo, FluvioBinVersion, DEV_CHANNEL_NAME, STABLE_CHANNEL_NAME, LATEST_CHANNEL_NAME, }; use crate::install_channel_fluvio_bin; #[derive(Debug, ...
true
0572f8fff5fd24aa7503f09cf339cf2d217f23ff
Rust
km45/rust-studies
/projects/ch1801_pattern/src/main.rs
UTF-8
1,521
4.21875
4
[ "MIT" ]
permissive
fn main() { // `match` arm { let favorite_color: Option<&str> = None; match favorite_color { Some(s) => println!("favorite_color = {}", s), _ => println!("favorite_color is None"), } } // conditional `if let` expression { let favorite_color: O...
true
708892dbf2992f65dc9b3b628fb656e3a28e3159
Rust
Manishearth/elsa
/src/lib.rs
UTF-8
950
2.90625
3
[ "MIT", "Apache-2.0" ]
permissive
//! _🎵 Immutability never bothered me anyway 🎶_ //! //! This crate provides various "Frozen" collections. //! //! These are append-only collections where references to entries can be held //! on to even across insertions. This is safe because these collections only //! support storing data that's present behind some ...
true
deadc490e13370e2dd9947dacb09a5823d97d692
Rust
shadeMe/liblinear-rs
/crates/liblinear/src/errors.rs
UTF-8
1,918
3.234375
3
[ "MIT" ]
permissive
//! Error enumerations. use thiserror::Error; /// Errors related to input/training data. #[derive(Debug, Error)] pub enum TrainingInputError { /// The LIBSVM data file was not found/couldn't be read. #[error("io error: {0}")] IoError(String), /// The LIBSVM data file has invalid/incomplete entries th...
true
20cfb69001cab42338eabbea08c53bd42673699d
Rust
emabee/rust-hdbconnect
/hdbconnect_async/tests/test_033_clobs.rs
UTF-8
8,154
2.625
3
[ "MIT", "Apache-2.0" ]
permissive
extern crate serde; mod test_utils; use flexi_logger::LoggerHandle; use hdbconnect_async::{types::CLob, Connection, HdbResult, HdbValue}; use log::{debug, info}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; use std::fs::File; use std::io::Read; #[tokio::test] async fn test_033_clobs() -> HdbResul...
true
f948f5293b7f4e30c51e513b3b12385877dfeed5
Rust
edwardcunningham/spritz
/rust/src/main.rs
UTF-8
2,243
2.578125
3
[ "MIT" ]
permissive
mod base85; mod sbox; mod spritz; use self::base85::{decode85, encode85}; use self::sbox::{sbox, sbox_with_scope, unsbox, unsbox_with_scope}; use self::spritz::{aead, aead_decrypt}; use std::fs::File; use std::io; use std::io::Read; use std::time::Instant; fn main() { bench_sbox(); repl(); } fn repl() { ...
true
fbeb208849949d986ccac64f5c59f71d4bbd9185
Rust
pirapira/pwasm-abi
/src/eth/decode.rs
UTF-8
12,200
2.96875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
//! Payload decoder according to signature in legacy (ethereum) ABI //! Original code is mostly by debris in ethabi use lib::*; use super::util::{as_bool, as_i32, as_u32, as_u64, as_i64, Error, Hash}; use super::{ValueType, ParamType}; /// Decodes ABI compliant vector of bytes into vector of runtime values pub fn dec...
true
7c8876a5449c259d61d05bd885a394a98f984731
Rust
vigoo/rust-sphere
/src/gfx/renderable.rs
UTF-8
1,331
2.75
3
[]
no_license
use glium; use glium::{Frame, Surface}; use glium::uniforms::{Uniforms, UniformValue}; use gfx::vertices::Vertex2D; use std::collections::HashMap; pub trait Renderable { fn render(&self, renderer: &mut Renderer); } pub trait Renderer { fn render_vertices_2d(&mut self, vertices: &glium::VertexBuffer<Vertex2D>,...
true
1892eb535ad56a334baba860530c289284ff2c67
Rust
khachaturh/truck
/truck-polymesh/src/polygon_mesh.rs
UTF-8
21,100
3.75
4
[ "Apache-2.0" ]
permissive
use crate::*; use errors::Error; use std::iter::FromIterator; impl From<(usize, Option<usize>, Option<usize>)> for Vertex { fn from(tuple: (usize, Option<usize>, Option<usize>)) -> Vertex { Vertex { pos: tuple.0, uv: tuple.1, nor: tuple.2, } } } impl From<&(...
true
2cdcc1b82c0333b15a4bad67e00a847f4aa912a4
Rust
TangoJP/rust_vectorizer
/tests/ndarray_extension_test.rs
UTF-8
2,306
2.921875
3
[]
no_license
extern crate vectorizer; #[macro_use] extern crate ndarray; use vectorizer::ndarray_extension; #[test] #[ignore] fn test_convert_to_f64(){ let mut x = array![ [1, 2, 3], [2, 3, 4], [5, 6, 7]]; x = x.clone().mapv(|e| e as u32); let x_f64 = x.clone().mapv(|e| e as f64); let y = n...
true
6292288bbfd115c15593d558ef278373e3786d85
Rust
luketchang/Rust-HTTP-Server
/src/http/response.rs
UTF-8
1,258
3.578125
4
[]
no_license
use super::status_code::StatusCode; use std::fmt::{ Display, Debug, Formatter, Result as FmtResult }; use std::io::{ Write, Result as IoResult }; use std::net::TcpStream; /* Struct: Response * ________________ * - Response object containing status code and response body */ pub struct Response { status_code: St...
true
7405d9818a3d6c04303d0574e9a3b1c452276446
Rust
legendofmiracles/robbb
/src/commands/kick.rs
UTF-8
1,695
2.6875
3
[ "MIT" ]
permissive
use super::*; /// Kick a user from the server #[command] #[only_in(guilds)] #[usage("kick <user> <reason>")] pub async fn kick(ctx: &client::Context, msg: &Message, mut args: Args) -> CommandResult { let config = ctx.get_config().await; let guild = msg.guild(&ctx).context("Failed to load guild")?; let me...
true
4e0bf1b066edf227663b7140d7006a0a7cba923c
Rust
NelsonJTSM/In-Rust
/dupey-dupe/tests/cli.rs
UTF-8
1,000
2.609375
3
[]
no_license
use assert_cmd::prelude::*; // Add methods on commands use std::process::Command; // Run programs #[test] fn test_cli() -> Result<(), Box<dyn std::error::Error>> { let test_args = vec![ ("chocolate lava cake lava cake", "cake\n"), ("chocolate lava cake cake lava", "lava\n"), ("chocolate lav...
true
19fb68bf3e74c246f2b826aa0e00b0fec5f8968b
Rust
SymmetricChaos/classic_crypto
/src/ciphers/polyalphabetic/progressive_key.rs
UTF-8
2,881
3.1875
3
[]
no_license
use std::fmt; use std::{fs::File, io::{Error, Read, Write}}; use crate::{Cipher, PolyalphabeticCipher}; pub struct ProgressiveKey<'a> { cipher: &'a dyn PolyalphabeticCipher, step: usize, } impl ProgressiveKey<'_> { pub fn new(cipher: &dyn PolyalphabeticCipher, step: usize) -> ProgressiveKey { Pro...
true
0971246f945f520836de5897de42bb82feeadd5f
Rust
sdnts/nas
/server/src/routes/fs/get.rs
UTF-8
6,379
2.53125
3
[]
no_license
use actix_identity::Identity; use actix_web::{http, web, HttpResponse, Responder, Result}; use serde_json::{json, Value}; use std::convert::TryFrom; use std::fs; use std::path::PathBuf; use crate::app_state::AppState; use crate::error::NASError; use crate::file::{AbsolutePath, Breadcrumbs, NASFile, NASFileCategory, Re...
true
b62d7d333ef6c6151c726d679d24b4b778ad88df
Rust
tomerhc/broken
/src/enc/parse_args.rs
UTF-8
4,909
3.484375
3
[]
no_license
use common::error::ArgErr; #[derive(Debug)] /// holds the parsed arguments. it is passed to the main function to determine the proper action. /// some of the varients old a string with a prarmeter given with the argument (eg. -f /// /path/to/file). pub enum Args { Key(String), Encrypt(String), Decrypt(Stri...
true
a1a34e76ec404011ae78c2f8ea3ddab28729ed82
Rust
accusitive/cafebabe
/examples/publicapi.rs
UTF-8
1,031
2.84375
3
[]
no_license
use std::env; use std::fs::File; use std::io::Read; fn main() { for arg in env::args().skip(1) { let mut file = File::open(&arg).unwrap(); let mut bytes = Vec::new(); file.read_to_end(&mut bytes).unwrap(); match cafebabe::parse_class(&bytes) { Ok(class) => { ...
true
4558bf25eb34a1ad7cfd17c53bea924450f07bec
Rust
SteadBytes/advent-of-code-2020
/rust/benches/d16.rs
UTF-8
2,757
2.609375
3
[]
no_license
use aoc2020::d16::Field; use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use std::collections::HashSet; use std::iter::FromIterator; /// Fields from my day 16 input const FIELDS: [Field; 20] = [ Field { name: "departure location", r1: 45..=309, r2: 320.....
true
6a6d1b70faa71575994dad5383a0800eb8d142b4
Rust
solana-labs/solana
/net-utils/src/lib.rs
UTF-8
29,527
2.546875
3
[ "Apache-2.0" ]
permissive
//! The `net_utils` module assists with networking #![allow(clippy::arithmetic_side_effects)] use { crossbeam_channel::unbounded, log::*, rand::{thread_rng, Rng}, socket2::{Domain, SockAddr, Socket, Type}, std::{ collections::{BTreeMap, HashSet}, io::{self, Read, Write}, net:...
true
47d5a1ac0f49d7470429ed5c32027374a2fb3114
Rust
GilRtr/util-rs
/src/input/ux.rs
UTF-8
1,039
3.203125
3
[ "WTFPL" ]
permissive
use std::str::FromStr; use crate::Prompt; pub fn prompt(msg: &str) -> Prompt { Prompt::new().msg(msg) } pub fn input<T: FromStr>(msg: &str) -> Result<T, T::Err> { Prompt::new().msg(msg).get() } pub fn input_string(msg: &str) -> String { Prompt::new().msg(msg).get_string() } impl Prompt<'_> { pub fn...
true
98ebac0053935e805627840f388e2c358850d868
Rust
isgasho/random-access-memory
/src/lib.rs
UTF-8
5,767
3
3
[ "Apache-2.0", "MIT" ]
permissive
#![cfg_attr(feature = "nightly", deny(missing_docs))] #![cfg_attr(feature = "nightly", feature(external_doc))] #![cfg_attr(feature = "nightly", doc(include = "../README.md"))] #![cfg_attr(test, deny(warnings))] use anyhow::anyhow; use random_access_storage::RandomAccess; use std::cmp; /// Main constructor. #[derive(D...
true
b0fc9354d0e9b36677bf8e7a9993f5c99e1505e8
Rust
Mingun/rust-oci
/src/lob/clob.rs
UTF-8
16,296
2.828125
3
[]
no_license
//! Содержит типы для работы с большими символьными объектами. use std::io; use {Connection, Result, DbResult}; use types::Charset; use ffi::native::lob::{Lob, LobImpl, LobOpenMode, CharsetForm}; use ffi::types::Piece; use super::{Bytes, Chars, LobPrivate}; //---------------------------------------------------------...
true
e9f13f933be170eb2ca0154d11c2d44b7c177eeb
Rust
15967-po2/Data-Structure-InsertionSort
/insertion_sort/src/main.rs
UTF-8
3,337
3.5625
4
[]
no_license
/* Insertion Sort Algorithm main.rs Nuno Cruz 2021.03.16 utilização de vetores como tabelas com utilização dinâmica da memória - tabelas de dimensão definida em tempo de compilação (arrays) - tabelas de dimensão definida em tempo de execução (Vec) */ use rand::Rng; use std::time::Instant; //use rand::prelude::*; /*...
true
ad2e444ffc00cc068f6dcd4458ccaec674c1df2f
Rust
ifyouseewendy/exercisms
/rust/isbn-verifier/src/lib.rs
UTF-8
671
3.3125
3
[]
no_license
/// Determines whether the supplied string is a valid ISBN number pub fn is_valid_isbn(isbn: &str) -> bool { let chars = isbn .chars() .enumerate() .skip_while(|&(_, c)| c == '-') .filter(|&(i, c)| { if i != isbn.len() - 1 { c.is_ascii_digit() ...
true
8a25bdc7fa12787c7b20519b9030112321d3fc36
Rust
rustype/typestate-examples
/auction/src/auction.rs
UTF-8
1,098
3.1875
3
[]
no_license
use std::collections::HashMap; pub struct Auction { owner: String, bids: HashMap<String, u64>, highest_bid: u64, ended: bool, } impl Auction { pub fn new(owner: String) -> Self { Self { owner, bids: HashMap::new(), highest_bid: 0, ended: fals...
true
45c493ea66282eb0b650235dd096fd27b69f7422
Rust
unknownue/leetcode.rs
/src/p00xx/p32.rs
UTF-8
5,432
3.875
4
[ "MIT" ]
permissive
//! //! Longest Valid Parentheses //! //! https://leetcode.com/problems/longest-valid-parentheses/ //! //! Given a string containing just the characters `'('` and `')'`, find the length of the longest valid (well-formed) parentheses substring. //! //! **Example 1:** //! ```text //! Input: "(()" //! Output: 2 //! Explan...
true
e7cfbd2e44dab7639be27d3b0d14578d3416d6f4
Rust
stevewirts/rust_string_exercises
/src/main.rs
UTF-8
13,959
3.578125
4
[]
no_license
use std::collections::HashMap; fn main() { let test_one_input = "Today is Monday"; let max_chars = one(test_one_input); println!("1) the most of a char(first appearing) in '{}' is '{}', appearing {} times", test_one_input, max_chars.0, max_chars.1); let test_two_input = "supracalafragalisticexpealadoc...
true
85b94ac766bccd1b3e1441d0cd6e3246749bde33
Rust
ijackson/thirtyfour_sync
/src/http/connection_sync.rs
UTF-8
751
2.84375
3
[ "MIT", "Apache-2.0" ]
permissive
use std::fmt::Debug; use crate::error::WebDriverResult; use std::time::Duration; use thirtyfour::RequestData; /// Trait for executing HTTP requests to selenium/webdriver. /// As long as you have some struct that implements WebDriverHttpClientSync, /// you can turn it into a WebDriver like this: /// /// ```ignore /// ...
true
c21463a4001475d1619fce969c425b7ee0a64033
Rust
chris-henderson-alation/GHActionsRustTest
/k8s/service/acm/src/podmanager/server_check.rs
UTF-8
9,120
2.65625
3
[]
no_license
use backoff::backoff::Backoff; use error::*; use futures::FutureExt; use futures_util::{pin_mut, select}; use k8s::PodExt; use k8s_openapi::api::core::v1::Pod; use result::Result; use term_colors::*; use tokio::sync::oneshot::{channel, Receiver, Sender}; use tokio::task::JoinHandle; use tonic::transport::Endpoint; use ...
true
bf8f8f75acde265b40d1efb0264196602f62ba0b
Rust
sogapalag/contest
/yukicoder/1226.rs
UTF-8
4,016
2.921875
3
[]
no_license
#[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; use std::io::Read; #[allow(dead_code)] fn getline() -> String { let mut ret = String::new(); std::io::stdin().read_line(&mut ret).ok().unwrap(); ret } fn get_word() -> String { let stdin = std::io::stdin(); ...
true
3524d36477b3744bbadb6f612b0498017682a67d
Rust
TurtlePU/rust-merge
/src/merge.rs
UTF-8
1,060
3.265625
3
[]
no_license
pub trait Mergeable<F, T, I> { fn merge(self, f: F) -> Merge<F, T, I>; } impl<F, T, I> Mergeable<F, T, I> for I where I: Sized { fn merge(self, f: F) -> Merge<F, T, I> { Merge { merger: f, accum: None, iter: self } } } pub struct Merge<F, T, I> { merger: F, accum: Option<T>, iter: I, }...
true
5b32e2d2daa8770c0ffe8d44aa3dc6ec1b65293f
Rust
nebbles/rust-sandbox
/src/types.rs
UTF-8
750
3.421875
3
[]
no_license
/* Primitive Types Integers: u8, i8, (both variants for 8/16/32/64/128 bits) Floats: f32, f64 Boolean: bool Characters: char Tuples Arrays Rust is statically typed, but can often infer the type of the variable. */ pub fn run() { // Default is i32 let x = 1; // Default is f64 let y = 2.5; // Expl...
true
13a988d9614b7a6158838846e074c0336e4e75e9
Rust
dip-proto/boring
/boring/src/dsa.rs
UTF-8
11,333
2.890625
3
[ "Apache-2.0", "MIT" ]
permissive
//! Digital Signatures //! //! DSA ensures a message originated from a known sender, and was not modified. //! DSA uses asymetrical keys and an algorithm to output a signature of the message //! using the private key that can be validated with the public key but not be generated //! without the private key. use ffi; u...
true
58c3e2b95b4e318e3d6a861d96a258800df2a855
Rust
mthh/mapsvg-rs
/src/macros.rs
UTF-8
535
2.609375
3
[ "MIT" ]
permissive
macro_rules! expect_float { ($value:expr, $name:expr) => ( match $value.as_float() { Some(v) => v, None => panic!("Expected float value on property \"{}\"!", $name) } ) } macro_rules! string_or_default { ($value:expr, $default:expr) => ( if $value.is_none() {...
true
1365b39f94e1d167d163f0abeee5d8cd02b03999
Rust
andrew-pa/txd
/src/mode/normal.rs
UTF-8
5,412
3.140625
3
[]
no_license
use super::*; use winit::{WindowEvent}; use movement::Movement; use app::ClipstackId; //Normal Mode pub struct NormalMode { buf: String } // actions: // [mov]: move cursor // [reg]d[mov]: delete // i: insert text // [reg]c[mov]: change text // r[char]: replace char // [reg]y[mov]: yank (copy) text into reg // [r...
true
b82a30b3f1b519839083350ff75377c638d7d0fc
Rust
rust-lang/regex
/regex-syntax/src/hir/print.rs
UTF-8
20,901
3.203125
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unicode" ]
permissive
/*! This module provides a regular expression printer for `Hir`. */ use core::fmt; use crate::{ hir::{ self, visitor::{self, Visitor}, Hir, HirKind, }, is_meta_character, }; /// A builder for constructing a printer. /// /// Note that since a printer doesn't have any configuration ...
true
1281526d96efdeaa4f70b0fb1d894a73a62f8c14
Rust
mun-lang/mun
/crates/mun_abi/src/primitive.rs
UTF-8
2,840
3.0625
3
[ "Apache-2.0", "MIT" ]
permissive
//! A module that defines information for built-in (or primitive) types. use crate::{Guid, HasStaticTypeId, TypeId}; /// Defines functions for built-in types like f32, i32, etc. pub trait PrimitiveType: HasStaticTypeId { /// Returns the name of the type fn name() -> &'static str; /// Returns the GUID of ...
true
160e104de3ebc89db99a00638117845d3179c8a2
Rust
impuls71/grammers
/lib/grammers-mtproto/src/transports/abridged.rs
UTF-8
5,894
2.71875
3
[ "Apache-2.0", "MIT" ]
permissive
// Copyright 2020 - developers of the `grammers` project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distr...
true
27c754c8adf59d11c55a191d3eb904ed803a0b40
Rust
PolishRoute/ideal-guacamole
/leg_archive/src/lib.rs
UTF-8
2,449
3.015625
3
[]
no_license
use std::fs::File; use std::io::{BufRead, BufReader, Read, Seek, SeekFrom}; use std::ops::Range; use std::path::Path; #[derive(Debug)] struct ArchiveEntry { file_name: String, range: Range<u64>, } pub struct Archive { reader: BufReader<File>, files: Vec<ArchiveEntry>, case_sensitive: bool, } impl...
true
c3e8c13b070e2c814a5e7c78ccc25d86fba43eaf
Rust
TheRincon/rex_sort
/src/odd_even_sort.rs
UTF-8
2,376
3.484375
3
[]
no_license
pub fn odd_even_sort<T>(a: &mut [T]) where T: PartialOrd { let n = a.len(); for i in 0..n { if i % 2 == 1 { let mut j = 2; while j < n { if a[j] < a[j - 1] { a.swap(j - 1, j); } j += 2; } } e...
true
854080ccf9562ae1e55529ce2bdde217ae5d6f45
Rust
iqlusioninc/delphi
/src/currency.rs
UTF-8
6,619
3.203125
3
[ "Apache-2.0" ]
permissive
//! Currency support (i.e. assets) use crate::networks::terra::denom::Denom; use crate::Error; use serde::{de, ser, Deserialize, Serialize}; use std::{ fmt::{self, Display}, str::FromStr, }; /// Currencies for use in trading pairs #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] pub enum Currency { ...
true
b7bc8f11f4a9897b3ebf411a4fced855f7d1d2d4
Rust
sagebind/rote
/src/runner.rs
UTF-8
14,727
3.03125
3
[ "Apache-2.0" ]
permissive
use graph::Graph; use modules; use num_cpus; use runtime::{Environment, Runtime}; use std::cmp; use std::collections::{HashMap, HashSet}; use std::error::Error; use std::path::{Path, PathBuf}; use std::rc::Rc; use std::sync::mpsc; use std::thread; use task::Task; use term; #[derive(Clone)] pub struct EnvironmentSpec ...
true
210670a6ebcdff3398911529bdc0aee1aa4b4b69
Rust
tail-island/stamp-art
/src/io.rs
UTF-8
4,178
2.59375
3
[]
no_license
use std::arch::x86_64::*; use std::cmp::*; use std::io::*; use std::str::*; use super::game::*; fn read_field(width: i32, height: i32, bits_str: &str) -> Field { let field_units = { let lines_collection = { let mut result = (0..width).step_by(64).map(|_| Vec::with_capacity(height as usize)).co...
true
cc6c360a581d83d3a9273c44f2818e027948bdc0
Rust
tshepang/gd32vf103-pac
/src/timer1/chctl1_input.rs
UTF-8
7,884
2.578125
3
[ "ISC" ]
permissive
#[doc = r" Value read from the register"] pub struct R { bits: u16, } #[doc = r" Value to write to the register"] pub struct W { bits: u16, } impl super::CHCTL1_INPUT { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, ...
true
a240af30c8d617b5a5a82c98ead0440bd238b10b
Rust
likr/atcoder
/practice2/src/bin/e.rs
UTF-8
10,608
2.546875
3
[]
no_license
use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std::usize::MAX / 4; #[allow(unused)] const M: usize = 1000000007; #[...
true
014ea802af81f454efb7ee0952d3c994e8574585
Rust
rylynchen/TRPL-Code
/TRPL_04_01_ownership_base/src/main.rs
UTF-8
366
3.390625
3
[]
no_license
use std::string::String; fn main() { let s = String::from("hello"); // s into take_ownership(s); // s out : move let x = 5; // x into make_copy(x); // x not out because of base type } // x out fn take_ownership(some_thing: String) { println!("take ownership : {}", some_thing); } fn make_copy (...
true
efa0d4665adbd3a5bb1b3574d9526173b1cd1463
Rust
chvish/prom2jsonrs
/src/lib.rs
UTF-8
12,445
2.78125
3
[]
no_license
use regex::Regex; use serde::{Deserialize, Serialize}; use std::collections::HashMap; #[macro_use] extern crate lazy_static; #[macro_use] extern crate maplit; lazy_static! { static ref METRIC_REGEX_NO_LABEL: Regex = Regex::new(r"([a-zA-Z_:][a-zA-Z0-9_:]*)\s(-?[\d.]+(?:e-?\d+)?|NaN)").unwrap(); static r...
true
71f9371a5df6eb59aa9209f557f6ff9409e1263d
Rust
PatiPavanSai/rust-cardano
/cardano/src/hash.rs
UTF-8
7,956
2.765625
3
[ "MIT", "Apache-2.0" ]
permissive
//! module to provide some handy interfaces atop the hashes so we have //! the common interfaces for the project to work with. use std::{fmt, result, str::{FromStr}, ops::{Deref}}; use cryptoxide::digest::Digest; use cryptoxide::blake2b::Blake2b; use cryptoxide::sha3::Sha3; use util::{hex, try_from_slice::{TryFromSl...
true
f20708a0fa3077fa28b5c073af69e3185c007428
Rust
tjefferson08/rustcraft
/src/matrix.rs
UTF-8
829
2.609375
3
[]
no_license
extern crate cgmath; use cgmath::{Matrix3, Matrix4}; fn pretty_print4(m: Matrix4<f32>) { println!( " {:>13.10}, {:>13.10}, {:>13.10}, {:>13.10},", m.x.x, m.y.x, m.z.x, m.w.x ); println!( " {:>13.10}, {:>13.10}, {:>13.10}, {:>13.10},", m.x.y, m.y.y, m.z.y, m.w.y ); p...
true
9df374e3f2894c13062a51e066c68ecd96656921
Rust
diffeo/kodama
/src/lib.rs
UTF-8
26,038
3.1875
3
[ "MIT" ]
permissive
/*! This crate provides a fast implementation of agglomerative [hierarchical clustering](https://en.wikipedia.org/wiki/Hierarchical_clustering). The ideas and implementation in this crate are heavily based on the work of Daniel Müllner, and in particular, his 2011 paper, [Modern hierarchical, agglomerative clustering ...
true
284adf72e0664755d0d646c39f6c0f8e4302d507
Rust
twe4ked/aoc2020
/day_10/src/main.rs
UTF-8
9,974
3.390625
3
[]
no_license
// --- Day 10: Adapter Array --- // // Patched into the aircraft's data port, you discover weather forecasts of a massive tropical // storm. Before you can figure out whether it will impact your vacation plans, however, your // device suddenly turns off! // // Its battery is dead. // // You'll need to plug it in. There...
true
a52ea07ba1f0475078dff245a6d7ec9c1bdd0f65
Rust
bastion-rs/alcazar
/src/alcazar.rs
UTF-8
4,940
2.78125
3
[]
no_license
use crate::error::Result; use crate::request::HttpRequest; use crate::router::Router; use bastion_executor::run::run; use lightproc::prelude::ProcStack; use std::io::Write; use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener}; use tracing::info; pub struct AppBuilder { addr: SocketAddr, router: Router, } ...
true
1474c144ac02477d5132eab1f09f33371e37b611
Rust
stephica/dns-proxy
/src/server.rs
UTF-8
8,344
2.65625
3
[]
no_license
use std; use rand::random; use dns; use Action; use filter::Filter; use std::net::{UdpSocket, ToSocketAddrs, SocketAddr, SocketAddrV4, Ipv4Addr}; fn ipv4null() -> SocketAddr { SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), 0)) } // instead of a big array, to scale properly you'd really want // a larg...
true
69e31bea2d55c4f956d313fff888cbbcc6d8455b
Rust
asiafrank/learn
/rust/xdb/src/cmd_line.rs
UTF-8
2,012
3.578125
4
[]
no_license
use std::io::{self, Write}; use crate::cmds::SUPPORTED_CMD; /// 获取输入的命令,匹配输入的格式是否正确, /// 如果不正确则打印提示,再次要求输入, /// 直到匹配正确的命令,返回 CmdLine 对象 pub fn get_cmd_line() -> CmdLine { let cmd_line = loop { let line = prompt(); match CmdLine::new(line) { Ok(x) => break x, Err(e) => eprint...
true
aeb422876a801bfbac87820e5c115c93aae9ab9f
Rust
Nadhum/kml
/src/types/geom_props.rs
UTF-8
716
2.8125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
use std::str::FromStr; use crate::types::altitude_mode::AltitudeMode; use crate::types::coord::{Coord, CoordType}; // TODO: Should this be an attribute of geometries? Only complication is Point doesn't include // tessellate, not sure how to represent that // TODO: Implement validity check based on ATC-112 https://doc...
true
670e8a45299eda1cda7138ee3d8dc1380b522785
Rust
gs-akhan/learning-rust
/src/ownership.rs
UTF-8
761
4.21875
4
[ "MIT" ]
permissive
fn main() { //String in rust has three parts // 1. pointer to memory that holds the content of the string // 2. length - Is the memory in bytes the content of the string is using. // 3. capacity - The total memory in bytes the string has recieved from operating system. let s1 = String::from("Tea ...
true
08d9244ad9f54d718e8e98a592e0db879698f645
Rust
B3RR10/AdventOfCode2019
/src/day2.rs
UTF-8
2,309
3.515625
4
[]
no_license
pub fn part1(input: &[i32]) -> i32 { let mod_input = modifiy_input(input.to_vec(), 12, 2); run_intcode(mod_input)[0] } pub fn part2(input: &[i32]) -> i32 { let searched_ouptut = 19690720; for i in 0..100 { for j in 0..100 { let mod_input = modifiy_input(input.clone().to_vec(), i, j...
true
60344b23648d7d786e96f8b3a4f8d8e79c0f2cec
Rust
Mahmoud333/Browser_Engine
/src/css.rs
UTF-8
8,299
3.78125
4
[]
no_license
/* CSS is a series of rules it include one or more selectors which are separated by commas followed by series of declarations which are enclosed in braces * these selectors can be simple selector or chain of selectors joined by 'Combinators' * our implementation is only going to support simple selection & not going t...
true
3e949f5de065deb3b0e34b28dd684bef50bac642
Rust
fazo96/rust-game
/src/game/mod.rs
UTF-8
3,918
2.921875
3
[]
no_license
use rustbox::{Key, RustBox}; use rand::prelude::*; use rand_pcg::Pcg64; type RNG = Pcg64; pub mod render; pub mod animals; pub mod entity; pub mod position; pub mod player; pub mod map; pub mod rpg; use std::fmt; use render::render; use entity::*; use player::*; use animals::*; use map::*; use position::*; #[derive...
true
7da03c6cddf3a38e31a43ed647fb093f0299c1ff
Rust
jamieapps101/google_word2vec_rust_inference_server
/src/server.rs
UTF-8
6,259
2.765625
3
[]
no_license
use crate::word2vec; use std::path::PathBuf; use threadpool::ThreadPool; use tokio; use tokio::sync::oneshot; use std::collections::HashMap; use std::net::{Ipv4Addr, SocketAddrV4, SocketAddr}; use std::sync::Arc; use std::sync::Mutex; use warp::Filter; // use serde_derive::{Deserialize, Serialize}; use serde::{Deseria...
true
17aba22e2153e53c92d47f7b38b8dfb17320a248
Rust
rowanoulton/RESS
/src/comments.rs
UTF-8
6,086
3.125
3
[ "MIT" ]
permissive
use combine::{ choice, eof, error::ParseError, optional, parser::{char::string, repeat::take_until}, attempt, Parser, Stream, }; use strings; use tokens::Token; #[derive(Debug, PartialEq, Clone)] pub struct Comment { pub kind: Kind, pub content: String, pub tail_content: Option<String>,...
true
c08647ebc30a5a02e97be9d85fca379daa95c2a2
Rust
seb-odessa/zkb
/src/lib/models/region.rs
UTF-8
1,802
2.78125
3
[]
no_license
use crate::schema::neighbors_regions; use crate::schema::named_systems; use super::{Connection, QueryResult, Integer, OptString}; #[derive(Queryable, Associations, Debug, PartialEq)] #[table_name = "named_systems"] pub struct RegionNamed { pub region_id: Integer, pub region_name: OptString, } impl RegionNamed...
true
cefa9292e7a961026236571c5a2f9c93ab503177
Rust
plol/adventofcode2019
/src/advent_21.rs
UTF-8
1,879
2.828125
3
[]
no_license
pub struct Advent; use super::intcode; impl super::common::Advent for Advent { fn advent_number() -> u8 { 21 } fn main1(input: &Vec<String>) -> String { let mut computer = intcode::IntcodeComputer::new_from_input_lines(input); computer.start(); let input = "NOT J J AND A ...
true
362d5a8cc096aa3f097ed7676211a3cb0ef86ad9
Rust
arifd/web-server-demo
/src/api.rs
UTF-8
9,159
2.71875
3
[]
no_license
mod auth; mod db; #[cfg(test)] mod tests; use once_cell::sync::Lazy; use rocket::{ form::{Form, FromForm}, fs::FileServer, get, http::{ContentType, Cookie, CookieJar, Status}, post, request, request::FromRequest, response::{content::Json, Redirect, Responder}, routes, serde::Serial...
true
ac61fb8623d9dfb527e8c3a7db1f9021085e487f
Rust
usert5432/fdedup
/tests/utils/mod.rs
UTF-8
3,805
2.578125
3
[ "LicenseRef-scancode-warranty-disclaimer", "ISC" ]
permissive
extern crate fdedup; extern crate crypto_hash; extern crate fastrand; extern crate tempfile; pub mod fs_skel; use std::collections::HashMap; use std::fs::{File, create_dir_all}; use std::io::{self, Write}; use std::iter::repeat_with; use std::path::Path; use fdedup::fs_entry::{FSEntry, INode, Dev, collect_files}; us...
true