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
183839bc868f65f8e9a0ab66ca7ef71d9891a21a
Rust
ernestyalumni/HrdwCCppCUDA
/Constructicon/Mixmaster/projects/minigrep/src/lib.rs
UTF-8
5,328
3.71875
4
[ "MIT" ]
permissive
use std::error::Error; pub struct Configuration { pub query_: String, pub file_path_: String, pub ignore_case_: bool, } impl Configuration { // Creating a Constructor for Configuration // cf. https://doc.rust-lang.org/book/ch12-03-improving-error-handling-and-modularity.html#creating-a-constructor-for-confi...
true
5ac87264296fbb9edb8df16eea99c5e6db0bcf0a
Rust
amanusk/curv
/src/cryptographic_primitives/hashing/merkle_tree.rs
UTF-8
2,305
2.796875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
/* This file is part of Curv library Copyright 2018 by Kzen Networks (https://github.com/KZen-networks/curv) License MIT: https://github.com/KZen-networks/curv/blob/master/LICENSE */ use merkle::{MerkleTree, Proof}; use ring::digest::{Context, SHA256}; use GE; /* pub struct MT256<'a> { tree: Merkle...
true
b1930f1ef401285db33ccbba261525fa93178590
Rust
rustkas/opp_rust
/do_print_usung_function/src/main.rs
UTF-8
2,829
3.625
4
[]
no_license
use std::fmt; use std::fmt::Display; pub trait Area { fn area(&self) -> f64; } pub struct Rectangle { width: f64, length: f64, } pub struct Square { rectangle: Rectangle, } impl Area for Rectangle { fn area(&self) -> f64 { self.width * self.length } } impl Area for Square { fn a...
true
1243bd76e9a268902b3bfe2bd0270912ce714649
Rust
infinyon/flv-util
/src/concurrent.rs
UTF-8
1,785
3.546875
4
[ "Apache-2.0" ]
permissive
use std::collections::HashMap; use std::collections::BTreeMap; use std::hash::Hash; use std::sync::RwLock; use std::sync::RwLockReadGuard; use std::sync::RwLockWriteGuard; /// inefficient but simple concurren hashma /// this should be only used in a test /// it locks for every write pub struct SimpleConcurrentHashMap...
true
db44a3f86b7c401da5ed3ac2c08b529c1a7ce279
Rust
ttakamura/binary-nn-rust
/src/loader.rs
UTF-8
2,768
3
3
[]
no_license
use std::f32; use std::io::prelude::*; use std::fs::File; use std::error::Error; use std::mem; use backend::bitmatrix::BitMatrix2; use backend::bitvec::BitVec; use backend::bitmatrix_trait::BitMatrixMut; pub fn load_text_as_i32(path: &str) -> Vec<i32> { let buffer = load_text(path); let mut vec = Vec::new(); fo...
true
14e46d8e9c3addf7543fed7570582978286d00e8
Rust
knsd/from-ascii
/src/boolean.rs
UTF-8
1,627
3.0625
3
[ "MIT", "Apache-2.0" ]
permissive
// Copyright (c) 2016 Fedor Gogolev <knsd@knsd.net> // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
true
c700277b504b16ed4355a131106b63b350349bda
Rust
darobs/iotedge
/edge-modules/edge-dashboard/src/health.rs
UTF-8
1,093
2.6875
3
[ "MIT" ]
permissive
// Copyright (c) Microsoft. All rights reserved. #[derive(Debug)] pub enum Health { Healthy, Degraded, Poor, } #[derive(Debug)] pub struct Status { iotedged: bool, edge_agent: bool, edge_hub: bool, other_modules: bool, } impl Status { pub fn new() -> Self { Status { ...
true
91f8bc0bf2028acf482438231f3827fb25dee0bc
Rust
yngvek/rust_piglatin
/src/main.rs
UTF-8
3,809
4.21875
4
[]
no_license
// Convert strings to pig latin. // The first consonant of each word is moved to the end of the word and “ay” is added, // so “first” becomes “irst-fay.” // Words that start with a vowel have “hay” added to the end instead (“apple” becomes “apple-hay”). // Keep in mind the details about UTF-8 encoding! // Support for U...
true
7441c107647026d873ae0a9fb4207b5cb2d72061
Rust
thinety/rust-raytracing
/src/material/lambertian.rs
UTF-8
764
2.796875
3
[ "MIT" ]
permissive
use crate::math::{Color, Vector}; use super::{MaterialInterface, ScatterRecord}; pub struct Lambertian { pub albedo: Color, } impl MaterialInterface for Lambertian { fn scatter(&self, _hit_direction: Vector, hit_normal: Vector) -> ScatterRecord { let non_unit_scatter_direction = hit_normal + Vector::...
true
f112dca6ff06d6a7657c7be43341161152a28a12
Rust
truelossless/crocolang
/src/lexer.rs
UTF-8
13,086
3.125
3
[ "MIT" ]
permissive
extern crate unicode_segmentation; use std::{iter::Peekable, rc::Rc}; use unicode_segmentation::{UWordBounds, UnicodeSegmentation}; use crate::token::Identifier; use crate::token::{ CodePos, KeywordEnum::*, LiteralEnum, OperatorEnum::*, SeparatorEnum::*, Token, Token::*, }; use crate::error::CrocoError; fn is_n...
true
43b779696400d32fd692ff9e1cac9a1fbb1fb1da
Rust
rcolinray/trex
/src/simulation.rs
UTF-8
1,626
3.328125
3
[ "MIT" ]
permissive
use super::family::{Family, FamilyMember}; use super::world::World; use super::event::{EventQueue, EventEmitter}; use super::system::System; /// Internal event used to stop the `Simulation`. This event is automatically /// registered. pub struct Halt; impl FamilyMember for Halt { fn family() -> Family { 0...
true
42477d52c0fd248fe15778bce0b7ed75bee01a90
Rust
donnol/JustPlay
/rust/src/main.rs
UTF-8
4,866
2.703125
3
[ "Apache-2.0" ]
permissive
#![allow(unused)] use std::fmt::Debug; use std::fs::File; use std::io; use std::io::Read; use std::ops::Add; use std::path::PathBuf; use std::str; use std::sync::mpsc; use std::sync::mpsc::{Receiver, Sender}; use std::thread; use structopt::StructOpt; mod usersrv; // 还要在这里声明mod的文件路径,好难理解 use usersrv::user::User; // ...
true
c30a14c101ba549ab148679704b70028fdf9d211
Rust
vulkano-rs/vulkano-www
/chapter_code/src/models/square.rs
UTF-8
836
2.609375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use crate::models::Model; use crate::shaders::movable_square; use crate::Vertex2d; pub struct SquareModel; type UniformData = movable_square::vs::Data; impl Model<Vertex2d, UniformData> for SquareModel { fn get_vertices() -> Vec<Vertex2d> { vec![ Vertex2d { position: [-0.25, -...
true
c0dadab7677e4d53fe959fc23ce9abb9b4213a7e
Rust
IThawk/rust-project
/rust-demo/kafka-rust/tests/integration/consumer_producer/consumer.rs
UTF-8
5,583
2.921875
3
[ "MIT", "Apache-2.0" ]
permissive
use super::*; use kafka::producer::Record; use kafka::error; use env_logger; /// Tests that consuming one message works #[test] fn test_consumer_poll() { let _ = env_logger::init(); // poll once to set a position in the topic let mut consumer = test_consumer(); let mut messages = consumer.poll().unw...
true
0589de83e74f372940888ee2bb9322092a18b1e5
Rust
RoaringBitmap/roaring-rs
/src/bitmap/util.rs
UTF-8
3,431
3.40625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::ops::{Bound, RangeBounds, RangeInclusive}; /// Returns the container key and the index /// in this container for a given integer. #[inline] pub fn split(value: u32) -> (u16, u16) { ((value >> 16) as u16, value as u16) } /// Returns the original integer from the container /// key and the index of it in th...
true
c56fff36e4de48e09d592b47576684c5f76f6f71
Rust
Desdaemon/flutter-playground
/src/frontends/ffi.rs
UTF-8
6,340
2.828125
3
[]
no_license
use crate::impls::{ ast::{AstParser, Element, HtmlTag, Tags, TextAlign}, json::JsonParser, }; use crate::slice::free_slice; use crate::slice::rust_slice_to_c; use crate::slice::Slice; use pulldown_cmark::{html::push_html, Options, Parser}; use std::ffi::{c_void, NulError}; use std::ptr::null_mut; use std::{ ...
true
b9b3e7dc8895a3d92aa89af6b2f3ea93433a35ee
Rust
sdeu/rust-rt
/src/material.rs
UTF-8
1,842
3.15625
3
[ "MIT" ]
permissive
use super::math::Vec3; use pa::query::Ray; use pa::query::RayIntersection; use rand::distributions::{Distribution, Uniform}; use std::f32::consts::PI; pub trait Material: Send + Sync { fn scatter(&self, ray: &Ray, intersection: &RayIntersection) -> Option<Ray>; fn color(&self) -> Vec3; } fn random_unit_vector...
true
22a76bab9e3e8068705d0c9656a9f81b009e23fa
Rust
helgoboss/helgoboss-midi
/src/structured_short_message.rs
UTF-8
11,929
2.96875
3
[ "MIT" ]
permissive
use crate::{ build_14_bit_value_from_two_7_bit_values, build_status_byte, extract_channel_from_status_byte, extract_high_7_bit_value_from_14_bit_value, extract_low_7_bit_value_from_14_bit_value, extract_type_from_status_byte, Channel, ControllerNumber, KeyNumber, ShortMessage, ShortMessageFactory, Short...
true
e1498c63b4420e557949d7165b99c7e40f6ff13f
Rust
woubuc/postage-rs
/src/sync/transfer.rs
UTF-8
2,072
2.90625
3
[ "MIT" ]
permissive
use atomic::{Atomic, Ordering}; use crate::{stream::PollRecv, Context}; use super::{ notifier::Notifier, oneshot_cell::{OneshotCell, TryRecvError}, }; #[derive(Copy, Clone)] enum State { Alive, Dead, } pub struct Transfer<T: Sized> { sender: Atomic<State>, receiver: Atomic<State>, value:...
true
2abd79031a587b1a06607152a959606d7ea39e52
Rust
isgasho/sdfu
/src/ops.rs
UTF-8
8,646
3.4375
3
[]
no_license
//! Operations you can perform to combine two SDFs. use super::*; macro_rules! impl_ops { ($($t:ty),+) => { /// A function which can get the minimum between two SDFs. /// This is useful because sometimes we want to be able to /// interpolate between the minimums for 'soft blending' between ...
true
510f495de0e20651931166562f90907bf60ec270
Rust
natebolam/coda
/src/lib/marlin_plonk_bindings/stubs/src/caml_pointer.rs
UTF-8
1,965
3.015625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::ops::{Deref, DerefMut}; use std::rc::Rc; #[derive(std::fmt::Debug, Clone)] pub struct CamlPointer<T>(pub Rc<T>); impl<T> CamlPointer<T> { extern "C" fn caml_pointer_finalize(v: ocaml::Value) { let v: ocaml::Pointer<CamlPointer<T>> = ocaml::FromValue::from_value(v); unsafe { v....
true
aeeb1c7c67cca06564f878aff53508d99e694299
Rust
NeoCogi/rs-streams
/src/file.rs
UTF-8
11,048
2.546875
3
[ "BSD-3-Clause" ]
permissive
use crate::*; use rs_alloc::*; use libc::*; pub struct FileWriter { file : *mut ::libc::FILE, } impl FileWriter { pub fn create(fname: &str) -> Result<Self, ()> { let mut sname = String::from(fname); sname.push('\0' as u8); let f = unsafe { ::libc::fopen(sname.as_str().as_bytes().as...
true
4eab1625dbd97dff95b4ed632cabf1d71de5823f
Rust
funbringer/zenith
/integration_tests/tests/test_pageserver.rs
UTF-8
3,339
2.53125
3
[]
no_license
#[allow(dead_code)] // mod control_plane; use control_plane::compute::ComputeControlPlane; use control_plane::storage::TestStorageControlPlane; // XXX: force all redo at the end // -- restart + seqscan won't read deleted stuff // -- pageserver api endpoint to check all rels // Handcrafted cases with wal records that ...
true
7a466e24cdc83c64c48ce36a8002b25affb21b63
Rust
moelife-coder/rkyv
/rkyv/src/ser/mod.rs
UTF-8
6,620
3.15625
3
[ "MIT" ]
permissive
//! Serialization traits, serializers, and adapters. #[cfg(feature = "std")] pub mod adapters; pub mod serializers; use crate::{ Archive, ArchivePointee, ArchiveUnsized, Archived, Fallible, RelPtr, Serialize, SerializeUnsized, }; use core::{mem, slice}; /// A byte sink that knows where it is. /// /// A type ...
true
5e0b841b5a621aee467e12b741ffa94441437889
Rust
pipopotamasu/words-counter
/src/words_counter/counter.rs
UTF-8
547
2.84375
3
[]
no_license
use std::io::BufRead; use anyhow::Result; use std::collections::HashMap; pub fn run<R: BufRead>(mut reader: R, skip_header: bool) -> Result<()> { let mut counter: HashMap<String, u32> = HashMap::new(); if skip_header { let mut buf = String::new(); reader.read_line(&mut buf).unwrap_err(); } for line i...
true
63ebed5fd95274cb07077eaebc1c7c926fcb7914
Rust
neo-moism/game-of-life
/src/consul.rs
UTF-8
1,810
2.953125
3
[ "MIT" ]
permissive
use serde::Deserialize; use serde::Serialize; use std::collections::HashMap; use surf; #[derive(Deserialize, Debug)] pub struct Service { #[serde(rename = "ID")] pub id: String, #[serde(rename = "Service")] pub service: String, #[serde(rename = "Address")] pub address: String, } pub struct Con...
true
9e58caeee07892a17f225680da242524e3459df9
Rust
izzabelle/msg
/src/server.rs
UTF-8
2,855
2.5625
3
[]
no_license
// namespacing use crate::Result; use async_std::{ net::{TcpListener, TcpStream}, sync::Mutex, task, }; use futures::io::{ReadHalf, WriteHalf}; use futures_util::{io::AsyncReadExt, stream::StreamExt}; use ilmp::encrypt; use ilmp::encrypt::Encryption; use ilmp::Sendable; use lazy_static::lazy_static; use std...
true
a69d48d0a2215fb1bfdec51886fe1765ea35c9bc
Rust
gtnao0219/rust_cpu_emu
/src/main.rs
UTF-8
683
2.78125
3
[]
no_license
use std::env; use std::io::{self, Read}; use std::fs::File; use rust_cpu_emu::emulator::*; fn main() { let args: Vec<String> = env::args().collect(); if args.len() <= 1 { eprintln!("arguments error"); return; } let mut program = match read_binary(&args[1]) { Ok(v) => v, ...
true
5021f42ebc5842c27c5b6a1a73d2a30d3cf1bdb8
Rust
lineCode/GameServer_Rust
/gamecenter/src/net/http.rs
UTF-8
3,881
2.515625
3
[]
no_license
use crate::Lock; use async_std::task::block_on; use http_types::Error as HttpTypesError; use serde_json::{json, Value}; use tools::http::HttpServerHandler; pub struct StopAllServerHandler { gm: Lock, } impl StopAllServerHandler { pub fn new(gm: Lock) -> Self { StopAllServerHandler { gm } } } imp...
true
b3f149ad148a801ab5c98989ef0f1715e50be70b
Rust
kofing1/tlg2png
/src/bin/tlg/main.rs
UTF-8
2,971
2.53125
3
[ "Unlicense" ]
permissive
use indicatif::{ParallelProgressIterator, ProgressBar, ProgressStyle}; use rayon::prelude::*; use std::convert::TryInto; use std::fs::File; use std::io::Read; use std::path::PathBuf; use structopt::StructOpt; use tlg_rs::formats::constants::{TLG0_MAGIC, TLG5_MAGIC, TLG6_MAGIC, TLG_MAGIC_SIZE}; use tlg_rs::formats::{tl...
true
c8c5fd4cec1b7d6cd3239295415fa8e12715aed2
Rust
yoloseem/projecteuler
/0007/0007.rs
UTF-8
443
2.984375
3
[]
no_license
fn main() { let mut sieve: Vec<bool> = vec![true; (1000000 + 1) as usize]; let mut n = 0; let mut nth_prime = 0; for i in (2..1000000) { if sieve[i as usize] == true { nth_prime = i; n = n + 1; if n == 10001 { break } for j in (2..(1000000 / i + 1)...
true
f1f9f21fb21b852d6655bec861c3a48abc9aff48
Rust
Shahzad-Dock/dock-substrate
/pallets/poa/src/lib.rs
UTF-8
70,410
2.5625
3
[]
no_license
//! Pallet to add/remove validators and do emission rewards. //! UPDATE: Adding removing validators and emission rewards is no more done by this pallet. The only //! reason for this pallet's existence is to unlock the locked emission rewards and tracking last //! block of PoA chain. #![cfg_attr(not(feature = "std"), n...
true
dc960f38de9638b7219fe4d77cdc131c875b04fb
Rust
willingc/find-work
/back/src/data.rs
UTF-8
3,667
2.921875
3
[ "Apache-2.0", "MIT" ]
permissive
use config::Config; use github::Client; use std::collections::HashMap; use std::fs::File; use std::io::Read; use std::path::Path; use serde_json; const DATA_ROOT: &'static str = "data"; const TABS: &'static str = "tabs.json"; const CATEGORIES: &'static str = "categories.json"; const TAB_CATEGORY: &'static str = "tab...
true
ac99b2db0cd333086b4ba3e75b762d178bdef546
Rust
kilork/abctracer
/src/geometry/cylinder.rs
UTF-8
4,517
3.09375
3
[ "Unlicense", "MIT" ]
permissive
use super::*; pub struct Cylinder { material: Surface, e1: Vector, e2: Vector, d1: f64, d2: f64, len: f64, len2: f64, radius2: f64, radius4: f64, loc: Vector, dir: Vector, radius: f64, } impl Cylinder { pub fn new(material: Surface, loc: Vector, dir: Vector, radius:...
true
de904086f85a62a128c0137f37db93ec680b0b2c
Rust
Klades/Advent2020
/src/day5.rs
UTF-8
3,591
3.078125
3
[]
no_license
pub fn part1(data: &Vec<String>) -> i32 { return *get_all_ids(data).iter().max().unwrap(); } fn get_all_ids(data: &Vec<String>) -> Vec<i32> { let seats = Seat::build_seats(&data); return seats.iter().map(|seat| seat.id).collect(); } pub fn part2(data: &Vec<String>) -> i32 { let seats = Seat::build_seats(&data); ...
true
9a7f26e2eebaf5af8a59e0ee7b44eac16e14c4e2
Rust
qshan/rust-study
/try1/src/main.rs
UTF-8
5,135
3.125
3
[ "Apache-2.0" ]
permissive
fn main() { println!("Hello, try1!"); //case 1 println!("[Case 1]"); let a = 12; let b = 12.5; println!("Hello, world!"); println!("a is {}", a); println!("b is {}", b); println!("a and b is {} and {}", a, b); //case 2 println!("[Case 2]"); let mut c = 567; println...
true
70b753c4659d8d57f4a15a37b151562ad8d3035a
Rust
de-vri-es/jws
/src/combine.rs
UTF-8
4,011
3.03125
3
[ "BSD-2-Clause" ]
permissive
///! Combine multiple verifiers. use crate::{Error, JsonObject, Result, Verifier}; #[derive(Clone, Debug)] pub struct OrVerifier<Left, Right> { pub left : Left, pub right : Right, } #[derive(Clone, Debug)] pub struct AndVerifier<Left, Right> { pub left : Left, pub right : Right, } /// Verifier that accepts me...
true
9f58825bdf0a015a8f379b48b33586231dde65cd
Rust
napi-rs/napi-rs
/examples/napi/src/typed_array.rs
UTF-8
1,346
2.578125
3
[ "MIT" ]
permissive
use napi::bindgen_prelude::*; #[napi] fn get_buffer() -> Buffer { String::from("Hello world").as_bytes().into() } #[napi] fn append_buffer(buf: Buffer) -> Buffer { let mut buf = Vec::<u8>::from(buf); buf.push(b'!'); buf.into() } #[napi] fn get_empty_buffer() -> Buffer { vec![].into() } #[napi] fn convert_...
true
9eab39b518d41ec35d00a5cee50f9eec7ece7d5a
Rust
swidoff/ostep-projects
/initial-utilities/wgrep/src/main.rs
UTF-8
3,253
3.46875
3
[]
no_license
#![feature(iter_map_while)] use std::env; use std::fs::File; use std::io::{Read, stdin, Bytes}; use std::process::exit; use itertools::Itertools; /// * Your program **wgrep** is always passed a search term and zero or /// more files to grep through (thus, more than one is possible). It should go /// through each...
true
b1a52b56a519a71ed6d6b1bb15053d74bcb72b3f
Rust
holmgr/hansa
/src/ship/mod.rs
UTF-8
7,964
2.71875
3
[ "MIT" ]
permissive
use ggez::{ graphics::{Color as ggezColor, DrawParam, Point2, Rect}, nalgebra as na, timer::get_delta, Context, }; use std::time::Duration; use animation::Animation; use color::Color; use config::Config; use draw::Drawable; use geometry::Position; use route::Waypoint; use update::Updatable; use world::...
true
465d8317c0347974f277e4bda0c8e1eac76d6164
Rust
hml1006/amqp-proto
/src/error/frame.rs
UTF-8
761
2.875
3
[ "BSD-2-Clause" ]
permissive
use std::fmt::Display; use std::fmt::Formatter; use std::fmt; use std::io; #[derive(Debug)] pub enum FrameDecodeErr { Incomplete, SyntaxError(&'static str), DecodeError(String), } impl Display for FrameDecodeErr { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { F...
true
b13c5e260b09867c9837daac6ca64c374be74225
Rust
adriensamson/aoc2019
/src/bin/day19.rs
UTF-8
2,883
3.1875
3
[]
no_license
fn main() { let input = include_str!("day19input.txt"); step1(input); step2(input); } use aoc2019::intcode::{IntCode, IntCodeIo}; use std::collections::VecDeque; pub fn step1(input: &str) { let beam_program = BeamProgram::new(input); let mut n = 0; for y in 0..50 { for x in 0..50 { ...
true
cf1f68b09dea9f21a073f891c342e7b2638e369b
Rust
homersimpsons/euler
/p014/src/main.rs
UTF-8
1,049
3.71875
4
[]
no_license
struct Collatz { current: u128, } impl Collatz { fn new(start: u128) -> Self { Collatz{current: start} } } impl Iterator for Collatz { type Item = u128; fn next(&mut self) -> Option<u128> { if self.current == 1 { None } else { if self.current % 2 == ...
true
985d0d033095595705416ba7c9bb9efeb2cdf001
Rust
funn1est/leetcode-rust
/src/solutions/n1299_replace_elements_with_greatest_element_on_right_side/mod.rs
UTF-8
689
3.375
3
[]
no_license
/// https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side/ /// /// https://leetcode-cn.com/problems/replace-elements-with-greatest-element-on-right-side/ pub struct Solution {} impl Solution { pub fn replace_elements(arr: Vec<i32>) -> Vec<i32> { let mut max = -1; arr.it...
true
07a9591eaa5f42dd0e3974483fa4fc33f3afac60
Rust
ayrat555/el_monitorro
/src/bot/commands/get_global_template.rs
UTF-8
1,224
2.890625
3
[ "MIT" ]
permissive
use super::Command; use super::Message; use super::Response; use crate::db::telegram; use diesel::PgConnection; use typed_builder::TypedBuilder; static COMMAND: &str = "/get_global_template"; #[derive(TypedBuilder)] pub struct GetGlobalTemplate { message: Message, } impl GetGlobalTemplate { pub fn run(&self)...
true
eba7a1a61104f82951cfb67283608f5f44763a42
Rust
N3xed/imgui-app
/src/window.rs
UTF-8
28,449
3.390625
3
[ "MIT" ]
permissive
//! General logic for OS window manipulation and creation. //! //! Each `Window` gets a data model, which is a struct that implements the `Layout` //! trait. All window and UI specific state is contained in the data model and it is //! responsible for the GUI layout (`Layout::layout()`). //! //! Manipulation of all GUI...
true
d26beef53a9116e49063d27ade45181a3e9acb52
Rust
simukarya11/Rust_Story-Solutions
/Chapter_1/3.rs
UTF-8
784
3.515625
4
[]
no_license
/* Declaring a struct and using its indexing. */ #[derive(Debug)] struct Point{ x:i32, y:i32, z:i32, } fn main() { //Below is a way to initalize an object for a structure. let obj1=Point{ x:2, y:3, z:4 ...
true
79f89e7a4c291cd38ee17de53f05d09b3a952238
Rust
nathantypanski/rust-csv
/examples/simple_missing.rs
UTF-8
402
2.65625
3
[ "Unlicense" ]
permissive
extern crate csv; extern crate serialize; use std::path::Path; #[deriving(Decodable)] struct Record { s1: String, s2: String, dist: Option<uint>, } fn main() { let fp = &Path::new("./data/simple_missing.csv"); let mut rdr = csv::Decoder::from_file(fp); for record in rdr.decode_iter::<Record>...
true
3e0b524b72faa7e52135609fa9d2ce62af5baf41
Rust
nushell/nushell
/crates/nu-cmd-extra/src/extra/math/euler.rs
UTF-8
1,438
2.9375
3
[ "MIT" ]
permissive
use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] pub struct SubCommand; impl Command for SubCommand { fn name(&self) -> &str { "math e" }...
true
ee155e5b1d90d23004f191c379376a282f19b586
Rust
mhowto/bolt-rust
/src/freelist.rs
UTF-8
14,727
2.6875
3
[]
no_license
use types::{txid_t, pgid_t}; use page::{Page, get_page_header_size, merge_pgids, merge_pgids_raw, FREELIST_PAGE_FLAG}; use std::rc::Rc; use std::cell::RefCell; use std::collections::{HashMap, HashSet}; use std::mem; use std::slice; // FreeList represents a list of all pages that are available for allocation. // It als...
true
1a2f3faa1d03cd097899533b5f3c7bde34d8cc7b
Rust
faim-lab/mappy
/mappy/src/mappy/matching.rs
UTF-8
4,514
2.796875
3
[]
no_license
#[derive(Debug)] pub struct MatchTo(pub usize, pub Vec<Target>); #[derive(Debug)] pub struct Target(pub Option<usize>, pub u32); #[derive(Debug)] pub struct Matching(Vec<Match>); impl std::iter::IntoIterator for Matching { type Item = Match; type IntoIter = std::vec::IntoIter<Self::Item>; fn into_iter(self...
true
ee059d629766db933a15b086b53e59b376e0d4d5
Rust
dnaeon/rust-sshkeys
/examples/certificate.rs
UTF-8
781
2.640625
3
[ "BSD-3-Clause", "BSD-2-Clause", "LicenseRef-scancode-bsd-unchanged" ]
permissive
extern crate sshkeys; fn main() { let cert = sshkeys::Certificate::from_path("examples/id_ed25519-cert.pub").unwrap(); println!("Type: {} {}", cert.key_type.name, cert.cert_type); println!("Public key: {}", cert.key); println!("Signing CA: {}", cert.signature_key); println!("Key ID: {}", cert.key_...
true
b2ac0f0a26e405da2ca3535040141c07e6586a1c
Rust
jlgerber/packybara
/src/db/find/versionpin.rs
UTF-8
7,663
2.984375
3
[]
no_license
use super::versionpins::{FindVersionPinsError, FindVersionPinsRow}; use crate::coords_error::CoordsError; use crate::types::IdType; pub use crate::Distribution; use log; use postgres::types::ToSql; use postgres::Client; use snafu::{ResultExt, Snafu}; /// Error type returned from FindVersionPinsError #[derive(Debug, Sn...
true
bdf2fce790fc6674545d4c8caadf0fb9eadc9edf
Rust
gitter-badger/angel-whisper
/src/llsd/client.rs
UTF-8
18,828
2.59375
3
[]
no_license
use byteorder::BigEndian; use bytes::{Bytes, BytesMut}; use bytes::BufMut; use futures::Poll; use futures::future; use futures::future::Future; use llsd::errors::LlsdError; use llsd::frames::Frame; use llsd::route::Route; use llsd::session::KeyPair; use llsd::session::Sendable; use llsd::session::client::Session; use s...
true
998c7c846b70182204f02e4844cd5d366e1ee88e
Rust
vlad9486/un-algebra
/src/tests/random.rs
UTF-8
5,504
3.359375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
//! //! Random value generation for generative tests. //! //! `un_algebra` generative tests (using `proptest`) rely on randomly //! generated values of Rust's built in numeric types. The `random` //! module provides convenient `proptest` generators for one or //! several built-in integer and floating point types. //! /...
true
ef57daf57e95e1e99ebdf458c9164ffb7373f376
Rust
rust-lang/annotate-snippets-rs
/src/snippet.rs
UTF-8
2,398
3.421875
3
[ "MIT", "Apache-2.0" ]
permissive
//! Structures used as an input for the library. //! //! Example: //! //! ``` //! use annotate_snippets::snippet::*; //! //! Snippet { //! title: Some(Annotation { //! label: Some("mismatched types"), //! id: None, //! annotation_type: AnnotationType::Error, //! }), //! footer: vec![...
true
da43657481d531250f1d0a68d010dee4ddd7b1d6
Rust
AndreTeixeira1998/tasproxy
/src/config.rs
UTF-8
1,841
2.5625
3
[]
no_license
use color_eyre::{eyre::WrapErr, Report, Result}; use rumqttc::MqttOptions; use std::str::FromStr; #[derive(Default)] pub struct Config { pub mqtt_host: String, pub mqtt_port: u16, pub mqtt_credentials: Option<Credentials>, pub host_port: u16, } pub struct Credentials { username: String, passwo...
true
5c4f40a25feb56238238b9530a24d6b097db8b64
Rust
krircc/weft
/weft/src/template.rs
UTF-8
2,955
3.453125
3
[ "Apache-2.0" ]
permissive
use std::io; use v_htmlescape::escape; /// An internal representation of a qualified name, such as a tag or attribute. /// Does not currently support namespaces. #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct QName(String); impl From<String> for QName { fn from(src: String) -> Self { ...
true
9115392940d434f811cbade8a0e67e46e4edc96d
Rust
arnau/gluon
/tests/regex_bind.rs
UTF-8
1,380
2.671875
3
[ "MIT" ]
permissive
#![cfg(feature = "regex")] extern crate env_logger; extern crate gluon; use gluon::{new_vm, Compiler}; #[test] fn regex_match() { let _ = ::env_logger::try_init(); let thread = new_vm(); let text = r#" let regex = import! std.regex let { (|>) } = import! std.function let { not } =...
true
679a65898d62574d8b9c08d76a6546d26eda16a7
Rust
theseus-os/Theseus
/applications/test_serial_echo/src/lib.rs
UTF-8
1,938
2.75
3
[ "MIT" ]
permissive
//! Simple tests for I/O transfers across the [`serial_port::SerialPort`]. //! #![no_std] extern crate alloc; // #[macro_use] extern crate log; #[macro_use] extern crate app_io; extern crate task; extern crate core2; extern crate io; extern crate sync_irq; extern crate serial_port; use core::convert::TryFrom; use a...
true
a4e40e7088bf69195cb306e925018713c16d351a
Rust
rust-lang/rust-semverver
/tests/cases/inherent_impls/old.rs
UTF-8
487
2.71875
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#[allow(dead_code)] pub struct Abc { } #[allow(dead_code)] impl Abc { const A: u8 = 3; pub fn abc(&self) -> u8 { 0 } fn def(&self) { } pub fn ghi<A>(&self, a: A) -> A { a } } #[allow(dead_code)] pub struct Def<A> { field: A, } #[allow(dead_code)] impl Def<bool> { pu...
true
201bb12a890e0a75d73cb60db07917dc9bb1c747
Rust
rajbahakdanyu/lms_rust
/src/borrow_book.rs
UTF-8
6,704
2.71875
3
[]
no_license
use crate::database::database; use crate::utils::{get_booklist, read_booklist, read_input}; use chrono::Duration; use regex::Regex; use std::fs::OpenOptions; use std::fs::{self, File}; use std::io::Write; pub fn borrow_book() { let mut borrower_name = String::new(); println!("Enter borrower name: "); rea...
true
41f08caedf4b6b5049f27e2cd25ba1c4cb1b640e
Rust
xclusive1111/playground
/rust/collections/src/main.rs
UTF-8
1,286
3.390625
3
[]
no_license
pub mod vec; pub mod fun; pub mod str; pub mod hashmap; fn main() { let mut v = vec::new_vector(); v.push(1); v.push(2); println!("{:?}", v); let first = &v[0]; println!("The first element is {}", first); v.push(3); let second = &v[1]; println!("The second element is {}", second); ...
true
1531391579ed96aabaee6828872ad783989ee46a
Rust
klaxit/heroku_rs
/src/endpoints/testing/get.rs
UTF-8
7,086
3.046875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
//Anything related to GET requests for Heroku tests goes here. use super::{TestCase, TestNode, TestRun}; use crate::framework::endpoint::{HerokuEndpoint, Method}; /// Test Case List /// /// List test cases /// /// [See Heroku documentation for more information about this endpoint](https://devcenter.heroku.com/article...
true
b6da2d1d4ed7b64ab907f5f3aa622f24f5fd04e4
Rust
AregevDev/rustcord
/src/presence.rs
UTF-8
6,379
2.71875
3
[ "Apache-2.0" ]
permissive
use libc; use rustcord_sys as sys; use std::ffi::{CString, NulError}; use std::ptr; use std::time::*; /// Defines the data displayed on the rich presence screen on a user's profile. /// Due to the C API limits, this data is limited to a maximum amount of bytes will be listed below #[derive(Default, Clone, Hash, Partia...
true
f53674731298fbc0871c1d75758ed32803b9f6c9
Rust
HadrienG2/3photons-rust
/src/spinor.rs
UTF-8
5,656
2.78125
3
[]
no_license
//! Facilities for computing spinor products use crate::{ event::{ Event, ParticleMatrix, ParticleVector, INCOMING_E_M as E_M, INCOMING_E_P as E_P, NUM_INCOMING, NUM_OUTGOING, NUM_SPINS, }, momentum::{E, X, Y, Z}, numeric::{ floats::{consts::SQRT_2, MIN_POSITIVE}, functi...
true
e8e3a56c9eef1e5f8f024887bf2a90ebf48d827b
Rust
rschulman/pinecone-rs
/src/router/spanning_tree.rs
UTF-8
2,312
2.546875
3
[]
no_license
use async_std::{ channel::{self, Receiver, Sender}, prelude::*, task, }; use std::{sync::mpsc::channel, time::Duration}; use chrono::DateTime; use super::Router; const ANNOUNCEMENT_INTERVAL: u32 = 15 * 60; // 15 minutes const ANNOUNCEMENT_TIMEOUT: u64 = ANNOUNCEMENT_INTERVAL * 2; struct RootAnnouncementW...
true
1e03b36f648624ca0d6fb2bbddd98a2687bc2733
Rust
kira-bruneau/tokio-process
/src/unix/reap.rs
UTF-8
6,282
3.15625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use futures::{Async, Future, Poll, Stream}; use std::io; use std::ops::Deref; use std::process::ExitStatus; /// An interface for waiting on a process to exit. pub trait Wait { /// Try waiting for a process to exit in a non-blocking manner. fn try_wait(&mut self) -> io::Result<Option<ExitStatus>>; } /// An int...
true
8589237342317d05f89004b841aad4ff04a0e634
Rust
hannes-hochreiner/sensor-net-web-app
/src/components/parameter.rs
UTF-8
4,056
2.890625
3
[ "MIT", "Apache-2.0" ]
permissive
use chrono::{format::Fixed, DateTime, Duration, FixedOffset, Utc}; use url::Url; use uuid::Uuid; use yew::{classes, html, Component, Context, Html, Properties}; use crate::objects::parameter_type::ParameterType; #[derive(PartialEq, Properties)] pub struct Props { pub parameter_type: ParameterType, pub sensor_...
true
cd3d51ec98b9384d0fa54b528337032ce0e5a3c2
Rust
prabirshrestha/wilo
/src/main.rs
UTF-8
7,832
2.9375
3
[ "MIT" ]
permissive
use anyhow::Result; use std::cmp::{max, min}; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::PathBuf; use termwiz::{ caps::Capabilities, color::*, input::*, surface::*, terminal::{buffered::BufferedTerminal, SystemTerminal, Terminal}, }; pub struct Editor { bt: BufferedTer...
true
dae3f074f0df27fddaf116a21114d8c294bf97a2
Rust
doomhammerhell/quantum-rust
/src/algorithms/deutsch.rs
UTF-8
2,049
3.796875
4
[ "MIT" ]
permissive
//! Deutsch's algorithm. use complex::Complex; use computer::QuantumComputer; use gate::Gate; use gates; use matrix::Matrix; #[allow(unused)] #[derive(Debug, PartialEq)] enum DeutschAlgorithmOutput { Balanced, Constant, } /// Takes |a, b> to |a, b+f(a)> /// /// f must be a function from {0, 1} to {0, 1} pub...
true
fd3b36540d45a11372802242c49bb8c2a6881f21
Rust
ChewyGumball/advent_of_code_2020
/4/b/src/main.rs
UTF-8
5,512
3.0625
3
[ "MIT" ]
permissive
use std::env; use std::fs::File; use std::io::{self, BufRead, Lines}; use std::path::Path; use regex::Regex; use lazy_static::lazy_static; struct Passport { birth_year: Option<String>, issue_year: Option<String>, expiration_year: Option<String>, height: Option<String>, hair_colour: Option<String>,...
true
c224f598e82f194b62239eee20ef9c550206bd52
Rust
quietlychris/gpuarray-rs
/examples/matmul.rs
UTF-8
702
2.640625
3
[ "MIT" ]
permissive
extern crate gpuarray as ga; use ga::Context; use ga::tensor::{Tensor, TensorMode}; use ga::array::Array; fn main() { let ref ctx = Context::new(); let a = Array::from_vec(vec![5, 10], (0..5*10).map(|x| x as f32).collect()); let b = Array::from_vec(vec![10, 15], (0..10*15).map(|x| (x as f32)*2.0).collect...
true
b410c7afdd2f67a0d89e07d6b3a469b471cff30d
Rust
0xisk/rust-algorithms
/src/sorting/quick.rs
UTF-8
476
3.0625
3
[ "MIT" ]
permissive
// TODO fn quick_sort<T: Ord + Copy>(left: usize, right: usize, arr: &mut [T]) { if right - left <= 0 { return; } let pivot: T = arr[left]; let pivot_idx: usize = right / 2; quick_sort(left, (pivot_idx as isize - 1) as usize, arr); quick_sort(pivot_idx + 1, right, arr) } fn main() { ...
true
dc25c2d05b933a81cdbf6baea56b85eb94015b23
Rust
ethresearch/Shuffle_SSLE
/rust_code/src/main.rs
UTF-8
2,700
2.75
3
[]
no_license
mod shuffle; use shuffle::{setup, prove, verify}; use algebra::{bls12_381::{Fr, G1Affine}}; use algebra_core::{AffineCurve, curves::ProjectiveCurve}; use rand::{thread_rng,Rng}; use std::time::{Instant}; fn get_shuffle(ciph_r: &Vec<G1Affine>, ciph_s: &Vec<G1Affine>, ell: usize) -> (Vec<G1Affine>, Vec<G1Affine...
true
b9f56a6566ca23f6aac0a004bf9668c7a82a0144
Rust
wycats/sysinfo
/src/mac/process.rs
UTF-8
7,131
2.890625
3
[ "MIT" ]
permissive
// // Sysinfo // // Copyright (c) 2015 Guillaume Gomez // use std::fmt::{self, Formatter, Debug}; use std::path::{Path, PathBuf}; use libc::{c_int, gid_t, kill, uid_t}; use Pid; use ::ProcessExt; /// Enum describing the different status of a process. #[derive(Clone, Copy, Debug)] pub enum ProcessStatus { /// ...
true
2c91f00005730f084b52b5e173029cb81a72264c
Rust
denilson020898/rwp
/c03/basic_async/src/main.rs
UTF-8
751
3.484375
3
[]
no_license
// use std::thread::JoinHandle; use std::{thread, time}; fn do_something(number: i8) -> i8 { println!("number {} is running", number); let two_seconds = time::Duration::new(2, 0); thread::sleep(two_seconds); return 2; } fn main() { let now = time::Instant::now(); let thread_one = thread::spaw...
true
ac6a17b59d11ba19482061756fe671b720d4a923
Rust
koshilife/atcoder.jp
/abc210/c_rust/src/main.rs
UTF-8
1,189
2.90625
3
[]
no_license
use std::collections::HashMap; fn main() { proconio::input! { n: usize, k: usize, cn: [u64; n] } // println!("n:{}, k:{}, cn:{:?}", n, k, cn); let mut occur_map = HashMap::new(); for c in &cn[0..k] { let count = occur_map.entry(c).or_insert(0); *count += 1; ...
true
f929d849cacea323ccc55908c5cc15808de42c59
Rust
haraldng/kompact
/core/src/messaging/deser_macro.rs
UTF-8
10,972
3.328125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
/// A macro to make matching serialisation ids and deserialising easier /// /// This macro basically generates a large match statement on the serialisation ids /// and then uses [try_deserialise_unchecked](crate::prelude::NetMessage::try_deserialise_unchecked) /// to get a value for the matched type, which it then uses...
true
c4aece23119ea47c3fb005bc1e6d11b27b4b1a67
Rust
ThibaudDauce/advent_of_code_2020
/src/02.rs
UTF-8
26,676
3.171875
3
[]
no_license
fn main() { part1(); part2(); } fn part1() { let passwords = input(); let mut number_of_correct_passwords = 0; for password in &passwords { let count = password.password.matches(password.search).count(); if count >= password.number_1 && count <= password.number_2 { numb...
true
8147dc09a150e29195eff5051484f1147f4267b2
Rust
petrSchreiber/Calling-PowerBASIC-DLL-from-Rust
/pblib-test/src/dynamic_strings.rs
UTF-8
3,368
3.3125
3
[]
no_license
// Cargo for DLL support extern crate libloading; extern crate ascii; extern crate winapi; // Adjusting the signatures for our use extern "system" { pub fn SysAllocStringByteLen(psz: *const u8, len: usize) -> *const u8; pub fn SysFreeString(bstrString: *const u8); pub fn SysStringByteLen(bstr:...
true
814c399cf368a1041017967a2d07501f2d1a27db
Rust
cmal/rust-practise-questions
/answer/chapter_04/my_regex/src/main.rs
UTF-8
1,589
3.484375
3
[ "MIT" ]
permissive
// use std::io; // use std::io::prelude::*; // use regex::Regex; // fn main() { // let mut input = String::new(); // print!("Numbers to sort: "); // io::stdout().flush().unwrap(); // io::stdin().read_line(&mut input).ok().expect("failed to read line"); // let re = Regex::new(r"\s+").unwrap(); // ...
true
19a6fc03aa5c45c0071aaa897eedb29ccb9c14e1
Rust
FredrikAugust/wasm-bsgs
/src/lib.rs
UTF-8
1,934
2.703125
3
[ "MIT", "Apache-2.0" ]
permissive
mod utils; extern crate console_error_panic_hook; use wasm_bindgen::prelude::*; use std::collections::HashMap; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[w...
true
ce96c888faa05d87b2ae3e7006029be02b6ffc8d
Rust
baishuai/rust-exercism
/triangle/src/lib.rs
UTF-8
897
3.515625
4
[]
no_license
use std::ops::Add; use std::cmp::PartialOrd; pub struct Triangle<T> { a: T, b: T, c: T, } impl<T> Triangle<T> where T: PartialOrd + Add<Output = T> + Copy + Default { // use default as zero pub fn build(slice: [T; 3]) -> Result<Triangle<T>, String> { let (a, b, c) = (slice[0], slice[1...
true
f6f785fc3116b9004f524c608ba595e8d6f544c8
Rust
hardliner66/aoc_2015
/src/bin/aoc_09_1.rs
UTF-8
641
2.65625
3
[]
no_license
fn main() -> Result<(), Box<dyn std::error::Error>> { let content = std::fs::read_to_string("data/aoc_09.txt")?; let v = content .lines() .map(|line| { line.split("to") .flat_map(|s| s.split("=")) .map(str::trim) .map(str::to_...
true
f3ff86417f82e5f35ae16613d8164bfa7ed078dd
Rust
encointer/substrate-fixed
/src/macros_round.rs
UTF-8
28,442
3.125
3
[ "Apache-2.0", "FSFAP", "MIT" ]
permissive
// Copyright © 2018–2019 Trevor Spiteri // This library is free software: you can redistribute it and/or // modify it under the terms of either // // * the Apache License, Version 2.0 or // * the MIT License // // at your option. // // You should have recieved copies of the Apache License and the MIT // License al...
true
9875d688ebc45839cf5dba81cebb64f8d9031407
Rust
nervosnetwork/molecule
/tools/codegen/src/parser/mod.rs
UTF-8
9,738
2.609375
3
[ "MIT" ]
permissive
use std::path::Path; use crate::{ast, utils::ParserUtils as _}; mod inner; pub(crate) use inner::{Parser as InnerParser, Rule}; pub struct Parser; impl Parser { pub fn parse<P: AsRef<Path>>(path: &P) -> ast::Ast { let ast_raw = Self::preprocess(path).unwrap(); ast::Ast::complete(ast_raw) } }...
true
a95070bc7a5cdefc68b91545326e804d286ded29
Rust
port-finance/anchor
/lang/src/vec.rs
UTF-8
2,562
2.703125
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
use crate::{Accounts, ToAccountInfos, ToAccountMetas}; use solana_program::account_info::AccountInfo; use solana_program::instruction::AccountMeta; use solana_program::program_error::ProgramError; use solana_program::pubkey::Pubkey; impl<'info, T: ToAccountInfos<'info>> ToAccountInfos<'info> for Vec<T> { fn to_acc...
true
a43c7c2be6ca8f359d7d5f7462307dceda4e89f3
Rust
shoegaze/raster_rs
/src/math/scalars/ops.rs
UTF-8
723
3.09375
3
[]
no_license
use std::ops::{Neg, Add, Sub, Mul, Div}; // Fixed-point scalars are closed under unary -, +, -, * pub trait ScalarNaturalOps: Sized + Neg<Output = <Self as ScalarNaturalOps>::Output> + Add<Output = <Self as ScalarNaturalOps>::Output> + Sub<Output = <Self as ScalarNaturalOps>::Output> + Mul<...
true
a43b4619d4d83a27ac880b6103238440eb3f620a
Rust
jonayerdi/aoc2018
/src/bin/day10.rs
UTF-8
3,779
3.3125
3
[]
no_license
use std::fs::File; use std::io::{self, Read}; use std::ops::{AddAssign, SubAssign}; use std::path::PathBuf; #[derive(Clone, Copy, PartialEq)] struct Point { x: i32, y: i32, } impl AddAssign for Point { fn add_assign(&mut self, other: Self) { *self = Self { x: self.x + other.x, ...
true
8df60649f57274abe37278b253e4aa45041a05ab
Rust
jaynus/balls
/game/core/src/app.rs
UTF-8
5,571
2.5625
3
[]
no_license
use crate::{ event::{Channel, ListenerId}, legion::prelude::*, settings::Settings, time::Time, GameState, GlobalCommandBuffer, Manager, }; use std::sync::Arc; use winit::{ event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent}, event_loop::{ControlFlow, EventLoop}, win...
true
0092bcaca370189604e10d5e288d769bab0d74ec
Rust
resonancellc/NEruSt
/src/test.rs
UTF-8
3,590
3.5
4
[]
no_license
pub struct RAM { pub data: Vec<u8>, } pub struct ROM { pub data: Vec<u8>, } pub struct CPU { pub acc: u8, pub x: u8, pub y: u8, /// process status register pub p: u8, } // addressing modes pub fn imp() -> OpcodeOperand { OpcodeOperand::Implied } pub fn imm(ram: &RAM, val: u8) -> Opcode...
true
4733146c701d592f59891c18abbd5c8ed48416fb
Rust
wangmarkqi/remote_shell
/src/common/order.rs
UTF-8
1,563
2.515625
3
[]
no_license
use serde::{Deserialize, Serialize}; use super::utils::*; use super::cmd::Cmd; use udp_hole_punching as hole; use std::net::SocketAddr; #[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)] pub struct Order { pub input: String, pub cmd: String, pub args: Vec<String>, pub data: Vec<u8>, } impl...
true
ff96605a75aef9df9822292dbcd9ed32d4e21d78
Rust
rainbowbismuth/hamt-rs
/tests/properties.rs
UTF-8
2,015
2.5625
3
[ "MIT", "Apache-2.0" ]
permissive
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern crate quickc...
true
28d3e6859b3dd75da53b18c3982f0d03e78d83fd
Rust
bevyengine/bevy
/crates/bevy_scene/src/dynamic_scene.rs
UTF-8
11,412
2.765625
3
[ "Apache-2.0", "MIT", "Zlib", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-other-permissive" ]
permissive
use std::any::TypeId; use crate::{DynamicSceneBuilder, Scene, SceneSpawnError}; use anyhow::Result; use bevy_ecs::{ entity::Entity, reflect::{AppTypeRegistry, ReflectComponent, ReflectMapEntities}, world::World, }; use bevy_reflect::{Reflect, TypePath, TypeRegistryArc, TypeUuid}; use bevy_utils::HashMap; ...
true
85c38a3ec97501cf0460e6baea79c483eed339b1
Rust
Enet4/propan
/src/game/wall.rs
UTF-8
2,784
2.796875
3
[ "MIT", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use graphics::{Context, DrawState, Graphics, Image, Transformed, ImageSize}; use physics::{AnimatedObject, Collidable, CollisionInfo, Positioned}; use na::{norm_squared, Vector2}; use resource::{GameTexture, ResourceManage, Result}; use resource::sprite::{AssetId, SpriteManage}; use level::info::WallInfo; pub struct W...
true
43d51f08de87a74950ab7e6048c9d87f9ae6f45a
Rust
shopglobal/xmr
/primitives/src/h256.rs
UTF-8
5,869
3.03125
3
[ "MIT", "Apache-2.0" ]
permissive
use std::fmt::{self, Debug, Formatter}; use bytes::{Buf, IntoBuf, LittleEndian}; use serde; use crypto::{fast_hash, slow_hash}; use format::{Deserialize, DeserializerStream, Error, Serialize, SerializerStream}; /// H256 length in bytes. pub const H256_LENGTH: usize = 32; /// A 256-bit hash. #[derive(Default, Clone,...
true
19593da1f40cc0ed99c71b1b228d829aec6f1b92
Rust
steven-joruk/advent-of-code
/aoc19/src/day8.rs
UTF-8
1,459
3.140625
3
[]
no_license
static INPUT: &str = include_str!("../res/8"); static WIDTH: usize = 25; static HEIGHT: usize = 6; static AREA: usize = WIDTH * HEIGHT; pub fn solve() { let layers = INPUT.as_bytes().chunks(AREA); // Doing it this way was just for fun, it's not particularly nice. // Convert each layer in to a tuple of (0_...
true
0bf707699de45589eb9c3abe31612f13ecedb2ae
Rust
michael-82/ssh-permit-a38
/src/subcommand_group.rs
UTF-8
5,918
2.953125
3
[ "MIT" ]
permissive
use cli_flow; use database::{Database, UserGroup}; pub fn add(db: &mut Database, group_id: &str) { // check group is not present if db.group_get(group_id).is_some() { cli_flow::errorln(&format!("Group {} already exists", group_id)); } // add new group let mut group_new = vec![UserGroup { ...
true
d306ed15e2f83161fae9661037358d9bb1e02f22
Rust
local-minimum/advent-of-code-2020
/day05/src/main.rs
UTF-8
2,620
3.59375
4
[]
no_license
use std::fs; // 1023 is highest possible value by BBBBBBBRRR const MAX_ID: usize = 1024; #[derive(Debug)] struct Seat { row: usize, col: usize, } impl Seat { fn id(&self) -> usize { self.row * 8 + self.col } fn from_string(data: &str) -> Option<Self> { let mut row: usize = 0;...
true