commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
ba2617f7dd04281b38c7c5cd581e5200de059d67
src/class/hash.rs
src/class/hash.rs
use std::convert::From; use binding::hash; use types; use super::object; use super::traits::RawObject; pub struct Hash { value: types::rb_value } impl Hash { pub fn new() -> Self { Hash { value: hash::new() } } pub fn at<T: RawObject>(&self, key: T) -> object::Object { ...
use std::convert::From; use binding::hash; use types; use super::object; use super::traits::RawObject; pub struct Hash { value: types::rb_value } impl Hash { pub fn new() -> Self { Hash { value: hash::new() } } pub fn at<T: RawObject>(&self, key: T) -> object::Object { ...
Add different trait constraints to Hash store()
Add different trait constraints to Hash store()
Rust
mit
d-unseductable/ruru
fdab70538e523709d1f3e9a58d61cd6721c7cb2b
src/main.rs
src/main.rs
//#![feature(libc)] extern crate libc; extern crate rand; extern crate rustc_serialize; use rand::*; mod yubikey; fn random_challenge() -> Vec<u8> { let mut vec: Vec<u8> = Vec::new(); for _ in 0..64 { vec.push(rand::random()); } vec } fn main() { yubikey::yubikey_init(); let yk = yu...
#![allow(unused_variables)] #![allow(dead_code)] extern crate libc; extern crate rand; extern crate rustc_serialize; use rand::*; mod yubikey; fn random_challenge() -> Vec<u8> { let mut vec: Vec<u8> = Vec::new(); for _ in 0..64 { vec.push(rand::random()); } vec } fn main() { yubikey::yu...
Allow unused functions & dead_code
Allow unused functions & dead_code This should be removed again when things start to stabilize, but at the moment it's spamming my rustc output which is very annoying.
Rust
mit
jbothma/yubikey-fde,tazjin/yubikey-fde,tazjin/yubikey-fde,jbothma/yubikey-fde
7c65188536fe7c9081284536d8b4d8865d1117ac
src/material/specular_metal.rs
src/material/specular_metal.rs
//! Defines a specular metal material use std::vec::Vec; use film::Colorf; use geometry::Intersection; use bxdf::{BxDF, BSDF, SpecularReflection, fresnel}; use material::Material; /// The Specular Metal material describes specularly reflective metals using their /// refractive index and absorption coefficient pub st...
//! Defines a specular metal material use std::vec::Vec; use film::Colorf; use geometry::Intersection; use bxdf::{BxDF, BSDF, SpecularReflection}; use bxdf::fresnel::{Fresnel, Conductor}; use material::Material; /// The Specular Metal material describes specularly reflective metals using their /// refractive index a...
Clean up specular metal imports a bit
Clean up specular metal imports a bit
Rust
mit
GuzTech/tray_rust,voidException/tray_rust,Twinklebear/tray_rust
966bf159c612692d059602153177d68676f29398
src/script/lex_script_tool.rs
src/script/lex_script_tool.rs
use serde_json::*; use super::super::lex::*; /// /// Creates a lexing tool for the scripting language /// pub fn create_lex_script_tool() -> StringLexingTool { // Parse the lexer let script_json = from_str::<Vec<LexToolSymbol>>(include_str!("syntax_lexer.json")).unwrap(); // The name isn't used here, but...
use serde_json::*; use super::super::lex::*; /// /// Creates a lexing tool for the scripting language /// pub fn create_lex_script_tool() -> StringLexingTool { // Parse the lexer let script_json = from_str::<Vec<LexToolSymbol>>(include_str!("syntax_lexer.json")).unwrap(); // The name isn't used here, but...
Add some tests to make sure we can parse the syntax JSON file
Add some tests to make sure we can parse the syntax JSON file
Rust
apache-2.0
Logicalshift/gossyp,Logicalshift/gossyp
c877a6c44324b0135017ab1e1300c0d666746c84
core/platform/src/syscalls_impl.rs
core/platform/src/syscalls_impl.rs
//! Implements `Syscalls` for all types that implement `RawSyscalls`. use crate::{RawSyscalls, Syscalls, YieldNoWaitReturn}; mod yield_op { pub const NO_WAIT: u32 = 0; pub const WAIT: u32 = 1; } impl<S: RawSyscalls> Syscalls for S { // ---------------------------------------------------------------------...
//! Implements `Syscalls` for all types that implement `RawSyscalls`. use crate::{RawSyscalls, Syscalls, YieldNoWaitReturn}; mod yield_op { pub const NO_WAIT: u32 = 0; pub const WAIT: u32 = 1; } impl<S: RawSyscalls> Syscalls for S { // ---------------------------------------------------------------------...
Move yield_no_wait's flag init out of `unsafe`.
Move yield_no_wait's flag init out of `unsafe`. Turns out core::mem::MaybeUninit::uninit is not `unsafe`!
Rust
apache-2.0
tock/libtock-rs
32b9e1c74726dab76b802fccd6fc07924ca6aa14
kernel/fs/kscheme.rs
kernel/fs/kscheme.rs
use super::{Resource, Url}; use alloc::boxed::Box; use system::error::{Error, Result, ENOENT}; use system::syscall::Stat; #[allow(unused_variables)] pub trait KScheme { fn on_irq(&mut self, irq: u8) { } fn scheme(&self) -> &str { "" } fn open(&mut self, path: Url, flags: usize) -> Resu...
use super::{Resource, Url}; use alloc::boxed::Box; use system::error::{Error, Result, EPERM}; use system::syscall::Stat; #[allow(unused_variables)] pub trait KScheme { fn on_irq(&mut self, irq: u8) { } fn scheme(&self) -> &str { "" } fn open(&mut self, path: Url, flags: usize) -> Resul...
Return EPERM in the default KScheme implementation
Return EPERM in the default KScheme implementation
Rust
mit
tedsta/redox,tedsta/redox,nounoursheureux/redox,nounoursheureux/redox,vvlevchenko/redox,tedsta/redox,vvlevchenko/redox,imp/redox,nounoursheureux/redox,tedsta/redox,imp/redox,imp/redox,vvlevchenko/redox
ba4f188168c11f61f8db79a00a166fe0a1c6a378
tests/test_stmt.rs
tests/test_stmt.rs
#[macro_use] mod macros; use syn::Stmt; #[test] fn test_raw_operator() { let stmt = syn::parse_str::<Stmt>("let _ = &raw const x;").unwrap(); snapshot!(stmt, @r###" Local(Local { pat: Pat::Wild, init: Some(Verbatim(`& raw const x`)), }) "###); } #[test] fn test_raw_variable() { ...
#[macro_use] mod macros; use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree}; use std::iter::FromIterator; use syn::Stmt; #[test] fn test_raw_operator() { let stmt = syn::parse_str::<Stmt>("let _ = &raw const x;").unwrap(); snapshot!(stmt, @r###" Local(Local { pat: Pat::Wild,...
Add none-group statement parsing test
Add none-group statement parsing test
Rust
apache-2.0
dtolnay/syn
b3b179ecb40c894ed09b9a92b704c65898c69a10
src/buffer/buffer.rs
src/buffer/buffer.rs
use std::io::{File, Open, ReadWrite}; use std::io::IoResult; use super::GapBuffer; use super::gap_buffer; use super::Position; use super::Range; pub struct Buffer { data: GapBuffer, file: Option<File>, cursor: Position, selection: Option<Range>, } pub fn from_file(path: &Path) -> IoResult<Buffer> { ...
use std::io::{File, Open, ReadWrite}; use std::io::IoResult; use super::GapBuffer; use super::gap_buffer; use super::Position; use super::Range; pub struct Buffer { data: GapBuffer, file: Option<File>, } pub fn from_file(path: &Path) -> IoResult<Buffer> { // Try to open and read the file, returning any er...
Remove cursor and selection fields; these should be handled by the UI.
Remove cursor and selection fields; these should be handled by the UI.
Rust
mit
jmacdonald/scribe
1bd22ab70be8f812677143742d011a06bb1ea799
src/gauge.rs
src/gauge.rs
pub struct Gauge<T> { pub value: T } impl<T> Gauge<T> { pub fn update(&mut self, value: T) { self.value = value } pub fn snapshot(self) -> Gauge<T> { Gauge { value: self.value } } } #[cfg(test)] mod test { use gauge::Gauge; #[test] fn create_and_snapshot() { ...
pub struct StdGauge<T> { pub value: T } pub trait Gauge<T> { fn update(&mut self, value: T); fn snapshot(self) -> Self; } impl<T> Gauge<T> for StdGauge<T> { fn update(&mut self, value: T) { self.value = value } fn snapshot(self) -> StdGauge<T> { StdGauge { value: self.value ...
Use traits and type specifiable
Use traits and type specifiable
Rust
apache-2.0
cstorey/rust-metrics,chridou/rust-metrics,waywardmonkeys/rust-metrics,waywardmonkeys/rust-metrics,cstorey/rust-metrics,chridou/rust-metrics
9f078a33062ff75d24b011acbf8887a1dce778ae
rust/hello.rs
rust/hello.rs
// Run with `rust run hello.rs` fn greeter(greeting_text: &str) { println(fmt!("Hello %s!", greeting_text)); } fn main() { greeter("World"); }
// compile with `rustc hello.rs` // run with `./hello` fn greeter(greeting_text: &str) { println!("Hello {}!", greeting_text); } fn main() { greeter("World"); }
Make Rust example work in post-rust-1.0 world
Make Rust example work in post-rust-1.0 world
Rust
mit
pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds
4835b75be9f221c00d3ec5c6035829f05dc71e16
src/application.rs
src/application.rs
use Application; use ffi; use gio::ApplicationFlags; use glib::object::IsA; use glib::translate::*; use rt; use glib; use glib_ffi; impl Application { #[cfg(feature = "v3_6")] fn new(application_id: Option<&str>, flags: ApplicationFlags) -> Result<Application, glib::BoolError> { skip_assert_initialized...
use Application; use ffi; use gio::ApplicationFlags; use glib::object::IsA; use glib::translate::*; use rt; use glib; use glib_ffi; impl Application { #[cfg(feature = "v3_6")] pub fn new<'a, I: Into<Option<&'a str>>>(application_id: I, flags: ApplicationFlags) -> Result<Application, glib::BoolError> { ...
Change gtk::Application::new parameter to use Into<Option<&str>>
Change gtk::Application::new parameter to use Into<Option<&str>> Signed-off-by: Jean Pierre Dudey <341388fa1817ca285e65547384a9727ce7f6d39a@hotmail.com>
Rust
mit
rust-gnome/gtk,EPashkin/rust-gnome-gtk,EPashkin/rust-gnome-gtk,rust-gnome/gtk
678cd7ac7b0fb2482d93a9ceccb8824a9eb3c646
src/aserror.rs
src/aserror.rs
use std::error::Error; pub trait AsDynError { fn as_dyn_error(&self) -> &(dyn Error + 'static); } impl<T: Error + 'static> AsDynError for T { fn as_dyn_error(&self) -> &(dyn Error + 'static) { self } } impl AsDynError for dyn Error + 'static { fn as_dyn_error(&self) -> &(dyn Error + 'static) ...
use std::error::Error; pub trait AsDynError { fn as_dyn_error(&self) -> &(dyn Error + 'static); } impl<T: Error + 'static> AsDynError for T { #[inline] fn as_dyn_error(&self) -> &(dyn Error + 'static) { self } } impl AsDynError for dyn Error + 'static { #[inline] fn as_dyn_error(&self...
Make the trivial as_dyn_error impls inlinable
Make the trivial as_dyn_error impls inlinable
Rust
apache-2.0
dtolnay/thiserror
9579d00951996a2216cd87ca4caa4ca111feeca9
src/macros.rs
src/macros.rs
#[macro_export] macro_rules! poll { ($e:expr) => ({ loop { match $e { ::futures::__rt::Ok(::futures::Async::Ready(e)) => { break ::futures::__rt::Ok(e) } ::futures::__rt::Ok(::futures::Async::NotReady) => {} ::fu...
#[macro_export] macro_rules! poll { ($e:expr) => ({ loop { match $e { ::futures::__rt::Ok(::futures::Async::Ready(e)) => { break ::futures::__rt::Ok(e) } ::futures::__rt::Ok(::futures::Async::NotReady) => {} ::fu...
Fix API in new `futures-await`
Fix API in new `futures-await`
Rust
unlicense
iovxw/plasmodesmata
ecfdbab9474e73794c3d108979cfdc72682a8e14
libimagentrylist/src/cli.rs
libimagentrylist/src/cli.rs
use clap::{Arg, App, SubCommand}; pub fn build_list_cli_component<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name(list_subcommand_name()) .author("Matthias Beyer <mail@beyermatthias.de>") .version("0.1") .about("List entries") } pub fn list_subcommand_name() -> &'static str { "list" }...
use clap::{Arg, App, SubCommand}; pub fn build_list_cli_component<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name(list_subcommand_name()) .author("Matthias Beyer <mail@beyermatthias.de>") .version("0.1") .about("List entries") .arg(Arg::with_name(list_backend_line()) ...
Add default arguments for builtin lister backends
Add default arguments for builtin lister backends
Rust
lgpl-2.1
matthiasbeyer/imag,mario-kr/imag,matthiasbeyer/imag,mario-kr/imag
500adddb73b40aae388d5aa417bd87c366fe469a
crypto-square/src/lib.rs
crypto-square/src/lib.rs
pub fn encrypt(text: &str) -> String { let text = text.to_lowercase() .chars() .filter(|c| c.is_lowercase()) .collect::<Vec<_>>(); if text.is_empty() { return String::new(); } let rows = (text.len() as f64).sqrt() as usize; let cols = (text.len() as f64 / rows as f6...
pub fn encrypt(text: &str) -> String { let text = text.to_lowercase() .chars() .filter(|c| c.is_lowercase()) .collect::<Vec<_>>(); let size = (text.len() as f64).sqrt().ceil() as usize; (0..size) .map(|r| { (0..size) .filter_map(|c| text.get(c * ...
Improve solution for Crypto Square
Improve solution for Crypto Square
Rust
mit
attilahorvath/exercism-rust
19ed8c3e24a285e398a274bc5548d950929d6192
src/front/interactive.rs
src/front/interactive.rs
use js::exec::{Executor, Interpreter}; use syntax::Lexer; use syntax::Parser; use getopts::Matches; use std::io::stdio::stdin; use std::io::{BufReader, BufferedReader}; /// An interactive command-line mode pub struct Interactive { m: Matches } impl Interactive { /// Create a new interactive mode info pub fn new(m: M...
use js::exec::{Executor, Interpreter}; use syntax::Lexer; use syntax::Parser; use getopts::Matches; use std::io::stdio::stdin; use std::io::{BufReader, BufferedReader}; /// An interactive command-line mode pub struct Interactive { m: Matches } impl Interactive { /// Create a new interactive mode info pub fn new(m: M...
Move verbose output into condition
Move verbose output into condition
Rust
mit
new-mind/js.rs,synlestidae/js.rs,TomBebbington/js.rs,synlestidae/js.rs,TomBebbington/js.rs,new-mind/js.rs
060d83133fc4ed433f8b310dd771236b222299ce
tests/tests.rs
tests/tests.rs
extern crate test; extern crate ndarray; use ndarray::Array; #[bench] fn time_matmul(b: &mut test::Bencher) { b.iter(|| { let mut a: Array<uint, (uint, uint)> = Array::zeros((2u, 3u)); for (i, elt) in a.iter_mut().enumerate() { *elt = i; } let mut b: Array<uint, (uint,...
extern crate test; extern crate ndarray; use ndarray::Array; #[test] fn char_array() { // test compilation & basics of non-numerical array let cc = Array::from_iter("alphabet".chars()).reshape((4u, 2u)); assert!(cc.at_sub(1, 0) == Array::from_iter("apae".chars())); } #[bench] fn time_matmul(b: &mut test:...
Add test for Array of char
Add test for Array of char
Rust
apache-2.0
Pireax/rust-ndarray,SuperFluffy/rust-ndarray,SuperFluffy/rust-ndarray,Pireax/rust-ndarray
642239c857124b109f43f7223baddbe8694c84ee
tests/ui/zero_offset.rs
tests/ui/zero_offset.rs
fn main() { unsafe { let m = &mut () as *mut (); m.offset(0); m.wrapping_add(0); m.sub(0); m.wrapping_sub(0); let c = &() as *const (); c.offset(0); c.wrapping_add(0); c.sub(0); c.wrapping_sub(0); let y = &1 as *const i32; ...
fn main() { unsafe { let m = &mut () as *mut (); m.offset(0); m.wrapping_add(0); m.sub(0); m.wrapping_sub(0); let c = &() as *const (); c.offset(0); c.wrapping_add(0); c.sub(0); c.wrapping_sub(0); let sized = &1 as *const i32;...
Update var name in test
Update var name in test
Rust
apache-2.0
graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust
ed7e4e1e27d21d47b93f756e615b5cb750275c3f
src/test/run-pass/union/union-const-eval-field.rs
src/test/run-pass/union/union-const-eval-field.rs
// 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 ...
// 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 ...
Expand union test to include different types
Expand union test to include different types
Rust
apache-2.0
GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust
00f207c71e29e501c521a3d480f432d63976c2a0
src/lib.rs
src/lib.rs
#![crate_type = "lib"] #![crate_name = "leveldb"] #![feature(globs,phase)] #![phase(syntax, link)] extern crate log; extern crate serialize; extern crate libc; pub use database::options as options; pub use database::error as error; pub use database::iterator as iterator; mod cbits; pub mod database;
#![crate_type = "lib"] #![crate_name = "leveldb"] #![feature(globs)] extern crate serialize; extern crate libc; pub use database::options as options; pub use database::error as error; pub use database::iterator as iterator; pub mod cbits; pub mod database;
Make the cbits public for those who want
Make the cbits public for those who want
Rust
mit
skade/leveldb,alekseysidorov/leveldb,alekseysidorov/leveldb
f7bdf86e870f03591c0728679cc47d189200094a
json_tests/tests/test.rs
json_tests/tests/test.rs
#![cfg_attr(feature = "nightly-testing", feature(plugin))] #![cfg_attr(feature = "nightly-testing", plugin(clippy))] #![cfg_attr(not(feature = "with-syntex"), feature(proc_macro, plugin))] #![cfg_attr(not(feature = "with-syntex"), plugin(indoc))] #[cfg(not(feature = "with-syntex"))] #[macro_use] extern crate serde_de...
#![cfg_attr(feature = "nightly-testing", feature(plugin))] #![cfg_attr(feature = "nightly-testing", plugin(clippy))] #![cfg_attr(not(feature = "with-syntex"), feature(plugin))] #![cfg_attr(not(feature = "with-syntex"), plugin(indoc))] #[cfg(not(feature = "with-syntex"))] #[macro_use] extern crate serde_derive; exter...
Remove the proc_macro feature gate
Remove the proc_macro feature gate
Rust
apache-2.0
bolinfest/serde-jsonrc,serde-rs/json,google/serde_json_lenient
4225638710ee2e63238c48f86e93d1445ba2c485
benches/file.rs
benches/file.rs
// $ cargo bench --features full --bench file #![feature(rustc_private, test)] #![recursion_limit = "1024"] #![allow(clippy::missing_panics_doc, clippy::must_use_candidate)] extern crate test; #[macro_use] #[path = "../tests/macros/mod.rs"] mod macros; #[path = "../tests/common/mod.rs"] mod common; #[path = "../tes...
// $ cargo bench --features full --bench file #![feature(rustc_private, test)] #![recursion_limit = "1024"] #![allow(clippy::missing_panics_doc, clippy::must_use_candidate)] extern crate test; #[macro_use] #[path = "../tests/macros/mod.rs"] mod macros; #[path = "../tests/common/mod.rs"] mod common; #[path = "../tes...
Add baseline benchmark to distinguish TokenStream::clone from syn::parse2
Add baseline benchmark to distinguish TokenStream::clone from syn::parse2
Rust
apache-2.0
dtolnay/syn
2d5f019f262c02fefbec0001ae6bd8d6db1c61be
src/container.rs
src/container.rs
use std::any::{ Any }; use std::collections::HashMap; use super::{ GetterErr, Registry }; use super::definition::{ TypeDef }; use super::getter::{ GetterWrap }; pub struct Container { typedefs: HashMap<String, TypeDef>, getters: HashMap<String, Box<Any>>, } impl Container { /// Create container from regi...
use std::any::{ Any }; use std::collections::HashMap; use super::{ GetterErr, Registry }; use super::definition::{ TypeDef }; use super::getter::{ GetterWrap }; pub struct Container { getters: HashMap<String, (TypeDef, Box<Any>)>, } impl Container { /// Create container from registry definitions. pub fn ...
Add typedef together with value.
Add typedef together with value.
Rust
apache-2.0
Nercury/di-rs
48e29168861ef1770e48d59e587e9b4fb4240671
tests/test_parse_buffer.rs
tests/test_parse_buffer.rs
extern crate syn; use syn::{ parse::{Parse, ParseStream}, parse::discouraged::Speculative, Result, }; #[test] #[should_panic(expected = "Fork was not derived from the advancing parse stream")] fn smuggled_speculative_cursor() { struct Smuggled(ParseStream<'static>); impl Parse for Smuggled { ...
#[macro_use] extern crate syn; use syn::{ parse::{Parse, ParseStream}, parse::discouraged::Speculative, Result, }; #[test] #[should_panic(expected = "Fork was not derived from the advancing parse stream")] fn smuggled_speculative_cursor_between_sources() { // don't do this ever this is very unsafe and...
Add speculative smuggling test between bracket contexts
Add speculative smuggling test between bracket contexts
Rust
apache-2.0
dtolnay/syn
c04cd8d882776ccb0d93bc60c85783b9a42c9ca9
tests/inv.rs
tests/inv.rs
extern crate rand; extern crate ndarray; extern crate ndarray_rand; extern crate ndarray_linalg as linalg; use ndarray::prelude::*; use linalg::SquareMatrix; use rand::distributions::*; use ndarray_rand::RandomExt; fn all_close(a: Array<f64, (Ix, Ix)>, b: Array<f64, (Ix, Ix)>) { if !a.all_close(&b, 1.0e-7) { ...
extern crate rand; extern crate ndarray; extern crate ndarray_rand; extern crate ndarray_linalg as linalg; use ndarray::prelude::*; use linalg::SquareMatrix; use rand::distributions::*; use ndarray_rand::RandomExt; fn all_close(a: Array<f64, (Ix, Ix)>, b: Array<f64, (Ix, Ix)>) { if !a.all_close(&b, 1.0e-7) { ...
Add test case which should panic
Add test case which should panic
Rust
mit
termoshtt/ndarray-linalg
11fdd9c3cd22a52f07ae825c742fea5a8ef8d0c1
rust/all-your-base/src/lib.rs
rust/all-your-base/src/lib.rs
/// /// Convert a number between two bases. /// /// A number is any slice of digits. /// A digit is any unsigned integer (e.g. u8, u16, u32, u64, or usize). /// Bases are specified as unsigned integers. /// /// Return an `Err(.)` if the conversion is impossible. /// The tests do not test for specific values inside the ...
pub fn convert(number: &[u32], from_base: u32, to_base: u32) -> Result<Vec<u32>, ()> { if from_base < 2 || to_base < 2 { return Err(()); } if number.iter().any(|&x| x >= from_base) { return Err(()); } let limit = number.iter().fold(0, |acc, &x| acc * from_base + x); let mut r =...
Clean up rust code for all-your-base
Clean up rust code for all-your-base It looks better now
Rust
bsd-2-clause
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
953923c8eff2524590ff7f043cb26451564d218f
src/prodbg/core/src/plugin.rs
src/prodbg/core/src/plugin.rs
///! ///! Standard plugin is of the type of view plugins and backend plugins ///! which follows the same structure in the shared libs ///! use dynamic_reload::Lib; use libc::{c_char, c_void}; use std::rc::Rc; use std::mem::transmute; use std::ffi::CStr; #[repr(C)] pub struct CBasePlugin { pub name: *const c_char,...
///! ///! Standard plugin is of the type of view plugins and backend plugins ///! which follows the same structure in the shared libs ///! use dynamic_reload::Lib; use libc::{c_char, c_void}; use std::rc::Rc; use std::mem::transmute; use std::ffi::CStr; #[repr(C)] pub struct CBasePlugin { pub name: *const c_char,...
Move construction of names to local vars first
Move construction of names to local vars first
Rust
mit
emoon/ProDBG,emoon/ProDBG,SlNPacifist/ProDBG,v3n/ProDBG,kondrak/ProDBG,emoon/ProDBG,SlNPacifist/ProDBG,emoon/ProDBG,kondrak/ProDBG,emoon/ProDBG,kondrak/ProDBG,SlNPacifist/ProDBG,v3n/ProDBG,kondrak/ProDBG,kondrak/ProDBG,SlNPacifist/ProDBG,kondrak/ProDBG,v3n/ProDBG,v3n/ProDBG,emoon/ProDBG,SlNPacifist/ProDBG,v3n/ProDBG,Sl...
d6d0e761c7483f15f11eac338d216a3f10eff832
src/main.rs
src/main.rs
extern crate rustix; use std::io::Read; use std::fs::File; use rustix::bot; use rustix::client::MatrixClient; use rustix::services::echo::*; use rustix::services::self_filter::*; use rustix::services::upvote::*; fn main() { let mut m = MatrixClient::new("https://cclub.cs.wmich.edu/"); let mut password = St...
extern crate rustix; use std::io::Read; use std::fs::File; use rustix::bot; use rustix::client::MatrixClient; use rustix::services::echo::*; use rustix::services::self_filter::*; use rustix::services::upvote::*; fn main() { let mut m = MatrixClient::new("https://cclub.cs.wmich.edu/"); let mut password = St...
Enable show karma module functionality
Enable show karma module functionality
Rust
mit
jpypi/rustix
6366e0bc35f4021e40f684f746dff216fe5c4ca8
src/main.rs
src/main.rs
extern crate orbtk; #[cfg(target_os = "redox")] #[no_mangle] pub fn main() { orbtk::example(); } #[cfg(not(target_os = "redox"))] fn main() { orbtk::example(); }
extern crate orbtk; use orbtk::*; fn real_main(){ let mut window = Window::new(Rect::new(100, 100, 420, 420), "Editor"); TextBox::new() .position(0, 0) .size(420, 420) .place(&mut window); window.exec(); } #[cfg(target_os = "redox")] #[no_mangle] pub fn main() { real_main();...
Replace contents with big text box
Replace contents with big text box
Rust
mit
redox-os/editor,redox-os/orbutils
0600d61f1f1fd54173686e90f3959e3e9fd40848
src/main.rs
src/main.rs
/* ** A simple program that allows basic arithmetic operations using roman numerals and conversions to decimal numbers. */ fn main() { let roman_number = "CLIII"; let decimal_number = to_decimal(&roman_number); println!("The roman number {} is equal to {} in decimal numbers", roman_number, decimal_number); let ...
/* ** A simple program that allows basic arithmetic operations using roman numerals and conversions to decimal numbers. */ fn main() { let roman_numbers = vec!["CliiI", "XxXiV", "CM", "ABC0", "vii"]; for roman_number in roman_numbers { println!("The roman number {} is equal to {} in decimal.", roman_number, to_d...
Add support for lowercase roman numerals.
Add support for lowercase roman numerals.
Rust
mit
tzkhan/roman-rust
6841b2ce5940ac21e53da254a745e7645019ed7f
src/main.rs
src/main.rs
extern crate ultra; fn main() { println!("Hello, World War II"); }
extern crate ultra; use std::io::{stdin, stdout, Write}; use ultra::enigma::Enigma; fn main() { let mut msg = String::new(); print!("Message to encrypt: "); stdout().flush().unwrap(); stdin().read_line(&mut msg).unwrap(); let msg = msg.trim_right(); if !msg.is_empty() { let mut enigma...
Add basic enciphering functionality to CLI
Add basic enciphering functionality to CLI
Rust
mit
iKevinY/ultra
056b0c1cf2c55510f8b1e4698d31b71dce00c3b7
tests/run-pass/deprecated.rs
tests/run-pass/deprecated.rs
#![feature(plugin)] #![plugin(clippy)] #[warn(str_to_string)] //~^WARNING: warning: lint str_to_string has been removed: using `str::to_string` #[warn(string_to_string)] //~^WARNING: warning: lint string_to_string has been removed: using `string::to_string` #[warn(unstable_as_slice)] //~^WARNING: warning: lint unstabl...
#![feature(plugin)] #![plugin(clippy)] #[warn(str_to_string)] //~^WARNING: lint str_to_string has been removed: using `str::to_string` #[warn(string_to_string)] //~^WARNING: lint string_to_string has been removed: using `string::to_string` #[warn(unstable_as_slice)] //~^WARNING: lint unstable_as_slice has been removed...
Remove redundant labels in tests
Remove redundant labels in tests
Rust
apache-2.0
graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust
f70fdecb56171972a79316875deeeaab927cbc28
src/client.rs
src/client.rs
use std::collections::HashMap; use rustc_serialize::json; use schema::{UnitOption, UnitStates}; use fleet::FleetAPI; pub struct Client { fleet: FleetAPI, } impl Client { pub fn new(root_url: &'static str) -> Client { Client { fleet: FleetAPI::new(root_url) } } pub fn cre...
use std::collections::HashMap; use rustc_serialize::json; use schema::{UnitOption, UnitStates}; use fleet::FleetAPI; pub struct Client { fleet: FleetAPI, } impl Client { pub fn new(root_url: &'static str) -> Client { Client { fleet: FleetAPI::new(root_url) } } pub fn cre...
Mark failing test as pending.
Mark failing test as pending.
Rust
mit
jimmycuadra/rust-fleet,jimmycuadra/rust-fleet
ef90893cf7788b54582f843e75bf1c5ad9b9983a
src/tableau/enter_vars.rs
src/tableau/enter_vars.rs
use tableau::tables::Table; pub fn get_enter_var_column_index(table: &Table) -> usize { let table_rows = table.get_rows(); let last_row_index = table_rows.len() - 1; // Select the most negative cell in the objective function row. let mut column_index = 0; // Loop until the end of the basic variable...
use tableau::tables::Table; pub fn get_enter_var_column_index(table: &Table) -> usize { let table_rows = table.get_rows(); let last_row_index = table_rows.len() - 1; // Select the most negative cell in the objective function row. let mut column_index = 0; for i in 0..table_rows[last_row_index].len(...
Remove non-basic variable calculations. Non-basic variables have different meaning.
Remove non-basic variable calculations. Non-basic variables have different meaning.
Rust
mit
MrKonstantinT/rust-cassowary
2d88305417bd7bca7fdfe07ed597ff938dbc1468
guessing_game/src/main.rs
guessing_game/src/main.rs
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn main() { println!("Hello in my guessing game!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); println!("Input your guess, please:"); let mut guess = Strin...
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn main() { println!("Hello in my guessing game!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); loop { println!("Input your guess, please:"); let...
Add loop to allow multiple guesses
Add loop to allow multiple guesses
Rust
mit
pgrzesik/learning-rust
6aa3545e1027e8b2a4f511ad3340e53ac6074c7c
rustrelay/src/relay/relay.rs
rustrelay/src/relay/relay.rs
use mio::*; use mio::tcp::TcpListener; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use super::eventhandler::*; pub struct Relay { port: u16, } impl Relay { pub fn new(port: u16) -> Relay { Relay { port: port } } pub fn start(&self) { println!("Starting on port {...
use mio::*; use mio::tcp::TcpListener; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use super::eventhandler::*; pub struct Relay { port: u16, } impl Relay { pub fn new(port: u16) -> Relay { Relay { port: port } } pub fn start(&self) { println!("Starting on port {...
Call expect() to give an error message
Call expect() to give an error message
Rust
apache-2.0
WPO-Foundation/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet
238c8155a0b425a1a72ff842b7c33db8a497b0dd
src/windowsx.rs
src/windowsx.rs
// Copyright © 2015, Peter Atashian // Licensed under the MIT License <LICENSE.md> //! Macro APIs, window message crackers, and control APIs //1233 pub fn GET_X_LPARAM(lp: ::LPARAM) -> ::c_int { ::LOWORD(lp as ::DWORD) as ::c_int } pub fn GET_Y_LPARAM(lp: ::LPARAM) -> ::c_int { ::HIWORD(lp as ::DWORD) as ::c_int }
// Copyright © 2015, Peter Atashian // Licensed under the MIT License <LICENSE.md> //! Macro APIs, window message crackers, and control APIs //1233 pub fn GET_X_LPARAM(lp: ::LPARAM) -> ::c_int { ::LOWORD(lp as ::DWORD) as i16 as ::c_int } pub fn GET_Y_LPARAM(lp: ::LPARAM) -> ::c_int { ::HIWORD(lp as ::DWORD) as i16 a...
Fix GET_X_LPARAM and GET_Y_LPARAM for negative coordinates
Fix GET_X_LPARAM and GET_Y_LPARAM for negative coordinates
Rust
apache-2.0
jmesmon/winapi-rs,bvinc83/winapi-rs,gentoo90/winapi-rs,Boddlnagg/winapi-rs,tomaka/winapi-rs,ROki1988/winapi-rs,overdrivenpotato/winapi-rs,DenisKolodin/winapi-rs,docbrown/winapi-rs,bungcip/winapi-rs,roblabla/winapi-rs,alexcrichton/winapi-rs,DoumanAsh/winapi-rs,Osspial/winapi-rs,Connorcpu/winapi-rs
e686f05bb5222289026f1e47527daf8de28991ec
script-extractor/src/main.rs
script-extractor/src/main.rs
#[macro_use] extern crate clap; extern crate regex; extern crate xml; pub mod parse; pub mod serialize; use clap::{App, Arg}; use std::fs::File; use std::io::BufReader; fn main() { let args = App::new("script-extractor") .version(&crate_version!()) .about("Parse movie script...
#[macro_use] extern crate clap; extern crate regex; extern crate xml; pub mod parse; pub mod serialize; use clap::{App, Arg}; use std::fs::File; use std::io::{BufReader, Read}; fn main() { let args = App::new("script-extractor") .version(&crate_version!()) .about("Parse movi...
Allow reading the input from stdin
Allow reading the input from stdin
Rust
agpl-3.0
heyLu/fis,heyLu/fis,heyLu/fis,heyLu/fis,heyLu/fis,heyLu/fis
f049aefa24349bc8ef3e021cf973ecf07bc7ef50
21_generics/src/main.rs
21_generics/src/main.rs
fn largest<T>(list: &[T]) -> T { let mut largest = list[0]; for &item in list.iter() { if item > largest { largest = item; } } largest } struct Point<T, U> { x: T, y: U, } impl<T, U> Point<T, U> { fn x(&self) -> &T { &self.x } } impl<T, U> Point<T...
use std::cmp::PartialOrd; fn largest<T: PartialOrd + Copy>(list: &[T]) -> T { let mut largest = list[0]; for &item in list.iter() { if item > largest { largest = item; } } largest } struct Point<T, U> { x: T, y: U, } impl<T, U> Point<T, U> { fn x(&self) -> &T...
Fix largest by adding traits bounds
Fix largest by adding traits bounds
Rust
mit
pgrzesik/learning-rust
cd685eefb48bf16ff1e15205228a758daccb0dd6
testing/tests/hello.rs
testing/tests/hello.rs
#[macro_use] extern crate askama; use askama::Template; #[derive(Template)] // this will generate the code... #[template(path = "hello.html", print = "all")] // using the template in this path, relative // to the templates dir in the crate root struct HelloTemplate<'a> { // the name o...
#[macro_use] extern crate askama; use askama::Template; #[derive(Template)] // this will generate the code... #[template(path = "hello.html")] // using the template in this path, relative // to the templates dir in the crate root struct HelloTemplate<'a> { // the name of the struct ca...
Disable debug output for example by default
Disable debug output for example by default
Rust
apache-2.0
djc/askama,djc/askama,djc/askama
5264bc886bb42cdbd1ce61820ecc19c36dd0ea48
bob/example.rs
bob/example.rs
pub fn reply(message: &str) -> &str { if is_silence(message) { "Fine. Be that way!" } else if is_yelling(message) { "Whoa, chill out!" } else if is_question(message) { "Sure." } else { "Whatever." } } fn is_silence(message: &str) -> bool { message.is_empty() } fn is_yelling(message: &str) -> bool ...
pub fn reply(message: &str) -> &str { if is_silence(message) { "Fine. Be that way!" } else if is_yelling(message) { "Whoa, chill out!" } else if is_question(message) { "Sure." } else { "Whatever." } } fn is_silence(message: &str) -> bool { message == "" } fn is_yelling(message: &str) -> bool { ...
Revert "Make checking for the empty string slightly more idiomatic"
Revert "Make checking for the empty string slightly more idiomatic" This reverts commit 558a7e98cef215c3b75859a08d499264d5fc386c.
Rust
mit
sacherjj/rust,medek/xrust,sacherjj/rust,Rust-Twin-Cities/flaming-octo-wookie,pminten/xrust,Rust-Twin-Cities/flaming-octo-wookie,petertseng/exercism-rust,pminten/xrust,spazm/xrust,Jeff-Hostetler/xrust,spazm/xrust,Jeff-Hostetler/xrust,exercism/xrust,petertseng/exercism-rust,exercism/xrust,ekse/exercism-rust,stevejb71/xru...
c0ac0f798d9e717e2a1b8a08740a472f37626230
src/tree_path.rs
src/tree_path.rs
// Copyright 2013-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use std::slice; use ffi; use glib::translate::*; use TreePath; impl TreePath { pub fn ge...
// Copyright 2013-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use std::slice; use ffi; use glib::translate::*; use TreePath; impl TreePath { pub fn ge...
Return a vector instead of a slice with unbounded lifetime
Return a vector instead of a slice with unbounded lifetime
Rust
mit
gkoz/rust-gnome-gtk,daa84/gtk,EPashkin/rust-gnome-gtk,gkoz/gtk-rs-gtk,Susurrus/gtk,daa84/gtk,rust-gnome/gtk,Susurrus/gtk,gkoz/rust-gnome-gtk,EPashkin/rust-gnome-gtk,gkoz/gtk-rs-gtk,rust-gnome/gtk
00d55bb18eb6eddbf051182ae6d12debff3704d0
13_rectangle_area/src/main.rs
13_rectangle_area/src/main.rs
fn main() { let length = 50; let width = 30; println!( "Area of rectangle with length: {} and width: {} is equal to: {}", length, width, area(length, width) ); } fn area(length: u32, width: u32) -> u32 { length * width }
fn main() { let length = 50; let width = 30; println!( "Area of rectangle with length: {} and width: {} is equal to: {}", length, width, area(length, width) ); let rect = (length, width); println!( "Area of rectangle with length: {} and width: {} is equal to: {}", ...
Add implementation with tuple usage
Add implementation with tuple usage
Rust
mit
pgrzesik/learning-rust
9e435aadefea47c6a13f02259c2b640a58a42ce8
src/input/mod.rs
src/input/mod.rs
mod keyboard; mod mouse; mod state; pub use self::keyboard::{Keyboard, KeyboardState}; pub use self::mouse::{Mouse, MousePosition, MouseProximity, MouseState}; pub use self::state::{Element, Input, InputState, InputDifference, InputTransition, State}; pub use event::{MouseButton, VirtualKeyCode}; #[cfg(test)] mod te...
mod keyboard; mod mouse; mod state; pub use self::keyboard::{Keyboard, KeyboardState}; pub use self::mouse::{Mouse, MousePosition, MouseProximity, MouseState}; pub use self::state::{Input, InputState, InputDifference, InputTransition}; pub use event::{MouseButton, VirtualKeyCode}; #[cfg(test)] mod tests { use su...
Remove re-exports of internal traits.
Remove re-exports of internal traits.
Rust
mit
olson-sean-k/bismuth
aa2c6959418392759bce37e25dcd933d26be8984
tests/test_pinnable_slice.rs
tests/test_pinnable_slice.rs
extern crate rocksdb; use rocksdb::{Options, DB}; #[test] fn test_pinnable_slice() { let path = "_rust_rocksdb_pinnable_slice_test"; let mut opts = Options::default(); opts.create_if_missing(true); let db = DB::open(&opts, path).unwrap(); db.put(b"k1", b"value12345").unwrap(); let result = ...
extern crate rocksdb; mod util; use rocksdb::{Options, DB}; use util::DBPath; #[test] fn test_pinnable_slice() { let path = DBPath::new("_rust_rocksdb_pinnable_slice_test"); let mut opts = Options::default(); opts.create_if_missing(true); let db = DB::open(&opts, &path).unwrap(); db.put(b"k1", b...
Use DBPath in PinnableSlice test
Use DBPath in PinnableSlice test
Rust
apache-2.0
spacejam/rust-rocksdb,spacejam/rust-rocksdb,spacejam/rust-rocksdb
0cae36e79168884c65cece1a6df8051de32f0c8d
toml-query_derive/src/lib.rs
toml-query_derive/src/lib.rs
#![warn(rust_2018_idioms)] use proc_macro::TokenStream; use quote::quote; use syn::{Lit, Meta, MetaNameValue}; #[proc_macro_derive(Partial, attributes(location))] pub fn derive_partial(tokens: TokenStream) -> TokenStream { let ast: syn::DeriveInput = syn::parse(tokens).unwrap(); let mut location: Option<Strin...
#![warn(rust_2018_idioms)] #![allow(clippy::collapsible_match)] use proc_macro::TokenStream; use quote::quote; use syn::{Lit, Meta, MetaNameValue}; #[proc_macro_derive(Partial, attributes(location))] pub fn derive_partial(tokens: TokenStream) -> TokenStream { let ast: syn::DeriveInput = syn::parse(tokens).unwrap(...
Allow collapsible match for better readability
Allow collapsible match for better readability Signed-off-by: Matthias Beyer <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@beyermatthias.de>
Rust
mpl-2.0
matthiasbeyer/toml-query
a59c2b92326e772db71519ba7e0f6506d151d8f4
async/dbus-tokio/src/lib.rs
async/dbus-tokio/src/lib.rs
extern crate dbus; extern crate futures; extern crate tokio_core; extern crate mio; /// Tokio integration for dbus /// /// For examples to get you started, see the examples directory and the Readme. pub mod tree; mod adriver; pub use adriver::{AConnection, AMessageStream, AMethodCall};
extern crate dbus; extern crate futures; extern crate tokio_core; extern crate mio; //! Tokio integration for dbus //! //! What's currently working is: //! //! * Client: Make method calls and wait asynchronously for them to be replied to - see `AConnection::method_call` //! * Get a stream of incoming messages (so yo...
Add doc comment for tokio crate
Add doc comment for tokio crate Signed-off-by: David Henningsson <9ae66a7c420ac43dafc6e60221abac36e5a3336a@ubuntu.com>
Rust
apache-2.0
manuels/dbus-rs
f2be005c8b9f222d4b1322c620f0d1208ef3d22a
rust/programming_rust_notes/annotations.rs
rust/programming_rust_notes/annotations.rs
// This definition works for current file. // Everywhere. #![allow(dead_code)]
// This definition works for current file. // Everywhere. #![allow(dead_code)] // Doc tests. Looks fine. use std::ops::Range; /// Return true if two ranges overlap. /// /// assert_eq!(ranges::overlap(0..7, 3..10), true); /// assert_eq!(ranges::overlap(1..5, 101..105), false); /// /// If either range is empty, ...
Add doctest, just for example sake, it does not work
Add doctest, just for example sake, it does not work
Rust
mit
raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning
1cac56f4dcd9dbbcccdb8fc2a2cdec025ff59cfc
rust/test/time/now_test.rs
rust/test/time/now_test.rs
use test_tools::*; use super::TheModule; // fn basic_test() { use TheModule::*; // test.case( "time::now" ); let got = time::now(); assert!( got > 0 ); // test.case( "time::ms::now" ); let got1 = time::now(); let got2 = time::ms::now(); assert_eq!( got1, got2 ); // // test.case( "time::ns::now"...
use test_tools::*; use super::TheModule; // tests_impls! { #[ test ] fn basic() { use TheModule::*; // test.case( "time::now" ); let got = time::now(); assert!( got > 0 ); // test.case( "time::ms::now" ); let got1 = time::now(); let got2 = time::ms::now(); assert_eq!( got1, g...
Update tests of module `time_tools`, use new test macroses
Update tests of module `time_tools`, use new test macroses
Rust
mit
Wandalen/wTools,Wandalen/wTools
f8fc5c0523c174e27e670525f5fa22d087315507
src/test/ui/issue-49257.rs
src/test/ui/issue-49257.rs
// 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 ...
// 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 ...
Fix error annotations in test
Fix error annotations in test
Rust
apache-2.0
graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust
b83bdb364356236a960e1278f66d0052dd901d11
arch/test/src/interrupt.rs
arch/test/src/interrupt.rs
//! Interrupt instructions static mut INTERRUPTS_ENABLED: bool = false; /// Clear interrupts #[inline(always)] pub unsafe fn disable() { println!("CLEAR INTERRUPTS"); INTERRUPTS_ENABLED = false; } /// Set interrupts #[inline(always)] pub unsafe fn enable() { println!("SET INTERRUPTS"); INTERRUPTS_ENA...
//! Interrupt instructions static mut INTERRUPTS_ENABLED: bool = false; /// Clear interrupts #[inline(always)] pub unsafe fn disable() { println!("CLEAR INTERRUPTS"); INTERRUPTS_ENABLED = false; } /// Set interrupts #[inline(always)] pub unsafe fn enable() { println!("SET INTERRUPTS"); INTERRUPTS_ENA...
Interrupt enable and nop function
Interrupt enable and nop function
Rust
mit
Stephen-Seo/redox,k0pernicus/redox,jackpot51/redox,Yoric/redox,Yoric/redox,Yoric/redox,jackpot51/redox,redox-os/redox,jackpot51/redox
38e8cee9bf0dc61ec44926797706352449510773
examples/dump.rs
examples/dump.rs
extern crate mp4parse; use std::env; use std::fs::File; use std::io::{Read, Take}; use std::thread; fn limit<'a>(f: &'a mut File, h: &mp4parse::BoxHeader) -> Take<&'a mut File> { f.take(h.size - h.offset) } fn dump_file(filename: String) { let mut f = File::open(filename).unwrap(); let task = thread::spa...
extern crate mp4parse; use std::env; use std::fs::File; use std::io::{Read, Take}; use std::thread; fn limit<'a>(f: &'a mut File, h: &mp4parse::BoxHeader) -> Take<&'a mut File> { f.take(h.size - h.offset) } fn read_box(f: &mut File) { match mp4parse::read_box_header(f) { Some(h) => { matc...
Move box reading to a separate function.
Move box reading to a separate function.
Rust
mpl-2.0
kinetiknz/mp4parse-rust,kinetiknz/mp4parse-rust,mozilla/mp4parse-rust
bc4c92d0e1c57db56a927e295f73d77df61927d4
examples/repeat.rs
examples/repeat.rs
extern crate msgflo; use msgflo::participant::{Participant, InfoBuilder, Info}; struct Repeat { state: Option<String>, // we don't really have any state } impl Participant for Repeat { fn info(&self) -> Info { InfoBuilder::new("rust/Repeat") .label("Repeats input as-is") .inpo...
extern crate msgflo; use msgflo::participant::{Participant, InfoBuilder, Info}; struct Repeat { state: Option<String>, // we don't really have any state } impl Participant for Repeat { fn info(&self) -> Info { InfoBuilder::new("rust/Repeat") .label("Repeats input as-is") .inpo...
Remove not-needed unsafe impl Sync
Remove not-needed unsafe impl Sync Now that we're properly trait'ed this is not needed
Rust
mit
msgflo/msgflo-rust
882755291b7f4a4f2107af60415c7cca73d239d9
lib/rs/src/test/prim.rs
lib/rs/src/test/prim.rs
use test::*; use mock::*; macro_rules! test_prim_encode { ($({ $testname:ident, $iter:expr, $variant:ident, $T:ty }),*) => {$( #[test] fn $testname() { for val in $iter { let mut protocol = encode(&val); assert_eq!(protocol.log(), &[Prim($variant(val.clon...
use test::*; use mock::*; use protocol::Type; macro_rules! test_prim_encode { ($({ $testname:ident, $iter:expr, $variant:ident, $T:ty }),*) => {$( #[test] fn $testname() { for val in $iter { let mut protocol = encode(&val); assert_eq!(protocol.log(), &[P...
Add tests for container encoding and decoding.
Add tests for container encoding and decoding.
Rust
apache-2.0
terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift
e7c8edcb79bbd40e898403c1cf2adcaec93f5312
src/lib.rs
src/lib.rs
#![allow(unstable)] extern crate tcod; pub mod engine; pub mod gui; pub mod util;
#![feature(core, collections, io, path)] extern crate tcod; pub mod engine; pub mod gui; pub mod util;
Allow unstable features during alpha
Allow unstable features during alpha
Rust
bsd-3-clause
jgilchrist/rslike
d82d8c947cc1101ea11ef1706357f39d4746458c
src/metadata/mod.rs
src/metadata/mod.rs
mod types; mod parser; mod metadata; pub use self::types::{ Block, BlockData, StreamInfo, Application, VorbisComment, CueSheet, Picture, SeekPoint, CueSheetTrack, CueSheetTrackIndex, PictureType, MetaDataConsumer, }; pub use self::parser::metadata_parser; pub use self::metadata::{ get_stream_info, get_vorb...
mod types; mod parser; mod metadata; pub use self::types::{ Block, BlockData, StreamInfo, Application, VorbisComment, CueSheet, Picture, SeekPoint, CueSheetTrack, CueSheetTrackIndex, PictureType, }; pub use self::parser::metadata_parser; pub use self::metadata::{ get_stream_info, get_vorbis_comment, get_cue_...
Remove public re-exporting of `MetaDataConsumer`
Remove public re-exporting of `MetaDataConsumer`
Rust
bsd-3-clause
sourrust/flac
e73a0a45291e6c46d0fdec5628daac0a4e562676
src/to_ref.rs
src/to_ref.rs
pub trait ToRef<'a> { type Ref: 'a; fn to_ref(&'a self) -> Self::Ref; } pub trait ToMut<'a>: ToRef<'a> { type Mut: 'a; fn to_mut(&'a mut self) -> Self::Mut; } impl<'a, T: 'a> ToRef<'a> for &'a T { type Ref = &'a T; fn to_ref(&'a self) -> Self::Ref { &*self } } impl<'a, T: 'a> T...
pub trait ToRef<'a> { type Ref: 'a; fn to_ref(&'a self) -> Self::Ref; } pub trait ToMut<'a>: ToRef<'a> { type Mut: 'a; fn to_mut(&'a mut self) -> Self::Mut; } impl<'a, T: 'a> ToRef<'a> for &'a T { type Ref = &'a T; fn to_ref(&'a self) -> Self::Ref { &*self } } impl<'a, T: 'a> T...
Add `ToRef` and `ToMut` impls for `()`
Add `ToRef` and `ToMut` impls for `()`
Rust
apache-2.0
kylewlacy/glitter,kylewlacy/glitter
43746342dc764eb1723ff300c1d69f6857c7b1c8
src/concurrency_control.rs
src/concurrency_control.rs
use std::sync::atomic::AtomicBool; use parking_lot::{RwLockReadGuard, RwLockWriteGuard}; use super::*; #[derive(Default)] pub(crate) struct ConcurrencyControl { necessary: AtomicBool, rw: RwLock<()>, } pub(crate) enum Protector<'a> { Write(RwLockWriteGuard<'a, ()>), Read(RwLockReadGuard<'a, ()>), ...
use std::sync::atomic::AtomicBool; use parking_lot::{RwLockReadGuard, RwLockWriteGuard}; use super::*; #[derive(Default)] pub(crate) struct ConcurrencyControl { necessary: AtomicBool, upgrade_complete: AtomicBool, rw: RwLock<()>, } pub(crate) enum Protector<'a> { Write(RwLockWriteGuard<'a, ()>), ...
Fix race condition in the CC upgrade path
Fix race condition in the CC upgrade path
Rust
apache-2.0
spacejam/sled,spacejam/sled,spacejam/sled
ca4e994d00ca5c37a23067e2b5cc0f358d24e740
src/agents/prediction/td.rs
src/agents/prediction/td.rs
use Parameter; use fa::VFunction; use agents::PredictionAgent; use geometry::{Space, NullSpace}; use std::marker::PhantomData; pub struct TD<S: Space, V: VFunction<S>> { v_func: V, alpha: Parameter, gamma: Parameter, phantom: PhantomData<S>, } impl<S: Space, V: VFunction<S>> TD<S, V> { pub fn n...
use Parameter; use fa::{VFunction, Linear}; use agents::PredictionAgent; use geometry::{Space, NullSpace}; use std::marker::PhantomData; pub struct TD<S: Space, V: VFunction<S>> { v_func: V, alpha: Parameter, gamma: Parameter, phantom: PhantomData<S>, } impl<S: Space, V: VFunction<S>> TD<S, V> { ...
Correct return value in TD type
Correct return value in TD type
Rust
mit
tspooner/rsrl
051aa6912ac8bbb5b8059b074dc969a20f4473a3
src/lib.rs
src/lib.rs
// Copyright 2015 Nathan Sizemore <nathanrsizemore@gmail.com> // // This Source Code Form is subject to the terms of the // Mozilla Public License, v. 2.0. If a copy of the MPL was not // distributed with this file, You can obtain one at // http://mozilla.org/MPL/2.0/. #[macro_use] extern crate log; extern crate libc...
// Copyright 2015 Nathan Sizemore <nathanrsizemore@gmail.com> // // This Source Code Form is subject to the terms of the // Mozilla Public License, v. 2.0. If a copy of the MPL was not // distributed with this file, You can obtain one at // http://mozilla.org/MPL/2.0/. #[macro_use] extern crate log; extern crate libc...
Set waiting before io to stop repeat reads
Set waiting before io to stop repeat reads
Rust
mpl-2.0
nathansizemore/hydrogen
88fb6527735aabe34e3a776fe319ebe50813cdcb
src/muxed_root.rs
src/muxed_root.rs
use std::path::posix::Path; use std::os::homedir; static MUXED_NAME_STR: &'static str = "muxed"; /// Return the users current homedir as a string. fn homedir_string() -> String { let home_unwrap = homedir().unwrap(); format!("{}", home_unwrap.display()) } pub fn path() -> Path { Path::new(format!("{}/.{}...
use std::path::posix::Path; #[cfg(not(test))] use std::os::homedir; static MUXED_NAME_STR: &'static str = "muxed"; /// Return the users current homedir as a string. #[cfg(not(test))] fn homedir_string() -> String { match homedir() { Some(dir) => format!("{}", dir.display()), None => fail!("I...
Test the expected Path for muxed root.
Test the expected Path for muxed root.
Rust
mit
brianp/muxed,brianp/muxed
e2006c781b4ef11e99041d3f1dba8cab0173e2b3
tests/crate.rs
tests/crate.rs
extern crate libcratesio; use libcratesio::{CratesIO, Crate, Error}; #[test] fn basic_data() { let krate = Crate::by_name("requests").unwrap(); println!("{:?}", krate); assert_eq!(krate.name, "requests"); } #[test] fn raw_data() { let krate = CratesIO::query("requests").unwrap().as_json().unwrap(); ...
extern crate libcratesio; use libcratesio::{CratesIO, Crate, Error, ErrorKind}; #[test] fn basic_data() { let krate = Crate::by_name("requests").unwrap(); println!("{:?}", krate); assert_eq!(krate.name, "requests"); } #[test] fn raw_data() { let krate = CratesIO::query("requests").unwrap().as_json()....
Add test for error response
Add test for error response
Rust
apache-2.0
imp/libcratesio-rs
6202a4ad55a779bc8f05ee73e837356422ef2fa4
bip_disk/src/disk/builder.rs
bip_disk/src/disk/builder.rs
use disk::fs::FileSystem; use disk::manager::{self, DiskManager}; use futures_cpupool::Builder; const DEFAULT_PENDING_SIZE: usize = 10; const DEFAULT_COMPLETED_SIZE: usize = 10; /// `DiskManagerBuilder` for building `DiskManager`s with different settings. pub struct DiskManagerBuilder { builder: Builder...
use disk::fs::FileSystem; use disk::manager::{self, DiskManager}; use futures_cpupool::Builder; const DEFAULT_PENDING_SIZE: usize = 10; const DEFAULT_COMPLETED_SIZE: usize = 10; /// `DiskManagerBuilder` for building `DiskManager`s with different settings. pub struct DiskManagerBuilder { builder: Builder...
Add Doc Comments For DiskManagerBuilder
Add Doc Comments For DiskManagerBuilder
Rust
apache-2.0
GGist/redox-rs
512144fc92a1eabf1e97f5a586bc1f1dbbf8ed07
examples/print_keyboard_key.rs
examples/print_keyboard_key.rs
#![feature(globs)] extern crate graphics; extern crate piston; use piston::{ AssetStore, Game, GameWindow, GameWindowSDL2, GameWindowSettings, keyboard, }; pub struct App; impl App { /// Creates a new application. pub fn new() -> App { App } } impl Game for App { fn...
#![feature(globs)] extern crate graphics; extern crate piston; use piston::{ AssetStore, Game, GameWindow, GameWindowSDL2, GameWindowSettings, keyboard, }; pub struct App; impl App { /// Creates a new application. pub fn new() -> App { App } } impl Game for App { fn...
Print keycode when released a key
Print keycode when released a key
Rust
mit
oldmanmike/piston,axelmagn/piston,bvssvni/piston,Potpourri/piston,getynge/piston,mitchmindtree/piston,placrosse/piston,KevinFrans3/piston,bvssvni/piston,tempbottle/piston,caldwell/piston,PistonDevelopers/piston,PistonDevelopers/piston
77cc790345066a1b39c22b1284725063167c3c5f
src/lib.rs
src/lib.rs
#![crate_type = "lib"] #![feature(core)] #![feature(no_std, unsafe_destructor)] #![warn(missing_docs)] //! Synchronization primitives based on spinning #![no_std] #[cfg(test)] extern crate std; #[macro_use] extern crate core; pub use mutex::*; pub use rw_lock::*; mod mutex; mod rw_lock; #[cfg(not(test))] mod std...
#![crate_type = "lib"] #![feature(core)] #![feature(no_std, unsafe_destructor)] #![warn(missing_docs)] //! Synchronization primitives based on spinning #![no_std] #[cfg(test)] extern crate std; #[macro_use] extern crate core; pub use mutex::*; pub use rw_lock::*; mod mutex; mod rw_lock;
Remove some now useless code
Remove some now useless code
Rust
mit
tempbottle/spinlock-rs,arthurprs/spinlock-rs,RustOS-Fork-Holding-Ground/spinlock-rs,mvdnes/spin-rs,dpc/spinlock-rs,mvdnes/spinlock-rs
7a4c75ba4480040b843ec9755909573f8ef73577
src/lib.rs
src/lib.rs
// Copyright 2016 Mozilla // // 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 in writing, software...
// Copyright 2016 Mozilla // // 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 in writing, software...
Rename to Project Mentat (src).
Rename to Project Mentat (src).
Rust
apache-2.0
ncalexan/datomish,ncalexan/mentat,ncalexan/mentat,mozilla/mentat,mozilla/mentat,mozilla/mentat,mozilla/mentat,mozilla/mentat,ncalexan/datomish,ncalexan/mentat,ncalexan/mentat,mozilla/mentat,ncalexan/mentat,ncalexan/mentat
b18c8384f7ade5a4d64f57b061a5017d0306ccd3
src/lib.rs
src/lib.rs
#![allow(dead_code)] #![allow(unused_parens)] #![allow(unstable)] #![feature(box_syntax)] extern crate syntax; pub mod lexer; pub mod token; #[derive(Copy)] pub struct Span { pub start: u32, pub end: u32, }
#![allow(dead_code)] #![allow(unused_parens)] #![allow(unstable)] #![feature(box_syntax)] extern crate syntax; /* * Rust's lexical grammar is not unambiguous. * 'a'b can parse either as <Lifetime><Lifetime * or <CharLiteral><Ident>. Libsyntax lexer panic!()s on that. * I've took stats from servo and rust sources...
Update mod docs with my findings about lexer grammar
Update mod docs with my findings about lexer grammar
Rust
apache-2.0
vosen/simeon
2e96a73c9699c35809f0d442a0b4fbf4d5e497cd
src/lib.rs
src/lib.rs
#![recursion_limit = "1024"] // We need this for error_chain, unfortunately. /// # toml-query /// /// A crate to help executing queries on toml data structures inside Rust code. /// // external crates #[macro_use] extern crate error_chain; #[macro_use] extern crate is_match; #[macro_use] extern crate lazy_static; ex...
#![recursion_limit = "1024"] // We need this for error_chain, unfortunately. /// # toml-query /// /// A crate to help executing queries on toml data structures inside Rust code. /// // external crates #[macro_use] extern crate error_chain; #[macro_use] extern crate is_match; #[macro_use] extern crate lazy_static; ex...
Fix import: if not compiling with log support, use log module to replace macros
Fix import: if not compiling with log support, use log module to replace macros
Rust
mpl-2.0
matthiasbeyer/toml-query
c2238f4a5f7072723e87303f29f8eed852225356
src/main.rs
src/main.rs
#![feature(slicing_syntax)] extern crate crc64; use crc64::crc64; use std::os; use std::io::{BufferedReader, File}; fn main() { let args = os::args(); if args.len() == 1 { println!("Usage: {} [list of files]", args[0]); return } for f in args[1..].iter() { let mut crc : u64 = ...
#![feature(core)] #![feature(io)] #![feature(env)] #![feature(path)] extern crate crc64; use crc64::crc64; use std::env; use std::old_io::{BufferedReader, File}; fn main() { let mut args = env::args(); let (len,_) = args.size_hint(); let prog = args.next().unwrap(); if len == 1 { println!("Us...
Use unstable features and new env::args
Use unstable features and new env::args
Rust
bsd-3-clause
badboy/crc64-rs
3b4c94df6e6cc969db3dc414173546af667e8311
userspace/test_harness/src/lib.rs
userspace/test_harness/src/lib.rs
// Copyright 2018 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 ...
// Copyright 2018 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 ...
Remove unused "feature(asm)" from test_harness.
Remove unused "feature(asm)" from test_harness.
Rust
apache-2.0
google/tock-on-titan,google/tock-on-titan,google/tock-on-titan
d91ad9b7ac0bdf9ca590129f344236029e6bc740
libs/stach_derive/src/lib.rs
libs/stach_derive/src/lib.rs
#![feature(proc_macro)] #![feature(proc_macro_lib)] #![recursion_limit = "128"] #[macro_use] extern crate quote; extern crate proc_macro; extern crate syn; use proc_macro::TokenStream; use std::str::FromStr; // Yield mock generated code for template // Hello, {{name}} ({{age}}) #[proc_macro_derive(StacheDisplay...
#![feature(proc_macro)] #![feature(proc_macro_lib)] #![recursion_limit = "128"] #[macro_use] extern crate quote; extern crate proc_macro; extern crate syn; use proc_macro::TokenStream; use std::str::FromStr; // Yield mock generated code for template // Hello, {{name}} ({{age}}) #[proc_macro_derive(StacheDisplay...
Use macro input to generate impl for correct struct
Use macro input to generate impl for correct struct
Rust
mit
maghoff/bart,maghoff/bart
029009e1886ad889e485733a76d56770981c526d
build.rs
build.rs
extern crate cmake; fn add_squirrel_defines(cmake_cfg: &mut cmake::Config) { cmake_cfg.define("INSTALL_LIB_DIR", "."); if cfg!(feature = "use_double") { cmake_cfg.define("SQUSEDOUBLE", ""); } if cfg!(feature = "use_unicode") { cmake_cfg.define("SQUNICODE", ""); } } fn expo...
extern crate cmake; fn add_squirrel_defines(cmake_cfg: &mut cmake::Config) { cmake_cfg.define("INSTALL_LIB_DIR", "."); if cfg!(feature = "use_double") { cmake_cfg.define("SQUSEDOUBLE", ""); } if cfg!(feature = "use_unicode") { cmake_cfg.define("SQUNICODE", ""); } } fn expo...
Fix stdc++ linkage on linux
Fix stdc++ linkage on linux
Rust
mit
devcen13/squirrel
171a0e7e1fa391526e4b25b26b6e51341577f710
core/src/lib.rs
core/src/lib.rs
// // Mnemosyne: a functional systems programming language. // (c) 2015 Hawk Weisman // // Mnemosyne is released under the MIT License. Please refer to // the LICENSE file at the top-level directory of this distribution // or at https://github.com/hawkw/mnemosyne/. // #![crate_name = "mnemosyne"] #![crate_type = "lib"]...
// // Mnemosyne: a functional systems programming language. // (c) 2015 Hawk Weisman // // Mnemosyne is released under the MIT License. Please refer to // the LICENSE file at the top-level directory of this distribution // or at https://github.com/hawkw/mnemosyne/. // #![crate_name = "mnemosyne"] #![crate_type = "lib"]...
Remove feature gates for features that were stablised
Remove feature gates for features that were stablised
Rust
mit
hawkw/mnemosyne
1f6f22acb4d2f28118c978cf27bce5c094775b44
src/http/server.rs
src/http/server.rs
extern crate hyper; use std::thread; use self::hyper::server; use http::dispatcher::Dispatcher; use http::app_manager::AppManager; pub struct Server { pub thread: thread::JoinHandle<()>, } impl Server { pub fn create() -> Server { let thread = Server::create_thread(); Server{ t...
extern crate hyper; use std::thread; use self::hyper::server; use http::dispatcher::Dispatcher; use http::app_manager::AppManager; pub struct Server { pub thread: thread::JoinHandle<()>, } impl Server { pub fn create() -> Server { let thread = Server::create_thread(); Server{ t...
Increase number of threads to 20
feature: Increase number of threads to 20 To overcome this bug: https://github.com/hyperium/hyper/issues/368
Rust
mit
juanibiapina/zas,juanibiapina/zas,juanibiapina/zas
6b9a79e7bf53e5d89e02288c0b34aa5cbab5d90b
examples/timers/timers.rs
examples/timers/timers.rs
#![feature(old_io)] #![feature(std_misc)] #![feature(step_by)] use std::old_io::{timer, Timer}; use std::time::duration::Duration; use std::sync::mpsc; fn main() { let interval = Duration::milliseconds(1000); // Create a timer object let mut timer = Timer::new().unwrap(); // Create a one-shot notific...
use std::thread; fn main() { let interval = 1000; println!("Block for {} ms...", interval); thread::park_timeout_ms(interval); println!("Done"); println!("Sleep for {} ms...", interval); thread::sleep_ms(interval); println!("Done"); }
Trim timer to what remains in std
Trim timer to what remains in std
Rust
apache-2.0
chriskrycho/rust-by-example,rwaldron/rust-by-example,nodakai/rust-by-example,aakloxu/rust-by-example-cn,dieface/rust-by-example,shaleh/rust-by-example,narutosanjiv/rust-by-example,zhjh1209/rust-by-example,rwaldron/rust-by-example,sohan99/rust-by-example,colinvh/rust-by-example,MatejLach/rust-by-example,MatejLach/rust-b...
00e46d7cdaf0e9ac17f1129521e9c780db1e00fe
examples/client.rs
examples/client.rs
#![feature(os, io)] extern crate hyper; use std::os; use std::old_io::stdout; use std::old_io::util::copy; use hyper::Client; fn main() { let args = os::args(); match args.len() { 2 => (), _ => { println!("Usage: client <url>"); return; } }; let url = ...
#![feature(env, os, io)] extern crate hyper; use std::env; use std::old_io::stdout; use std::old_io::util::copy; use hyper::Client; fn main() { let url = match env::args().nth(1) { Some(url) => url, None => { println!("Usage: client <url>"); return; } }; l...
Stop using deprecated std::os::args in example
chore(examples): Stop using deprecated std::os::args in example As per this compiler warning "warning: use of deprecated item: use std::env::args() instead, #[warn(deprecated)] on by default"
Rust
mit
nickgonzales/hyper,clatour/hyper,erickt/hyper,Keats/hyper,nstoddard/hyper,peterhj/hyper,huonw/hyper,Twey/hyper,golddranks/hyper,sfackler/hyper,hannobraun/hyper,Twey/hyper,markuskobler/hyper,jmmaranan/hyper,yazaddaruvala/hyper,giftcards/hyper,youprofit/hyper,hyperium/hyper,lame-nickname/hyper,fhahn/hyper,rschulman/hyper...
f3a4b0a78f9aea9f0d71e63b9810912396ea15ad
secure/storage/src/lib.rs
secure/storage/src/lib.rs
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] mod crypto_kv_storage; mod crypto_storage; mod error; mod github; mod in_memory; mod kv_storage; mod namespaced_storage; mod on_disk; mod policy; mod storage; mod vault; pub use crate::{ crypto_kv_storage:...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] mod crypto_kv_storage; mod crypto_storage; mod error; mod github; mod in_memory; mod kv_storage; mod namespaced_storage; mod on_disk; mod policy; mod storage; mod vault; pub use crate::{ crypto_kv_storage:...
Add bytes <-> base64 string adapter
[secure-storage] Add bytes <-> base64 string adapter
Rust
apache-2.0
libra/libra,aptos-labs/aptos-core,libra/libra,libra/libra,libra/libra,aptos-labs/aptos-core,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core
b00121d74f2148e03ffa0bc370dfaad33634ee67
src/bin/ui/panels/chat.rs
src/bin/ui/panels/chat.rs
use ui::ncurses::*; use ui::{RIGHT_PANEL_WIDTH, CMD_ENTRY_HEIGHT, Position, Size}; use ui::window::BorderWindow; pub struct Chat { window: BorderWindow, } // glibc will panic if a message containing a C-style format string is entered fn sanitize(string: &str) -> String { string.replace('%', "%%") } impl Chat...
use ui::ncurses::*; use ui::{RIGHT_PANEL_WIDTH, CMD_ENTRY_HEIGHT, Position, Size}; use ui::window::BorderWindow; pub struct Chat { window: BorderWindow, } impl Chat { pub fn new(size: Size) -> Chat { let window = BorderWindow::new( Position::new(0, 0), S...
Replace wprintw call with waddstr to bypass message sanitization
Replace wprintw call with waddstr to bypass message sanitization
Rust
mit
Acizza/twirc
cfc52dfaabcb88e2831be2ff57af6984b6455aa1
src/main.rs
src/main.rs
// Generate an identity like so: // // ```bash // openssl req -x509 -newkey rsa:4096 -nodes -keyout localhost.key -out localhost.crt -days 3650 // openssl pkcs12 -export -out identity.p12 -inkey localhost.key -in localhost.crt --password mypass // // ``` extern crate iron; extern crate hyper_native_tls; fn main() { ...
// Generate an identity like so: // // ```bash // openssl req -x509 -newkey rsa:4096 -nodes -keyout localhost.key -out localhost.crt -days 3650 // openssl pkcs12 -export -out identity.p12 -inkey localhost.key -in localhost.crt --password mypass // // ``` extern crate iron; extern crate hyper_native_tls; fn main() { ...
Add dummy message for new connection
Add dummy message for new connection
Rust
agpl-3.0
SirRade/homepage,SirRade/homepage,SirRade/homepage
f5206fcd81bd60591d40279c2c7ae3db28260b6f
src/sdl2_gfx/lib.rs
src/sdl2_gfx/lib.rs
/*! A binding for SDL2_gfx. */ #![crate_name="sdl2_gfx"] #![crate_type = "lib"] #![feature(libc)] extern crate libc; extern crate sdl2; extern crate "sdl2-sys" as sys; // Setup linking for all targets. #[link(name="SDL2_gfx")] extern {} pub mod primitives; pub mod rotozoom; pub mod framerate; pub mod imagefilter;...
/*! A binding for SDL2_gfx. */ #![crate_name="sdl2_gfx"] #![crate_type = "lib"] #![feature(libc)] #![feature(unique)] #![feature(core)] extern crate libc; extern crate sdl2; extern crate "sdl2-sys" as sys; // Setup linking for all targets. #[link(name="SDL2_gfx")] extern {} pub mod primitives; pub mod rotozoom; p...
Add more features to reduce warnings.
Add more features to reduce warnings.
Rust
mit
andelf/rust-sdl2_gfx,Cobrand/rust-sdl2,Rust-SDL2/rust-sdl2,Cobrand/rust-sdl2,Cobrand/rust-sdl2,vadixidav/rust-sdl2,Rust-SDL2/rust-sdl2,Rust-SDL2/rust-sdl2,AngryLawyer/rust-sdl2
4ec3692af94e514cb5ff23ebdb21fddf184032af
23_closures/src/main.rs
23_closures/src/main.rs
use std::thread; use std::time::Duration; fn main() { let simulated_user_specified_value = 3; let simulated_random_number = 4; generate_workout(simulated_user_specified_value, simulated_random_number); } fn simulated_expensive_calculation(intensity: i32) -> i32 { println!("Very expensive calculation...
use std::thread; use std::time::Duration; fn main() { let simulated_user_specified_value = 3; let simulated_random_number = 4; generate_workout(simulated_user_specified_value, simulated_random_number); } fn simulated_expensive_calculation(intensity: i32) -> i32 { println!("Very expensive calculation...
Refactor to call expensive calc only once
Refactor to call expensive calc only once
Rust
mit
pgrzesik/learning-rust
33832a318543d94a6619556b59f8ba9e7faf0c89
src/repository.rs
src/repository.rs
use object_id::ObjectId; use tag::Tag; use branch::Branch; use reference::Reference; use pack_index::PackIndex; pub struct Repository { pub path: String, pub wc_path: String, pub tags: Vec<Tag>, pub branches: Vec<Branch>, pub references: Vec<Reference>, pub pack_indexes: Vec<PackIndex>, }
use object_id::ObjectId; use tag::Tag; use branch::Branch; use reference::Reference; use pack_index::PackIndex; pub struct Repository { pub path: String, pub wc_path: String, pub tags: Vec<Tag>, pub branches: Vec<Branch>, pub references: Vec<Reference>, pub pack_indexes: Vec<PackIndex>, } impl...
Implement a simple constructor for Repository
Implement a simple constructor for Repository
Rust
mit
kaisellgren/rust_git
ebc9531ce7c411d3950f73f679b5ac01f47145dd
tests/test_dsl.rs
tests/test_dsl.rs
extern crate env_logger; extern crate gears; use gears::dsl::command::*; use gears::structure::domain::Domain; #[test] fn test_dsl_domain() { let _ = env_logger::init(); let mut domain = Domain::default(); let e_count = domain.entities.len(); domain.interpret_dsl(&"add entity abc;"); assert_eq!(d...
extern crate env_logger; extern crate gears; use gears::dsl::command::*; use gears::structure::domain::Domain; #[test] fn test_dsl_domain() { let _ = env_logger::init(); let mut domain = Domain::default(); let e_count = domain.entities.len(); domain.interpret_dsl(&"add entity abc;"); assert_eq!(d...
Add domain dsl generate and consume test
test: Add domain dsl generate and consume test
Rust
mit
gears-project/gears-core-rust,michiel/xflow-rust,gears-project/gears-core-rust,michiel/xflow-rust,gears-project/gears-core-rust,michiel/xflow-rust
d891c8cd544e7f01dba2163cd1016ddf90dfedaf
compiler/rustc_lint/src/tests.rs
compiler/rustc_lint/src/tests.rs
use crate::context::parse_lint_and_tool_name; use rustc_span::{with_default_session_globals, Symbol}; #[test] fn parse_lint_no_tool() { with_default_session_globals(|| assert_eq!(parse_lint_and_tool_name("foo"), (None, "foo"))); } #[test] fn parse_lint_with_tool() { with_default_session_globals(|| { a...
use crate::context::parse_lint_and_tool_name; use rustc_span::{create_default_session_globals_then, Symbol}; #[test] fn parse_lint_no_tool() { create_default_session_globals_then(|| { assert_eq!(parse_lint_and_tool_name("foo"), (None, "foo")) }); } #[test] fn parse_lint_with_tool() { create_defaul...
Update to last upstream version
Update to last upstream version
Rust
apache-2.0
aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust
d8c53ace6236ce95b8c357a2a4a56bf23f89e565
src/adapter.rs
src/adapter.rs
use objectclass::ObjectClass; use server::{Id, Entry, Result}; pub trait Transaction<D> { fn commit(self) -> Result<()>; // TODO: these are the guts of LmdbAdapter leaking out. They should get moved elsewhere fn get(&self, database: D, key: &[u8]) -> Result<&[u8]>; fn find<P>(&self, db: D, key: &[u8],...
use objectclass::ObjectClass; use server::{Id, Entry, Result}; pub trait Transaction<D> { fn commit(self) -> Result<()>; fn get(&self, database: D, key: &[u8]) -> Result<&[u8]>; fn find<P>(&self, db: D, key: &[u8], predicate: P) -> Result<&[u8]> where P: Fn(&[u8]) -> bool; } pub trait Adapter<'a, D, R: Tr...
Remove scary TODO message from Transaction
Remove scary TODO message from Transaction I am beginning to think that adapter.rs is actually interestingly generic across ordered k/v stores like LMDB. Perhaps the Transaction trait is actually OK as described, and would allow some of the functionality presently in LmdbAdapter to be reused with other similar backen...
Rust
apache-2.0
cryptosphere/ithos
6315a2e2ace63ecd7f06e7fe0166bfcc1804e4e1
src/handler.rs
src/handler.rs
//!Request handlers. use context::Context; use response::Response; ///A trait for request handlers. pub trait Handler: Send + Sync + 'static { ///Handle a request from the client. Panicking within this method is ///discouraged, to allow the server to run smoothly. fn handle_request(&self, context: Context...
//!Request handlers. use context::Context; use response::Response; use std::sync::Arc; ///A trait for request handlers. pub trait Handler: Send + Sync + 'static { ///Handle a request from the client. Panicking within this method is ///discouraged, to allow the server to run smoothly. fn handle_request(&se...
Implement Handler for Arc and Box
Implement Handler for Arc and Box 1. Handler trait impl for Arc<T> calles handle_request() on T. 2. Handler trai can not be implemented generecally for Box without conflicting with trait impl for Fn(). So implemented for Box<Handler>. Clients need to cast their Box<T> as Box<Handler> to use this. Fixes #70
Rust
mit
kvikas/rustful,kvikas/rustful
5dd04ae3b05e4d58281a09192dc5b057957f2150
src/datastore/hash_map_store.rs
src/datastore/hash_map_store.rs
use super::{DataStore, DataStoreError}; use std::collections::HashMap; pub type HashMapStore = HashMap<String,String>; /// Implement the DataStore methods for HashMap impl DataStore for HashMapStore { fn store(&mut self, key: &str, value: &str) -> Result<(), DataStoreError> { self.insert(key.into(), valu...
use super::{DataStore, DataStoreError}; use std::collections::HashMap; pub type HashMapStore = HashMap<String,String>; /// Implement the DataStore methods for HashMap impl DataStore for HashMapStore { fn store(&mut self, key: &str, value: &str) -> Result<(), DataStoreError> { self.insert(key.into(), valu...
Add unit tests for HashMapStore
server: Add unit tests for HashMapStore
Rust
apache-2.0
cmr/spaceapi-server-rs,coredump-ch/spaceapi-server-rs,cmr/spaceapi-server-rs
8475a4b0c6adce70940617ea5bbb5b691d50d975
src/test/compile-fail/custom_attribute.rs
src/test/compile-fail/custom_attribute.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Check that custom attributes are disallowed on statements and expressions
Check that custom attributes are disallowed on statements and expressions
Rust
apache-2.0
aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust
8854ea2b937319740cccb5f0d551a886d99250f0
src/hardcoded_butterflies.rs
src/hardcoded_butterflies.rs
use num::Complex; pub fn butterfly_2(input: &[Complex<f32>], input_stride: usize, output: &mut [Complex<f32>], output_stride: usize, twiddles: &[Complex<f32>], num_rows: usize) { let mut out_idx_1 = 0us; let mut out_idx_2 = num_rows * o...
use num::Complex; pub fn butterfly_2(input: &[Complex<f32>], input_stride: usize, output: &mut [Complex<f32>], output_stride: usize, twiddles: &[Complex<f32>], num_rows: usize) { let mut out_idx_1 = 0us; let mut out_idx_2 = num_rows * o...
Store multiplication to avoid two multiplications. Small performance improvement
Store multiplication to avoid two multiplications. Small performance improvement
Rust
apache-2.0
ejmahler/RustFFT,ejmahler/RustFFT
c6512a5d81c7607e2cab37199cde898119ec898f
traits/src/lib.rs
traits/src/lib.rs
pub trait Summarizable { fn summary(&self) -> String; } #[cfg(test)] mod tests { #[test] fn it_works() { } }
pub trait Summarizable { fn summary(&self) -> String; } pub struct NewsArticle { pub headline: String, pub location: String, pub author: String, pub content: String, } impl Summarizable for NewsArticle { fn summary(&self) -> String { format!("{}, by {} ({})", self.headline, self.author...
Add struct NewsArticle and implement Summarizable trait for it
Add struct NewsArticle and implement Summarizable trait for it
Rust
mit
pgrzesik/learning-rust
1d40fb279647835afa9f26e7c268d22b0b908fa9
src/structures/paging/frame_alloc.rs
src/structures/paging/frame_alloc.rs
//! Traits for abstracting away frame allocation and deallocation. use crate::structures::paging::{PageSize, PhysFrame}; /// A trait for types that can allocate a frame of memory. /// /// This trait is unsafe to implement because the implementer must guarantee that /// the `allocate_frame` method returns only unique ...
//! Traits for abstracting away frame allocation and deallocation. use crate::structures::paging::{PageSize, PhysFrame}; /// A trait for types that can allocate a frame of memory. /// /// # Safety /// /// The implementer of this trait must guarantee that the `allocate_frame` /// method returns only unique unused fram...
Add Safety comment to FrameAllocator
Add Safety comment to FrameAllocator This fixes a clippy warning Signed-off-by: Joe Richey <24d3dd8348b5cac19a417e52b4f8141ba91506f0@google.com>
Rust
mit
phil-opp/rust-x86_64
2b8e3e8d8798002f3db24969610feebf5eb2b0a8
tests/tempfile.rs
tests/tempfile.rs
extern crate tempfile; use std::io::{Read, Seek, SeekFrom, Write}; use std::fs; #[test] fn test_basic() { let mut tmpfile = tempfile::tempfile().unwrap(); write!(tmpfile, "abcde").unwrap(); tmpfile.seek(SeekFrom::Start(0)).unwrap(); let mut buf = String::new(); tmpfile.read_to_string(&mut buf).unwr...
extern crate tempfile; use std::io::{Read, Seek, SeekFrom, Write}; use std::fs; use std::thread; use std::sync::mpsc::{sync_channel, TryRecvError}; #[test] fn test_basic() { let mut tmpfile = tempfile::tempfile().unwrap(); write!(tmpfile, "abcde").unwrap(); tmpfile.seek(SeekFrom::Start(0)).unwrap(); le...
Add test to emulate a pathological temporary file cleaner
Add test to emulate a pathological temporary file cleaner Assert that temporary files work as expected in the presence of a file cleaner that aggressively removes files in the tmpdir.
Rust
apache-2.0
Stebalien/tempfile
928bb2be8fee3600db086cfa94775ac9110937e2
src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs
src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Improve test to include a projection, per @huonw's suggestion.
Improve test to include a projection, per @huonw's suggestion.
Rust
apache-2.0
ktossell/rust,reem/rust,philyoon/rust,jroesch/rust,aepsil0n/rust,hauleth/rust,pshc/rust,hauleth/rust,ktossell/rust,ebfull/rust,mahkoh/rust,ejjeong/rust,TheNeikos/rust,TheNeikos/rust,reem/rust,mihneadb/rust,bombless/rust,untitaker/rust,kwantam/rust,dwillmer/rust,defuz/rust,XMPPwocky/rust,mdinger/rust,richo/rust,nwin/rus...
f6611db1d59bbf5fb7d5cfbcccc629b6916d06a3
src/test/run-pass/const-int-sign.rs
src/test/run-pass/const-int-sign.rs
const NEGATIVE_A: bool = (-10i32).is_negative(); const NEGATIVE_B: bool = 10i32.is_negative(); const POSITIVE_A: bool= (-10i32).is_positive(); const POSITIVE_B: bool= 10i32.is_positive(); fn main() { assert!(NEGATIVE_A); assert!(!NEGATIVE_B); assert!(!POSITIVE_A); assert!(POSITIVE_B); }
#![feature(const_int_sign)] const NEGATIVE_A: bool = (-10i32).is_negative(); const NEGATIVE_B: bool = 10i32.is_negative(); const POSITIVE_A: bool = (-10i32).is_positive(); const POSITIVE_B: bool = 10i32.is_positive(); const SIGNUM_POS: i32 = 10i32.signum(); const SIGNUM_NIL: i32 = 0i32.signum(); const SIGNUM_NEG: i32...
Add `const`-ness tests for `i32::signum`
Add `const`-ness tests for `i32::signum`
Rust
apache-2.0
graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust
8773f69b690016d1c0eb3c4aa081a3ae61102191
src/fs.rs
src/fs.rs
// Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers // // The terms of the Evaluation Agreement (Habitat) between Chef Software Inc. // and the party accessing this file ("Licensee") apply to Licensee's use of // the Software until such time that the Software is made available under an // open source license...
// Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers // // The terms of the Evaluation Agreement (Habitat) between Chef Software Inc. // and the party accessing this file ("Licensee") apply to Licensee's use of // the Software until such time that the Software is made available under an // open source license...
Use `HAB_CACHE_SRC_PATH` for default src download, extract, & compile.
Use `HAB_CACHE_SRC_PATH` for default src download, extract, & compile. `HAB_SRC_PATH` is the default path where source artifacts are downloaded, extracted, & compiled. It defaults to `$HAB_ROOT_PATH/cache/src`.
Rust
apache-2.0
rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat
b6334d444183a20f32d15d8925f4045b31aeaecb
src/default.rs
src/default.rs
// Copyright 2014 Michael Yang. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use num::complex::Complex; pub trait Default { fn one() -> Self; fn zero() -> Self; } macro_rules! default_impl( ($t:ty, $ov:expr, $zv:expr) => { ...
// Copyright 2014 Michael Yang. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use num::complex::Complex; pub trait Default { fn one() -> Self; fn zero() -> Self; fn neg_one() -> Self; } macro_rules! default_impl( ($t:ty, $...
Add negative one to Default
Add negative one to Default
Rust
mit
mikkyang/rust-blas
ce4ecda0e3045dc40dc4d94fa624365e095b9bc9
src/agent.rs
src/agent.rs
use random::Random; use types::Reward; /// Model struct for an agent which can interact with an environment. pub struct Agent { age: i32, total_reward: Reward, num_actions: i16, random: Box<Random>, } impl Agent { pub fn new(num_actions: i16, random: Box<Random>) -> Agent { Agent { age: 0, t...
use random::Random; use types::Reward; /// Model struct for an agent which can interact with an environment. pub struct Agent { age: i32, total_reward: Reward, num_actions: i16, random: Box<Random>, } impl Agent { pub fn new(num_actions: i16, random: Box<Random>) -> Agent { Agent { age: 0, t...
Add some more missing documentation.
Add some more missing documentation.
Rust
mit
dinowernli/marvin
d7a0d580d450e1591b95c629043c7c13c383cc76
src/error_impls.rs
src/error_impls.rs
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
Set doc(cfg(feature = "std")) on std trait impls
Set doc(cfg(feature = "std")) on std trait impls Signed-off-by: Joe Richey <24d3dd8348b5cac19a417e52b4f8141ba91506f0@google.com>
Rust
apache-2.0
rust-random/getrandom
4290403cd32539b1b8f8bc7727fbda56f7499f6d
src/storage/mod.rs
src/storage/mod.rs
//! SBD message storage. //! //! We can store messages in one of several backends, provided as submodules here. Storages //! implement the `Storage` trait. mod filesystem; mod memory; pub use self::filesystem::Storage as FilesystemStorage; pub use self::memory::Storage as MemoryStorage; use Result; use mo::Message; ...
//! Squirrel away SBD messages and retrieve them later. mod filesystem; mod memory; pub use self::filesystem::Storage as FilesystemStorage; pub use self::memory::Storage as MemoryStorage; use Result; use mo::Message; /// Basic storage operations. pub trait Storage { /// Place a message into this storage. //...
Add doc test for store
Add doc test for store
Rust
apache-2.0
gadomski/sbd-rs
9c2059db072b2436e30086e5686e4eb611df83c0
tests/http_version_test.rs
tests/http_version_test.rs
#[cfg(test)] mod test { #[test] fn validate_http_version() { unimplemented!() } }
extern crate hyper; extern crate snatch; #[cfg(test)] mod test_http_versions { use hyper::version::HttpVersion; use snatch::http_version::is_valid_http_version; #[test] fn test_version_09() { assert!(!is_valid_http_version(HttpVersion::Http09)) } #[test] fn test_version_10() { ...
Add unit tests for checking HTTP version
Add unit tests for checking HTTP version
Rust
mit
derniercri/snatch