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
6601fd7b96c506237ed9515d863f961022f44fdd
Rust
drager/httper
/src/client/payload_builder.rs
UTF-8
2,169
2.96875
3
[ "MIT", "Apache-2.0" ]
permissive
use super::{Headers, HttperClient}; use client::response_future::ResponseFuture; use failure::Error; use http; use hyper; use std::collections::HashMap; #[derive(Debug)] pub struct PayloadBuilder<'a> { pub request_builder: Result<http::request::Builder, Error>, pub client: &'a HttperClient, pub payload: Op...
true
5c760918707767b01e0f682530a97498cb26c191
Rust
MuhannadAlrusayni/savory
/core/src/lib.rs
UTF-8
4,118
3.40625
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Savory is library for building user interface. //! //! //! [![master docs](https://img.shields.io/badge/docs-master-blue.svg)](https://malrusayni.gitlab.io/savory/savory/) //! &middot; //! [![crate info](https://img.shields.io/crates/v/savory.svg)](https://crates.io/crates/savory) //! &middot; //! [![pipeline](http...
true
47fd1a3cfab924f2ee75339f25027b2b12f537fc
Rust
nettan20/rust_sexpr
/lisplike.rs
UTF-8
15,776
3.46875
3
[ "MIT" ]
permissive
extern mod std; use std::hashmap::HashMap; use std::to_str::ToStr; use std::rc::Rc; use std::io::stdio::{print, println}; use sexpr; // A very simple LISP-like language // Globally scoped, no closures /// Our value types #[deriving(Clone)] pub enum LispValue { List(~[LispValue]), Atom(~str), Str(~str), Num(f64), ...
true
1dbf241e5f5e1509a3586244a10e291393818bef
Rust
chrisliebert/quick-3d
/src/dbloader.rs
UTF-8
9,747
2.71875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// Copyright(C) 2016 Chris Liebert extern crate time; extern crate libc; #[cfg(feature = "sqlite")] extern crate rusqlite; #[cfg(feature = "sqlite")] use std::ffi::CStr; #[cfg(feature = "sqlite")] use std::io::Error; #[cfg(feature = "sqlite")] use scene::Scene; #[cfg(feature = "sqlite")]use shader::Shader; #[cfg(fea...
true
3c09bde656b1b52e28557d7b4aabc0102b923e6d
Rust
erlendr/rust_rt
/src/maths/objects/object.rs
UTF-8
184
2.65625
3
[]
no_license
use maths::vector3d::Vector3D; use maths::ray::Ray; pub trait Object { fn get_normal_at(&self, point: &Vector3D) -> Vector3D; fn find_intersection(&self, ray: &Ray) -> f64; }
true
795c98f22e9e7ac0d8db06a97677fe97c5a45f70
Rust
moonmile/rust-sample
/src/appendix/sample-a-01/src/main.rs
UTF-8
2,292
3.921875
4
[]
no_license
fn main() { // 変数のポインタを取得する let a: i32 = 10 ; let a_ptr: *const i32 = &a ; println!("a is {:?}", a ); println!("a_ptr is {:?}", a_ptr ); // 文字列のポインタを取得する let a = "rust" ; println!("a is {:?}", a ); println!("a_ptr is {:?}", a.as_ptr() ); } fn main2() { let a = Person{name: "masu...
true
7674b1eaeb005557c53968c3dd6e1a4d6037fa60
Rust
Naraenda/marchy
/src/display.rs
UTF-8
1,694
3.03125
3
[ "MIT" ]
permissive
use palette::Hsv; use palette::rgb::LinSrgb; use ultraviolet::Vec3; use std::io::Write; use crossterm::{ QueueableCommand, cursor, style::{ self, StyledContent } }; #[allow(unused_must_use)] pub fn draw_image(data: Vec<Vec3>, width: i32, stdout: &mut std::io::Stdout) -> Result<(), Box<dyn std::error::Erro...
true
280aebf28b285aa67a25a0d35966dde25bcac76a
Rust
finalitylabs/rust-fil-proofs-ffi
/src/helpers.rs
UTF-8
3,848
2.578125
3
[ "MIT", "Apache-2.0" ]
permissive
use std::collections::BTreeMap; use std::slice::from_raw_parts; use filecoin_proofs::types as api_types; use filecoin_proofs::{constants as api_constants, Commitment, PublicReplicaInfo}; use libc; use crate::error::Result; use storage_proofs::sector::SectorId; /// Produce a map from sector id to replica info by pair...
true
dd55e6bfd34a1f32cf9ab5f533ce1a9ff2989a18
Rust
krishnakumar4a4/desync-rs
/src/assembler/mod.rs
UTF-8
2,674
2.6875
3
[ "MIT" ]
permissive
use crate::io as local_io; use crate::index; use crate::seed; use crate::store; use log::{debug, info}; use std::rc::Rc; // AssemblerConfig pub struct AssemblerConfig { pub seed: Option<seed::LocalSeedFile>, pub seed_index: Option<Box<index::Index>>, pub store: Box<store::Store>, pub new_index: Box<i...
true
16a5d64d70cdc6a3e9e514ba8a2c31434d6cbdbe
Rust
nathanrossi/meta-random
/recipes-utility/rust-simple-init/files/src/lib/services/gadget.rs
UTF-8
1,959
2.765625
3
[]
no_license
use std::io; use super::super::*; use service::{Service, ServiceEvent, ServiceState}; use runtime::Runtime; use configfs::usb::Gadget; pub struct UsbGadgetService<'a> { name : String, configfn : Box<dyn Fn() -> io::Result<Option<Gadget>> + 'a>, device : Option<Gadget>, failed : bool, } impl<'a> UsbGadgetService<'...
true
4f67c52e814e0ce597ff1c2568d5b5056a2a42f0
Rust
10allday-kai/api-daemon
/third-party/lexical-core/src/float/convert.rs
UTF-8
2,985
3.578125
4
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-other-permissive" ]
permissive
//! Convert between extended-precision and native floats/integers. use crate::lib::convert::From; use crate::lib::mem; use crate::util::*; use super::float::ExtendedFloat; use super::mantissa::Mantissa; // FROM INT // Import ExtendedFloat from integer. // // This works because we call normalize before any operation,...
true
3d6ebb3990742eb2004a6395d52f429cd78ccf8d
Rust
teotwaki/xylosip
/src/parser/rfc3261/tokens.rs
UTF-8
13,598
2.796875
3
[ "MIT" ]
permissive
use crate::parser::Result; use nom::{ combinator::{ opt, recognize }, sequence::{ pair, tuple, preceded, separated_pair, terminated, }, branch::alt, multi::{ many0, many1 }, character::{ is_alphanumeric, is_hex_digit }, character::complete::{ space0, space1, }, bytes::complete::{ is...
true
a8e05aa48e098f26324f8602e4483a1e84fb052d
Rust
gostreap/project_euler
/src/problem4.rs
UTF-8
628
3.484375
3
[]
no_license
pub fn solve() { let mut max = 0; let mut product; for i in 1..1000 { for j in i..1000 { product = i * j; if max < product && is_palindrome(product) { max = product; } } } println!( "Le plus grand palindrome produit de deux ...
true
a93dc3278e4f798626a08af915c8dcdfdf33e78b
Rust
defuz/sublimate
/src/view/modal.rs
UTF-8
2,768
2.6875
3
[ "MIT", "Apache-2.0" ]
permissive
use std::cell::Cell; use ncurses::{newwin, new_panel, PANEL, del_panel, update_panels, doupdate}; use core::bindings::Key; use toolkit::*; #[derive(Debug, Clone, Copy)] pub enum ModalPosition { AboveLeft, AboveRight, UnderLeft, UnderRight, RightTop, } #[derive(Debug)] pub struct Modal<T> { ...
true
7fc90e8a732f80d76b005cc8c00e4927888772b4
Rust
sseering/AdventOfCode
/2021/aoc06/src/main.rs
UTF-8
3,181
2.890625
3
[]
no_license
#[allow(unused)] const TEST_INPUT_A: &str = "3"; #[allow(unused)] const TEST_INPUT_B: &str = "3,4,3,1,2"; #[allow(unused)] const INPUT: &str = "1,1,3,5,1,1,1,4,1,5,1,1,1,1,1,1,1,3,1,1,1,1,2,5,1,1,1,1,1,2,1,4,1,4,1,1,1,1,1,3,1,1,5,1,1,1,4,1,1,1,4,1,1,3,5,1,1,1,1,4,1,5,4,1,1,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,...
true
0456164987addad1debc63a37be1111409781068
Rust
dcuenot/kata-wallet-rust
/src/lib/domain/wallet.rs
UTF-8
2,484
3.34375
3
[]
no_license
struct Wallet { stocks: String, } #[cfg(test)] mod test { use super::*; use lib::domain::wallet::test_glue::WalletDSL; use lib::domain::money::Money; use lib::domain::currency::Currency; use regex::Regex; #[test] fn an_empty_wallet_in_euro_should_be_0_euro() { // assert_wall...
true
29fc98ddd290bb9d4224ef90df410602647c13e4
Rust
Putinspudding/grrs
/src/lib.rs
UTF-8
3,636
2.921875
3
[]
no_license
use console::{style, Color}; use itertools::Itertools; use lazy_static::lazy_static; use regex::Regex; use std::fs::File; use std::io::{BufRead, BufReader}; fn print_line(line: &str, pattern: &str) { let v = format!( "{}", line.split(pattern) .intersperse(&format!("{}", style(pattern).r...
true
b8194dc4c062956be3376036ab6351a31f92019a
Rust
the-kenny/libpaprika
/src/recipe.rs
UTF-8
2,401
2.921875
3
[]
no_license
use serde::Deserialize; use serde::Serialize; use serde_json; use std::fs::File; use std::io::Read; use std::io::Write; use std::path::Path; use super::Error; pub type Url = String; pub type Uuid = String; pub type Base64 = String; pub type Hash = String; #[derive(Debug, Serialize, Deserialize)] pub struct RecipePho...
true
962358909a24151efbc8ebcce9c57722208d0e07
Rust
Fullstop000/abstreet
/viewer/src/lib.rs
UTF-8
2,658
2.671875
3
[ "Apache-2.0" ]
permissive
use aabb_quadtree::QuadTree; use ezgui::{Color, Drawable, EventCtx, GfxCtx, Prerender, Text}; use geom::{Bounds, Circle, Distance, Polygon, Pt2D}; use std::collections::{HashMap, HashSet}; use std::fmt::Debug; use std::hash::Hash; pub trait ObjectID: Clone + Copy + Debug + Eq + Hash { // Higher shows up in the fro...
true
75a1dffefeb39b5bab027f2318ef86b77e41c02e
Rust
michaelcontento/simpleflake-rs
/src/lib.rs
UTF-8
1,071
3.265625
3
[ "MIT" ]
permissive
extern crate time; extern crate rand; static EPOCH:f64 = 946702800.0; static TIMESTAMP_SHIFT:usize = 23; static RANDOM_MAX_VALUE:u32 = 4194303; #[derive(Clone, Copy, Debug)] pub struct Id { pub timestamp: f64, pub random_bits: u32, } pub fn new() -> u64 { let now = time_as_float(time::get_time()); le...
true
01aa89ab6c6f04b26ce1ad4b5935bf2bb3b5a319
Rust
chalme/coco
/src/infrastructure/git/git_file_history.rs
UTF-8
5,758
2.546875
3
[ "MIT", "Apache-2.0" ]
permissive
// MIT License // // Copyright (c) 2020 Korny Sietsma // // 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, modif...
true
314865dcf808646e57dcf05d74911127dc7570d6
Rust
simlay/iced
/web/src/widget/image.rs
UTF-8
1,010
2.640625
3
[ "MIT" ]
permissive
use crate::{Bus, Element, Length, Widget}; use dodrio::bumpalo; pub use iced_core::Image; impl<Message> Widget<Message> for Image { fn node<'b>( &self, bump: &'b bumpalo::Bump, _bus: &Bus<Message>, ) -> dodrio::Node<'b> { use dodrio::builder::*; let src = bumpalo::for...
true
80ae05a0c4f8c962f5b25765a696443255fda26b
Rust
astral-sh/ruff
/crates/ruff/src/rules/flake8_comprehensions/rules/helpers.rs
UTF-8
807
2.578125
3
[ "BSD-3-Clause", "0BSD", "LicenseRef-scancode-free-unknown", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
permissive
use ruff_python_ast::{self as ast, Expr, Keyword}; pub(super) fn expr_name(func: &Expr) -> Option<&str> { if let Expr::Name(ast::ExprName { id, .. }) = func { Some(id) } else { None } } pub(super) fn exactly_one_argument_with_matching_function<'a>( name: &str, func: &Expr, args...
true
a866503682c74bd37f789e5b48d12e3f28522118
Rust
MattesWhite/sophia_rs
/api/src/term/simple_iri.rs
UTF-8
2,259
3.296875
3
[ "CECILL-B", "LicenseRef-scancode-cecill-b-en" ]
permissive
//! Minimal implementation of [`TTerm`](https://docs.rs/sophia_api/latest/sophia_api/term/trait.TTerm.html), //! for representing datatype IRIs of literals. use super::*; use sophia_iri::error::{InvalidIri, Result}; use sophia_iri::is_valid_suffixed_iri_ref; use std::borrow::Borrow; use std::fmt; use std::hash; /// Se...
true
514e545aa11f02c76ff92666b099f7494ee499a5
Rust
mhspradlin/lines
/src/sensors/cpu_time.rs
UTF-8
9,376
2.609375
3
[ "MIT" ]
permissive
extern crate cadence; use super::Sensor; pub type CpuTimeSensor = platform::PlatformCpuTimeSensor; impl CpuTimeSensor { pub fn new() -> CpuTimeSensor { platform::PlatformCpuTimeSensor::init() } } #[cfg(windows)] mod platform { extern crate winapi; extern crate kernel32; use super::Senso...
true
76d1a38444ad163c655c9841c314018542e2651d
Rust
elrnv/buffer
/src/value.rs
UTF-8
20,231
3.046875
3
[ "MIT", "Apache-2.0" ]
permissive
//! This module defines a mechanism for type earasure simplar to `dyn Any`. //! //! This method allows storing and referencing values coming from a `DataBuffer` in other `std` //! containers without needing a downcast. //! #![allow(dead_code)] use std::any::{Any, TypeId}; use std::fmt; use std::hash::{Hash, Hasher}; u...
true
e34337abb045a9113a2e9582e01a83f70d8e3b5d
Rust
diseraluca/uavcan
/src/rx/buildup.rs
UTF-8
6,896
2.546875
3
[]
no_license
use core::{convert::TryInto, marker::PhantomData}; use crc_any::CRCu16; use heapless::{ArrayLength, Vec}; use crate::{ session_id::{MessageSessionId, SessionId, SessionKind}, tail_byte::{PayloadKind, TailByte, TransferId}, CanFrame, }; use super::transfer::Transfer; #[derive(Debug)] pub enum Error<Frame:...
true
abf01cb3930e036d80b14e458695fe9f43ff979e
Rust
paritytech/parity-wasm
/src/elements/name_section.rs
UTF-8
10,444
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
permissive
use crate::io; use alloc::string::String; use super::{ index_map::IndexMap, Deserialize, Error, Module, Serialize, Type, VarUint32, VarUint7, }; const NAME_TYPE_MODULE: u8 = 0; const NAME_TYPE_FUNCTION: u8 = 1; const NAME_TYPE_LOCAL: u8 = 2; /// Debug name information. #[derive(Clone, Debug, PartialEq)] pub struct ...
true
b2018d6562d8aad542f67cf17654f26d9ef56959
Rust
rust-lang/rust
/library/core/src/sync/exclusive.rs
UTF-8
6,193
3.65625
4
[ "Apache-2.0", "LLVM-exception", "NCSA", "BSD-2-Clause", "LicenseRef-scancode-unicode", "MIT", "LicenseRef-scancode-other-permissive" ]
permissive
//! Defines [`Exclusive`]. use core::fmt; use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; /// `Exclusive` provides only _mutable_ access, also referred to as _exclusive_ /// access to the underlying value. It provides no _immutable_, or _shared_ /// access to the underlying value. /// /...
true
7200cb6e30df723ae7e9b671fc9bd1267bd43904
Rust
rkat0/AtCoder
/SoundHound2018_main/A.rs
UTF-8
954
3.3125
3
[]
no_license
use std::io::*; fn read<T: std::str::FromStr>() -> T { let stdin = stdin(); let mut buf = String::new(); stdin.lock().read_line(&mut buf); buf.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { read::<String>().trim().split_whitespace() .map(|w| w.parse().ok().unwrap())....
true
68479eb971216a03aabb558b9b0381adc81a22d1
Rust
anddani/advent-of-code
/trang/rust-2020/src/days/d05.rs
UTF-8
1,168
3.375
3
[]
no_license
use std::fs::File; use std::io::{BufRead,BufReader}; use itertools::izip; use std::ops::Range; pub fn run() { let file = BufReader::new(File::open("./data/input_d05.txt").unwrap()); /* seat ID = row*8 + col iter through lines, map result into a filter map The fold method takes an initial value (0 in ...
true
05687c81c6abae4aa8b4d19efe16f5d7c73eb7ef
Rust
rocket-org/state
/src/storage.rs
UTF-8
7,594
3.953125
4
[ "MIT", "Apache-2.0" ]
permissive
use std::fmt; use crate::cell::UnsafeCell; use crate::init::Init; /// A single storage location for global access to a value. /// /// A `Storage` instance can hold a single value in a global context. A /// `Storage` instance begins without a value and must be initialized via the /// [set](#method.set) method. Once a ...
true
c26fecd4cd6f40be9b58b7e6e6656fe9213c1b51
Rust
hyone/rust_by_example
/chapter12/12_7_2_associated_types.rs
UTF-8
1,223
4.28125
4
[]
no_license
struct Container(i32, i32); // A trait which checks if 2 items are stored inside of container. // Also retrieves first or last value. trait Contains { type A; type B; fn contains(&self, &Self::A, &Self::B) -> bool; fn first(&self) -> i32; fn last(&self) -> i32; } impl Contains for Container { ...
true
f59ebbac200b0826d4010533bf20de25ba6983f0
Rust
szubtsovskiy/jlrs
/jlrs/src/multitask.rs
UTF-8
28,815
2.875
3
[ "MIT" ]
permissive
//! Run Julia in a separate thread and execute tasks in parallel. //! //! While access to Julia with the C API is entirely single-threaded, it's possible to offload a //! function call to another thread by using `Base.Threads.@spawn`. The experimental async runtime //! offered by jlrs combines this feature with Rust's ...
true
26215a46f7e310d26835d49b8fa8ce296b3fd302
Rust
reillysiemens/advent-of-rust
/2016/01/src/main.rs
UTF-8
4,872
3.359375
3
[ "ISC" ]
permissive
use std::env; use std::error::Error; use std::fs::File; use std::io::prelude::*; use std::path::Path; use std::collections::HashSet; #[derive(Debug, Copy, Clone)] enum Direction { North, East, West, South, } #[derive(Debug)] enum Turn { Left(Direction), Right(Direction), } #[derive(Debug)] st...
true
32103fde5d31bb540076c20adc164820b6e19a68
Rust
dannypsnl-fork/logic-solver-rs
/src/parsing/error.rs
UTF-8
1,262
3.234375
3
[ "Apache-2.0", "MIT" ]
permissive
use std::fmt; use thiserror::Error; use crate::parsing::tokenizer::TokenKind; use super::pos::Pos; use super::tokenizer::Token; #[derive(Debug, Error)] #[error("parse error at line {}, column {}: {}", .start.line + 1, .start.column + 1, .kind)] pub struct ParseError { pub kind: ParseErrorKind, pub start: Pos...
true
7d3fdb6a5996aeb79ce5f648cc2f059a5433485f
Rust
Bwallker/my-new-lang
/project/src/lexer.rs
UTF-8
754
2.875
3
[]
no_license
mod src { mod lib { pub mod lib; } } use lib::token_str; #[define(token_str)] pub enum Token { Plus, Minus, Divide, Multiply, Colon, Semicolon, Comma, LeftParenthesis, RightParenthesis, Int(i64), Float(f64), String(String), } impl std::fmt::Debug for Toke...
true
bd8b2556f787d9497a63548dd84774e7b5333980
Rust
tehAnswer/sport_monks
/src/ops/commentaries.rs
UTF-8
1,611
3.078125
3
[]
no_license
use super::super::errors::SportMonksError; use super::super::models::{Comment,Wrapper}; use super::super::gateway::{Gateway,Options}; pub struct CommentariesGateway { gateway: Gateway } impl CommentariesGateway { pub fn new(gateway: Gateway) -> CommentariesGateway { CommentariesGateway { gateway } ...
true
325824d27a1ac26bc2a18bd45392a4648ec767b6
Rust
tferic/euler-project
/rust/euler-003/src/main.rs
UTF-8
3,073
3.453125
3
[]
no_license
/* Problem 3: Largest prime factor The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? https://projecteuler.net/problem=3 */ //extern crate num_bigint_dig as num_bigint; //use num_bigint::BigUint; use std::time::{Instant}; fn main() { let numbers: Vec::<u6...
true
db46efa0bea1cdfcb8fe45830ae013864ddd11df
Rust
bltavares/presentations
/getting-started-with-rust/exposed-concepts/src/main.rs
UTF-8
471
3.0625
3
[]
no_license
extern crate example; fn main() { let example = String::from("Hello World!"); //A big source of confusion! let transformed = example::upper(&example); println!("Initial input: {}, Modified: {:?}", example, transformed); //Move semanatics and ownership let steal_ownership = &transformed; printl...
true
f5e84fab519587c622eb673a723c373f02fe9c3a
Rust
HeroicKatora/rust-aliasable
/src/mut_ref.rs
UTF-8
4,754
3.328125
3
[ "MIT" ]
permissive
//! Aliasable `&mut`. use core::fmt; use core::marker::PhantomData; use core::ops::{Deref, DerefMut}; use core::pin::Pin; use core::ptr::NonNull; /// Basic aliasable alternative to `&mut`. /// /// Note that this does not circumvent the core aliasing rules of Rust; if you use this to create /// multiple mutable refere...
true
24637d081aa4624bb0eb247049f4a944adab9381
Rust
jjeffcaii/aliyun-oss-rust-sdk
/src/util.rs
UTF-8
2,640
3
3
[ "Apache-2.0" ]
permissive
use std::io::Write; use once_cell::sync::Lazy; use crate::Result; pub(crate) fn check_bucket_name(name: &str) -> Result<()> { let len = name.len(); if len < 3 || len > 63 { return bail!("bucket name {} len is between [3-63],now is {}", name, &len); } for ch in name.chars() { let valid...
true
95a139fafa5fee77c16c279c6aab49e1ea49225a
Rust
wsgalaxy/fastxdr
/src/ast/indexes/type_index.rs
UTF-8
10,650
3.3125
3
[ "BSD-3-Clause" ]
permissive
use crate::ast::{Enum, Node, Struct, Typedef, Union}; use std::collections::BTreeMap; #[derive(Debug, Clone, PartialEq)] pub enum AstType { Struct(Struct), Union(Union), Enum(Enum), Typedef(Typedef), } impl std::fmt::Display for AstType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt:...
true
43035bf992d6a24868221daa7968950b54da59f2
Rust
Jezza/txl
/src/main.rs
UTF-8
13,123
2.8125
3
[]
no_license
use std::ops::Deref; use std::path::PathBuf; use serde::Deserialize; use structopt::StructOpt; use tmux_interface::{AttachSession, NewSession, NewWindow, SelectWindow, SendKeys, SplitWindow, TmuxInterface}; const ORIGINAL_WINDOW_NAME: &str = "__DEFAULT__"; #[derive(Debug, Deserialize)] struct Setup { file: Option<S...
true
fceb58b5c90836d54bb1a0899d30c7334645584c
Rust
RazrFalcon/svgtypes
/codegen/main.rs
UTF-8
2,854
2.84375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
extern crate phf_codegen; extern crate itertools; use itertools::Itertools; use std::fs; use std::io::{Read, Write}; use std::str; const PHF_SRC: &str = "// A stripped down `phf` crate fork. // // https://github.com/sfackler/rust-phf use std::borrow::Borrow; use std::hash::Hasher; pub struct Map<V: 'static> { ...
true
76e2f3e5b6909640556f7fb53fabaeaa833ca1fc
Rust
solana-labs/solana
/sdk/program/src/program_pack.rs
UTF-8
1,579
3.421875
3
[ "Apache-2.0" ]
permissive
//! The [`Pack`] serialization trait. use crate::program_error::ProgramError; /// Check if a program account state is initialized pub trait IsInitialized { /// Is initialized fn is_initialized(&self) -> bool; } /// Implementors must have a known size pub trait Sealed: Sized {} /// Safely and efficiently (de...
true
35b8328d46250800ffd889814b8725dbfd151baa
Rust
NajmusSaqib/rustgym
/tfrs/src/creation/clone.rs
UTF-8
948
3.1875
3
[ "MIT" ]
permissive
use crate::core::*; impl TensorFlow { pub fn clone(&mut self, id: TensorId) -> TensorId { use TensorId::*; let tensor = self.get(id); match id { F32(_) => { let clone: Tensor<f32> = tensor.as_f32().clone(); self.register(Box::new(clone)) ...
true
082b5cdae8aa88511b5061430c47fe565a7a7340
Rust
olegnn/union
/union_export/src/lib.rs
UTF-8
2,220
2.609375
3
[ "MIT" ]
permissive
//! //! Exports of the `union!`, `union_async!`, `asyncion!`, `union_spawn!`, `union_async_spawn!`, `async_spawn!` macros. //! extern crate proc_macro; extern crate syn; extern crate union_impl; use proc_macro::TokenStream; use proc_macro_hack::proc_macro_hack; use union_impl::{generate_union, Config, Union}; fn un...
true
9907926fd996ba8b21ae8b5ddf01373d62bfcf5d
Rust
zeta1999/ruststep
/espr/src/parser/expression/aggregate_initializer.rs
UTF-8
2,987
3.34375
3
[ "Apache-2.0" ]
permissive
use super::{super::combinator::*, *}; /// 169 aggregate_initializer = `[` \[ [element] { `,` [element] } \] `]` . pub fn aggregate_initializer(input: &str) -> ParseResult<Expression> { tuple(( char('['), opt(comma_separated(element)).map(|opt| opt.unwrap_or(Vec::new())), char(']'), )) ...
true
e66871f07f912b91a5c976eb248944c347330197
Rust
jrhea/ewasm-rt
/tests/utils/mod.rs
UTF-8
201
2.78125
3
[ "Apache-2.0" ]
permissive
pub fn escape(bytes: &[u8]) -> String { let mut output = String::with_capacity(bytes.len() * 4); for byte in bytes { output.push_str(&format!(r#"\{:02x}"#, byte)); } output }
true
9100f055ce88a7000cd741d40463e868d0d0676e
Rust
rcore-os-infohub/ossoc2020-kszlzj-daily
/step0/rust_exercise/leetcode_1121/1121.rs
UTF-8
396
2.90625
3
[]
no_license
impl Solution { pub fn balanced_string_split(s: String) -> i32 { let mut st = Vec::new(); let mut count:i32=0; for i in s.chars() { if (st.len()==0||st[st.len()-1]==i){ st.push(i); }else{ st.pop(); } if(st.len()=...
true
2b39a4a9cc3bfff1ac41c78dfbca61bf7e68488e
Rust
CarloMicieli/railists-rs
/src/domain/catalog/rolling_stocks.rs
UTF-8
27,759
3.21875
3
[ "Apache-2.0" ]
permissive
use std::fmt; use std::str; use heck::ShoutySnakeCase; use itertools::Itertools; use thiserror::Error; use crate::domain::catalog::categories::{ Category, FreightCarType, LocomotiveType, PassengerCarType, TrainType, }; use crate::domain::catalog::railways::Railway; /// The model railway industry adopted an 'Era...
true
1b4b86d7c8f189e12ec6371b9d5ed377c0c26086
Rust
jeffa5/lls
/src/wordnet/index.rs
UTF-8
2,805
3.0625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
use super::pos::PoS; use std::collections::HashMap; use std::fs::File; use std::io::BufRead; use std::io::BufReader; use std::path::Path; #[derive(Default, Debug)] pub struct Index { /// Map from lemma to list of items which may be different items: HashMap<String, Vec<IndexItem>>, } #[derive(Debug)] pub struc...
true
c9819f6303552adb7120d8b8a516430061b6bda8
Rust
satanson/rust_etudes
/Reverse_Integer/src/main.rs
UTF-8
1,457
3.40625
3
[]
no_license
struct Solution {} impl Solution { fn reverse_pos(x: i32) -> i32 { assert_eq!(x > 0, true); const i32_max: i32 = std::i32::MAX; let mut n = 0; let mut q = x; loop { if q == 0 { break; } // overflow let r = q % 10; q = q / 10; if n > (i32_max - r) / 10 {...
true
49b0a129f422907da4131cb5193601fad41658c4
Rust
oli-obk/rust
/src/test/run-pass/issue-55380.rs
UTF-8
865
2.5625
3
[ "MIT", "BSD-3-Clause", "NCSA", "Apache-2.0", "LicenseRef-scancode-other-permissive", "BSD-2-Clause" ]
permissive
// Copyright 2018 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
5e71707226dd0249ddd98dd5e792f8ecf57f2041
Rust
marco-c/gecko-dev-wordified
/third_party/rust/libudev/src/device.rs
UTF-8
9,860
2.921875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std : : str ; use std : : ffi : : { CStr OsStr } ; use std : : path : : Path ; use std : : str : : FromStr ; use libc : : { c_char dev_t } ; use : : context : : Context ; use : : handle : : * ; pub fn new ( context : & Context device : * mut : : ffi : : udev_device ) - > Device { Device { _context : context device ...
true
c1543095a5c22a790bca11ba7061e4caab73dc67
Rust
detailyang/promql-rs
/src/parser/func.rs
UTF-8
8,520
2.640625
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
use crate::ast; use crate::ast::aggregator::{AggregationModifier, AggregationModifierAction}; use crate::ast::funcall::FunCall; use crate::ast::Expr; use crate::parser::error::Error; use crate::parser::group::parse_grouping_labels; use crate::parser::literal::parse_string_literal; use crate::parser::{parse_expr, parse_...
true
139c8ad77956f140391eebefc417fc6dc83d8706
Rust
MatthieuBizien/Rboost
/rboost/src/rf.rs
UTF-8
5,108
2.59375
3
[ "MIT" ]
permissive
use crate::math::sample_indices_ratio; use crate::{ FitResult, Loss, Node, PreparedDataset, StridedVecView, TreeParams, DEFAULT_COLSAMPLE_BYTREE, DEFAULT_N_TREES, SHOULD_NOT_HAPPEN, }; use rand::prelude::Rng; use rayon::prelude::*; use std::sync::Arc; use std::sync::Mutex; /// Parameters for constructing a ran...
true
cbdf12bf23e8507dd925e96fcbab3a1a48ddcf16
Rust
kamioftea/advent-of-code-2018
/src/day4.rs
UTF-8
9,304
3.234375
3
[]
no_license
use std::cmp::Ordering; use std::collections::HashMap; use chrono::{DateTime, Timelike, TimeZone, Utc}; use regex::Regex; #[derive(Debug, Eq, PartialEq)] pub enum Log { ShiftBegins(i32), FallsAsleep, WakesUp, } #[derive(Debug)] pub struct Entry { timestamp: DateTime<Utc>, log: Log, } impl Partia...
true
bcf47c736aff55e50b51016ddb2cd33ab65a26d0
Rust
AndrewMendezLacambra/rust-programming-contest-solutions
/atcoder/icpc2014summer_day4_f.rs
UTF-8
7,001
2.984375
3
[]
no_license
use std::io; use std::cmp; use std::cmp::Ordering; use std::usize::MAX; fn main() { let mut sc = Scanner::new(); let s = sc.read::<String>().bytes().collect::<Vec<_>>(); let n = s.len(); let m = sc.read::<usize>(); let xy = (0..m).map(|_| { let x = sc.read::<String>().bytes().collect::<Vec...
true
26fa2bf06f23723e11524657c9eb4adcaeb8a3c9
Rust
FreeCX/programming-challenges
/src/05-fizzbuzz.rs
UTF-8
259
2.734375
3
[ "Unlicense" ]
permissive
fn main() { for index in 1..16 { match (index % 3, index % 5) { (0, 0) => println!("FizzBuzz"), (0, _) => println!("Fizz"), (_, 0) => println!("Buzz"), _ => println!("{}", index), }; } }
true
1dd8e4f42d5174c1461d7b64d58451f6acc10430
Rust
aristotle9/qt_generator-output
/qt_core/src/hash.rs
UTF-8
34,438
2.515625
3
[]
no_license
/// C++ type: <span style='color: green;'>```QHash<int, QByteArray>```</span> #[repr(C)] pub struct HashCIntByteArray([u8; ::type_sizes::QT_CORE_HASH_HASH_C_INT_BYTE_ARRAY]); impl ::cpp_utils::new_uninitialized::NewUninitialized for HashCIntByteArray { unsafe fn new_uninitialized() -> HashCIntByteArray { HashCIn...
true
63bc73a6b22cd81d9845adb908ca1495f2292878
Rust
aludvik/coleslaw
/python_from_rust_zmq/rust/main.rs
UTF-8
2,333
3.09375
3
[]
no_license
extern crate zmq; use std::process::{Command}; use std::collections::HashMap; struct Channel { socket: zmq::Socket, } enum Endpoint { Bind(String), Connect(String), } impl Channel { pub fn new(ctx: zmq::Context, endpoint: Endpoint) -> Self { let socket = ctx.socket(zmq::PAIR).unwrap(); ...
true
2f5665348a6593fdb06bfd963ed37c065f5b0e66
Rust
uta8a/ant-book-rust
/c2-1/p4/main.rs
UTF-8
426
3.25
3
[]
no_license
fn main() { let mut v = Vec::<u64>::new(); // **stack.push** v.push(1); v.push(2); v.push(100); println!("{:?}", v); // **out of bounds** // let existq = Some(v[4]); // this is panick. // println!("{:?}", existq); // **get top element** // let Some(top) = v.pop(); // None is no...
true
7bc3552b0a52b9f14d1be74109d96820121ae36b
Rust
liufuyang/adventofcode-2020
/examples/day2/main.rs
UTF-8
1,843
3.171875
3
[ "MIT" ]
permissive
use std::collections::HashMap; use std::fs::File; use std::io::{self, BufRead, BufReader}; use recap::Recap; use serde::Deserialize; use std::error::Error; #[derive(Debug, Deserialize, Recap)] #[recap(regex = r#"(?x) (?P<p1>\d+) - (?P<p2>\d+) \s+ (?P<letter>[a-z]) :\s+ (?P<text>\S+) "#)]...
true
731d6a15770545f36f6d3c91fd484f4208cb2faa
Rust
stm32-rs/stm32-rs-nightlies
/stm32mp1/src/stm32mp157/adc2/adc_ofr1.rs
UTF-8
2,970
2.625
3
[]
no_license
#[doc = "Register `ADC_OFR1` reader"] pub type R = crate::R<ADC_OFR1_SPEC>; #[doc = "Register `ADC_OFR1` writer"] pub type W = crate::W<ADC_OFR1_SPEC>; #[doc = "Field `OFFSET1` reader - OFFSET1"] pub type OFFSET1_R = crate::FieldReader<u32>; #[doc = "Field `OFFSET1` writer - OFFSET1"] pub type OFFSET1_W<'a, REG, const ...
true
520d096fcff7842c0f3ab73947f3c6061a0e78ed
Rust
PsypherPunk/advent-of-code
/2019/02/src/main.rs
UTF-8
2,855
3.59375
4
[ "BSD-3-Clause" ]
permissive
use std::fs::File; use std::io::prelude::*; fn read_input() -> String { let filename = "input.txt"; match File::open(filename) { Ok(mut file) => { let mut content = String::new(); file.read_to_string(&mut content).unwrap(); content } Err(error) => { ...
true
eaf524ec764e7abbe7c14042f2d841861d009a6d
Rust
gong023/underscore-rust
/src/btreemap/expands.rs
UTF-8
1,951
3.28125
3
[]
no_license
use std::collections::BTreeMap; use btreemap::BTreeMapU; impl<K: Ord + Clone, V: Ord + Clone> BTreeMapU<K, V> for BTreeMap<K, V> { fn invert(self) -> BTreeMap<V, K> { let mut invert = BTreeMap::new(); for (key, value) in self.into_iter() { invert.insert(value, key); } r...
true
01885cce155cf71f4efa4477c331174935a3df38
Rust
karlvlam/hkosc2017-demo
/05-concurrency-thread.rs
UTF-8
2,228
3.21875
3
[]
no_license
use std::io::*; use std::net::*; use std::{thread, time}; fn main(){ let src_addr = "0.0.0.0:12345"; let dest_addr = "127.0.0.1:22"; thread::spawn( move|| { start_listener(src_addr, dest_addr); }); loop { thread::sleep(time::Duration::from_millis(3600000)); } } fn start_lis...
true
b0f7aaec19cda20a3288a1ba2c010b132b574222
Rust
zmanian/grin
/chain/src/store.rs
UTF-8
1,794
2.78125
3
[ "Apache-2.0" ]
permissive
//! Implements storage primitives required by the chain use byteorder::{WriteBytesExt, BigEndian}; use types::*; use core::core::Block; use grin_store; const STORE_PATH: &'static str = ".grin/chain"; const SEP: u8 = ':' as u8; const BLOCK_PREFIX: u8 = 'B' as u8; const TIP_PREFIX: u8 = 'T' as u8; const HEAD_PREFIX:...
true
ca19d06759c33e8d35d874a0bcc371a6829a3cd7
Rust
adomixaszvers/dotfiles-nix
/nixos/work/throttled/helper.rs
UTF-8
462
2.546875
3
[]
no_license
use std::fs::OpenOptions; use std::io::prelude::*; use std::{thread, time}; fn main() -> std::io::Result<()> { let file_name = "/sys/devices/virtual/powercap/intel-rapl-mmio/intel-rapl-mmio:0/constraint_0_power_limit_uw"; loop { let mut file = OpenOptions::new().write(true).open(&file_name)?; ...
true
6b187ca87d69d7fd2348f9f1847fa0153085ff90
Rust
mwwolf/mwwolf
/backend/mwwolf/src/infrastructure/datastore/theme.rs
UTF-8
9,269
2.71875
3
[ "MIT" ]
permissive
pub(crate) use super::*; use database::ConnectionFactory as _; use std::collections::HashMap; #[derive(new)] pub struct ThemeRepository { connection_factory: Arc<ConnectionFactory>, } // FIXME: remove this for name_of macro! struct ThemeFields; impl ThemeFields { const KIND: &'static str = "kind"; const F...
true
03eff902d90a80d1bfde5adee40cd722fc165474
Rust
gabo01/artid
/UI/cli/src/errors.rs
UTF-8
2,709
3.421875
3
[ "MIT" ]
permissive
//! This file contains the implementation of the top-level application error. //! //! This error is responsible for showing the the general applciation error cause to the //! user. use std::error; use std::fmt::{self, Display}; #[derive(Debug)] pub struct Error { kind: ErrorKind, cause: Option<Box<dyn error::E...
true
2afda51421953c637f05af0c96c4e9314f504841
Rust
himlpplm/rust-tdlib
/src/types/delete_account.rs
UTF-8
2,088
2.984375
3
[ "MIT" ]
permissive
use crate::errors::*; use crate::types::*; use uuid::Uuid; /// Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is auth...
true
7d07b6f63580472231033aed82573c2da26c7dc3
Rust
Karlinde/pololu-smc
/src/command.rs
UTF-8
5,266
3.3125
3
[ "MIT" ]
permissive
//! Defines types that handle sending commands to the controller. /// Representations of the commands that can be sent to the controller. /// /// These only contain the commands which do not provide any response, which can thus be used in [`SimpleMotorController::send_command`]. There are some additional commands ava...
true
6535f27038ae7f2e8493552156fc458f5a110877
Rust
exonum/exonum
/components/api/src/error.rs
UTF-8
5,853
2.890625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
true
7cb6a23d26b9fbba0fd359024adae91f10f40677
Rust
EdeMeijer/aoc2018
/src/days/day3.rs
UTF-8
3,937
3.4375
3
[ "MIT" ]
permissive
//! Solutions for https://adventofcode.com/2018/day/3 use std::collections::HashSet; use regex::Regex; use utils::data::load_data; use utils::data::non_empty_lines; use utils::matrix::Matrix; #[allow(dead_code)] pub fn part1() { println!("{}", solve_combined(get_puzzle_input()).0); } #[allow(dead_code)] pub fn ...
true
c048a3f5915bb1cdb8242d17c32bb692de28b39d
Rust
jakyle/rust-algos
/src/count_points.rs
UTF-8
496
2.953125
3
[ "MIT" ]
permissive
fn count_points(points: Vec<Vec<i32>>, queries: Vec<Vec<i32>>) -> Vec<i32> { let mut result = vec![0; queries.len()]; for (i, query) in queries.iter().enumerate() { let r_squared = i32::pow(query[2], 2); for point in &points { let distance_squared = i32::pow(query[0]...
true
2bc35114c71c9a471753cca929ce9929a088f898
Rust
tupshin/libterm
/src/control.rs
UTF-8
3,064
3.21875
3
[ "MIT" ]
permissive
use std::io::{Write, Result as IoResult}; use {Color, Mode}; /// Controlling terminals. pub trait TermControl { /// Print the CSI (control sequence introducer) followed by a byte string. fn csi(&mut self, b: &[u8]) -> IoResult<usize>; /// Print OSC (operating system command) followed by a byte string. ...
true
8842f95c17d66a68763564eeec72c0206138d763
Rust
m1so/advent-of-code-2020
/day-18/src/main.rs
UTF-8
5,663
3.09375
3
[]
no_license
#![feature(or_patterns)] use std::{collections::{VecDeque, vec_deque::Iter}, error::Error, fs::read_to_string}; type Result<T> = std::result::Result<T, Box<dyn Error>>; #[derive(Debug, PartialEq, Eq, Clone, Copy)] enum Token { Value(u64), Mult, Add, LParen, RParen, } #[derive(Debug, PartialEq, E...
true
5957258a31b8c69034ebdb10466f21865a97aecf
Rust
blt/bitintr
/src/x86/intrinsics/bmi2/bzhi.rs
UTF-8
1,870
3.15625
3
[ "MIT" ]
permissive
use int::Int; use alg; #[cfg(RUSTC_IS_NIGHTLY)] mod intrinsics { use alg; use int::Int; #[allow(dead_code)] extern "platform-intrinsic" { fn x86_bmi2_bzhi_32(x: u32, y: u32) -> u32; fn x86_bmi2_bzhi_64(x: u64, y: u64) -> u64; } #[inline] pub unsafe fn bzhi<T: Int>(x: T, y:...
true
1bd004f10f9be5062a749ff8e543179ebca941f1
Rust
prixt/wiki2life-twitterbot
/src/wiki.rs
UTF-8
485
2.734375
3
[ "MIT" ]
permissive
use std::error::Error; pub fn read_wiki() -> Result<(String, String, String), Box<dyn Error>> { let body: serde_json::Value = reqwest::get("https://en.wikipedia.org/api/rest_v1/page/random/summary")? .json()?; let title = body["title"].as_str().unwrap(); let extract = body["extract"].as_s...
true
dfea294f789042f980b1d49b149e108a80eaebe0
Rust
yew1eb/rustlab
/example-projects/rusty-journal/src/cli.rs
UTF-8
759
3.046875
3
[ "MIT" ]
permissive
use std::path::PathBuf; use structopt::StructOpt; #[derive(Debug, StructOpt)] pub enum Action { // Write tasks to the journal file. Add { /// The task description text. #[structopt()] text: String, }, /// Remove an entry from the journal file by position. Done { #[st...
true
eee499f961a2450c335832de3efd6a3dc6dec544
Rust
jk-gan/emulator-chip8
/src/ram.rs
UTF-8
824
2.546875
3
[]
no_license
/* Memory Map: +---------------+= 0xFFF (4095) End of Chip-8 RAM | | | | | | | | | | | 0x200 to 0xFFF| | Chip-8 | | Program / Data| | Space | | | | | | | +- - - - - - - -+= 0x600 (1536) Start ...
true
08a4d44302090d7baca3a3f590baafdd297f804c
Rust
vindvaki/advent-of-code-2018
/src/bin/day_07.rs
UTF-8
7,228
2.828125
3
[]
no_license
#[macro_use] extern crate error_chain; extern crate regex; use regex::Regex; use std::collections::BTreeMap; use std::collections::BTreeSet; use std::collections::HashMap; use std::collections::HashSet; use std::io::Read; mod errors { error_chain!{} } use errors::*; pub fn main() { let mut data = String::ne...
true
a9ecedf649b95fd44c2697991f4b27fa235b11db
Rust
ancientstraits/lisp
/src/reader.rs
UTF-8
8,389
3.171875
3
[]
no_license
use super::object; use core::fmt; use std::io::{self, BufRead}; use std::str::from_utf8; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum ReadError { EndOfFile, UnmatchedClosedParen, UnexpectedChar(char, char), } impl fmt::Display for ReadError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::...
true
42b1fabf77964fca8d4e9638debe504f55cd4058
Rust
osa1/guru-rs
/src/widgets/watchpoints.rs
UTF-8
6,018
2.8125
3
[]
no_license
// TODO: Make "type" column editable use gtk::prelude::*; use crate::types::WatchpointType; use crate::widgets::watchpoint_add::WatchpointAddW; pub struct WatchpointsW { // scrolled -> box -> [tree view, button ("Add watchpoint") widget: gtk::ScrolledWindow, model: gtk::ListStore, wp_enabled_renderer...
true
a46e819394ff076388ecadf8f08c310c2803e001
Rust
fnzr/behave-rs
/src/nodes/decorator.rs
UTF-8
1,499
2.84375
3
[]
no_license
use crate::{Behavior, FnOnComplete, Node, Status}; use std::collections::VecDeque; pub struct Repeater { pub node: Node, pub repeat_for: i32, pub current_loop: i32, pub status: Status, pub on_complete_cb: FnOnComplete, } impl Repeater { pub fn new(node: Node, repeat_for: i32, on_complete: FnOn...
true
3503d6a4c8326f828b5416f1639a90f6577c29a9
Rust
hamiltonsalazar/hamiltonsalazar.github.com
/RUST/bloques/src/main.rs
UTF-8
828
3.703125
4
[]
no_license
fn main() { /* let mensaje = "Hola, soy una variable en el bloque main."; let resultado = { println!("Hola desde un segundo bloque."); /* let mensaje="Hola, soy una variable en un bloque anidado."; println!("{}", mensaje); */ let variable: i32 = 200; ...
true
32c80ab7e02ccb6f2bd5829a47a822905de5f3a1
Rust
jaredloomis/ratchet
/src/blockchain/chain.rs
UTF-8
5,759
3
3
[]
no_license
use std; use std::io::Read; use std::collections::HashSet; use serde::{Serialize, Deserialize}; use serde::de::DeserializeOwned; use serde_json; use reqwest; use blockchain::block::*; /** * A node on the blockchain. Client and server */ #[derive(Debug, Serialize, Deserialize, Clone)] pub struct BlockchainNode<T> ...
true
b3f4f04da087526298099155790829bc858c0996
Rust
andygrove/arrow-rs
/arrow/tests/timezone.rs
UTF-8
2,973
2.609375
3
[ "Apache-2.0", "MIT", "BSD-3-Clause", "BSD-2-Clause" ]
permissive
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
true
9f38df2b2892a7059c9f571352ba633df028d29f
Rust
hamishgibbs/rust_dsa
/src/bin/comb_sort.rs
UTF-8
1,936
3.875
4
[]
no_license
/* How it works: This is very similar to bubble sort except that bubble sort compares elements that are 1 element away from eachother while Comb sort compares elements that are > 1 element away The sort starts by comparing the top and bottom elements of the array, then "shrinks" the comparison distance until it is 1...
true
18fd1ae0e9c3316f86e21771e9200c7d073e903f
Rust
kumarmo2/leetCode
/linked_list/reverse_linked_list/src/main.rs
UTF-8
972
3.40625
3
[]
no_license
struct Solution {} #[derive(PartialEq, Eq, Clone, Debug)] pub struct ListNode { pub val: i32, pub next: Option<Box<ListNode>>, } impl ListNode { #[inline] fn new(val: i32) -> Self { ListNode { next: None, val } } } impl Solution { pub fn reverse_list(head: Option<Box<ListNode>>) -> Opti...
true
a9f20570b20f2aaa5ac04d7508c1fbc283017189
Rust
Dylan-DPC-zz/cdrs
/src/lib.rs
UTF-8
2,140
2.515625
3
[ "Apache-2.0", "MIT" ]
permissive
//! **cdrs** is a native Cassandra DB client written in Rust. extern crate byteorder; extern crate snap; #[macro_use] pub mod macros; #[macro_use] extern crate log; extern crate lz4_compress; #[cfg(feature = "ssl")] extern crate openssl; extern crate r2d2; extern crate rand; extern crate time; extern crate uuid; use...
true
1dae90de527434a83d58b493ce01ff4e3c415e27
Rust
jhungerford/adventofcode-2019
/day8/src/main.rs
UTF-8
4,172
3.75
4
[]
no_license
use std::io::BufReader; use std::io::prelude::*; use std::fs::File; /// Parses the given image data into a series of layers. fn parse_image(width: usize, height: usize, data: &Vec<u32>) -> Vec<Vec<u32>> { let mut layers = Vec::new(); let mut start = 0; while start < data.len() { let end = start + (...
true
cf6f746e72ad8aa6d13c3a9450d7ed634aa41a9e
Rust
RobbeBryssinck/interpreter_in_rust
/src/repl.rs
UTF-8
1,492
2.9375
3
[]
no_license
use std::io::{self, Write}; use super::token; use super::token::{Token}; use super::lexer::{Lexer, TokenParsingError}; const PROMPT: &str = ">> "; pub fn start() { loop { print!("{}", PROMPT); io::stdout().flush().unwrap(); let mut input = String::new(); let bytes_read = std::io:...
true
474f44909be032149a090ed7d8475283373d9536
Rust
zachnicoll/advent-of-code-2020
/day-4/src/main.rs
UTF-8
4,249
3.140625
3
[]
no_license
use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; use regex::Regex; #[derive(Debug)] struct Passport { byr: String, iyr: String, eyr: String, hgt: String, hcl: String, ecl: String, pid: String, cid: String } impl Passport { pub fn new() -> Passport { Pas...
true
08b031d3d72c39fd09fd1d8e95256ad9bd2636df
Rust
quininer/ene
/core/src/aead/aes128colm0.rs
UTF-8
4,450
2.828125
3
[ "MIT" ]
permissive
//! AES128 + COLM0 //! //! * [COLM v1](https://competitions.cr.yp.to/round3/colmv1.pdf) use generic_array::GenericArray; use arrayref::{ array_ref, array_mut_ref }; use aes::{ Aes128, block_cipher_trait::BlockCipher as _ }; use colm::{ Colm, NONCE_LENGTH }; use colm::traits::{ KEY_LENGTH, BLOCK_LENGTH, BlockCipher }; ...
true
1361ba2ac449538c90b1b58e26c3c38a715ed0df
Rust
cumason123/Rust-GCode-Parser
/src/parser/lexicon.rs
UTF-8
954
3.0625
3
[]
no_license
use parsing_error::ParsingError; pub struct Linear { pub point: (f32, f32, f32), pub prev: Option<(f32, f32, f32)>, pub feedrate: f32, // meters/second pub accelerator_weight: Option<f32> } pub fn distance_from(first: (f32, f32, f32), second: (f32, f32, f32)) -> f32 { ((first.0 - second.0).powi(2) ...
true
fb2a9d7a262da8c363cd79f5d38026bcaf836a70
Rust
jeffmosquera/opentron
/services/producer/src/lib.rs
UTF-8
6,920
2.609375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
//! The block producer. //! //! The java-tron's block producer is not optimized. //! It sleeps and wait for next slot, so it can only use 750ms(default) to generate a block, //! Making the 3s block producing interval meaningless. use chrono::Utc; use futures::future::FutureExt; use indexmap::IndexMap; use log::{debug,...
true