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
cdcccf3cb43e01e9d2afd63e0c3a9d74ea0e203d
Rust
wwposkernel/OperatingSystem
/src/lib/src/bits/flags.rs
UTF-8
5,135
2.65625
3
[ "Apache-2.0" ]
permissive
///! 存放所有的位操作 use crate::bitflags::bitflags; bitflags! { /// 页异常错误码 #[repr(transparent)] pub struct PageFaultErrorCode: u64 { const PROTECTION_VIOLATION = 1 << 0; const CAUSED_BY_WRITE = 1 << 1; const USER_MODE = 1 << 2; const MALFORMED_TABLE = 1 << 3; const INSTRUC...
true
737d8a471042af865702649af856d4c00e13b415
Rust
gabriel376/exercism
/rust/minesweeper/src/lib.rs
UTF-8
1,174
3.390625
3
[]
no_license
use std::char; const MINE: char = '*'; const ADJACENTS: [(i8, i8); 8] = [ (-1, -1), (-1, 0), (-1, 1), ( 0, -1), ( 0, 1), ( 1, -1), ( 1, 0), ( 1, 1), ]; pub fn annotate(board: &[&str]) -> Vec<String> { board .iter() .enumerate() .map(|(x, row)| annotate_row(board, x, r...
true
12f4f444b4f623b43efad005caf3b5f5cb3c88c3
Rust
cambricorp/drone
/src/cli.rs
UTF-8
4,473
2.78125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
//! Command Line Interface. #![allow(missing_docs)] use crate::device::Device; use drone_config::parse_size; use failure::{bail, Error}; use std::{collections::BTreeSet, ffi::OsString, num::ParseIntError, path::PathBuf}; use structopt::StructOpt; use termcolor::ColorChoice; /// Drone OS command line utility. #[deriv...
true
f1c2c868495a04317c021cb761b4c9dac6caaa45
Rust
awelkie/rustfst
/rustfst/src/algorithms/inversion.rs
UTF-8
1,103
3.109375
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::mem::swap; use crate::fst_traits::{ExpandedFst, MutableFst}; /// This operation inverts the transduction corresponding to an FST /// by exchanging the FST's input and output labels. /// /// # Example 1 /// ``` /// # use rustfst::fst; /// # use rustfst::utils::{acceptor, transducer}; /// # use rustfst::semiri...
true
4c7041b6aa31d760f893323936758e44e35e7a88
Rust
Zach41/rust-algorithm-club
/src/arena_tree/test.rs
UTF-8
4,121
2.90625
3
[]
no_license
extern crate typed_arena; use std::ops::Drop; use std::cell::Cell; use self::typed_arena::Arena; use super::*; struct DropChecker<'a>(&'a Cell<usize>); impl<'a> Drop for DropChecker<'a> { fn drop(&mut self) { self.0.set(self.0.get() + 1); } } #[test] fn test_create_tree() { let root = ArenaNod...
true
744ddb184cda8e92295b1fcae2da795fbd17917f
Rust
jhungerford/adventofcode-2019
/day23/src/main.rs
UTF-8
4,611
3.453125
3
[]
no_license
use crate::computer::Computer; use crate::computer::ProgramState::WaitingForInput; use std::collections::HashSet; mod computer; // Boot 50 computers, provide network address as input (0 to 49) // Packets have two values named X and Y, and are queued by the recipient in the order they're received. // Send: three outpu...
true
1f7e17d9ad35881113e97f210ecb006510f1a542
Rust
barskern/small-rust-projects
/web-server/src/utils.rs
UTF-8
2,021
3.09375
3
[]
no_license
use std::{fs::{self, DirEntry}, io::Read, net::TcpStream, path::{Path, PathBuf}}; use super::errors::ReadStreamError; const MAX_REQUEST_SIZE: usize = 1024; /// Visits all files in from given dir to deepest nested /// subdir. Applies the function to all files. pub fn visit_dir<F>(dir_path: &Path, f: &mut F) where F...
true
48faeed73357485bb28d1ba2fb3f4e56e90161d1
Rust
ishmamAli786/Batch435_Quarter2_Saturday
/2021 01 09 Saturday/panic_learning/src/main.rs
UTF-8
443
2.65625
3
[]
no_license
fn main() { let mut age:u8 = 0; println!("PIAIC Batch 4-35 IOT Quarter 2"); println!("Saturday January 09, 2021"); // loop { // println!("Before icrement {}",age); // age = age + 1; // } let nashta = ["OmeleteParatha","Halwa Puri","Alsee ka lado","Butter Bread","Kabab Paratha"]...
true
e8b0a6b290240c8d220bd3965d6255a6ee1ac234
Rust
nbigaouette/gitlab-api-rs
/src/projects/id_hooks_id.rs
UTF-8
501
3.296875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
//! Get project hook //! //! https://docs.gitlab.com/ce/api/projects.html#get-project-hook //! //! # Get project hook //! //! Get a specific hook for a project. //! //! ```text //! GET /projects/ID/hooks/HOOK_ID //! ``` //! //! Parameters: //! //! | Attribute | Type | Required | Description | //! | --------- | ---- | -...
true
edd641e8091fbff170e38d9d04e0495325797adc
Rust
Qvist30/AocRust
/src/Day3_2018.rs
UTF-8
3,275
3.109375
3
[]
no_license
use std::fs::File; use std::io::{BufReader, BufRead, Error, Read}; use std::str::{FromStr, Chars}; use std::collections::{HashSet, HashMap}; extern crate regex; use regex::Regex; type Grid = HashMap<(i32, i32), i32>; pub fn main() -> Result<(),Error> { let mut file = File::open("resources/2018Day3.input")?; le...
true
cda13a5890926d45794cf0d895a41b5c8d3c7c7f
Rust
shayne-fletcher/zen
/rust/intern/src/symbol/mod.rs
UTF-8
348
2.828125
3
[]
no_license
use crate::hash_cons::Consed; use std::ops::Deref; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Symbol(Consed<String>); impl Deref for Symbol { type Target = String; fn deref(&self) -> &String { &self.0 } } impl From<Consed<String>> for Symbol { fn from(sym: Consed<String>) -> Symbol { ...
true
edcca3516fa0a128cab115c515352ffe5eb5b58a
Rust
Joonardo/sade
/src/math/mat4.rs
UTF-8
2,154
3.125
3
[]
no_license
use crate::math::{Mat4, ZipMap}; impl Mat4 { #[inline] pub fn eye() -> Self { Mat4([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., ]) } #[inline] pub fn sqrt(&self) -> Self { self.map(|v| v.sqrt()) } #[inline] pub fn max(&self, oth...
true
2bd634713b9f28d335d119d73ac2232ecf021891
Rust
drk-geek/iot-q1
/assignment2/src/main.rs
UTF-8
995
3.484375
3
[]
no_license
// fn main() { // let mut name = String::from("Danish"); // let salary:i32 = 50_000; // let fee:f64 = 25_00.85; // println!("First Name: {} Fees is {} and Salary is {}",name,fee,salary); // //user_define(); // //square(); // //fn user_define(){ // let lname = &mut name; // lname.pu...
true
1e558a703d9a50e6de06a2c77c587a228c19c243
Rust
Ecnavda/magic
/src/sql.rs
UTF-8
9,257
3.09375
3
[]
no_license
use rusqlite::{ Connection, Result }; use rusqlite::NO_PARAMS; use rusqlite::types::Value as SQLValue; use rocket::request::FromForm; #[derive(FromForm)] pub struct CardSets { pub name: String, pub release: Option<String>, } #[derive(FromForm)] pub struct Users { pub email: String, pub name: Option<S...
true
d6e41832f1f3b091fce0f2de614b7339e077c3e5
Rust
lusen82/advent-of-code-2017
/src/dec_14.rs
UTF-8
5,170
2.890625
3
[]
no_license
extern crate regex; extern crate ascii; use std::io::Read; use std::i32; use std::i64; use std::string::String; use std::convert::From; use std::cell::RefCell; use std::cell::RefMut; use std::cell::Ref; use super::print_utils; use super::parse_utils; use dec_10; pub fn day_14(){ let input = "hwlqcszp";//"hwlqcs...
true
a6a86a360083cb0e1fe55934036406fa5f4f8dec
Rust
knokko/griphin-rs
/src/data.rs
UTF-8
4,365
3.59375
4
[]
no_license
use crate::*; /// Represents a data 'kind' (like int or float) for a shader variable. Together /// with a *DataShape*, a *DataKind* forms a *DataType*. You can't construct new /// *DataKind*s; you can only use the built-in data types *INT*, *FLOAT*, and *BOOL*. #[derive(PartialEq, Eq, Debug, Clone, Copy)] pub struct D...
true
3fab6c427eb1a808235b782aec10d13eee0b4380
Rust
jeremyandrews/goose
/src/report.rs
UTF-8
20,832
2.890625
3
[ "Apache-2.0" ]
permissive
//! Optionally writes an html-formatted summary report after running a load test. use crate::metrics; use std::collections::BTreeMap; use std::mem; use serde::Serialize; /// The following templates are necessary to build an html-formatted summary report. #[derive(Debug)] pub(crate) struct GooseReportTemplates<'a> {...
true
7b65dec5e61e900fd589fabceb11e909977bf90e
Rust
liurenjin/datafuse
/common/datavalues/src/arrays/builders/primitive.rs
UTF-8
2,732
2.5625
3
[ "Apache-2.0" ]
permissive
// Copyright 2020-2021 The Datafuse Authors. // // SPDX-License-Identifier: Apache-2.0. use common_arrow::arrow::array::*; use common_exception::Result; use common_io::prelude::*; use super::ArrayDeserializer; use crate::arrays::DataArray; use crate::prelude::*; use crate::utils::get_iter_capacity; use crate::utils::...
true
f874ef6a0459c879dc77802dbf5d7fabbbbab05d
Rust
m-hilgendorf/tuix
/examples/eq8.rs
UTF-8
29,240
2.515625
3
[ "MIT" ]
permissive
extern crate tuix; use tuix::*; static THEME: &'static str = include_str!("themes/eq8_theme.css"); const ICON_FLOPPY: &str = "\u{1f4be}"; const ICON_PLUS: &str = "\u{2b}"; const frequencies: [f32; 27] = [1.477121, 1.60206, 1.69897, 1.778151, 1.845098, 1.90309, 1.954243, 2.0, 2.30103, 2.477121, 2.60206, 2.69897, 2.7...
true
beff625778e3fe3d623f0b2b9e31b2abd1187a56
Rust
dfrankland/mk20d7
/src/i2s0/rcr2/mod.rs
UTF-8
21,750
2.765625
3
[ "MIT" ]
permissive
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::RCR2 { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut ...
true
0291604c16a5a039a40a9efd8572b9fde2ebf8f0
Rust
storiqaamericanteam/stores
/tests/testsuite/base_product.rs
UTF-8
4,728
2.5625
3
[]
no_license
use std::str::FromStr; use hyper::header::{Authorization, ContentLength, ContentType}; use hyper::Uri; use hyper::{Method, Request}; use stq_http::request_util::read_body; use stq_http::request_util::Currency as CurrencyHeader; use stq_static_resources::*; use stq_types::*; use futures::Future; use rand::Rng; use c...
true
7c84294e740a2e63962c945ef7706cb0965aae64
Rust
nathantypanski/cs4414-project
/src/schooner/net/peer.rs
UTF-8
10,220
2.59375
3
[ "MIT" ]
permissive
use std::io::BufferedReader; use std::io::net::ip::SocketAddr; use std::io::net::tcp::TcpStream; use std::option::Option; use std::io::timer::sleep; use uuid::{Uuid, UuidVersion, Version4Random}; use super::super::events::*; use super::parsers::{read_rpc, as_network_msg, make_id_bytes}; use super::types::*; static CON...
true
46215a4a0ff05e16767384456f33adc12d46ed9d
Rust
vladimirovmm/projecteuler_solving_problems
/src/lesson2/mod.rs
UTF-8
785
3.40625
3
[]
no_license
/// /// https://projecteuler.net/problem=2 /// /// Каждый следующий элемент ряда Фибоначчи получается при сложении двух предыдущих. /// Начиная с 1 и 2, первые 10 элементов будут: /// /// 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... /// /// Найдите сумму всех четных элементов ряда Фибоначчи, /// которые не превышают четыре ...
true
dba0d0884a0eb293ecb553067742e3fc29c7f56b
Rust
Marwes/combine
/src/stream/mod.rs
UTF-8
56,318
3.4375
3
[ "MIT" ]
permissive
// //Traits and implementations of arbitrary data streams. //! //! Streams are similar to the `Iterator` trait in that they represent some sequential set of items //! which can be retrieved one by one. Where `Stream`s differ is that they are allowed to return //! errors instead of just `None` and if they implement the ...
true
51f746f2ce33019e70394931f33f7ea8aa51b87c
Rust
bpglaser/advent
/2015/src/day17_part02/src/main.rs
UTF-8
856
2.953125
3
[]
no_license
extern crate itertools; use itertools::Itertools; static INPUT: [usize; 20] = [50, 44, 11, 49, 42, 46, 18, 32, 26, 40, 21, 7, 18, 43, 10, 47, 36, 24, 22, 40]; fn main() { let mut min_size = usize::max_value(); let mut min_combinations = vec![]; for i in 1..INPUT.len() + 1 { for combination in INP...
true
fd45019ae10efa92de0c183b5a388a47f9329c8a
Rust
atroche/rust-headless-chrome
/src/browser/context.rs
UTF-8
1,571
3
3
[ "MIT" ]
permissive
use std::sync::Arc; use anyhow::Result; use crate::browser::tab::Tab; use crate::protocol::cdp::Target::CreateTarget; /// Equivalent to a new incognito window pub struct Context<'a> { id: String, browser: &'a super::Browser, } impl<'a> Context<'a> { pub fn new(browser: &'a super::Browser, context_id: St...
true
289542461f876058fa58812422e5b4e0e3caf8c4
Rust
zhangkaizhao/lab
/rust/trpl/ch04-02-references-and-borrowing/ref.rs
UTF-8
1,283
4.5
4
[]
no_license
fn calculate_length(s: &String) -> usize { // The scope in which the variable s is valid is the same as any function parameter’s scope, // but we don’t drop what the reference points to when it goes out of scope because we don’t have ownership. // When functions have references as parameters instead of the ...
true
86e1f117204a04581c2ce62cb19c84c8789b9bc1
Rust
yurapyon/maru.rs
/src/math/aabb.rs
UTF-8
2,477
3.234375
3
[ "MIT" ]
permissive
use nalgebra_glm as glm; use nalgebra::{ Scalar, ClosedAdd, ClosedSub, }; use num_traits::{ ToPrimitive, }; #[derive(Copy, Clone, Debug)] #[repr(C)] /// An AABB rectangle. pub struct AABB<T: Scalar> { pub c1: glm::TVec2<T>, pub c2: glm::TVec2<T>, } impl<T: Scalar> AABB<T> { pub fn new(x1: ...
true
8713ee3b4a50e6d14fb03a5b01ad200403a6b16e
Rust
JScearcy/advent-of-code-2018
/day6/src/map.rs
UTF-8
12,665
3.109375
3
[]
no_license
use std::collections::HashMap; pub struct Map { pub points: Vec<Coordinate>, parents: Vec<Coordinate>, size_x: isize, size_y: isize, } impl Map { pub fn new(parents: &Vec<(isize, isize)>) -> Map { let (size_x, size_y) = parents.iter().fold((-1, -1), |(curr_x, curr_y), parent| { ...
true
2db49bdc237726597477d70c96089b9a3f31c023
Rust
FlowerSamda/Rust
/learning/object_oriented/src/blog/mod.rs
UTF-8
6,401
4
4
[]
no_license
pub struct Post { content: String, } // 상태와 동작을 타입처럼 인코딩하기 // -> 상태는 결국 타입(구조체)에 의해 구별된다! // content 메소드를 가지지 않게하여, 메소드 접근시 존재하지 않는다는 컴파일 에러 반환 pub struct DraftPost { content: String, } impl DraftPost { pub fn add_text(&mut self, text: &str) { self.content.push_str(text); } // self를 취하므로,...
true
db6db3672746aa09a12badada3ffcc68d279f37e
Rust
Coutlaw/cosmac
/src/tests/register_instructions.rs
UTF-8
4,863
3.3125
3
[]
no_license
use crate::{Chip, Instruction}; use crate::components::AddressableStorage; macro_rules! register_eq { ($chip:tt, $vx:expr, $value:expr) => (assert_eq!($chip.register.get($vx), $value);) } #[test] fn load_byte() { let mut chip = Chip::new(); chip.execute(&Instruction::LdByte(0, 10)); chip.execute(&Inst...
true
12d7282cab26f9439c37fc1e3be1985c8190ad5a
Rust
rome/tools
/crates/rome_js_analyze/src/analyzers/suspicious/no_shadow_restricted_names.rs
UTF-8
2,049
2.859375
3
[ "MIT" ]
permissive
use crate::globals::runtime::BUILTIN; use rome_analyze::{context::RuleContext, declare_rule, Ast, Rule, RuleDiagnostic}; use rome_console::markup; use rome_js_syntax::JsIdentifierBinding; use rome_rowan::AstNode; declare_rule! { /// Disallow identifiers from shadowing restricted names. /// /// ## Examples ...
true
05febc8b5254946de87645428144e828cc27cbb3
Rust
padoyle/advent2019
/day-1/src/main.rs
UTF-8
2,830
3.390625
3
[]
no_license
use std::{ fs::File, io::{BufRead, BufReader}, path::PathBuf, }; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Args { /// The path to the input file path: PathBuf, } fn main() { let args = Args::from_args(); let file = File::open(&args.path).expect("Could not find file."); ...
true
4ad105939d847457af3f25815c4d770f9ebdc09d
Rust
bolcom/libunftp
/crates/unftp-sbe-gcs/src/object_metadata.rs
UTF-8
1,177
2.96875
3
[ "Apache-2.0" ]
permissive
//! The Metadata for the CloudStorage use libunftp::storage::Error; use libunftp::storage::Metadata; use std::time::SystemTime; /// The struct that implements the Metadata trait for the CloudStorage #[derive(Clone, Debug)] pub struct ObjectMetadata { pub(crate) last_updated: SystemTime, pub(crate) is_file: bo...
true
9796e0bed06c0d8c80126338a7942e63e88549dc
Rust
jmarianer/adventofcode
/2020/src/day20.rs
UTF-8
1,787
3.078125
3
[]
no_license
use std::cmp::min; use std::collections::HashMap; use std::collections::HashSet; use std::fs::File; use std::io::{BufRead, BufReader}; use num_bigint::BigUint; use num_traits::One; fn chars_to_u32<'a>(cs : impl Iterator<Item = &'a char>) -> u32 { let mut i = 0; for c in cs { i *= 2; if *c == '#...
true
0f7351908acf6382fac93e7fed25057a2531d45a
Rust
likr/atcoder
/abc059/src/bin/c.rs
UTF-8
1,317
2.8125
3
[]
no_license
use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std::usize::MAX / 4; #[allow(unused)] const M: usize = 1000000007; fn...
true
cf82160336b29109cf1af6ca6d3661b014e24cf1
Rust
DenkiBran21/os
/os/src/vga.rs
UTF-8
4,539
2.953125
3
[ "MIT" ]
permissive
use core::fmt; use core::ops::{Deref, DerefMut}; use lazy_static::lazy_static; use spin::Mutex; use volatile::Volatile; #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u8)] #[allow(dead_code)] pub enum Color { Black = 0x0, Blue = 0x1, Green = 0x2, Cyan = 0x3, Red = 0x4, Magenta = 0x5, B...
true
488e39cc4477d643977f0d88c3ed4894184938d8
Rust
wbuck/stm32767
/eth/src/smi.rs
UTF-8
1,772
2.640625
3
[]
no_license
use stm32f7xx_hal as stm32; use stm32::device::ethernet_mac::{MACMIIAR, MACMIIDR, macmiiar::CR_A}; use stm32::rcc::Clocks; pub struct Smi<'a> { macmiiar: &'a MACMIIAR, macmiidr: &'a MACMIIDR, clocks: Clocks, } impl<'a> Smi<'a> { pub fn new( macmiiar: &'a MACMIIAR, macmiidr: &'a MACMIIDR, clocks: Clock...
true
2c31df026a4d064acef2fc319c65cd624815fe29
Rust
isgasho/rg3d
/src/resource/fbx/texture.rs
UTF-8
1,029
2.65625
3
[ "MIT" ]
permissive
use std::path::{ PathBuf, Path, }; use crate::{ utils::{ pool::Handle, pool::Pool, }, resource::fbx::{ FbxNode, }, }; use crate::resource::fbx::find_and_borrow_node; pub struct FbxTexture { filename: PathBuf, } impl FbxTexture { pub(in crate::resource::fbx) fn r...
true
8832ec37ea8a954cd833ea1144eb6edd4fbb66d5
Rust
ties/routinator
/src/utils.rs
UTF-8
1,769
3.40625
3
[ "BSD-3-Clause" ]
permissive
//! Various useful things. use futures::Async; use futures::future::{Future, IntoFuture}; //------------ FinishAll ---------------------------------------------------- /// A future combinator that simply finishes all its futures. #[derive(Debug)] #[must_use = "futures do nothing unless polled"] pub struct FinishAll<...
true
9ac195350e76442fcda3b82fe56316c308f4dbb0
Rust
hooops/crypto-crawler-rs
/crypto-msg-parser/tests/utils.rs
UTF-8
2,478
2.625
3
[ "Apache-2.0" ]
permissive
use crypto_market_type::MarketType; use crypto_msg_parser::{FundingRateMsg, MessageType, OrderBookMsg, TradeMsg}; use float_cmp::approx_eq; pub fn check_trade_fields( exchange: &str, market_type: MarketType, pair: String, symbol: String, trade: &TradeMsg, ) { assert_eq!(trade.exchange, exchange...
true
959dc25ebd141bc3b9dd63869741d268deffd4bf
Rust
bokuweb/docx-rs
/docx-core/src/documents/elements/text_direction.rs
UTF-8
715
2.75
3
[ "MIT" ]
permissive
use serde::{Serialize, Serializer}; use crate::documents::BuildXML; use crate::types::*; use crate::xml_builder::*; #[derive(Debug, Clone, PartialEq)] pub struct TextDirection { val: TextDirectionType, } impl TextDirection { pub fn new(t: TextDirectionType) -> TextDirection { TextDirection { val: t }...
true
ef88975ed37614958f3e2873315e0ada414587ac
Rust
feifeiq/example.rs
/src/date.rs
UTF-8
1,254
3.234375
3
[]
no_license
extern crate chrono; use chrono::*; fn main() { let dt = UTC.ymd(2014, 7, 8).and_hms(9, 10, 11); // `2014-07-08T09:10:11Z` // July 8 is 188th day of the year 2014 (`o` for "ordinal") assert_eq!(dt, UTC.yo(2014, 189).and_hms(9, 10, 11)); // July 8 is Tuesday in ISO week 28 of the year 2014. assert_eq!(dt, UTC.isoywd(201...
true
faafd34d5e22785beec5c95f6446a8c35fb3594b
Rust
curiousleo/lorri
/src/build_loop.rs
UTF-8
7,569
2.671875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Uses `builder` and filesystem watch code to repeatedly //! evaluate and build a given Nix file. use crate::builder; use crate::builder::RunStatus; use crate::notify; use crate::pathreduction::reduce_paths; use crate::project::roots; use crate::project::roots::Roots; use crate::project::Project; use crate::watch::{...
true
274e33176f43dc0d163ab99f491a925551110ecb
Rust
peppizza/songbird
/src/input/cached/mod.rs
UTF-8
1,425
2.671875
3
[ "ISC" ]
permissive
//! In-memory, shared input sources for reuse between calls, fast seeking, and //! direct Opus frame passthrough. mod compressed; mod hint; mod memory; #[cfg(test)] mod tests; pub use self::{compressed::*, hint::*, memory::*}; use crate::constants::*; use crate::input::utils; use audiopus::Bitrate; use std::{mem, ti...
true
a8c6f2a9364d96ab3811b26cc46057ffecf88787
Rust
rafael1193/adventofcode-2020-rs
/src/day5.rs
UTF-8
734
2.921875
3
[]
no_license
#[allow(unused_imports)] use super::prelude::*; type Input = Vec<u16>; pub fn input_generator(input: &str) -> Input { input .lines() .map(|line| { line .chars() .fold(0, |acc, c| (acc << 1) + (c == 'B' || c == 'R') as u16) }) .sorted() ...
true
ef7f5fd15369395b5e4e7d6bc7bc614dc84448cd
Rust
rozgo/ref-contracts
/ref-exchange/src/account_deposit.rs
UTF-8
6,783
2.828125
3
[ "Apache-2.0", "MIT" ]
permissive
//! Account deposit is information per user about their balances in the exchange. use std::collections::HashMap; use std::convert::TryInto; use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::json_types::{ValidAccountId, U128}; use near_sdk::{assert_one_yocto, env, near_bindgen, AccountId, Ba...
true
74362d512a48db042c21b331c1da8327b8978aea
Rust
actix/examples
/websockets/chat-actorless/src/handler.rs
UTF-8
6,080
2.859375
3
[ "Apache-2.0" ]
permissive
use std::time::{Duration, Instant}; use actix_ws::Message; use futures_util::{ future::{select, Either}, StreamExt as _, }; use tokio::{pin, sync::mpsc, time::interval}; use crate::{ChatServerHandle, ConnId}; /// How often heartbeat pings are sent const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5); ...
true
5d7cdd163e7f259db49e5e9193da4821892ad642
Rust
wako057/rust-tutorial
/chapter-03/functions/src/main.rs
UTF-8
1,054
3.734375
4
[]
no_license
fn main() { println!("Hello, world!"); another_function(); another_function_with_arg(5); another_function_with_args(5, 6); let x = 5; println!("Ecriture particuliere d'un bloc aui sera evaluer grace au manque du point virgule"); let y = { let x = 3; x + 1 }; print...
true
a5d5aed86611f00095e938dd46df6dab958b28ff
Rust
alexliesenfeld/httpmock
/tests/examples/headers_tests.rs
UTF-8
895
2.609375
3
[ "LicenseRef-scancode-philippe-de-muyter", "MIT" ]
permissive
use httpmock::prelude::*; use isahc::{prelude::*, Request}; #[test] fn headers_test() { // Arrange let server = MockServer::start(); let m = server.mock(|when, then| { when.path("/test") .header("Authorization", "token 123456789") .header_exists("Authorization"); th...
true
74050c60f0c3b0425b1a3e4dc43c7f2c68cd71e5
Rust
kdheepak/moonshine.rs
/src/lib.rs
UTF-8
336
2.65625
3
[]
no_license
use proc_macro2::{Delimiter, TokenStream, TokenTree}; #[proc_macro] pub fn nvim(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let input = proc_macro2::TokenStream::from(input); proc_macro::TokenStream::from(input) } #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 +...
true
050b57e328fd8541bdff41d034b7f21d3f1ed2b9
Rust
blakesmith/arrow2
/src/buffer/mutable.rs
UTF-8
17,189
3.421875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
use std::iter::FromIterator; use std::ptr::NonNull; use std::usize; use crate::trusted_len::TrustedLen; use crate::types::{BitChunk, NativeType}; use super::bytes::{Bytes, Deallocation}; #[cfg(feature = "cache_aligned")] use crate::vec::AlignedVec as Vec; use super::immutable::Buffer; /// A [`MutableBuffer`] is thi...
true
c808d865e0e07d96d2f7bde082950a85a99ba028
Rust
imbolc/perseus
/packages/perseus-actix-web/src/configurer.rs
UTF-8
6,516
2.640625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate::initial_load::initial_load; use crate::page_data::page_data; use crate::translations::translations; use actix_files::{Files, NamedFile}; use actix_web::{web, HttpRequest}; use perseus::{ get_render_cfg, html_shell::prep_html_shell, path_prefix::get_path_prefix_server, stores::{ImmutableStore,...
true
03888b48e2cae0848ae8110dc8209f6cfd896a5e
Rust
hwchen/ika
/src/handlers.rs
UTF-8
2,169
2.8125
3
[]
no_license
use actix_web::{ AsyncResponder, FutureResponse, HttpRequest, HttpResponse, Path, Query, Result as ActixResult, State, }; use futures::future::Future; use log::*; use serde_derive::{Serialize, Deserialize}; use crate::app::AppState; use crate::pg::PgQuery; const DEFAULT_QUERY_LIMIT: u1...
true
7fe6734d023caa43c0431ac213b77f64c0475e26
Rust
utilForever/BOJ
/Rust/10972 - Next Permutation.rs
UTF-8
1,070
3.375
3
[ "MIT" ]
permissive
use std::cmp::Ordering; use std::io; pub fn next_permutation(nums: &mut Vec<i32>) -> bool { let last_ascending = match nums.windows(2).rposition(|w| w[0] < w[1]) { Some(i) => i, None => { nums.reverse(); return false; } }; let swap_with = nums[last_ascending...
true
1f40480863c8e3ec45eb1aa7748cf7bc0f909c06
Rust
ObliqueMotion/rust-criterion-template
/benches/bench.rs
UTF-8
1,638
3.109375
3
[ "MIT" ]
permissive
use criterion::{criterion_group, criterion_main, Criterion, Fun}; fn function1() -> u32 { 5 } // usually not defined here. fn function2() -> u32 { 5 } // usually not defined here. // Benchmark a single function's performance. fn benchmark_single_function(critreion: &mut Criterion) { critreion.bench_function( ...
true
6a2b3319069b5c8eb3aa17602529e8ba81b28a09
Rust
PISCES-HI/rover-gui
/src/stereo_ui.rs
UTF-8
9,026
2.59375
3
[]
no_license
use std::collections::{HashMap, VecDeque}; use std::io; use std::io::Write; use std::net::UdpSocket; use std::ops::DerefMut; use std::sync::mpsc::Sender; use conrod::{ self, Background, Button, Color, Colorable, Frameable, Text, Labelable, Positionable, Slider, Sizeable, ...
true
b39a2948de4238a71acf13b8fa9ce05cf87e8b7b
Rust
qwertz19281/rust_utils
/src/rope_vec/mod.rs
UTF-8
2,863
2.78125
3
[]
no_license
use super::*; use std::{slice, io::{self, IoSlice}, hash::{Hasher, Hash}, vec::IntoIter, fmt}; use io::Write; pub struct PartVec<T> { inner: Vec<Vec<T>>, factor: usize, } pub struct RopeVec<T> { inner: Vec<(usize,Vec<T>)>, } impl<T> Clone for PartVec<T> { fn clone(&self) -> Self { todo!() ...
true
c9352de8cb83dcdbff54bb2d8575bdf6d9b06926
Rust
pombredanne/elfkit
/src/dynamic.rs
UTF-8
4,259
3
3
[ "MIT" ]
permissive
use std::io::{Read, Write}; use {Error, Header, SectionContent}; use types; use num_traits::{FromPrimitive, ToPrimitive}; #[derive(Debug, Clone)] pub enum DynamicContent { None, String(String), Address(u64), Flags1(types::DynamicFlags1), } #[derive(Debug, Clone)] pub struct Dynamic { pub dhtype: t...
true
1d56ba1d46f918e70ab07e8dc9b103d51be83531
Rust
MirecIT/amethyst
/amethyst_ui/src/resize.rs
UTF-8
3,039
2.9375
3
[ "Apache-2.0", "MIT" ]
permissive
use amethyst_core::ecs::*; use amethyst_window::ScreenDimensions; #[cfg(feature = "profiler")] use thread_profiler::profile_scope; use super::*; /// Whenever the window is resized the function in this component will be called on this /// entity's UiTransform, along with the new width and height of the window. /// ///...
true
f7d6e464add94db1a91f3c757a229d5c8a302847
Rust
Kirszu/Rust-Lessons
/lesson2 - currency/src/main.rs
UTF-8
841
4.03125
4
[]
no_license
use std::io; fn main() { // PLN = 0.23EUR // EUR = 4.29PLN println!("Choose 1 to convert PLN to EUR"); println!("Choose 2 to convert EUR to PLN"); let mut input = String::new();; io::stdin().read_line(&mut input) .expect("Failed to read line"); let eur = 4.29; let pln = 0.23; let...
true
aea5f40429cab905fd93cc04828a1729d2b750d1
Rust
ItsHoff/Rusty
/src/pt_renderer.rs
UTF-8
4,282
2.71875
3
[ "MIT" ]
permissive
use std::path::Path; use std::sync::{ mpsc::{self, Receiver, Sender}, Arc, }; use std::thread::{self, JoinHandle}; use cgmath::Point2; use glium::backend::Facade; use glium::{Rect, Surface}; use crate::camera::{Camera, PTCamera}; use crate::config::RenderConfig; use crate::scene::Scene; use crate::stats; mo...
true
439b646a312273a2a55d9d0b78fc650915c8b3ac
Rust
Nessex/stream-ciphers
/ofb/src/lib.rs
UTF-8
3,693
3.0625
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Generic [Output Feedback (OFB)][1] mode implementation. //! //! This crate implements OFB as a [synchronous stream cipher][2]. //! //! # Security Warning //! This crate does not ensure ciphertexts are authentic! Thus ciphertext integrity //! is not verified, which can lead to serious vulnerabilities! //! //! # Exam...
true
966364472c04eb04ac85ecedb6bc41a571a24267
Rust
fpapado/aoc-2019-rust
/src/day1.rs
UTF-8
2,046
3.625
4
[]
no_license
use std::error; use std::fs::File; use std::io::{BufRead, BufReader}; pub fn part_1() -> Result<i32, Box<dyn error::Error>> { let input = File::open("inputs/day1.txt")?; let reader = BufReader::new(input); let mut result: i32 = 0; for line in reader.lines() { let module_mass: i32 = line?.pars...
true
d59474a10e6540809bd250d6c94b3c3fdca53e7d
Rust
lazear/rosalind
/grph/src/main.rs
UTF-8
2,372
3.140625
3
[ "MIT" ]
permissive
use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::Write; use utils::Fasta; #[derive(Debug)] pub struct Node<'s> { ids: Vec<&'s str>, matches: Vec<&'s str>, } #[derive(Debug)] pub struct Graph<'s> { suffixes: HashMap<&'s str, Node<'s>>, } impl<'s> Graph<'s> { /// Construct an o...
true
6d978062beafa8f4c0f77c062b223e0679f46be9
Rust
RalfNorthman/MoonZoon
/examples/canvas/frontend/src/lib.rs
UTF-8
1,551
2.5625
3
[ "MIT" ]
permissive
#![no_std] use zoon::*; blocks!{ #[derive(Copy, Clone)] enum Color { Red, Blue, } #[s_var] fn color() -> Color { Color::A } #[update] fn toggle_color() { use Color::{Red, Blue}; color().update(|color| if let Red = color { Blue } else { Red });...
true
4d5d1f92d84f0188f7c6e1c6dac3696ae265f327
Rust
jchv/asf-rs
/src/asfdump.rs
UTF-8
355
2.6875
3
[ "ISC" ]
permissive
use asf::parse; use std::{env::args, fs::File, io::Read}; fn main() { for name in args().skip(1) { let mut buffer = Vec::new(); let mut f = File::open(name).expect("opening file failed"); f.read_to_end(&mut buffer).expect("reading file failed"); println!("{:?}", parse(&buffer).expec...
true
f72c9d0f377a11703cde86b3e6d8f5872be6c9ff
Rust
hherman1/ParallelProgrammingCapstone
/src/utils.rs
UTF-8
6,748
2.78125
3
[]
no_license
use std; use rayon; use std::heap::Alloc; //use core::array::FixedSizeArray; #[cfg(test)] use rand; #[cfg(test)] use rand::Rng; #[macro_export] macro_rules! dbg { ($first:expr $(, $var:expr)* ) => {{ #[cfg(debug_assertions)] { use ::std::io::Write; let stdout = ::std::io::...
true
992ddaa714144562ba7cd160116ed96054fe50aa
Rust
Phippsaurus/proc_lr
/proc_lr/src/debug_output/graphviz.rs
UTF-8
3,936
2.78125
3
[]
no_license
use super::*; use std::process::{Command, Stdio}; pub(super) fn generate_transition_graph_svg( table: &[Vec<Action>], symbols: &[Symbol], states: &[State], rev_symbols: &HashMap<&Symbol, &str>, ) -> String { let digraph = generate_digraph(table, symbols, states, rev_symbols); let echo = Command...
true
d86fcb2a57e3b145192c055698d8a4d644dfd700
Rust
dialtone/aoc
/src/solutions/year2022/day03.rs
UTF-8
1,566
3.203125
3
[ "MIT" ]
permissive
use itertools::Itertools; use std::collections::HashSet; pub fn part1(input: &str) -> u64 { input .lines() .map(|l| { let half = l.chars().count() / 2; let c1: HashSet<char> = l.chars().take(half).collect(); let c2: HashSet<char> = l.chars().skip(half).collect()...
true
fb2f97decf12bbed5da3cf43031d0b817e0b21c3
Rust
GuilhermoReadonly/copy-rules
/src/api.rs
UTF-8
850
2.9375
3
[]
no_license
use crate::configuration::Verb; use std::error::Error; use std::fmt; pub fn call_verb_on_url(verb: &Verb, url: &str) -> Result<reqwest::Response, Box<dyn Error>> { debug!("Calling API on {} with {:?}", url, verb); let client = reqwest::Client::new(); match verb{ Verb::DELETE => { let...
true
eba20b967863798b59c6696f9faff23af2dc465f
Rust
CircArgs/rust-exercism
/clock/src/lib.rs
UTF-8
1,494
3.6875
4
[]
no_license
use std::fmt; #[derive(Debug, PartialEq, Eq)] pub struct Clock { hours: i32, minutes: i32, } /// a function with the same behavior as integer division in python e.g. /// >>> -40//60 /// -1 /// >>> -60//60 /// -1 /// >>> -80//60 /// -2 fn python_style_integer_division(dividend: i32, divisor: u32) -> i32 { l...
true
4af086309295392c2a1587635f8aee30d1d0b097
Rust
dradtke/allegro_window
/src/lib.rs
UTF-8
12,377
2.921875
3
[]
no_license
extern crate allegro; extern crate core; extern crate event_loop; extern crate input; extern crate window; use core::convert::From; use input::{ButtonState, Button, Input}; use input::keyboard::Key; use window::{AdvancedWindow, Window}; pub struct AllegroWindow { display: allegro::Display, event_queue: allegr...
true
9d458d7765c47d2258631bfb526351ecd5c2e05b
Rust
pierrechevalier83/unicode_types
/src/generated/emoticons.rs
UTF-8
14,574
3.078125
3
[ "LicenseRef-scancode-unicode" ]
permissive
/// An enum to represent all characters in the Emoticons block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Emoticons { /// \u{1f600}: '😀' GrinningFace, /// \u{1f601}: '😁' GrinningFaceWithSmilingEyes, /// \u{1f602}: '😂' FaceWithTearsOfJoy, /// \u{1f603}: '😃' SmilingF...
true
c542e232c35aa80515936b005d85d4b4c184616f
Rust
clarkema/grips
/src/main.rs
UTF-8
957
2.65625
3
[]
no_license
use futures_util::{pin_mut, stream::StreamExt}; use mdns::{Error, Record, RecordKind}; use std::{net::IpAddr, time::Duration}; const SERVICE_NAME: &'static str = "_elg._tcp.local"; #[tokio::main] async fn main() -> Result<(), Error> { let stream = mdns::discover::all(SERVICE_NAME, Duration::from_secs(2))?.listen(...
true
81b5d90e122162f07f45014debe4d4ae0f5dbc38
Rust
yoanndw/zen-rs
/src/cli/menu/title.rs
UTF-8
575
2.734375
3
[]
no_license
use super::*; use crate::cli::input; use crate::data::TransData; pub struct TitleMenu; impl Menu for TitleMenu { fn update(&mut self) -> MenuTrans { println!("-------[ZEN]-------"); println!("[1] Nouvelle partie"); println!("[2] Reprendre partie"); println!("[3] Quitter"); ...
true
781978fd2e98ee519f877765e237b61ca5b81c7d
Rust
darvin/DOS-Emulator-Rust-Src-Launch
/src/bios.rs
UTF-8
16,852
2.796875
3
[ "MIT" ]
permissive
use chrono::prelude::*; static KEYCODE_TO_ASCII: &'static [u16] = &[ 0x0000, 0x0000, 0x0000, 0x0000, 0x011b, 0x011b, 0x011b, 0x01f0, // Escape 0x0231, 0x0221, 0x0000, 0x7800, // 1 ! 0x0332, 0x0340, 0x0300, 0x7900, // 2 @ 0x0433, 0x0423, 0x0000, 0x7a00, // 3 # 0x0534, 0x0524, 0x0000,...
true
e370b44ccf169956c83f9682623d69700af80613
Rust
kevpy/tide-basic-crud
/src/main.rs
UTF-8
10,179
2.890625
3
[]
no_license
use serde::{Deserialize, Serialize}; use sqlx::postgres::{PgPoolOptions, PgRow}; use sqlx::{query, query_as, FromRow, PgPool, Row}; use tide::{Body, Request, Response, Server}; use uuid::Uuid; #[derive(Clone, Debug)] struct State { db_pool: PgPool, } #[derive(Debug, Clone, Deserialize, Serialize, FromRow)] struct...
true
e47b538f113295bfa4a614a40f9c62c389f20c31
Rust
astherath/rustler
/src/common_structs/output_block.rs
UTF-8
1,037
2.953125
3
[]
no_license
use super::{CommentType, MarkedSection, TokenizedLine}; pub struct OutputBlock { pub block_type: CommentType, pub special_line: TokenizedLine, pub all_lines: Vec<TokenizedLine>, } impl OutputBlock { /// Process a single [`MarkedSection`](MarkedSection) into an [`OutputBlock`](Self) pub fn from_mar...
true
9cfa0706c3db35483f11757b5f46255220199e4e
Rust
adamransom/spyparty-rs
/src/replay/header.rs
UTF-8
14,918
2.90625
3
[]
no_license
pub mod result_data; pub use result_data::ResultData; use crate::utils; use crate::{Error, Result}; use std::io::Read; /// The header of a replay. #[derive(Debug, Default)] pub struct Header { /// The version of the replay. /// /// Currently only versions 2 to 6 are supported. pub replay_version: u32...
true
d3752004e36aeb8bb23e3bb77f36a1ce60d70416
Rust
zhangpf/steed-1
/src/libc/internal/aarch64.rs
UTF-8
2,204
2.84375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use libc::thread; #[cfg(not(test))] mod not_test { // Syscall number is passed in x8, syscall arguments in x0, x1, x2, x3, x4. // The arguments are // (flags: c_ulong, // x0 // child_stack: *mut c_void, // x1 // ptid: *mut c_int, // x2 // newtls: c_ulong, // x3 ...
true
044acb4ef3c985e4245fe2e0763e2eb8aa3e732a
Rust
evilpie/jsparagus
/client/src/main.rs
UTF-8
1,843
2.59375
3
[]
no_license
#![cfg_attr(feature = "unstable", feature(test))] mod lexer; mod parser; mod parser_generated; mod parser_runtime; use crate::lexer::Lexer; use std::error::Error; use std::io; use std::io::prelude::*; #[cfg(all(feature = "unstable", test))] mod tests { extern crate test; use crate::lexer::Lexer; use std...
true
e1c09275ac9267d25deb43ed8c88b663efab2974
Rust
dmvict/wTools
/rust/test/willbe/tests/iterator.rs
UTF-8
3,869
2.859375
3
[ "MIT" ]
permissive
use super::*; #[ test ] fn over_workspace() { use std::collections::HashSet; let workspace_asset = Asset::from( PathBuf::from( ASSET_PATH ).join( "workspaces/workspace1" ) ); let workspace_path = workspace_asset.path_buf(); let workspace = Workspace::try_from( workspace_path.to_owned() ).unwrap(); // `works...
true
b612504e85b760cfffd78e30db92c26c28e8be88
Rust
CroPo/roguelike-tutorial-2018
/part_8/src/ecs/item.rs
UTF-8
1,600
2.953125
3
[ "WTFPL" ]
permissive
use tcod::colors; use ecs::Ecs; use ecs::component::Position; use ecs::component::Render; use ecs::component::Name; use ecs::id::EntityId; use ecs::component::MonsterAi; use ecs::component::Actor; use render::RenderOrder; use ecs::component::Item; use ecs::spell::Spell; /// Templates for common Creature types pub enum...
true
87698e1ad90fb919e8cd3eb0d518f5698d412624
Rust
tgblackburn/opal
/src/setup.rs
UTF-8
17,027
3.046875
3
[ "MIT" ]
permissive
//! Parse input configuration file use std::fmt; use std::error::Error; use std::path::Path; use yaml_rust::{YamlLoader, yaml::Yaml}; use meval::Context; use crate::constants::*; /// Represents the input configuration, which defines values /// for simulation parameters, and any automatic values /// for those paramet...
true
62952464f7e96d4156b6c4282dc9cb8b700cfd19
Rust
saschagrunert/indextree
/examples/simple.rs
UTF-8
297
2.90625
3
[ "MIT" ]
permissive
use indextree::Arena; pub fn main() { // Create a new arena let arena = &mut Arena::new(); // Add some new nodes to the arena let a = arena.new_node(1); let b = arena.new_node(2); // Append a to b a.append(b, arena); assert_eq!(b.ancestors(arena).count(), 2); }
true
10aea34e25f8cd0c9093e5c233e0354d6231046e
Rust
richjyp/rust-examples
/src/references.rs
UTF-8
3,041
4.46875
4
[]
no_license
/// References and Borrowing /// Rules: /// 1. Either 1 mut ref or any number of immutable references /// 2. References always be valid, and go out of scope before the data pub fn basic_reference() { // takes reference instead of taking ownership let s1 = String::from("hello"); let len = calculate_length(&...
true
b8d35992702815206081785ad4da0990eb493934
Rust
choroba/perlweeklychallenge-club
/challenge-205/ealvar3z/rust/src/main.rs
UTF-8
1,423
3.34375
3
[]
no_license
#[cfg(test)] mod tests { use super::*; #[test] pub fn test_task_one() { let a = [5,3,4]; let b = [5,6]; let c = [5,4,4,3]; assert_eq!(task_one(&a), 3); assert_eq!(task_one(&b), 6); assert_eq!(task_one(&c), 3); } #[test] pub fn test_task_two() { ...
true
8c13ec0bb62ce971db2b33019c7674623fa9c816
Rust
drmason13/space-age-derive
/src/lib.rs
UTF-8
1,840
2.875
3
[]
no_license
use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, DeriveInput, LitFloat}; #[proc_macro_derive(Planet, attributes(orbital_period))] pub fn derive_planet(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); let name = &input.ident; // Find the...
true
97b1842b9fb2b70720649338a3991c8af984445d
Rust
likr/atcoder
/keyence2019/src/bin/c.rs
UTF-8
1,023
2.8125
3
[]
no_license
use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std::usize::MAX / 4; #[allow(unused)] const M: usize = 1000000007; fn...
true
20d9bcd73acaee9bcc705e97000d2ece1fe2ba4d
Rust
while1malloc0/advent-of-code
/2021/rust/src/bin/day8.rs
UTF-8
16,029
3.34375
3
[]
no_license
use std::collections::{HashMap, HashSet}; fn main() { let p1_input = include_str!("../../inputs/8.txt"); let p1_answer = p1(p1_input); println!("Part 1: {}", p1_answer); let p2_input = include_str!("../../inputs/8.txt"); let p2_answer = p2(p2_input); println!("Part 2: {}", p2_answer); } fn p1...
true
0bf6ebeccc16968e5af1d1fa73e1902b6c8ad405
Rust
conorpp/date-version
/src/main.rs
UTF-8
6,044
2.75
3
[]
no_license
use clap::{self, crate_authors, crate_version, App, Arg }; use git2::Repository; pub const OFFSET_SECONDS_1970_TO_2000: i64 = 946713600; fn main() { let matches = App::new("Date Version") .author(crate_authors!()) .version(crate_version!()) .about("Generate a version string that is based o...
true
cd02d4729ce1a10af2ba6641fb3f1e096cf04ee3
Rust
TGX03/Radix_Rust
/src/radix.rs
UTF-8
1,643
3.015625
3
[]
no_license
pub fn sort(arr : &mut [u64]) { let mut position : u64 = 1; let mut first : Vec<u64> = Vec::new(); let mut second : Vec<u64> = Vec::new(); for i in 0..63 { if i == 0 { let size = arr.len(); for x in 0..size { let current = arr[x]; let list ...
true
1face251f2722999e508fb76d8e6213ef5cab204
Rust
r-englund/AdventOfCode2020
/src/bin/day06.rs
UTF-8
4,769
3.671875
4
[]
no_license
/* --- Day 6: Custom Customs --- As your flight approaches the regional airport where you'll switch to a much larger plane, customs declaration forms are distributed to the passengers. The form asks a series of 26 yes-or-no questions marked a through z. All you need to do is identify the questions for which anyone in...
true
6909bd0674959f280dbf6f45cf6512c8eef2458a
Rust
sullivant/euler
/rust/src/p1.rs
UTF-8
372
3.515625
4
[]
no_license
// Project Euler #[allow(dead_code)] pub fn run() { // List the sum of all numbers below 1000 that are multiples of 3 or 5 println!("Running problem one."); let mut total = 0; for i in 1..1000 { if i % 3 == 0 { total += i; } else if i % 5 == 0 { total += i; ...
true
ce91697024fb63ea0748381f0fa6e031393ad18c
Rust
RobJenks/flight-radar
/src/data/parsing.rs
UTF-8
3,726
3.515625
4
[]
no_license
use core::str::Chars; const SIMPLE_MULTI_LINE_STRING_PREFIX: &str = "MULTILINESTRING (("; pub struct GeoShpIter<'a> { input: &'a String, read_point: Chars<'a>, read_index: isize, block_depth: u32, } impl<'a> GeoShpIter<'a> { fn new(input: &'a String) -> Self { Self { input, read_point: in...
true
6b74c84a6e12b4d738f615057e2a4a5ed4f7495a
Rust
bbigras/squad-broadcasts
/src/maps.rs
UTF-8
2,175
2.609375
3
[]
no_license
use std::fs::File; use std::io::{BufRead, BufReader}; use failure::{err_msg, Error, ResultExt}; use default_game::load_default_game_ini; use parsers::parse_map_broadcast; use nom_result; use nom_err; use nom::types::CompleteStr; const BROADCAST_FILE: &str = "Broadcasts.cfg"; pub struct MapBroadcastOwned { pub m...
true
62b04bfa89351e886512d43701245b776979f1f6
Rust
thomaseizinger/autocxx
/engine/src/builder.rs
UTF-8
7,879
2.609375
3
[ "MIT", "Apache-2.0" ]
permissive
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
true
204f54b83163c3c0556b98a7237c00e650a3ed37
Rust
alekseysidorov/rise
/text_layout/src/types.rs
UTF-8
3,742
3.265625
3
[]
no_license
use euclid; // in logical pixels pub type Size = euclid::Size2D<f32>; pub type Point = euclid::Point2D<f32>; pub type Vector = euclid::Vector2D<f32>; pub type Rect = euclid::Rect<f32>; pub trait RectExt<T> { fn left(&self) -> T; fn top(&self) -> T; fn right(&self) -> T; fn bottom(&self) -> T; fn w...
true
e4a909948822c418867ceacbaccbf67468189d52
Rust
baszalmstra/plotters-iced
/src/chart.rs
UTF-8
3,707
2.6875
3
[ "MIT" ]
permissive
// plotters-iced // // Iced backend for Plotters // Copyright: 2021, Joylei <leingliu@gmail.com> // License: MIT #[cfg(not(target_arch = "wasm32"))] use iced_graphics::canvas::{Cursor, Event, Frame, Geometry}; #[cfg(not(target_arch = "wasm32"))] use iced_native::{event::Status, Rectangle, Size}; #[cfg(target...
true