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
3798e484f348c206ad81da9e7de43197062bff42
Rust
Ch00k/deary
/src/main.rs
UTF-8
4,213
3
3
[]
no_license
mod lib; use clap::{crate_authors, crate_description, crate_version, App, Arg}; use lib::{find_repo_path, Deary, DearyError}; use std::collections::HashMap; use std::env; use std::io; use std::io::prelude::*; fn exit_with_error(error: DearyError) { eprintln!("{}", error); std::process::exit(1); } fn main() {...
true
c2b72b57cff5ff849536d3421d6e6f19c7209071
Rust
sastels/advent-of-code-2020
/src/day15.rs
UTF-8
1,554
3.28125
3
[]
no_license
use std::collections::HashMap; pub fn solve_a(data: &[String]) -> usize { let input: Vec<usize> = data[0] .split(",") .map(|s| s.parse::<usize>().unwrap()) .collect(); let mut last_said: HashMap<usize, usize> = HashMap::new(); let mut new_number: usize = 0; for i in 0..2020 { ...
true
49216f99aaa862ae3fe52b5dc1b371ba970e980e
Rust
rust-lang/rust
/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-79450.rs
UTF-8
326
2.5625
3
[ "Apache-2.0", "LLVM-exception", "NCSA", "BSD-2-Clause", "LicenseRef-scancode-unicode", "MIT", "LicenseRef-scancode-other-permissive" ]
permissive
#![feature(const_fmt_arguments_new)] #![feature(const_trait_impl)] #[const_trait] trait Tr { fn req(&self); fn prov(&self) { println!("lul"); //~ ERROR: cannot call non-const fn `_print` in constant functions self.req(); } } struct S; impl const Tr for S { fn req(&self) {} } fn main...
true
ee99c73cffadebbc725579fa8cc4a8ba58901155
Rust
mhirai-bit/AIZU_ONLNE_JUDGE_RUST
/Courses/Lesson-ITP1/ITP1_10_D/src/main.rs
UTF-8
968
3.078125
3
[]
no_license
fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); let n: usize = s.trim().parse().unwrap(); let x = input(); let y = input(); let mut ans1: f64 = 0.0; for i in 0..n { ans1 += (x[i] - y[i]).abs(); } let mut ans2: f64 = 0.0; for i in 0.....
true
c405c4fb4bdf53b7357868617843c606868d9dff
Rust
ToruNiina/rustracer
/src/material.rs
UTF-8
3,090
3.203125
3
[ "MIT" ]
permissive
use crate::vector::*; use crate::color::RGB; use crate::collide::Collision; use crate::ray::Ray; use crate::util::*; use rand::Rng; pub trait Scatter { /// returns the next ray and the attenuation of the color. fn scatter<R: Rng>(&self, ray: &Ray, cr: Collision, rng: &mut R) -> Ray; } #[derive(Debug)] pub str...
true
6691b3ae55217d78d187cf56f3c50ff313a7c2dc
Rust
adamnemecek/flowbetween
/anim_sqlite/src/db/flo_sqlite/query.rs
UTF-8
31,948
2.65625
3
[ "Apache-2.0" ]
permissive
use super::*; use super::super::motion_path_type::*; use flo_canvas::*; use flo_animation::*; use rusqlite; impl FloSqlite { /// /// Queries a single row in the database /// fn query_row<T, F: FnOnce(&Row) -> rusqlite::Result<T>>(&mut self, statement: FloStatement, params: &[&dyn ToSql], f: F) -> Res...
true
a4a5729f4f59ac7d1ba9d617ecce461827756a6a
Rust
CNrocke/rpfm
/rpfm_lib/src/global_search/table.rs
UTF-8
2,567
2.9375
3
[ "CC-BY-3.0", "MIT" ]
permissive
//---------------------------------------------------------------------------// // Copyright (c) 2017-2020 Ismael Gutiérrez González. All rights reserved. // // This file is part of the Rusted PackFile Manager (RPFM) project, // which can be found here: https://github.com/Frodo45127/rpfm. // // This file is licensed un...
true
4a5878b82f40e013f8107f447fd3873b223ade42
Rust
Pireax/termion
/src/lib.rs
UTF-8
1,969
2.53125
3
[ "MIT" ]
permissive
//! Termion is a pure Rust, bindless library for low-level handling, manipulating //! and reading information about terminals. This provides a full-featured //! alternative to Termbox. //! //! Termion aims to be simple and yet expressive. It is bindless, meaning that it //! is not a front-end to some other library (e.g...
true
e296040766fb91a4d519d7e22c429b05581af121
Rust
rlucas585/examtrainer
/src/exam/database.rs
UTF-8
2,626
3.234375
3
[]
no_license
use super::{Exam, ExamError}; use crate::config::Config; use crate::question::QuestionDB; use colored::*; use std::collections::HashMap; use std::fmt; use std::fs::DirEntry; #[derive(Debug)] pub struct ExamDB { exams: HashMap<String, Exam>, } impl ExamDB { pub fn new(config: &Config, database: &QuestionDB) ->...
true
8b080194b346bd391111116c8a98fa5c042cc6d8
Rust
dunmengjun/tokio-icmp
/src/lib.rs
UTF-8
994
2.796875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
//! tokio-icmp-echo is an asynchronous ICMP pinging library. //! //! The repository is located at <https://github.com/jcgruenhage/tokio-icmp-echo/>. //! # Usage example //! //! Note, sending and receiving ICMP packets requires privileges. //! //! ```rust,no_run //! use futures_util::{future, StreamExt}; //! //! #[tokio...
true
49bc0dfca23ec3df2d33ba614b0e6f426e1f360f
Rust
timsuchanek/prisma-engines
/libs/datamodel/core/tests/directives/default_negative.rs
UTF-8
2,983
2.84375
3
[ "Apache-2.0" ]
permissive
use crate::common::*; use datamodel::{ast::Span, error::DatamodelError}; #[test] fn must_error_if_default_value_for_relation_field() { let dml = r#" model Model { id Int @id rel A @default("") } model A { id Int @id } "#; let errors = parse_error(dml); errors....
true
038d780a0bd01bbe48d1341dd86b76054c59a54c
Rust
mikialex/rendiation
/platform/graphics/webgpu/src/read.rs
UTF-8
5,042
2.671875
3
[]
no_license
use __core::ops::RangeBounds; use futures::FutureExt; use crate::*; #[derive(Debug, Copy, Clone)] pub struct ReadRange { pub size: Size, pub offset_x: usize, pub offset_y: usize, } pub struct ReadableTextureBuffer { buffer: ReadableBuffer, info: TextReadBufferInfo, } impl ReadableTextureBuffer { pub fn ...
true
eee8be9725b0b99a89adc231367c2389fa558c30
Rust
illumination-k/cmfmt
/src/main.rs
UTF-8
2,125
2.515625
3
[ "MIT" ]
permissive
extern crate anyhow; extern crate pulldown_cmark; extern crate pulldown_cmark_to_cmark; extern crate toml; #[cfg(test)] #[macro_use] extern crate maplit; #[macro_use] extern crate serde; use anyhow::Result; use utils::write_string; use std::{ env::var, fs, path::{Path, PathBuf}, process::exit, }; us...
true
67840d8f864ff252eecad0fca4fae89776ac5d7f
Rust
michidk/feather
/feather/server/src/entities.rs
UTF-8
1,847
2.921875
3
[ "Apache-2.0" ]
permissive
use base::{EntityKind, Position}; use ecs::{EntityBuilder, EntityRef, SysResult}; use quill_common::entity_init::EntityInit; use uuid::Uuid; use crate::{Client, NetworkId}; /// Component that sends the spawn packet for an entity /// using its components. pub struct SpawnPacketSender(fn(&EntityRef, &Client) -> SysResu...
true
0905f66ef069c0c73ed80aac136e5c70468d923b
Rust
shizhongpwn/CodeAndItsSafety
/Rust/minigrep/main.rs
UTF-8
1,158
3.21875
3
[]
no_license
use std::env; use std::fs; use std::process; use std::error::Error; /* mod lib; 这样的方式也可以引入lib中的内容 use lib::*; */ use minigrep::Config; use minigrep::run; fn main() { let args: Vec<String> = env::args().collect(); let config = Config::new(&args).unwrap_or_else(|err| { // 这里的err算是对new返回的错误进行接收 println!...
true
3c80e9fabf20c40651e1d02b437e033b8a2623f2
Rust
jaw-sh/sea-orm
/src/database/statement.rs
UTF-8
4,405
3.046875
3
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use crate::DbBackend; use sea_query::{inject_parameters, MysqlQueryBuilder, PostgresQueryBuilder, SqliteQueryBuilder}; pub use sea_query::{Value, Values}; use std::fmt; /// Defines an SQL statement #[derive(Debug, Clone, PartialEq)] pub struct Statement { /// The SQL query pub sql: String, /// The values f...
true
789bea0f88fceff375e581b3079b028961ca95be
Rust
DarrenTsung/hyper-http-connector
/src/dns/ip_addrs.rs
UTF-8
3,094
3.65625
4
[ "MIT" ]
permissive
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; pub(crate) struct IpAddrs { ips: Vec<SocketAddr>, current: usize, offset: usize, } impl IpAddrs { pub fn new(port: u16, mut ips: Vec<Ipv4Addr>, offset: usize) -> IpAddrs { ips.sort(); let ips = ips ...
true
765dfc6234805fbb96f35bb60d0c5bcb1fc58b9f
Rust
julian0zzx/rpl
/chapter7_crate/src/main.rs
UTF-8
636
3.578125
4
[]
no_license
mod sound { pub fn guitar() { println!("guitar in sound"); } pub mod voice { pub fn guitar() { // super::guitar(); // use super to call parent's mod/function println!("guitar in movie in sound"); } } } fn main() { println!("Hello, world!"); // c...
true
e5418e597c5b7c9262d8a7b282ef4139a4e7d124
Rust
DevinBayly/migrant_deaths_spatial_conversion
/src/main.rs
UTF-8
10,575
3.046875
3
[]
no_license
use rand::prelude::*; use serde::{Serialize}; use std::fs::read; use std::fs::write; mod obj_reader; mod csv_reader; #[derive(Debug)] struct Extent { min: f32, max: f32, unset: bool, } impl Extent { fn new() -> Self { Self { min: 0.0, max: 0.0, unset: true, ...
true
2b1895b5ef66644e99846496c130c4cafb3b1fd2
Rust
0xack13/RAProxy
/src/haproxy.rs
UTF-8
3,719
2.703125
3
[]
no_license
use std::io::Read; use std::str::FromStr; use std::{io, fs, num}; use std::os::unix::io::RawFd; use std::collections::HashMap; use std::process::{Command, Child}; use nix; use nix::sys::socket; use nix::sys::socket::SetSockOpt; use config::{Config, ServiceSpec}; struct Listener; #[derive(Debug)] pub struct HAProxy<...
true
5901d05c34cae62704c05eb69126e228a8a61b9a
Rust
nrc/tikv-bench
/src/main.rs
UTF-8
1,666
2.515625
3
[]
no_license
#![feature(async_await, await_macro, test, type_ascription)] use tikv_client::{raw::Client, Config, Error, Value}; use std::time::Instant; const PD: &str = "127.0.0.1:2379"; const COUNT: usize = 10_000; async fn run_tests(pd: String) -> Result<(), Error> { let config = Config::new(&[pd]); let unconnnected_cl...
true
87fe3aca7435c2a88a3b3017cab5d77b91819ae7
Rust
togatoga/procon-archive
/atcoder.jp/m-solutions2019/m_solutions2019_d/Main.rs
UTF-8
2,810
3.125
3
[]
no_license
use std::collections::BinaryHeap; use std::collections::VecDeque; fn solve() { let s = std::io::stdin(); let mut sc = Scanner { stdin: s.lock() }; let n: usize = sc.read(); let mut degrees = vec![0; n]; let mut values = vec![0; n]; let mut edges: Vec<Vec<usize>> = vec![vec![]; n]; for i in 0...
true
074327fda9352f6ee9b90e0c7c160b42da164e9a
Rust
qeebr/rust-like
/src/gen/monster.rs
UTF-8
4,337
2.671875
3
[]
no_license
extern crate rand; use rand::Rng; use super::super::character::entity::*; use super::super::character::item::*; use super::super::character::stats::*; use super::item::*; pub fn create_monster(player: &Entity, mut monster: &mut Entity, mn_type: u32, diff: u32) { match mn_type { 1 => { monster....
true
b2866cf956a029924b4de1e40850770916712ce3
Rust
Connor1996/RayTracing
/src/bvh.rs
UTF-8
3,170
3.234375
3
[]
no_license
use std::cmp::Ordering; use std::ops::RangeInclusive; use std::sync::Arc; use crate::aabb::AABB; use crate::hit::{HitRecord, Hittable}; use crate::ray::Ray; use crate::util::random_usize_range; pub struct BVH { left: Option<Arc<dyn Hittable>>, right: Option<Arc<dyn Hittable>>, bounding_box: AABB, } impl ...
true
860e578b77a2598539cb8f0c88dc9411188643c1
Rust
jrhea/hobbits-rs
/src/encoding/marshal.rs
UTF-8
4,934
2.9375
3
[ "MIT" ]
permissive
use crate::encoding::EwpError; use std::mem::transmute; use byteorder::{BigEndian, WriteBytesExt}; pub use super::envelope::{Envelope}; /// Marshal takes a parsed message and encodes it to a wire protocol message pub fn marshal(msg: &Envelope) -> Result<Vec<u8>, EwpError> { let mut outbytes: Vec<u8> = Envelope:...
true
cbf40c74fec28e9439567b3f6f67d0d97658dac5
Rust
H2CO3/database_dsl_complexity
/ExampleData/complexity_metrics/src/metrics/weighted_node_count.rs
UTF-8
7,198
3.09375
3
[]
no_license
use sqlparser::ast::*; use crate::visitor::{ Visitor, Acceptor }; /// Visitor for computing the "weighted nodes in the AST" metric. #[derive(Clone, Default, Debug)] struct WeightedNodeCountVisitor { /// State for accumulating the complexity metric. complexity: usize, } impl Visitor for WeightedNodeCountVisito...
true
ea035530c97126fe799a5e76b2f5de969fc982aa
Rust
strake/i-o.rs
/src/lib.rs
UTF-8
15,747
3
3
[ "MIT", "Apache-2.0" ]
permissive
//! Input/Output #![no_std] #![cfg_attr(test, feature(plugin))] #![cfg_attr(test, plugin(quickcheck_macros))] #![deny(missing_debug_implementations)] extern crate containers; extern crate either; extern crate loca; extern crate void; #[cfg(test)] extern crate quickcheck; #[cfg(test)] extern crate rand; #[cfg(test)...
true
c4550efe32a2772283b6f66708dcdebf875b6e28
Rust
JokerYa55/captcha_generator_rust
/src/routes/user.rs
UTF-8
1,152
2.8125
3
[]
no_license
use rocket::*; use serde::{Deserialize, Serialize}; use rocket_contrib::json::Json; use rocket_contrib::uuid::Uuid; #[derive(Serialize, Deserialize)] pub struct Response { status: String, message: String, } impl Response { fn ok(msg: &str) -> Self { Response { status: "Success".to_stri...
true
0786761c77586b13836692a50143eecacb292b4f
Rust
bigdatajim2020/nibble
/src/settings.rs
UTF-8
904
2.875
3
[]
no_license
use config::{ConfigError, Config, File}; use serde::Deserialize; use std::env; #[derive(Deserialize)] pub struct Settings { pub rpc_port: u32, pub tcp_port: u32, pub web_port: u32, pub data_dir: String, pub miner_enabled: bool, pub bootstrap_node: Option<String>, } impl Settings { pub fn n...
true
442f24ba7d7d59d79be77e14656df2467fa21723
Rust
Alexhuszagh/bdb
/src/db/uniprot/xml.rs
UTF-8
35,751
2.6875
3
[ "Apache-2.0", "MIT" ]
permissive
//! Helper utilities for XML loading and saving. //! //! This module, especially the implementation of the reader, is quite //! difficult to understand, due to the low-level optimizations and the //! SAX-like API present for the pull XML parser. The module is copiously //! commented to try to facilitate maintainability...
true
f99d035c62d0edf0d9dc512d61f01c54db1ce6e2
Rust
Monnoroch/mockall
/mockall/tests/mock_generic_method_returning_nonstatic.rs
UTF-8
1,139
3.203125
3
[ "Apache-2.0", "MIT" ]
permissive
// vim: tw=80 //! A generic method whose return value's lifetime is a generic parameter is a //! special case. Mockall can only mock such methods if the expectation is //! 'static. //! https://github.com/asomers/mockall/issues/76 use mockall::*; #[derive(Clone)] struct X<'a>(&'a u32); mock! { Thing { fn...
true
0a015fc846f27df275d2cb3af59b0217f6fcdb64
Rust
zhangzhishan/rust_jieba
/tests/tests.rs
UTF-8
521
2.578125
3
[]
no_license
extern crate jieba; // use jieba; #[test] fn it_works() { let result = jieba::jieba::cut(String::from("我来到北京清华大学")); // assert_eq!(vec!("我", "来到", "北京", "清华", "清华大学", "华大", "大学"), result); assert_eq!(vec!("我", "来到", "北京", "清华大学"), result); // assert_eq!(vec!(String::from("他"), String::from(...
true
9bf2ecb3682a4a70207660d0f0210e2b62bfdf21
Rust
stamp711/md4rip
/src/builder.rs
UTF-8
3,677
3.140625
3
[]
no_license
use crate::collision::CollisionFinder; use crate::common::*; use crate::state::MD4State; use std::io; #[derive(Default)] pub struct Builder { input_bytes: u64, buffer: BlockBuffer<U64>, state: MD4State, timeout_sec: usize, jpeg_mode: bool, } impl Builder { pub fn new() -> Builder { Bui...
true
bb502e00d78258f570f465d6d26f7cb16809d18a
Rust
blursed/blursed_bot
/src/net/reddit_client.rs
UTF-8
1,765
2.5625
3
[ "MIT" ]
permissive
use crate::net::auth::Auth; use crate::shared::config::Config; use rand::prelude::*; use reqwest; use reqwest::header::AUTHORIZATION; use reqwest::Client; use serde::{Deserialize, Serialize}; pub struct RedditClient<'a> { auth: Auth<'a>, config: &'a Config, client: &'a Client, blursed_url_path: String,...
true
6fc34cec77bd209b70502d4dee460c90e38dd2b0
Rust
Happy-Ferret/combustion
/combustion_game/src/components/light.rs
UTF-8
1,888
3.09375
3
[]
no_license
//! Lighted component use specs; use nalgebra::Point3; #[derive(Copy, Clone, Debug)] pub enum Kind { /// Directional light infinitely far away, with all rays parallel Directional, /// One-dimensional point light in space Point { /// Spherical radius of light from point. Used for attenuation. ...
true
4785e4541edf605dc232cf590dc2442891f2e91f
Rust
kiliankoe/htwdresden-rs
/src/lib.rs
UTF-8
2,183
2.96875
3
[ "MIT" ]
permissive
extern crate reqwest; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate chrono; mod grades; pub use grades::{Course, Grade}; mod exams; pub use exams::Exam; mod lesson; pub use lesson::Lesson; mod rooms; pub use rooms::Room; mod semester; pub use semester::{SemesterPlan, Period, Holiday}; ...
true
75449fde8414104b02a57561122f0e3932512c99
Rust
IamfromSpace/cube
/src/move_sets.rs
UTF-8
32,361
2.828125
3
[]
no_license
pub mod quarter_turns { #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Serialize, Deserialize)] pub enum QuarterTurn { U, UPrime, F, FPrime, R, RPrime, B, BPrime, L, LPrime, D, DPrime, } ...
true
2ee9e0ff5694c4d40b6ec953841cae62db9bd2ec
Rust
arraypad/tui-image
/src/lib.rs
UTF-8
4,781
3.046875
3
[ "MIT" ]
permissive
use failure::Error; use image::{imageops::resize, imageops::FilterType, RgbaImage}; use std::cmp::{max, min}; use tui::buffer::Buffer; use tui::layout::{Alignment, Rect}; use tui::style::{Color, Style}; use tui::widgets::{Block, Widget}; pub enum ColorMode { Luma, Rgb, } const BLOCK_LIGHT: char = '\u{2591}'; const ...
true
8f341bbce861b63ea4d697dcc1561041186e345e
Rust
nimalar/Advent-of-Code
/2019/day11.rs
UTF-8
4,662
2.890625
3
[]
no_license
use std::env; use std::fs::File; use std::io::prelude::*; use std::cmp; fn make_room(ref mut p:&mut Vec<i64>, index:usize) -> i64 { if index >= p.len() { p.resize(index + 1, 0); } return p[index]; } fn program(ref mut p:&mut Vec<i64>, ref mut input_signals:&mut Vec<i64>, ref mut output_signals:&mut Vec<i64>, mu...
true
d7a864bfc872179e954a9033d44a4d69e995ee9b
Rust
royswale/leetcode
/src/bin/maximum-score-after-splitting-a-string.rs
UTF-8
594
3.21875
3
[ "MIT" ]
permissive
fn main() {} struct Solution; impl Solution { pub fn max_score(s: String) -> i32 { let (mut score, mut left, mut right) = (0, 0, 0); let s = s.as_bytes(); for i in 1..s.len() { if s[i] == b'1' { right += 1; } } for i in 0..s.len() -...
true
03a8351cc942be5b3b656cd940d1bc6f858b197d
Rust
ReedKrawiec/compactor
/src/main.rs
UTF-8
2,457
3.25
3
[]
no_license
use std::env; use std::fs; use std::io; fn process_directory(dir:String, diff:u64) -> io::Result<()>{ for entry in fs::read_dir(dir)?{ let metadata = entry?; let path = metadata.path(); let metadata = metadata.metadata()?; match metadata.accessed(){ Ok(a) => { ...
true
37c819189f5dcfa750188f636779051e7be3545b
Rust
vorot93/rust-btrfs
/src/diskformat/filesystem.rs
UTF-8
9,983
2.78125
3
[ "MIT" ]
permissive
use super::prelude::*; pub struct BtrfsFilesystem<'a> { devices: &'a BtrfsDeviceSet<'a>, chunk_tree: BtrfsChunkTree<'a>, filesystem_trees: HashMap<u64, BtrfsFilesystemTree<'a>>, root_tree: BtrfsRootTree<'a>, } impl<'a> BtrfsFilesystem<'a> { pub fn open_try_backups( output: &Output, ...
true
3112087481e0432eee50a465fa92fdcb1da8e19e
Rust
msmith491/rust-embed
/examples/http.rs
UTF-8
700
2.59375
3
[ "MIT" ]
permissive
extern crate hyper; use hyper::Server; use hyper::server::Request; use hyper::server::Response; use hyper::uri::RequestUri::AbsolutePath; mod assets; fn handle_index(req: Request, res: Response) { match req.uri { AbsolutePath(ref path) => { println!("GET {:?}", &path); if &path[..]...
true
69e337b1fcb6a496becf8f71566d34ab3453bb8a
Rust
zirman/tet-rust
/src/linear/vector.rs
UTF-8
3,504
3.328125
3
[ "Apache-2.0", "MIT" ]
permissive
pub struct V2 { arr: [f32; 2], } impl V2 { pub fn new(x: f32, y: f32) -> Self { V2 { arr: [x, y] } } pub fn x(&self) -> f32 { self.arr[0] } pub fn y(&self) -> f32 { self.arr[1] } pub fn dot(&self, rhs: &Self) -> f32 { self.x() * rhs.x() + self.y() * rhs.y...
true
e72a5995eb9677f696b85e2a1a89cf090135d84d
Rust
LightHero/lightspeed
/email/src/repository/no_ops_email.rs
UTF-8
1,125
2.5625
3
[ "MIT" ]
permissive
use crate::model::email::EmailMessage; use crate::repository::email::EmailClient; use lightspeed_core::error::LightSpeedError; use log::warn; /// A EmailClient implementation that does nothing. #[derive(Clone, Default)] pub struct NoOpsEmailClient {} impl NoOpsEmailClient { pub fn new() -> Self { Self::de...
true
37dc273319d4d48c4a7701b1137899b7f32826f4
Rust
xea/squiddy
/squiddy-agent/src/lang/compiler.rs
UTF-8
850
2.984375
3
[ "Apache-2.0" ]
permissive
use super::ast::{Node, Processor}; use super::super::state::State; use super::SquiddyProgram; pub struct Compiler { } impl Processor for Compiler { type NodeType = Node; type ResultType = Result<SquiddyProgram, CompilerError>; fn process(&mut self, node: Self::NodeType) -> Self::ResultType { let...
true
ac0763bb985da1c4f735db9f4b356d48a8af6655
Rust
y-ich/gtp-rust
/src/api.rs
UTF-8
10,530
3.390625
3
[ "MIT" ]
permissive
//! This API contains all you will need to interface your //! your bot algorithm with the GTPv2 protocol. //! Your main task will be to implement the GoBot trait. use std::str::FromStr; use std::vec::Vec; /// Contains all the possible errors your bot /// may return to the library. /// Be careful, any callback returni...
true
99c68a4b587e63df42dc1abc36389868bfc5082e
Rust
ks3645/advent_of_code2017
/src/day13.rs
UTF-8
1,528
3.453125
3
[]
no_license
use utils; use utils::Part; pub fn solve(part:Part) -> i32 { let mut input = String::new(); utils::read_input_to_string(&mut input, 13).unwrap(); do_the_thing(input, part) } fn do_the_thing(input:String, part:Part) -> i32 { let mut out = 0; let mut firewall:Vec<(i32,i32)> = Vec::new(); for ...
true
45f34b09acbcf0456993e1608a8826e174f71b58
Rust
anookinov-training-ground/rust_adder_workspace
/add-one/src/lib.rs
UTF-8
238
2.890625
3
[]
no_license
// cargo publish // use rand; pub fn add_one(x: i32) -> i32 { x + 1 } // adder_workspace % cargo test -p add-one #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { assert_eq!(3, add_one(2)); } }
true
ddd64edfd162e7b714beaa2323e44fcb3c2ace00
Rust
mihyaeru21/rust-analyzer
/crates/ra_hir/src/adt.rs
UTF-8
4,980
2.796875
3
[ "Apache-2.0", "MIT" ]
permissive
use std::sync::Arc; use ra_db::Cancelable; use ra_syntax::ast::{self, NameOwner, StructFlavor}; use crate::{ DefId, Name, AsName, db::HirDatabase, type_ref::TypeRef, }; pub struct Struct { def_id: DefId, } impl Struct { pub(crate) fn new(def_id: DefId) -> Self { Struct { def_id } } ...
true
37727e02e5ad208d3ea29cca131f76c7079ac2b8
Rust
csixteen/LeetCode
/Problems/Algorithms/src/Rust/insert-delete-getrandom/src/lib.rs
UTF-8
2,450
3.578125
4
[ "MIT" ]
permissive
// https://leetcode.com/problems/insert-delete-getrandom-o1/ #![allow(dead_code)] use rand::{thread_rng, Rng}; use std::cell::RefCell; use std::collections::HashMap; #[derive(Default)] struct RandomizedSet { map: RefCell<HashMap<i32, usize>>, vec: RefCell<Vec<i32>>, } impl RandomizedSet { fn new() -> S...
true
08892f0c8d210b9b04a8e7c0e17afa7f1e9c9a43
Rust
johnterickson/rust
/src/test/rustdoc-ui/suggestions/html-as-generics.rs
UTF-8
802
2.515625
3
[ "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "MIT", "LicenseRef-scancode-other-permissive", "NCSA" ]
permissive
// run-rustfix #![deny(rustdoc::invalid_html_tags)] /// This Vec<i32> thing! //~^ERROR unclosed HTML tag `i32` //~|HELP try marking as source pub struct Generic; /// This vec::Vec<i32> thing! //~^ERROR unclosed HTML tag `i32` //~|HELP try marking as source pub struct GenericPath; /// This i32<i32> thing! //~^ERROR u...
true
9153770b8f346e11acf1c99643e36b1d3735739b
Rust
tirust/msp432e4
/src/crc/ctrl.rs
UTF-8
21,237
3.03125
3
[ "BSD-3-Clause" ]
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::CTRL { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w...
true
a76d20dc9f1f4642a608c471b6b4ff6be4055b9a
Rust
akoptelov/extfmt
/src/slice.rs
UTF-8
2,720
4.15625
4
[ "Apache-2.0" ]
permissive
//! Formatting options for slices. use core::fmt::*; /// Format a slice in a Rust syntax. /// Supports formatting using the following traits: /// - Display /// - Debug /// - Binary /// - Octal /// - LowerHex, UpperHex /// - LowerExp, UpperExp /// - Pointer /// /// # Examples /// ``` /// use extfmt::*; /// /// ...
true
0701dfed972fd66bf672daa8b99ba5ec677c498d
Rust
KonishchevDmitry/pyvsb-to-cloud
/src/config.rs
UTF-8
6,584
2.609375
3
[]
no_license
use std::fmt; use std::fs::File; use std::io::{self, Read, Write}; use std::path::{Path, PathBuf, Component}; use std::process; use std::time::Duration; use clap::{App, Arg, AppSettings}; use regex::Regex; use serde::de::{self, Deserializer, Visitor}; use crate::core::GenericResult; #[derive(Deserialize)] #[serde(de...
true
58e22c9982a572387572fc64e6aa890eec240df5
Rust
dropbox/rust-alloc-no-stdlib
/src/allocator.rs
UTF-8
209
2.515625
3
[ "BSD-3-Clause" ]
permissive
pub trait Allocator<T> { type AllocatedMemory : super::AllocatedSlice<T>; fn alloc_cell(&mut self, len : usize) -> Self::AllocatedMemory; fn free_cell(&mut self, data : Self::AllocatedMemory); }
true
064bba2080278773ac5ba26e95e96ee270d13054
Rust
frustak/Quest
/src/actions.rs
UTF-8
1,511
3.140625
3
[ "MIT" ]
permissive
//! Actions to do after a specific event occurs use crate::{App, InputMode, Quest}; pub fn new_quest(app: &mut App) { app.input_mode = InputMode::Adding; app.selected_quest = None; } pub fn exit_app(app: &mut App) { app.should_exit = true; } pub fn list_up(app: &mut App) { if let Some(index) = app.s...
true
0055bccba114bf55755de642c417f763456672fc
Rust
veniamin-ilmer/crate-race
/benches/vec_intsort/_dmsort.rs
UTF-8
1,279
2.6875
3
[ "Apache-2.0" ]
permissive
use bencher::Bencher; use rand::{thread_rng, Rng}; pub fn baseline(b: &mut Bencher) { let answer_vec: Vec<u32> = (0..1).collect(); b.iter(|| { let mut test_vec: Vec<u32> = (0..1).collect(); dmsort::sort(&mut test_vec); assert_eq!(test_vec, answer_vec); }); } pub fn sorted(b: &mut Bencher) { let a...
true
0bfb28caadca5ce52e97aa11613e54199b67f26d
Rust
benediktwerner/WikiLinkAnalyzer
/src/graph.rs
UTF-8
3,772
2.9375
3
[]
no_license
use rand::Rng; use std::collections::{HashMap, HashSet, VecDeque}; use std::fs::File; use std::io::BufReader; pub struct Graph { pub graph: HashMap<usize, HashSet<usize>>, } impl Graph { pub fn load(reverse: bool) -> Graph { let graph_file = if reverse { println!("Loading reverse graph .."...
true
674992e9f71ceeed891d143f18d5299d5d9ecc5a
Rust
elder-george/pas-rs
/src/token.rs
UTF-8
2,927
3.609375
4
[]
no_license
use logos::Logos; #[derive(Debug, PartialEq, Clone, Logos)] pub(crate) enum Token { #[token("begin")] Begin, #[token("end")] End, #[token("if")] If, #[token("then")] Then, #[token("else")] Else, #[token("while")] While, #[token("do")] Do, #[regex("[a-zA-Z][a-...
true
13d2ab53524ddb536c6bf55f24b94d74d225bc89
Rust
actors-rs/actors.rs
/src/kernel/queue.rs
UTF-8
2,075
3.09375
3
[ "MIT" ]
permissive
use std::sync::{ mpsc::{channel, Receiver, Sender}, Mutex, }; use crate::{Envelope, Message}; pub fn queue<Msg: Message>() -> (QueueWriter<Msg>, QueueReader<Msg>) { let (tx, rx) = channel::<Envelope<Msg>>(); let qw = QueueWriter { tx }; let qr = QueueReaderInner { rx, next_item: ...
true
a5f3208eb711ff43e69fe93e28694be412bf35b9
Rust
pombredanne/geodesic
/src/net/messages.rs
UTF-8
10,536
2.828125
3
[ "MIT" ]
permissive
use bytes::Bytes; use bytes::{Buf, BufMut, BytesMut, IntoBuf}; use std::collections::HashSet; use tokio::codec::{Decoder, Encoder}; use tokio::io::{Error, ErrorKind}; use secp256k1::key::PublicKey; use secp256k1::Signature; use crypto::signatures::ecdsa::*; use crypto::sketches::iblt::*; use primitives::transaction::...
true
1db3078895243887515a8e014e9cc0651ec3f015
Rust
mocsy/playground_rs_mac
/zul_aman/src/main.rs
UTF-8
1,155
2.65625
3
[ "MIT" ]
permissive
extern crate azul; use azul::prelude::*; use azul::widgets::{ button::Button, label::Label, table_view::TableView, text_input::TextInput }; struct CounterApplication { counter: usize, } impl Layout for CounterApplication { fn layout(&self, _info: WindowInfo<Self>) -> Dom<Self> { let label = Label:...
true
bc605f377be3936d2b5e2fae73dc9bbd8045526a
Rust
islab-official/biiot-prototype
/network/src/p2p.rs
UTF-8
963
2.6875
3
[]
no_license
use std::net::{UdpSocket, Ipv4Addr}; use std::io; use std::str::FromStr; pub struct P2pService { socket: UdpSocket, commands: Vec<u8> } impl P2pService { pub fn new() -> Self { let ip = Ipv4Addr::from_str("").unwrap(); let socket = UdpSocket::bind("0.0.0.0:8504").unwrap(); socket.s...
true
09be1d4f53f0fbe4369ff78d1f18b148d042bd0d
Rust
michaelmelanson/risp
/src/codegen/x86_64/function.rs
UTF-8
1,064
2.9375
3
[ "MIT" ]
permissive
use memmap2::Mmap; use crate::{ codegen::{self, FuncPointer}, value::Value, }; #[derive(Debug)] pub struct Function { #[allow(dead_code)] memory_map: Mmap, ptr: codegen::FuncPointer, } impl PartialEq for Function { fn eq(&self, other: &Self) -> bool { self.ptr == other.ptr } } im...
true
5b6c481752b803bf43054218ea47e9b3ee52cb37
Rust
delta1024/redblocks
/src/lib.rs
UTF-8
7,740
3.265625
3
[]
no_license
/*!# About Redblocks is a library inspired by dwmblocks for creating your own status blocks that writes to XROOTNAME?. Primaraly intended for along side the [Penrose] library. # Dependencies * xsetroot # Usage Requirments Using redblock is intended to be simple, baring creating custom pligins; if this is not the case ...
true
2dddb2858d71ea2fe0947586bf570f5da2448cf4
Rust
keiichiw/advent-of-code-2020
/day7/main.rs
UTF-8
3,725
3.203125
3
[ "MIT" ]
permissive
use std::collections::btree_map::Entry; use std::collections::{BTreeMap, BTreeSet}; use utils::read_strings; #[derive(Clone, PartialEq, Eq, Debug, Default, PartialOrd, Ord)] struct Color { adj: String, name: String, } fn parse(input: &str) -> (Color, Vec<(u32, Color)>) { use lazy_static::lazy_static; ...
true
beda959980b2e45a685ec59eb4fe2494ea064e2e
Rust
chantera/monolith
/examples/tagger/dataset.rs
UTF-8
2,647
2.515625
3
[ "Apache-2.0" ]
permissive
use monolith::lang::prelude::*; use monolith::dataset::{conll, StdLoader}; pub use monolith::dataset::Load; use monolith::preprocessing::Preprocess; use monolith::preprocessing::Vocab; static CHAR_PADDING: &'static str = "<PAD>"; /// (word_ids, char_ids, tag_ids) of a sentence. pub type Sample = (Vec<u32>, Vec<Vec<u3...
true
73cd8df8f4d0fd1d8414a1bfd0f9e3dbb47fa975
Rust
hummans/sharewifi
/src/windows.rs
UTF-8
1,588
2.84375
3
[ "MIT" ]
permissive
use std::process::Command; use crate::errors::{AppResult, Error}; pub fn connected_ssid() -> AppResult<String> { let output = Command::new("netsh") .arg("wlan") .arg("show") .arg("interface") .output() .expect("Unable to get Wi-Fi info"); let wifi_info = String::fr...
true
13560afb5e16e42358aca9b889f04358b81ba5d5
Rust
lparth/conduit
/policy-controller/k8s/status/src/http_route.rs
UTF-8
3,071
2.8125
3
[ "Apache-2.0" ]
permissive
use crate::resource_id::ResourceId; use anyhow::Result; use linkerd_policy_controller_k8s_api::{ gateway, policy::{self, Server}, }; /// Represents an HTTPRoute's parent reference from its spec. /// /// This is separate from the policy controller index's `InboundParentRef` /// because it does not validate that...
true
76e155c30b9b6bc45138c1675e5205a4e62fa50e
Rust
regexident/optimization-engine
/src/core/solver_status.rs
UTF-8
1,293
3.171875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
//! Status of the result of a solver (number of iterations, etc) //! //! pub use crate::core::SolverStatus; impl SolverStatus { /// Constructs a new instance of SolverStatus /// /// ## Arguments /// /// - `converged` whether the algorithm has converged to a solution up to /// the specified to...
true
36eeb540d524ecc82aa85af19624b48301b72537
Rust
wez/max32630
/max32630_svd/src/flc/ctrl/mod.rs
UTF-8
18,845
2.78125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "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::CTRL { #[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
d8824def906c9e31bdc11b89c8f718fb00efcd37
Rust
polunzh/rust-demo
/ownership/src/main.rs
UTF-8
920
3.953125
4
[]
no_license
fn takes_ownership(some_str: String) { println!("{}", some_str); } fn makes_copy(some_integer: i32) { println!("{}", some_integer); } fn get_length(s: &String) -> usize { s.len() } fn main() { // let mut s = String::from("zhang"); // s.push_str(" zhen"); // s.push_str(" qiang"); // let y = s; ...
true
5b3487c5a713009a60e4fb4efdce86462cf5008b
Rust
rachlmac/sos-kernel
/cpu/src/x86_64/msr.rs
UTF-8
1,285
3.046875
3
[ "MIT", "Apache-2.0" ]
permissive
// // SOS: the Stupid Operating System // by Hawk Weisman (hi@hawkweisman.me) // // Copyright (c) 2015 Hawk Weisman // Released under the terms of the MIT license. See `LICENSE` in the root // directory of this repository for more information. // //! Code for interacting with the Model-Specific Registers (MSRs). ...
true
ef42ebaa91c12a733be985695413347a59373942
Rust
dannbuckley/rust-algorithms
/decrease-and-conquer/quickselect/src/main.rs
UTF-8
1,762
3.828125
4
[ "MIT" ]
permissive
use std::cmp::Ordering; use std::mem; // courtesy of https://stackoverflow.com/a/28294764 fn swap<T>(x: &mut [T], i: usize, j: usize) { let (lo, hi) = match i.cmp(&j) { // no swapping necessary Ordering::Equal => return, // get the smallest and largest of the two indices Ordering::...
true
48f389215afb399c99f18485e7875896601d1b9a
Rust
kaidokert/manticore
/src/serde.rs
UTF-8
3,733
2.890625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 //! Internal `serde` helpers. #![allow(clippy::from_str_radix_10)] use core::fmt::Binary; use core::fmt::LowerHex; use core::marker::PhantomData; #[cfg(feature = "std...
true
b6d7d01ad54debbbbbb0c9ec096f7ffa5be3da60
Rust
Dace617/skyrim-cell-dump
/src/bin/cli.rs
UTF-8
1,901
2.90625
3
[]
no_license
use std::path::PathBuf; use std::{fs::read, str::FromStr}; use anyhow::{anyhow, Error, Result}; #[cfg(feature = "build-binary")] use argh::FromArgs; use skyrim_cell_dump::parse_plugin; enum Format { Json, PlainText, } impl FromStr for Format { type Err = Error; fn from_str(s: &str) -> Result<Self> {...
true
4bc60c6e5118962dd3d4e82273e91d640007f141
Rust
Gryff/rust-wasm-pack-example
/src/lib.rs
UTF-8
489
2.703125
3
[]
no_license
#![feature(proc_macro, wasm_import_module, wasm_custom_section)] extern crate wasm_bindgen; use wasm_bindgen::prelude::*; #[wasm_bindgen] extern { fn alert(s: &str); } #[wasm_bindgen] #[no_mangle] pub extern fn add(a: i32, b: i32) -> i32 { a + b } #[wasm_bindgen] #[no_mangle] pub extern fn add_alert(a: i32, ...
true
c6fe393f168c9e41336d94cf915b7bad96bfe2f7
Rust
borntyping/rust-riemann_client
/src/client/hostname.rs
UTF-8
1,039
3.359375
3
[ "MIT" ]
permissive
//! Wrapper around the hostname function from libc use std::iter::repeat; use std::io::{Error,ErrorKind,Result}; use libc::{c_char,c_int,size_t}; extern { pub fn gethostname(name: *mut c_char, size: size_t) -> c_int; } /// Calls `gethostname` pub fn hostname() -> Result<String> { // Create a buffer for the ...
true
60ffc54424fc5ab8ff47238112ebd534a48aefd6
Rust
arduano/cake
/src/gui/src/window.rs
UTF-8
3,108
2.59375
3
[]
no_license
use std::time::Duration; use imgui::Context; use imgui_wgpu::{Renderer, RendererConfig}; use imgui_winit_support::WinitPlatform; use wgpu::{Instance, Surface, SwapChain, TextureFormat}; use winit::window::Window; use crate::application::ApplicationGraphics; pub trait DisplayWindow { // fn create_window(&self, i...
true
c095d88936f3dec08836687f0045802e01213810
Rust
jonvaldes/recense
/src/errors.rs
UTF-8
1,044
2.953125
3
[ "Unlicense" ]
permissive
pub trait Context<T, E> { fn with_context<C, F>(self, f: F) -> Result<T, failure::Error> where C: std::fmt::Display + Send + Sync + 'static, F: FnOnce() -> C; } impl<T, E> Context<T, E> for ::std::result::Result<T, E> where E: failure::Fail, { fn with_context<C, F>(self, context_func: F...
true
a9f0745e426cb8cde8e78f86058a402bb53a4f58
Rust
untoreh/sailfish
/sailfish-compiler/src/parser.rs
UTF-8
12,733
3.109375
3
[ "MIT" ]
permissive
// TODO: Better error message (unbalanced rust delimiter, etc.) // TODO: disallow '<%' token inside code block use memchr::{memchr, memchr2, memchr3}; use std::convert::TryInto; use std::rc::Rc; use crate::{Error, ErrorKind}; macro_rules! unwrap_or_break { ($val:expr) => { match $val { Some(t...
true
b824a4d5d26e3fdab3ec488c6396853916fdf51b
Rust
tik-stbuehler/axxon-ox16pci954-flash
/src/pci/endpoint.rs
UTF-8
10,442
2.796875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
use std::fmt; use std::fs; use std::io::{ self, Read, Write, }; use std::num::ParseIntError; use std::str; use super::Driver; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct SlotFunction(pub u8); impl SlotFunction { pub fn slot(&self) -> u8 { self.0 >> 3 } pub fn function(&self) -> u...
true
45e28c8eb66ed717403b5a4ec73ec6fd34ed69f3
Rust
BNationsDEV/Oxygengine
/oxygengine-script-flow/src/vm.rs
UTF-8
58,590
2.53125
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
use crate::{ast, ast::*, Guid}; use core::prefab::{PrefabNumber, PrefabValue}; use petgraph::{ algo::{has_path_connecting, toposort}, Direction, Graph, }; use std::{ collections::{BTreeMap, HashMap}, ops::{Deref, DerefMut}, sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard}, }; const VERSION: u...
true
e5735025588c15fabbdc45625f30cc2a5e522e62
Rust
Devolutions/devolutions-crypto
/devolutions-crypto/src/error.rs
UTF-8
5,716
3.015625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
//! Possible errors in the library. use std::fmt; #[cfg(feature = "wbindgen")] use wasm_bindgen::JsValue; use strum_macros::IntoStaticStr; use block_modes::{BlockModeError, InvalidKeyIvLength}; use hmac::crypto_mac::InvalidKeyLength; use hmac::crypto_mac::MacError; /// This crate's error type. #[derive(Debug, Into...
true
0030ea308fc28b0f148717c936c8999bf83cb7a7
Rust
ndr-brt/ruzen
/server/src/plot.rs
UTF-8
989
2.65625
3
[]
no_license
use gnuplot::{Figure, AxesCommon}; use gnuplot::Coordinate::Graph; use gnuplot::PlotOption::Caption; use crate::synth::ugen::{UGen, ValueAt}; pub(crate) trait Plot { fn plot(self); } impl<T> Plot for UGen<T> where T: ValueAt { fn plot(self) { const SAMPLE_RATE: usize = 1000; let mut x_axis: [...
true
8214dee438a9e778544d22a3362b53dec39ed891
Rust
Lokathor/fermium
/src/renderer.rs
UTF-8
41,984
2.9375
3
[]
no_license
//! SDL's portable 2D rendering functions. //! //! This API supports the following features: //! * single pixel points //! * single pixel lines //! * filled rectangles //! * texture images //! //! The primitives may be drawn in opaque, blended, or additive modes. //! //! The texture images may be drawn in opaque, blend...
true
e116de8c93abb9903d5dbf3396fdb33876e0ad01
Rust
julianandrews/sgf-parse
/src/unknown_game.rs
UTF-8
2,586
3.515625
4
[ "MIT" ]
permissive
//! Generic types for SGFs without a known game. //! //! This module contains a generic [`SgfProp`] implementation appropriate //! for use with any SGF file. This implementation recognizes all [general //! properties](https://www.red-bean.com/sgf/properties.html), but any game //! specific property will parse as [`Prop...
true
dda22d23276421ee3835d267dc1e0845aac5804d
Rust
SamuelBeliveau/advent-of-code-2019
/src/question_13/mod.rs
UTF-8
2,771
3.125
3
[]
no_license
use crate::util::{read_op_codes, print_positions}; use std::collections::HashMap; use crate::int_code::run_program; pub fn solve_ab() { let mut op_codes = read_op_codes("src/question_13/input.txt"); let mut current_position = 0; let mut relative_base = 0; let mut tiles: HashMap<(i64, i64), Ti...
true
7155e26843401d4af797854e72f6d415b47c6cb9
Rust
neoeinstein/sqlx
/sqlx-core/src/mysql/row.rs
UTF-8
1,537
2.65625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
use std::sync::Arc; use hashbrown::HashMap; use crate::error::Error; use crate::ext::ustr::UStr; use crate::mysql::{protocol, MySql, MySqlTypeInfo, MySqlValueFormat, MySqlValueRef}; use crate::row::{ColumnIndex, Row}; // TODO: Merge with the other XXColumn types #[derive(Debug, Clone)] pub(crate) struct MySqlColumn ...
true
5c123d982e3e7e5decb8f9429c62756708d93e8c
Rust
rillrate-fossil/rillrate
/pkg-core/rill-engine/src/config.rs
UTF-8
2,141
2.828125
3
[ "Apache-2.0" ]
permissive
//! Configuration structs for the provider and tracers use rill_protocol::config::ConfigPatch; use rill_protocol::io::provider::{EntryId, StreamType}; use serde::Deserialize; /// The external user app can set this value to override default server. /// If embedded server started it can put its socket address here. pub...
true
fbb400f61565798b8697557e882c4915bbe07bc1
Rust
biluohc/zipcs
/src/coll/unzip.rs
UTF-8
8,956
2.625
3
[ "MIT" ]
permissive
use super::consts::*; use chardet::{charset2encoding, detect}; use encoding::label::encoding_from_whatwg_label; use encoding::DecoderTrap; use filetime::{set_symlink_file_times, FileTime}; use zip::read::ZipArchive; use zip::result::ZipError; // https://docs.rs/filetime/ not follow symlink? use std; use std::error::E...
true
8da7a283ea9402ab630038a90b38e5247b1e83bd
Rust
ergoplatform/sigma-rust
/ergotree-interpreter/src/eval/extract_bytes_with_no_ref.rs
UTF-8
1,347
2.765625
3
[ "CC0-1.0" ]
permissive
use ergotree_ir::mir::extract_bytes_with_no_ref::ExtractBytesWithNoRef; use ergotree_ir::mir::value::Value; use crate::eval::env::Env; use crate::eval::EvalContext; use crate::eval::EvalError; use crate::eval::Evaluable; impl Evaluable for ExtractBytesWithNoRef { fn eval(&self, env: &Env, ctx: &mut EvalContext) -...
true
1b5f21535c522ebaae722111f9db95b99323d1c7
Rust
Redblueflame/gluesql
/src/data/value.rs
UTF-8
17,230
2.984375
3
[ "Apache-2.0" ]
permissive
use boolinator::Boolinator; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; use std::convert::{TryFrom, TryInto}; use std::fmt::Debug; use thiserror::Error as ThisError; use sqlparser::ast::{DataType, Expr, Ident, Value as AstValue}; use crate::executor::GroupKey; use crate::result::{Error, Result}; #[d...
true
0d902418dd00422a03daeca53e9e70b59a6ea204
Rust
veltzer/demos-rust
/src/variables/unused_variable_directive.rs
UTF-8
321
2.828125
3
[ "Apache-2.0" ]
permissive
#![allow(unused)] // This is an example of an unused variabe. // If you disable the compiler directive above you will get a compilation error. // another option is to call the variable _* which allows it to be unused (similar to python). fn main() { let _x: i32=0; let x: i32=0; println!("Hello World!"); }...
true
19828737ee906cbd7e620a8a27c620e5d4d6a1a6
Rust
IThawk/rust-project
/rust-master/src/test/ui/type/type-alias-bounds.rs
UTF-8
2,398
3.0625
3
[ "MIT", "LicenseRef-scancode-other-permissive", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "NCSA" ]
permissive
// Test `ignored_generic_bounds` lint warning about bounds in type aliases. // build-pass (FIXME(62277): could be check-pass?) #![allow(dead_code)] use std::rc::Rc; type SVec<T: Send + Send> = Vec<T>; //~^ WARN bounds on generic parameters are not enforced in type aliases [type_alias_bounds] type S2Vec<T> where T: S...
true
c02c2d4a62f62e6ed2ccd2129aa4116b4f8a133a
Rust
brooks-builds/game_template_platform
/src/entity/mod.rs
UTF-8
4,911
3.234375
3
[ "MIT" ]
permissive
use ggez::nalgebra::Vector2; use ggez::{Context, GameResult}; use crate::draw_system::DrawSystem; use crate::drawables::Drawables; use crate::physics_system::PhysicsSystem; use self::entity_state::EntityState; pub mod builder; pub mod entity_data; pub mod entity_state; pub mod entity_type; #[derive(Debug)] pub stru...
true
edf0777766fbe237819a23b0ae0c12088165ddb9
Rust
GaloisInc/mir-verifier
/lib/libtest/formatters/terse.rs
UTF-8
8,262
2.609375
3
[]
permissive
use std::{io, io::prelude::Write}; use super::OutputFormatter; use crate::{ bench::fmt_bench_samples, console::{ConsoleTestState, OutputLocation}, test_result::TestResult, time, types::NamePadding, types::TestDesc, }; // insert a '\n' after 100 tests in quiet mode const QUIET_MODE_MAX_COLUMN: ...
true
8d1e53bb98495ee682db7ee5310a382cf10cecdd
Rust
clucompany/macro_tt_utils
/src/data/if_args/cond_seq_blocks.rs
UTF-8
1,287
2.6875
3
[ "MIT", "Apache-2.0" ]
permissive
use alloc::vec::Vec; use crate::data::if_args::EqSeqBlocks; use crate::data::if_args::SeqBlocks; pub trait ConditionSeqBlocks { type SeqB: SeqBlocks; fn new() -> Self; fn with_capacity(u: usize) -> Self; fn new_seq_blocs(&mut self) -> &mut Self::SeqB; fn is_equality(&self) -> EqSeqBlocks; } impl<SeqB> Co...
true
06974bdeffb6a93bfbaeba9f3aca4f937695492c
Rust
ivfranco/notes
/Dragon_Book/chapter_8/ershov/src/lib.rs
UTF-8
2,955
3.109375
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
pub mod builder; pub mod machine_code; pub mod utils; use lalrpop_util::lalrpop_mod; use std::cmp; use std::error::Error; lalrpop_mod!(pub grammar); pub type Var = char; #[derive(Debug, Clone, Copy)] pub enum BinOp { Add, Sub, Mul, Div, } impl BinOp { fn code(self) -> &'static str { use...
true