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
e8260a557832be673fa27bbf314d5ab87259bf64
Rust
iamminji/TIL
/rust/tutorial/chapter05/src/main.rs
UTF-8
2,448
3.90625
4
[]
no_license
fn main() { _ex5() } fn _ex1() { let mut user1 = User { email: String::from("sample@example.com"), username: String::from("anonymous"), active: true, sign_in_count: 1, }; user1.username = String::from("unknown"); let user2 = _build_user( String::from("hellow...
true
dd3147c067aedff7ccee01d83c7133c701ae36cb
Rust
hasanpasha/anterofit
/src/net/method.rs
UTF-8
2,812
3.421875
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Strongly typed HTTP methods and their traits macro_rules! method ( ($(#[$meta:meta])* pub struct $method:ident) => ( $(#[$meta])* #[derive(Debug)] pub struct $method; impl Method for $method { fn to_hyper(&self) -> ::hyper::method::Method { ::hyper::...
true
5854f2e073b11bcfee8632f2403f6192cef4bf34
Rust
kragil/bevy_pixel_camera
/src/pixel_camera.rs
UTF-8
6,767
2.921875
3
[ "Apache-2.0", "MIT" ]
permissive
use bevy::prelude::{Bundle, GlobalTransform, Mat4, Reflect, ReflectComponent, Transform}; use bevy::render::camera::{Camera, CameraProjection, DepthCalculation, VisibleEntities}; /// Provides the components for the camera entity. /// /// When using this camera, world coordinates are expressed using virtual /// pixels,...
true
459cb37aa49b7af102242a7131b2ebb88135bfab
Rust
rust-bitcoin-tools/bitcoinrpc_rust_client
/src/types/block.rs
UTF-8
3,338
2.84375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use types::*; #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct BlockHeight(u32); impl BlockHeight { pub fn new(h: u32) -> BlockHeight { BlockHeight(h) } pub fn as_i64(&self) -> i64 { i64::from(self.0) } } impl From<BlockHeight> for u32 { fn from(block_height:...
true
748e4f8bb8dae9a98f61e29e6d9da36ec4134fc5
Rust
nickgerace/nushell
/crates/nu-parser/src/parse/token_tree.rs
UTF-8
15,828
2.578125
3
[ "MIT" ]
permissive
#![allow(clippy::type_complexity)] use crate::parse::{call_node::*, comment::*, flag::*, number::*, operator::*, pipeline::*}; use derive_new::new; use getset::Getters; use nu_errors::{ParseError, ShellError}; use nu_protocol::{ShellTypeName, SpannedTypeName}; use nu_source::{ b, DebugDocBuilder, HasSpan, PrettyDeb...
true
73e81d893ee4ab0cb91504e229fdc4167bd97fe4
Rust
FauxFaux/septid
/src/proto/kex.rs
UTF-8
4,734
2.859375
3
[ "MIT", "Apache-2.0" ]
permissive
use anyhow::Result; use super::crypto::BothNonces; use super::crypto::MacKey; use super::crypto::MasterKey; use super::crypto::Nonce; use super::crypto::XParam; use super::crypto::Y_H_LEN; use super::SessionCrypto; pub struct Kex { key: MasterKey, decrypt: bool, our_x: XParam, our_nonce: Nonce, ...
true
3ad085e392c77a2352911ed899cc0cb98f2a5211
Rust
oherrala/nimikirsu
/lib/parser/ip_common.rs
UTF-8
572
2.578125
3
[]
no_license
use untrusted::Input; use untrustended::Error; use parser::UdpPacket; #[derive(Debug)] pub enum IPPayload<'a> { UDP(UdpPacket<'a>), Unknown(u8, Input<'a>), } impl<'a> IPPayload<'a> { pub fn from_input(protocol: u8, input: Input<'a>) -> Result<Self, Error> { // https://www.iana.org/assignments/pro...
true
6cd936aaa1b6231e8832ae63e7869ab1692ec922
Rust
matsune/fenek
/compiler/lex/src/lexer.rs
UTF-8
16,536
2.90625
3
[]
no_license
use super::scanner::*; use super::token::*; use error::{CompileError, LexerError, LitError, Result}; use pos::Pos; use std::convert::TryInto; use std::str::Chars; #[inline] fn is_newline(c: char) -> bool { c == '\n' || c == '\r' } #[inline] fn is_not_newline(c: char) -> bool { !is_newline(c) } #[inline] fn is_...
true
94ccec8ca93146233dcfb9e6173f71d0edcf7ce0
Rust
bwestlin/advent-of-code-2018-rs
/src/lib.rs
UTF-8
317
2.5625
3
[ "MIT" ]
permissive
extern crate time; use std::error::Error; use time::*; pub fn measure_exec<F>(f: F) -> Result<(), Box<Error>> where F: FnOnce() -> Result<(), Box<Error>> { let start = precise_time_ns(); f()?; let dur_ns = precise_time_ns() - start; println!("Exec time: {}ms", dur_ns / 1_000_000); Ok(()) }
true
f828380732f40d114894effb72f7338eefb14cd9
Rust
jtr109/leetcode-in-rust
/intersection_of_two_arrays/src/lib.rs
UTF-8
1,850
3.796875
4
[ "MIT" ]
permissive
/*! * # 349. Intersection of Two Arrays * * * [Problem link](https://leetcode.com/problems/intersection-of-two-arrays/) */ #![allow(dead_code)] struct Solution {} // ---------------------------------------------------------------------------- impl Solution { pub fn intersection(nums1: Vec<i32>, nums2: Vec<i...
true
6bc86e5fd85aeb89e0a4db8456180771f3952050
Rust
ElliottLester/euler
/src/q2.rs
UTF-8
308
2.53125
3
[]
no_license
pub fn soln() -> usize { let mut i = 0; let mut j = 2; let mut v = vec![1,2]; while i < 4000000 { i = v[0] + v[1]; v.push(i); if i % 2 == 0 { j+=i; } v.remove(0); } j } #[cfg(test)] #[test] pub fn q2() {assert!(soln() == 4613732)}
true
003d88e7882eee2aac735283e61dd58403b69c61
Rust
pvmsikrsna/dyon
/src/lifetime/node.rs
UTF-8
19,417
2.84375
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::sync::Arc; use range::Range; use super::piston_meta::MetaData; use super::piston_meta::bootstrap::Convert; use super::lt::{arg_lifetime, Lifetime}; use super::kind::Kind; use super::ArgNames; use ast::{AssignOp, BinOp}; use Lt; use Type; #[derive(Debug)] pub struct Node { /// The kind of node. pub kin...
true
1ac05cea85b54ddbfc4ecb00da458bc2e9343625
Rust
MMKubicki/Advent-of-Code-2020
/day02/src/main.rs
UTF-8
1,686
3.25
3
[ "Apache-2.0", "MIT" ]
permissive
mod password; use password::{Password, Requirement, RequirementAndPassword}; use std::convert::TryFrom; use std::fs; fn main() -> anyhow::Result<()> { let options = common::simple_cli::Opts::get(); let input = fs::read_to_string(options.input)?; let content = parse(&input); println!("Part 1 rules:"...
true
0d9e07d2d06f3b0c8ed54b3448c3d6bc578598da
Rust
melkibalbino/rust-conc-e-perf-seguro
/05-Vetores-strings-e-tipos-genericos/string-05-truncate-clear/src/main.rs
UTF-8
597
3.265625
3
[]
no_license
fn main() { let mut a = String::from("Rust"); a.reserve(50); a.push_str(" rules"); println!("a: {} -> {}", a.capacity(), a); a.shrink_to_fit(); println!("a: {} -> {}", a.capacity(), a); a.truncate(4); println!("a: {} -> {}", a.capacity(), a); a.shrink_to_fit(); println!("a: ...
true
6ab0806c25af00abcd9a84af7c9160427575e6d6
Rust
Sheyne/pinochle
/lib/src/game/core.rs
UTF-8
5,837
3.1875
3
[ "MIT" ]
permissive
use itertools::{chain, iproduct}; use rand::seq::SliceRandom; use rand::thread_rng; use serde::{Deserialize, Serialize}; use strum::IntoEnumIterator; use strum_macros::{Display, EnumIter, EnumString}; pub const NUMBER_OF_TEAMS: usize = 2; pub const PLAYERS_PER_TEAM: usize = 2; pub const NUMBER_OF_PLAYERS: usize = NUMB...
true
df45b55b55ee8660595765d5e727c32edff63779
Rust
trankev/ai-algos-rs
/src/interface/rulesets/ruleset.rs
UTF-8
1,479
3.015625
3
[]
no_license
use super::ply; use super::ply_iterator; use super::state; use super::status; use super::symmetry_iterator; use super::PlayError; use super::Player; pub trait RuleSetTrait: Clone + Send + Sized { type State: state::StateTrait; type Ply: ply::PlyTrait; type PlyIterator: ply_iterator::PlyIteratorTrait<Self>;...
true
4acb34704fd95da099762bd3dc6ee0673b859d22
Rust
Pctg-x8/shading_descriptor
/src/tokparse.rs
UTF-8
47,083
3.140625
3
[]
no_license
//! Tokenizer use std::ops::{Add, AddAssign}; use std::io::prelude::*; use std::io::stderr; use std::fmt::{Display, Formatter, Result as FmtResult}; use std::cell::RefCell; use std; use std::mem::discriminant; use std::cmp::min; use {Position, EqNoloc}; use regex::Regex; /// 2なら1, 4なら2, 8なら3... static...
true
daa62fa9eb6618615d05f58c6dce5e8519f323fd
Rust
feldim2425/AdventOfCode19
/day_06/main.rs
UTF-8
3,886
2.9375
3
[]
no_license
#[path = "../common/title.rs"] mod title; use std::fs::File; use std::io::BufReader; use std::io::prelude::*; use std::collections::HashMap; #[derive(Clone, Debug)] struct OrbitMap { full_map: HashMap<String, Body>, roots: Vec<String> } #[derive(Clone, Debug)] struct Body { sub: Vec<String>, parent:...
true
899fde9d995c62317c3bf25b26d0b20ad1e78a3f
Rust
spacemeshos/tytle
/tytle_core/src/ast/semantic/symbol_table.rs
UTF-8
8,017
3
3
[ "Apache-2.0" ]
permissive
use crate::ast::semantic::*; use std::collections::HashMap; #[derive(Debug, Clone)] pub struct SymbolTable { symbols: HashMap<SymbolId, Symbol>, scopes: HashMap<ScopeId, Scope>, depth_scopes_stack: HashMap<usize, Vec<ScopeId>>, next_scope_id: ScopeId, next_scope_depth: usize, } impl SymbolTable { ...
true
c95afb0017f584a5cd57ceb69d2b0321405a8cd2
Rust
yalamber/channels-examples
/src/api_author/send_masked_payload.rs
UTF-8
1,681
2.828125
3
[]
no_license
#![cfg_attr(debug_assertions, allow(dead_code, unused_imports))] use iota_streams::ddml::types::Bytes; use iota_streams::app_channels::api::tangle::{Author, Address, Transport}; use anyhow::{Result, bail}; pub fn send_masked_payload<T: Transport>(author: &mut Author, channel_address: &String, keyload_message_identifi...
true
a812428a56dc43444d39ac17e17fdd2c7cd92c07
Rust
mseqs/birlscript
/src/vm/command.rs
UTF-8
6,012
2.890625
3
[ "MIT" ]
permissive
use vm; use nparser::command::Command; /// Implementação dos comandos mod cmd { use vm::signal::Signal; use eval::{self, Value}; use vm::variable::Variable; use vm::VM; use nparser::command::Command; use nparser::function::parse_function_call_params; use vm::comparision::Compar...
true
caa8c0f23b432562752ffef26d0296e813c0e2b0
Rust
japarado/appliance-catalog-api
/src/utils.rs
UTF-8
2,711
2.9375
3
[ "MIT" ]
permissive
use crate::errors::ServiceError; use crate::models::user::AuthUser; use argon2::Config; use chrono::{Duration, Local}; use jsonwebtoken::{decode, encode, Header, Validation}; use serde::{Deserialize, Serialize}; use std::convert::From; use std::env; #[derive(Debug, Serialize, Deserialize)] struct Claims { // issue...
true
cd9222b4019aa9d3adc6c59b65b600d43cb4f65d
Rust
LorenzSelv/dspa-project
/src/operators/post_trees.rs
UTF-8
12,517
2.578125
3
[]
no_license
use std::collections::HashMap; use timely::dataflow::channels::pact::Pipeline; use timely::dataflow::operators::generic::builder_rc::OperatorBuilder; use timely::dataflow::{Scope, Stream}; use colored::*; use crate::event::{Event, ID}; use crate::operators::active_posts::StatUpdate; use crate::operators::active_pos...
true
8beed8c7311081878e28c90898819a5da10f92a8
Rust
cesbo/textcode
/build/main.rs
UTF-8
1,325
2.828125
3
[]
no_license
//! Encoding/Decoding map generator //! Build: rustc -o build main.rs //! Launch: ./build >../src/data.rs mod iso6937; mod iso8859; mod gb2312; pub fn push_unicode_check(dst: &Vec<(u16, u16)>, unicode: u16) -> bool { for pair in dst.iter() { if pair.0 == unicode { return true; } }...
true
c7e3f5b41bc55fa63ec3b6d3f30e23abf3f265f9
Rust
sisshiki1969/shiika
/tests/definition_parser_test.rs
UTF-8
3,214
2.96875
3
[ "MIT" ]
permissive
use shiika::ast; use shiika::parser::Parser; use shiika::names::*; fn parse_definitions(src: &str) -> Result<Vec<ast::Definition>, shiika::error::Error> { let mut parser = Parser::new(src); parser.parse_definitions() } #[test] fn test_emtpy_class() { let result = parse_definitions("class A; end"); ass...
true
32c6659bd836ef0531f7bfb6432bfddada9ff5d2
Rust
auno/adventofcode-2020
/10a/src/main.rs
UTF-8
567
2.75
3
[]
no_license
use std::io::{self, BufRead}; fn main() { let mut adapters: Vec<i32> = io::stdin().lock().lines() .map(|line| line.unwrap()) .map(|line| line.parse().unwrap()) .collect(); adapters.push(0); let device = adapters.iter().max().unwrap() + 3; adapters.push(device); adapters.sor...
true
15790b0367c7b6255c992d9cec657be2da2db149
Rust
tailcalled/RustGame
/src/connection.rs
UTF-8
1,531
2.765625
3
[ "MIT" ]
permissive
use tokio::net::TcpStream; use tokio::io::{self, BufReader, AsyncReadExt, AsyncWriteExt}; use serde::{Serialize, Deserialize}; pub fn split_stream(stream: TcpStream) -> (ConnectionIn, ConnectionOut) { let (a, b) = tokio::io::split(stream); ( ConnectionIn { stream: BufReader::new(a), ...
true
d525b3d5682fcaffb47b1d4aac07a643886d3b65
Rust
k0pernicus/github-api-rs
/src/user.rs
UTF-8
7,383
3.4375
3
[]
no_license
/// /// Module to compose with `users`. /// Github documentation available at https://developer.github.com/v3/users/. /// use client::GithubClient; use GetterAPI; use hyper::method::Method; use serde_json; use UpdaterAPI; /// URL to access the Github API for myself const USER_API_URL: &'static str = "user"; /// URL to...
true
1f3f703994339e6a3490a0ce92ab11c3d4d9d286
Rust
Ahmad-Bamba/Trace
/robot/src/main.rs
UTF-8
3,784
2.578125
3
[ "MIT" ]
permissive
extern crate wiringpi; use wiringpi::*; extern crate joy; extern crate ctrlc; #[macro_use] extern crate lazy_static; mod tracelib; use tracelib::*; use std::thread; use std::time::Duration; use std::process; fn pass() { thread::sleep(Duration::from_millis(0)); } fn scale_deadband(x: f32) -> f32 { if x.abs()...
true
fdafb64f861f2e7720b124e61895a4b33c9e54e9
Rust
Jasperav/cdrs-tokio
/src/cluster/keyspace_holder.rs
UTF-8
528
2.953125
3
[ "MIT", "Apache-2.0" ]
permissive
use tokio::sync::Mutex; /// Cassandra tracks current keyspace per connection, so we need to remember it across all /// connections in the pool. #[derive(Default, Debug)] pub struct KeyspaceHolder { current_keyspace: Mutex<Option<String>>, } impl KeyspaceHolder { pub async fn current_keyspace(&self) -> Option<...
true
fe059e961a7faf0ea401e7621f69dcd243d6e26c
Rust
N5FPP/stm32f7xx
/stm32f7x7/src/dsi/dsi_fir1/mod.rs
UTF-8
10,424
2.6875
3
[]
no_license
#[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::DSI_FIR1 { #[doc = r" Writes to the register"] #[inline] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { let mut w = W::reset_value(); f(&mut w); self.register.se...
true
51eec97c2d2c5e5a0c5981572c916cb8f1280ed1
Rust
kchmck/p25.rs
/src/data/coder.rs
UTF-8
4,055
3.484375
3
[ "MIT" ]
permissive
//! Provides a convenience interface for coding symbols into a buffer. use bits; use coding::trellis; use consts; /// Half-rate (dibit) convolutional coder. pub type DibitCoder = DataCoder<trellis::DibitStates>; /// 3/4-rate (tribit) convolutional coder. pub type TribitCoder = DataCoder<trellis::TribitStates>; pub ...
true
87bb11d8d32f5991dd883e15724aa746d785a380
Rust
10allday-kai/api-daemon
/codegen/src/config.rs
UTF-8
286
2.6875
3
[ "Apache-2.0" ]
permissive
/// Configuration structure for codegen. pub struct Config { pub js_common_path: String, // The path that leads to the "common" crate. } impl Default for Config { fn default() -> Self { Self { js_common_path: "../../../../common".into(), } } }
true
4a2dfb0d5d60251c0522899a4466dc590b4e7878
Rust
fbxie/rust_wasm_graphics_lib
/src/drawing/line_utils.rs
UTF-8
1,342
2.796875
3
[ "MIT" ]
permissive
use crate::canvas::Canvas; pub fn plot_line_low(c: &mut Canvas, col: u32, x1: usize, y1: usize, x2: usize, y2: usize) { let dx: isize = (x2 - x1) as isize; let mut dy: isize = (y2 - y1) as isize; let mut yi: isize = 1isize; if dy < 0 { yi = -1isize; dy = -dy; } let mut d: isize ...
true
f64d9ab5dd17cf82176f13f86e575348d2543125
Rust
SteVwonder/advent_of_code
/2019/day01/src/main.rs
UTF-8
1,369
3.234375
3
[ "MIT" ]
permissive
use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; fn fuel_calc_v2(score: i32) -> i32 { let fuel_req = fuel_calc_v1(score); if fuel_req < 0 { return 0; } fuel_req + fuel_calc_v2(fuel_req) } fn fuel_calc_v1(score: i32) -> i32 { (score as f32 / 3.0).floor() as i32 - 2...
true
c418572a8c241750c8f25a56a44a2dc31a7541fa
Rust
TheWaWaR/learning-rust
/book/Chapter3/Chapter3_Learn-Rust/patterns.rs
UTF-8
475
4.125
4
[]
no_license
fn main() { // Patterns let x = 1; match x { 1 | 2 => println!("one or two"), 3 => println!("three"), _ => println!("anything"), } // Bindings #[derive(Debug)] struct Person { name: Option<String>, } let name = "Steve".to_string(); let x: Option...
true
dbf33b29044d5618fe623e23bbef2660859474ff
Rust
MacleanS/wonder
/src/player.rs
UTF-8
13,242
3.046875
3
[]
no_license
use std::collections::HashMap; use crate::card::{Card, Colour}; use crate::game::{Action, VisibleGame}; use crate::power::Power; use crate::power::ScienceItem; use crate::resources::{ProducedResources, Resources}; use crate::wonder::{WonderBoard, WonderSide, WonderType}; use std::fmt::Debug; use crate::algorithms::Pla...
true
28a16d6f4648a666b643ca9942bb8c7d89fbba20
Rust
anykao/rust-playground
/oauth2/oauth2-rocket/src/lib.rs
UTF-8
3,339
2.765625
3
[]
no_license
#![feature(plugin, custom_derive)] #![plugin(rocket_codegen)] #[macro_use] extern crate lazy_static; extern crate rocket; use std::env; use std::sync::Mutex; use std::collections::HashMap; use rocket::request::{self, Request, FromRequest}; use rocket::outcome::Outcome::*; lazy_static! { pub static ref PRO: Mute...
true
00bcb0356c19b50f657ac3704089f438e819d0fa
Rust
marco-c/gecko-dev-wordified
/third_party/rust/libc/src/fixed_width_ints.rs
UTF-8
4,531
2.609375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
permissive
/ / ! This module contains type aliases for C ' s fixed - width integer types . / / ! / / ! These aliases are deprecated : use the Rust types instead . # [ deprecated ( since = " 0 . 2 . 55 " note = " Use i8 instead . " ) ] pub type int8_t = i8 ; # [ deprecated ( since = " 0 . 2 . 55 " note = " Use i16 instead . " ) ] ...
true
34f817b2406bbd2c4d7daaca64dba2c6af5ffdc6
Rust
Pmyl/twitch-commands
/src/system_input/enigo/enigo_system_input.rs
UTF-8
847
2.6875
3
[]
no_license
use enigo::{Enigo, MouseControllable, KeyboardControllable, Key}; use crate::system_input::system_input::SystemInput; use tokio::time::{Duration, sleep, Sleep}; pub struct EnigoSystemInput { enigo: Enigo, } impl EnigoSystemInput { #[allow(dead_code)] pub fn new() -> EnigoSystemInput { EnigoSystemI...
true
450beb6709c2ec74c0fa21846eae2c192a4b3f3d
Rust
bitzl/iiif-forager
/src/iiif/metadata.rs
UTF-8
1,330
3.328125
3
[ "Apache-2.0" ]
permissive
use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, PartialEq, Serialize)] #[serde(untagged)] pub enum Value { Single(String), Many(Vec<String>), Multilang(Vec<LocalizedValue>), } #[derive(Debug, Deserialize, PartialEq, Serialize)] pub struct LocalizedValue { #[serde(rename = "@value")] ...
true
5aad5f104c5cc21479089c4e000a694fb9edaf21
Rust
FuturePresentLabs/finql
/finql-sqlite/src/asset_handler.rs
UTF-8
5,699
2.8125
3
[ "MIT", "Apache-2.0" ]
permissive
///! Implementation of sqlite3 data handler use std::str::FromStr; use rusqlite::{params, Row, NO_PARAMS}; use super::SqliteDB; use finql_data::asset::Asset; use finql_data::{AssetHandler, DataError}; use finql_data::currency::Currency; impl AssetHandler for SqliteDB<'_> { fn insert_asset(&mut self, asset: &Asse...
true
aa42b26174bbde81d786fef95c1a25591475cd69
Rust
GarrettSocling/rdedup
/lib/src/sg_tests.rs
UTF-8
3,059
3.25
3
[]
no_license
#[test] fn test_readerveciter() { let input = vec![0, 1, 2, 3, 4]; let r2vi = ReaderVecIter::new(input.as_slice(), 2); let mut while_ok = WhileOk::new(r2vi); let v: Vec<Vec<_>> = (&mut while_ok).collect(); assert_eq!(v, [vec![0, 1], vec![2, 3], vec![4]]); assert!(while_ok.e.is_none()); l...
true
d4be382edc724cc91a4181d82240f447799a0a2a
Rust
granitrocky/rust_olc_pge
/src/gltf_ext.rs
UTF-8
8,985
2.5625
3
[]
no_license
use super::{game_object::GameObject, geometry::*, math_3d::*, transform::*}; pub fn get_game_objects(data: &[u8]) -> Vec<GameObject> { let (document, buffers, images) = gltf::import_slice(data).unwrap(); let mut skip_nodes: Vec<usize> = document.nodes().map(get_children_id).flatten().collect(); document ...
true
e778a3055b8aed062f0316055a67e78aae971ed5
Rust
RalfJung/rhusics
/rhusics-ecs/src/physics/systems/current_frame.rs
UTF-8
2,086
2.984375
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::fmt::Debug; use std::marker; use cgmath::{BaseFloat, EuclideanSpace, InnerSpace, Rotation, VectorSpace, Zero}; use core::{BodyPose, NextFrame, Velocity}; use specs::{Join, ReadStorage, System, WriteStorage}; /// Current frame update system. /// /// Will update positions and velocities for the current frame, ...
true
1d3ed567c056e1341203930c993e43c5a1f2a891
Rust
NelsonKommander/Grupo-I
/fichas_de_estudo/rust/simpson_simples/simpson.rs
UTF-8
714
3.46875
3
[]
no_license
fn f(x: f32) -> f32{ let aux = 1.0 - (x*x); return aux.sqrt(); } fn simps(a: f32, b: f32, n: i32) -> f32{ let h; let y0; let yn; let sum; let mut sum1 = 0.0; let mut sum2 = 0.0; h = (b-a)/(n as f32); y0 = f(a+(0.0*h)); yn = f(a+((n as f32)*h)); for i in 1..n { ...
true
80e476d31e2de183b613c789ad2c2275547d07ef
Rust
c0sx/rpn-calculator
/src/translator/token.rs
UTF-8
1,287
3.390625
3
[]
no_license
pub fn get_numeric_tokens() -> Vec<char> { vec!['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.'] } pub fn get_not_numeric_tokens() -> Vec<char> { vec!['+', '-', '*', '/', '(', ')'] } pub fn get_unary_minus() -> String { String::from("~") } pub fn get_minus() -> String { String::from("-") } pub...
true
e606077ce16f513a0aa61a2669704b1769ff61e7
Rust
ddowl/advent-of-code
/2021/aoc04/src/main.rs
UTF-8
5,495
3.3125
3
[]
no_license
use std::collections::HashMap; use std::fs::File; use std::io::{BufRead, BufReader}; type BingoIndex = HashMap<usize, (usize, usize)>; type BingoBoard = [[(usize, bool); 5]; 5]; fn main() { let filename = "input/input.txt"; let (drawn_numbers, boards) = parse_input_file(filename); println!("drawn_numbers...
true
6fa1cac64fff509889315119cd1ae95f74758447
Rust
gambl0rdan/bondpricer
/src/bonds/mod.rs
UTF-8
3,908
2.875
3
[]
no_license
extern crate chrono; use chrono::{Utc, TimeZone}; use crate::equations::{df}; use crate::dates::{calc_payment_dates, days_accrued, year_fract_to_date}; use crate::rates::{YieldCurve, YieldCurveFactory, HasQueryRate}; pub mod analytics; trait HasPrice { fn price(&self) -> f64; } trait HasYld { fn yld(&self) -...
true
0bd3ba816818cd4aa47a740e1d2f46d41723ba94
Rust
alekratz/interkern
/src/memory/paging/entry.rs
UTF-8
2,651
3.140625
3
[]
no_license
use multiboot2::ElfSectionFlags; use memory::Frame; /// An entry in a page table. /// /// Page table entries for x86_64 are 64 bits wide. /// /// TODO(arch) this is x86_64 specific pub struct Entry(u64); impl Entry { pub fn is_used(&self) -> bool { self.0 != 0 } pub fn set_unused(&mut self) { ...
true
110c21d85be216a0538f420220dfa70e1e33f21e
Rust
wangchao0502/rust-leetcode
/src/p1024_video_stitching.rs
UTF-8
1,147
3
3
[]
no_license
#![allow(dead_code)] // use mods pub struct Solution {} // add structs // answers impl Solution { pub fn p1024_video_stitching(mut clips: Vec<Vec<i32>>, t: i32) -> i32 { // codes clips.sort(); let mut count = 0; let mut nxt = 0; let mut cur = 0; // println!("{:?}"...
true
8f88367d297c6a9ba8e49312cbc7edd064bbac4a
Rust
bananu7/minicraft-rs
/src/world/raycast.rs
UTF-8
2,539
3.234375
3
[]
no_license
use glm::*; use crate::world::{WorldCoord}; /* This is the raycasting algorithm. It works by finding the exit point from the current voxel, storing the voxel it enters, and repeating. The 't' name used throughout means "time" or "distance" spent during the casting, and is limited by the 'len' param. It ret...
true
4a0f5836790947ae4532a8bc7b50a52e1b64097e
Rust
chanakaudaya/rust-learning-examples
/ownership/src/main.rs
UTF-8
2,449
4.125
4
[ "Apache-2.0" ]
permissive
fn main() { println!("Hello, ownership!"); let mut s = String::from("hello"); s.push_str(", world!"); println!("{}", s); let s1 = String::from("Chanaka"); // Cloning the data here because RUST does not allow accessing s1 after moving the ownership to s2 let s2 = s1.clone(); println!(...
true
011f1b855bd8d80934d8c35a83971b85f63bf33f
Rust
Kollode/RustByExample
/1.2.2.1-test-case-list/src/main.rs
UTF-8
1,137
3.640625
4
[]
no_license
use std::fmt; struct List(Vec<i32>); impl fmt::Display for List { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let vec = &self.0; write!(f, "[")?; for (count, v) in vec.iter().enumerate() { if count != 0 { // ? will return the value or if it was an er...
true
4729a05b6e18d735fbdf04aeb06f15ecc51ff162
Rust
iolsen/sfb
/src/ship_spec.rs
UTF-8
1,327
2.8125
3
[]
no_license
use serde::Deserialize; use std::fs::File; use std::io::Read; use std::path; const SPECS_PATH: &str = "./resources/ship_specs"; #[derive(Deserialize)] pub struct ShipSpec { pub fx: Fx, pub defenses: Defenses, pub power: Power, pub ship: Ship, } #[derive(Deserialize)] pub struct Fx { pub image: St...
true
5ad18d53874dc7621f0f0d6f31e9a7d5dd9690b1
Rust
shadydealer/Rust
/points_and_vectors/src/lib.rs
UTF-8
4,572
3.4375
3
[]
no_license
use std::ops::{Add, Sub}; use std::f64::EPSILON as F_EPSILON; // Clone is so we have the clone() method available for out struct // Copy is so everytime we attempt to give away ownership we clone() instead #[derive(Debug, Clone, Copy)] pub struct Point{ pub x: f64, pub y: f64, pub z: f64 } impl Point { pub fn ne...
true
737c5e6f75f50381d985a3145c2fc828a1c60436
Rust
zaeleus/noodles
/noodles-bgzf/src/async/writer/deflate.rs
UTF-8
959
2.578125
3
[ "MIT" ]
permissive
use std::{ future::Future, io, pin::Pin, task::{Context, Poll}, }; use bytes::BytesMut; use pin_project_lite::pin_project; use tokio::task::JoinHandle; use super::CompressionLevel; // (CDATA, CRC32, ISIZE) pub type GzData = (Vec<u8>, u32, u32); pin_project! { pub struct Deflate { #[pin] ...
true
9514813bddc96b6ec32a3120c475836085ebebd1
Rust
rust-lang/rustfmt
/tests/target/trailing_commas.rs
UTF-8
844
2.6875
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// rustfmt-match_block_trailing_comma: true // rustfmt-trailing_comma: Always fn main() { match foo { x => {}, y => { foo(); }, _ => x, } } fn f<S, T,>(x: T, y: S,) -> T where T: P, S: Q, { x } impl Trait for T where T: P, { fn f(x: T,) -> T ...
true
aa2bf65dcca2784591d11c6516cd2bb62f3ffd31
Rust
langestefan/atsamd
/pac/atsamd51j19a/src/cmcc/maint1.rs
UTF-8
3,037
2.640625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::MAINT1 { #[doc = r" Writes to the register"] #[inline] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { let mut w = W::reset_value(); f(&mut w); self.register.set(...
true
4e57cbd02dd47b839e6b53c413ef5cabe9f5c68f
Rust
wartyz/TMatrixRust
/src/textures/terrain_texture_pack.rs
UTF-8
1,299
2.828125
3
[]
no_license
use crate::textures::terrain_texture::TerrainTexture; #[derive(Debug, Copy)] pub struct TerrainTexturePack { bacground_texture: TerrainTexture, r_texture: TerrainTexture, g_texture: TerrainTexture, b_texture: TerrainTexture, } impl Clone for TerrainTexturePack { fn clone(&self) -> Sel...
true
12c9dfa2599b6a2457f295c36bd8194e2822fbc0
Rust
richkadel/rust
/src/test/rustdoc/plain-text-summaries.rs
UTF-8
628
2.859375
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
#![crate_type = "lib"] #![crate_name = "summaries"] //! This summary has a [link] and `code`. //! //! This is the second paragraph. //! //! [link]: https://example.com // @has search-index.js 'This summary has a link and `code`.' // @!has - 'second paragraph' /// This `code` should be in backticks. /// /// This text...
true
b087561a474ac9c0929c0b8cbbd03923e417fbb6
Rust
rust-lang/futures-rs
/futures-util/src/io/read_to_end.rs
UTF-8
2,950
3.015625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use futures_core::future::Future; use futures_core::ready; use futures_core::task::{Context, Poll}; use futures_io::AsyncRead; use std::io; use std::pin::Pin; use std::vec::Vec; /// Future for the [`read_to_end`](super::AsyncReadExt::read_to_end) method. #[derive(Debug)] #[must_use = "futures do nothing unless you `.a...
true
3c671caaa6cf825280a47df369d7bf89259680e9
Rust
RyusukeMatsumoto7C9-B-2/rust-learn-projects
/ch05/src/ch05_01_box.rs
UTF-8
632
3.015625
3
[]
no_license
#[allow(dead_code)] pub fn sample(){ println!("ch05_01_box.rs"); sample_0(); } #[allow(dead_code)] fn sample_0(){ println!("ch5 sample_0"); let t1 = (3, "birds".to_string()); // (i32, String)型のタプル,スタックに置かれる let mut b1 = Box::new(t1); // Boxポインタを作る,タプルがヒープに移動する (*b1).0 += 1; ...
true
eb39e55f5176c2e7fb0a59f2c560aa29b31eca6d
Rust
poetry-book/poetry-book-cli
/src/input/files/preface_builder.rs
UTF-8
534
2.765625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::path::PathBuf; use crate::input::files::file_utils::FileUtils; use poetry_book::Preface; pub struct PrefaceBuilder { file_path: PathBuf, } impl PrefaceBuilder { pub fn new(file_path: PathBuf) -> PrefaceBuilder { PrefaceBuilder { file_path } } pub fn build(&self) -> Preface { ...
true
6593cc48232aa2a0fd1073e45261d1439bb9b945
Rust
dcchut/dcc-lsystem
/dcc-lsystem/src/turtle.rs
UTF-8
21,584
3.546875
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
//! Contains a collection of turtles which can be used to interpret the state of an LSystem //! as a rendering. use std::collections::HashMap; use rand::Rng; use regex::Regex; use dcc_lsystem_derive::TurtleContainer; use lazy_static::lazy_static; use crate::renderer::TurtleRenderer; use crate::{ArenaId, LSystem, LSy...
true
0823317f101a080a842af9d015bca6bb7781ec75
Rust
danieleades/fluent-setters
/src/field/visibility.rs
UTF-8
1,884
3.078125
3
[]
no_license
use quote::ToTokens; use syn::{ token::{Crate, Pub}, Lit, Meta, MetaNameValue, VisCrate, VisPublic, }; #[derive(Debug, PartialEq)] pub struct Visibility(syn::Visibility); impl Visibility { pub fn public() -> Self { Self(syn::Visibility::Public(VisPublic { pub_token: Pub::default(), ...
true
f2bd4915d283784140cd6607d07c7b2cc1d04036
Rust
chanhsu001/faux
/tests/return_self_method.rs
UTF-8
1,644
3.34375
3
[ "MIT" ]
permissive
#![allow(clippy::redundant_clone)] #[faux::create] #[derive(Debug)] pub struct Foo { a: i32, } #[faux::methods] impl Clone for Foo { fn clone(&self) -> Self { Self { a: self.a } } } #[faux::methods] impl Foo { pub fn new(a: i32) -> Self { Foo { a } } pub fn get(&self) -> i32 ...
true
9c1195110efbb7516825c0ae47fbd1829e432f34
Rust
Wintus/programming-contest-challenge-book-2nd-in-rust
/src/triangle.rs
UTF-8
1,389
3.03125
3
[]
no_license
use {Solvable, UnsolvableError}; use itertools::{Combinations, Itertools}; struct Problem { premise: Premise } struct Premise { sides: Vec<u32> } const N_TRIANGLE_SIDES: u8 = 3; impl Solvable for Problem { type I = Premise; type O = u32; fn input(&self) -> &Premise { &self.premise } fn so...
true
fe850029497a98a44babe77e1e52e8b83a27b631
Rust
sharkAndshark/geoengine
/datatypes/src/primitives/multi_polygon.rs
UTF-8
14,348
2.65625
3
[]
no_license
use std::convert::TryFrom; use arrow::array::{ArrayBuilder, BooleanArray}; use arrow::error::ArrowError; use geo::intersects::Intersects; use serde::{Deserialize, Serialize}; use snafu::ensure; use crate::collections::VectorDataType; use crate::error::Error; use crate::primitives::{ error, BoundingBox2D, Geometry...
true
19d7f088bce69d46d98136a3de888afbc245db3a
Rust
IamfromSpace/cube
/src/g1_coord_cube.rs
UTF-8
12,426
3.125
3
[]
no_license
extern crate functional; use super::permutation_group::PermutationGroup; use super::invertable::Invertable; /* A Cube in G1 can only rotate the top and bottom side with quarter turns, * all others are 180 deg turns only. This means that the edges and corners * are always "oriented," there is no move set that can g...
true
62043b1e740a2ab2caf8266ad68b00ddf30fe9fd
Rust
Mingun/rust-oci
/src/ffi/descriptor.rs
UTF-8
5,221
2.578125
3
[]
no_license
use std::fmt; use std::marker::PhantomData; use std::mem; use std::os::raw::{c_int, c_void}; use std::ptr; use std::slice; use {Environment, DbResult}; use ffi::{check, Handle};// Основные типобезопасные примитивы use ffi::DescriptorType;// Типажи для безопасного моста к FFI use ffi::attr::AttrHolder; use ffi::nativ...
true
08b9fb072864a564b5c28eec2584bd564c2d11fe
Rust
Yang-33/learn-rust
/syntax_semantics/src/4-08.rs
UTF-8
1,710
3.953125
4
[]
no_license
// 4-8 // references and borrowing // 借用 fn mode001() { fn foo(v1: &Vec<i32>, v2: &Vec<i32>) -> i32 { let mut sum = 0; for val in v1 { sum += val; } for val in v2 { sum += val; } sum } let v1 = vec![1, 2, 4]; le...
true
ca80b3263a1cf6239f99c4b7565920d3f4360278
Rust
DelSkayn/toyjs
/crates/vm/src/realm/builtin/number.rs
UTF-8
7,131
2.59375
3
[]
no_license
use common::atom::{self, Atoms}; use crate::{ cell::CellOwner, gc::Arena, object::{ObjectFlags, ObjectKind, Property, PropertyFlags}, realm::{ExecutionContext, GcRealm}, rebind, rebind_try, GcObject, Object, Value, }; use super::new_func; fn construct<'l, 'cell>( arena: &'l mut Arena<'_, 'cel...
true
61e118ed39e322de384967280eafd44b6d344b6c
Rust
TheButlah/rust-terrain-gen
/src/terrain.rs
UTF-8
2,610
3.046875
3
[ "MIT" ]
permissive
use super::height_map::{Height, HeightMap}; type TerrainMap = ndarray::Array2<TerrainType>; #[derive(Copy, Clone)] pub enum TerrainType { Water, Grass(Height), Mountain, Snow, } impl TerrainType { pub fn to_color(&self) -> [u8; 3] { match *self { Self::Water => [0, 0, 255], ...
true
e104d09198865b1667321a2f7491092d1a46303e
Rust
twick00/rust-async-crawler
/src/main.rs
UTF-8
4,352
3.03125
3
[]
no_license
use html5ever::tokenizer::{ BufferQueue, Tag, TagKind, Token, TokenSink, TokenSinkResult, Tokenizer, TokenizerOpts, }; use std::borrow::Borrow; use url::{ParseError, Url}; use async_std::sync::Sender; use async_std::{sync, task}; use std::str::FromStr; use surf; type CrawlResult = Result<(), Box<dyn std::error::E...
true
0ed38fba37c6fb20f6aec8d01eeee2bcb26d2e04
Rust
tylerwhall/rust
/src/librustc_borrowck/diagnostics.rs
UTF-8
1,320
2.890625
3
[ "Apache-2.0", "LicenseRef-scancode-other-permissive", "MIT", "Unlicense", "BSD-3-Clause", "bzip2-1.0.6", "NCSA", "ISC", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
// Copyright 2014 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
6b9d51e893c05d36c5e7b1be2fbaa920e053e010
Rust
DoumanAsh/async-timer
/src/lib.rs
UTF-8
2,158
2.859375
3
[ "BSL-1.0" ]
permissive
//! Async timer lib //! //! ## Accuracy //! //! Regular timers that do not rely on async event loop tend to be on par with user space timers //! like in `tokio`. //! If that's not suitable for you you should enable event loop based timers which in most cases //! give you the most accurate timers possible on unix platfo...
true
ae6001a0dd20f2f9c70326f584131271e882c47c
Rust
dmvict/wTools
/rust/impl/willbe/core/entities/workspace.rs
UTF-8
2,285
2.875
3
[ "MIT" ]
permissive
/// Internal namespace. pub( crate ) mod private { use std::path::PathBuf; use toml::Value; use wtools::{ BasicError, err }; use crate::{ Package, unique_walk }; /// Workspace #[ derive( Debug, Clone ) ] pub struct Workspace { path : PathBuf, } impl TryFrom< PathBuf > for Workspace { t...
true
0e17ed7134008532710ca500637f22ecfba90c35
Rust
BerenMillidge/RustTutorials
/src/grep.rs
UTF-8
3,498
3.421875
3
[]
no_license
// our own implementation ofthe command line tool grep!!! that is really cool // apparently rust shuold be really good for these sorts of things... so that is nice! // so first thing first is to be able to accept command line arguments get that working use std::env; use std::fs; use std::io::prelude::*; use std::proce...
true
cc1ae82b3ecc7a5df6a34138835968efc7a7ab98
Rust
stevelr/mdsite
/src/github.rs
UTF-8
7,048
2.953125
3
[ "MIT", "Apache-2.0" ]
permissive
//! github client library for fetching content from Github //! use crate::{Error, Result}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::json; const GITHUB_ENDPOINT: &str = "https://api.github.com"; const GH_USER_AGENT: &str = "mdsite"; /// Response from Github list-tree #[derive(Debug, D...
true
85c6ede825e86890acc0476f39eaf0529c83a907
Rust
caiocampos/Rust-Random-Stuff
/parallel-letter-frequency.rs
UTF-8
1,125
3.140625
3
[ "MIT" ]
permissive
extern crate rayon; use rayon::prelude::*; use std::collections::HashMap; pub fn frequency(input: &[&str], worker_count: usize) -> HashMap<char, usize> { match worker_count.min(input.len()) { 1 => frequency_seq(input), n => (0..n) .into_par_iter() .map(|i| { ...
true
6c816f432b027a934ea4e55a0b27bcb70d95d2de
Rust
ROki1988/csv2json-rs
/src/main.rs
UTF-8
924
2.546875
3
[]
no_license
use core::iter::Iterator; use csv::{ReaderBuilder, StringRecord}; use std::collections::HashMap; use std::io::Write; use std::path::Path; use std::{env, io}; fn main() { let args: Vec<String> = env::args().collect(); let path = Path::new(&args[1]); let mut rdr = ReaderBuilder::new().from_path(path).unwrap(...
true
9f1007804c707796f7681e9aff318a0226a51f99
Rust
Nalleyer/naive-raytracer
/src/color.rs
UTF-8
2,386
3.453125
3
[]
no_license
use std::ops::{Add, AddAssign, Div, Mul}; pub const GAMMA: f32 = 2.2; fn gamma_encode(linear: f32) -> f32 { linear.powf(1.0 / GAMMA) } fn gamma_decode(encoded: f32) -> f32 { encoded.powf(GAMMA) } #[derive(Debug, PartialEq, Default, Clone, Copy)] pub struct Color { pub r: f32, pub g: f32, pub b: f...
true
18350fd1f5fab853737d12f978eff40bc75777a0
Rust
bonsairobo/material-converter
/src/main.rs
UTF-8
3,402
3.375
3
[]
no_license
use material_converter::{ convert_images, feeling_lucky, guess_input, make_array_material, MaterialFormat, }; use std::path::PathBuf; use structopt::StructOpt; #[derive(StructOpt, Debug)] #[structopt( name = "material-converter", about = "Tool for converting common material image formats." )] enum Opt { ...
true
b45e239170b018aae8687f8eda46d5be926ec3d3
Rust
c0ding/swift-bindgen
/swift-sys/src/metadata/kind.rs
UTF-8
5,101
3.015625
3
[ "Apache-2.0", "MIT" ]
permissive
use crate::OpaqueValue; use std::ptr; /// Kinds of Swift metadata records. Some of these are types, some aren't. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[repr(transparent)] // enum class MetadataKind : uint32_t pub struct MetadataKind(pub u32); const NON_TYPE_FLAG: u32 = 0x400; const NON_HEAP_FLAG: u32 = ...
true
a6d77d976d83c18d7766180b6567f6c2b56c588b
Rust
fdenzer/chilli
/src/config.rs
UTF-8
3,290
3.84375
4
[ "BSD-3-Clause" ]
permissive
//! This module implements configuration related stuff. use std::fmt; use std::env; use std::io::Read; use std::fs::File; use std::path::Path; use serde_json::{self, Map, Value}; /// The pencil `Config` type, We provide ways to fill it from JSON files: /// /// ```rust,no_run /// let mut app = chilli::Pencil::new("/de...
true
3b04e0bd926b7f9908fbd55261455bb0f8e1b341
Rust
burcinbozkurt/wallet-rs
/src/lib.rs
UTF-8
2,082
2.734375
3
[ "Apache-2.0" ]
permissive
use rand_core::{OsRng, RngCore}; #[macro_use] extern crate arrayref; extern crate aead; extern crate ed25519_dalek; extern crate chacha20poly1305; extern crate thiserror; pub mod contents; pub mod locked; pub mod unlocked; mod error; pub mod prelude { pub use crate::contents::{ key_pair::KeyPair, ...
true
7ce3669715d3d96d57ac4fc3864cb0734a641fb6
Rust
gaybro8777/smashgg-upcoming-tournaments
/src/main.rs
UTF-8
1,416
2.515625
3
[]
no_license
//! Scraper //! //! Library for scanning various eSports websites and databases to keep a constant //! list of tournaments. Attempts to normalize and categorize them as well. //! //! @author Ryan McGrath <ryan@rymc.io> //! @created 05/23/2017 extern crate rand; extern crate serde; extern crate chrono; extern crate dot...
true
2049813c223b0c0517cc1849502432af40f252ec
Rust
Arpanbhagat5/resto-api
/src/status.rs
UTF-8
665
2.53125
3
[ "MIT" ]
permissive
use diesel; use diesel::prelude::*; use diesel::pg::PgConnection; use super::schema::status; use super::db_calls; #[derive(Queryable, Debug)] pub struct Status { pub status_id: i32, pub description: String, } #[derive(Queryable, Insertable, Debug)] #[table_name = "status"] pub struct NewStatus { pub descripti...
true
6fb802a0cb7965420624a7272e3a30a97a618812
Rust
seanwallawalla-forks/nushell
/crates/nu-completion/src/engine.rs
UTF-8
16,119
2.921875
3
[ "MIT" ]
permissive
use nu_protocol::hir::*; use nu_source::{Span, Spanned, SpannedItem}; #[derive(Debug, Clone, Eq, PartialEq)] pub enum LocationType { Command, Flag(String), // command name Argument(Option<String>, Option<String>), // command name, argument name Variable, } pub type Completi...
true
270d5bd88640c648fbd72780dbcedf557d8044d8
Rust
gsedometov/sound-amp
/src/main.rs
UTF-8
7,456
2.53125
3
[ "MIT" ]
permissive
extern crate ringbuf; use std::sync::{mpsc, Arc, Mutex}; use std::{error, io, thread}; use std::io::Stdout; use std::sync::mpsc::{Sender}; use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; use cpal::{Device, InputCallbackInfo, OutputCallbackInfo}; use crossterm::event::{self, Event, KeyCode, KeyEvent}; use ri...
true
10c3cfb03d23b27884e46b4dba4a774d5af28d9b
Rust
teo8192/codes
/src/crypt/aes.rs
UTF-8
27,304
2.9375
3
[]
no_license
//! The Advanced Encryption Standard, according to [NIST FIPS 197](https://csrc.nist.gov/publications/detail/fips/197/final) //! //! An example usage: //! //! # use codes::crypt::{aes::{AES, AESKey}, BlockCipher, pbkdf2, Cipher, mac::HMAC}; //! # let secret_password = b"top secret lol"; //! # let salt: Vec<...
true
0b9524f711aac5f6f73688b2e4a94e9e93182ffc
Rust
ChosunOne/rust-protobuf
/protobuf-test/src/common/v2/test_fmt_json.rs
UTF-8
6,718
2.703125
3
[ "BSD-2-Clause" ]
permissive
use std::f32; use std::f64; use protobuf::Message; use protobuf_test_common::*; use super::test_fmt_json_pb::*; #[test] fn empty() { test_json_print_parse_message("{}", &TestTypes::new()); } #[test] fn test_bool() { let mut m = TestTypes::new(); m.set_bool_singular(true); test_json_print_parse_mess...
true
3ea122f9c7c696f5e29558c131e2c59d49d27306
Rust
HereshAhmadi/RustBlog1TutoialCode
/Calculator/src/Calculator.rs
UTF-8
446
3.21875
3
[]
no_license
#[allow(non_snake_case)] pub struct Calculator{} impl Calculator{ pub fn new() -> Self{ Self{ } } pub fn add(&self, one: &f32, two: &f32) -> f32{ one + two } pub fn subtract(&self, one: &f32, two: &f32) -> f32{ one - two } pub fn divide(&self, one: &f32, t...
true
8d1ca8ad3e53abd2ca9115a9399faaa32e5a527e
Rust
GSam/rust-refactor
/src/util.rs
UTF-8
2,287
2.75
3
[]
no_license
use std::collections::HashMap; use std::io::{self, Write}; use analysis::AnalysisData; // Find the id associated with the row and column given // (or a -1 wildcard is given and any with a matching name will be returned). // TODO more efficient, perhaps better indexed and given type of node as arg pub fn identif...
true
6db96bf7777d4e8c022e416cdc62822dd70f0a10
Rust
Vlad-Shcherbina/aoc2017
/src/bin/day14.rs
UTF-8
1,284
2.578125
3
[]
no_license
extern crate aoc2017; extern crate bit_vec; const INPUT: &str = "ljoxqyyw"; fn main() { let mut grid = Vec::new(); for i in 0..128 { let h = &aoc2017::knot_hash(&format!("{}-{}", INPUT, i)); grid.push(bit_vec::BitVec::from_bytes(h)); } let mut cnt = 0; for y in 0..grid.len() { ...
true
e0587fbd3fd678759ab4eb155e8b9aa6f1014168
Rust
oknozor/tp_1_modelisation_par_agent
/particules_desktop/src/main.rs
UTF-8
3,141
2.640625
3
[]
no_license
#[macro_use] extern crate lazy_static; extern crate serde; #[macro_use] extern crate serde_derive; use std::fs::File; use std::io::prelude::*; use nannou::prelude::*; use particules::sma::Sma; use particules::SMA; mod user_config; lazy_static! { pub static ref CONFIG: user_config::Config = { let mut f...
true
15ca086816e588d84ff059af612899494929ea75
Rust
divyamSoni/Rust-Lang
/5. Conditional Statements/src/main.rs
UTF-8
1,054
3.53125
4
[]
no_license
#[allow(unused_variables)] fn main() { let some_bool = true; let some_int1 = 30; let some_int2 = 50; if some_bool == true || (some_int1 > 100 && some_int2 == 200) { println!("Hit if branch") } else if some_int1 == 10 { println!("Hit else if statement"); } else { println...
true
601acba213eb31c10b8215293ed8e9e8688b7d1c
Rust
softiger/datafuse
/common/datavalues/src/data_value.rs
UTF-8
11,604
2.578125
3
[ "Apache-2.0" ]
permissive
// Copyright 2020-2021 The Datafuse Authors. // // SPDX-License-Identifier: Apache-2.0. use std::convert::TryFrom; use std::fmt; use std::sync::Arc; use anyhow::bail; use anyhow::Error; use anyhow::Result; use serde::Deserialize; use serde::Serialize; use crate::BooleanArray; use crate::DataArrayRef; use crate::Data...
true
260a9950176d38d134e9651482d397851da90580
Rust
jgarte/AdventOfCode-3
/2020/Rust/Day11/src/main.rs
UTF-8
8,754
2.71875
3
[ "MIT" ]
permissive
// MIT License // // Copyright (c) 2020 Pedro Rodrigues // // 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, mod...
true