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
72c3995b68239e5d48aacdf5dfa503f8a8754664
rust/pythagorean-triplet/src/lib.rs
rust/pythagorean-triplet/src/lib.rs
pub fn find() -> Option<u32> { const LOWER: u32 = 1000/3; const UPPER: u32 = 1000/2; for c in LOWER..UPPER { for b in c/2..c { for a in 1..b { if a*a + b*b != c*c { continue; } if a + b + c == 1000 { ...
pub fn find() -> Option<u32> { const VALUE: u32 = 1000; const LOWER: u32 = VALUE / 3; const UPPER: u32 = VALUE / 2; for c in LOWER..UPPER { for b in c / 2..c { for a in 1..b { if a * a + b * b != c * c { continue; } ...
Use const instead of magic number
Use const instead of magic number It looks better now
Rust
bsd-2-clause
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
0af88e3c0495c5dfc78a8a31d0d8d4fee4f5aea8
src/test/compile-fail/extern-foreign-crate.rs
src/test/compile-fail/extern-foreign-crate.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 ...
Update a test error message
Update a test error message #17709
Rust
apache-2.0
sae-bom/rust,0x73/rust,untitaker/rust,dinfuehr/rust,ebfull/rust,rohitjoshi/rust,bombless/rust,quornian/rust,0x73/rust,richo/rust,GBGamer/rust,vhbit/rust,zachwick/rust,XMPPwocky/rust,carols10cents/rust,omasanori/rust,rprichard/rust,jroesch/rust,barosl/rust,kimroen/rust,mvdnes/rust,jashank/rust,pelmers/rust,ruud-v-a/rust...
0be526f2732b3c43c5d9374cf0616f83745b9d35
src/lib.rs
src/lib.rs
#[macro_use] extern crate bitflags; extern crate gl as gl_lib; #[cfg(feature = "cgmath")] extern crate cgmath as cgmath_lib; #[cfg(feature = "image")] extern crate image as image_lib; mod ref_into; #[macro_use] mod macros; mod context; mod buffer; mod shader; mod program; mod framebuffer; mod renderbuffer; mod textur...
#[macro_use] extern crate bitflags; extern crate gl as gl_lib; #[cfg(feature = "cgmath")] extern crate cgmath as cgmath_lib; #[cfg(feature = "image")] extern crate image as image_lib; mod ref_into; #[macro_use] mod macros; mod context; mod buffer; mod shader; mod program; mod framebuffer; mod renderbuffer; mod textur...
Add `RenderbufferContext` to the prelude
Add `RenderbufferContext` to the prelude
Rust
apache-2.0
kylewlacy/glitter,kylewlacy/glitter
8140208cd072f0dd5ff27e50e2e79b4e5d084268
test/sort.rs
test/sort.rs
use std::fs::File; use std::io::Read; use std::path::Path; use std::process::Command; static PROGNAME: &'static str = "./sort"; #[test] fn numeric1() { numeric_helper(1); } #[test] fn numeric2() { numeric_helper(2); } #[test] fn numeric3() { numeric_helper(3); } #[test] fn numeric4() { numeric_help...
use std::fs::File; use std::io::Read; use std::path::Path; use std::process::Command; static PROGNAME: &'static str = "./sort"; #[test] fn numeric1() { numeric_helper(1); } #[test] fn numeric2() { numeric_helper(2); } #[test] fn numeric3() { numeric_helper(3); } #[test] fn numeric4() { numeric_help...
Check return value of read().
Check return value of read().
Rust
mit
steveklabnik/coreutils,hexsel/coreutils,beni55/coreutils,dbrgn/coreutils,bundai223/coreutils,silvio/rust-coreutils,Shtong/coreutils,Shtong/coreutils,dennis/coreutils,retep998/coreutils,kwantam/coreutils,kball/coreutils,uutils/coreutils,efuquen/coreutils,kball/coreutils,steveklabnik/coreutils,mauricio/coreutils,sshling/...
770f4b45e59f314300a76976b85680af38ed834a
tests/compile-fail/no-leaking-poll-items.rs
tests/compile-fail/no-leaking-poll-items.rs
extern crate zmq; fn main() { let mut context = zmq::Context::new(); let _poll_item = { let socket = context.socket(zmq::PAIR).unwrap(); socket.as_poll_item(0) //~ ERROR `socket` does not live long enough }; }
extern crate zmq; fn main() { let mut context = zmq::Context::new(); let _poll_item = { let socket = context.socket(zmq::PAIR).unwrap(); socket.as_poll_item(0) }; //~ ERROR `socket` does not live long enough }
Fix compiletest failure on nightly
Fix compiletest failure on nightly
Rust
apache-2.0
petehayes102/rust-zmq,erickt/rust-zmq,pfernie/rust-zmq
b7e3aa877aac0a237c41c24614a7789a5f5efebc
rust-showcase/src/bin/brightness.rs
rust-showcase/src/bin/brightness.rs
extern crate simple_csv; use std::fs::File; use std::io::BufReader; use std::str::FromStr; use simple_csv::{SimpleCsvWriter, SimpleCsvReader}; fn main(){ let f = File::open("../long-cadence.csv").unwrap(); let buf = BufReader::new(f); let reader = SimpleCsvReader::new(buf); let o = File::create("aver...
extern crate simple_csv; use std::fs::File; use std::io::BufReader; use std::str::FromStr; use simple_csv::{SimpleCsvWriter, SimpleCsvReader}; fn main(){ let f = File::open("../long-cadence.csv").unwrap(); let buf = BufReader::new(f); let reader = SimpleCsvReader::new(buf); let o = File::create("aver...
Remove background noise from signal
Remove background noise from signal
Rust
mit
fifth-postulate/finding-the-planets,fifth-postulate/finding-the-planets,fifth-postulate/finding-the-planets
e1ad0457262396ee35b198bf9209a4385e4f5133
src/algebra/ops.rs
src/algebra/ops.rs
#![doc="Defines some operators. "] // std imports use std::ops::Div; /// A type for which computing the reciprocal is supported. /// Supported types include f32, f64, etc.. pub trait Recip { /// The resulting type after computing 1 / x. type Output = Self; /// The method for the computing 1 / x. fn ...
#![feature(associated_type_defaults)] #![doc="Defines some operators. "] // std imports use std::ops::Div; /// A type for which computing the reciprocal is supported. /// Supported types include f32, f64, etc.. pub trait Recip { /// The resulting type after computing 1 / x. type Output = Self; /// The m...
Add feature to make rustc on CI happy (mine wasn't complaining)
Add feature to make rustc on CI happy (mine wasn't complaining)
Rust
apache-2.0
achanda/scirust,tempbottle/scirust,indigits/scirust,Sean1708/scirust,daniel-vainsencher/scirust
d1a2915aad4317c8f71ab610de13e065e2a31cea
ll.rs
ll.rs
use core::libc::{c_char, c_void}; use core::libc::types::common::c99::uint32_t; #[nolink] #[link_args="-L../libwapcaplet -lwapcaplet"] pub extern mod linking { }
use core::libc::{c_char, c_void, size_t}; use core::libc::types::common::c99::uint32_t; #[nolink] #[link_args="-L../libwapcaplet -lwapcaplet"] pub extern mod linking { } pub type lwc_refcounter = uint32_t; pub type lwc_hash = uint32_t; pub struct lwc_string { prevptr: **lwc_string, next: *lwc_string, len...
Add definitions of a few data structures that rust-netsurfcss needs
Add definitions of a few data structures that rust-netsurfcss needs
Rust
apache-2.0
servo/rust-wapcaplet,servo/rust-wapcaplet
e05770738c050e4d464bdb929b1a03baa77c564a
rusty.rs
rusty.rs
extern mod std; #[test] fn test_tokenize() { assert tokenize( ~"(1 2 3)" ) == ~[~"(", ~"1", ~"2", ~"3", ~")"]; } #[test] fn test_addspaces() { assert addspaces( ~"(1 2 3)" ) == ~" ( 1 2 3 ) " } fn addspaces( input:&str ) -> ~str { str::replace(str::replace(input, ")", " ) "), "(", " ( ") } fn tokenize( ...
extern mod std; #[test] fn test_tokenize() { assert tokenize( ~"(1 2 3)" ) == ~[~"(", ~"1", ~"2", ~"3", ~")"]; } #[test] fn test_tokenize_empty() { assert tokenize( ~"" ) == ~[]; } #[test] fn test_tokenize_no_spaces() { assert tokenize( ~"one" ) == ~[~"one"]; } #[test] fn test_addspaces() { assert a...
Add more tests to tokenize
Add more tests to tokenize
Rust
mit
martica/rusty
da7ef2b58736a794fb3d0d783fc4ccd6f1737211
src/script/mod.rs
src/script/mod.rs
pub mod lex_script_tool; pub mod tool; use self::lex_script_tool::*; use silkthread_base::*; use silkthread_base::basic::*; /// /// ToolSet for dealing with the scripting language /// pub struct ScriptToolSet { } impl ToolSet for ScriptToolSet { fn create_tools(self, _: &Environment) -> Vec<(String, Box<Tool>)> ...
pub mod lex_script_tool; pub mod tool; use self::lex_script_tool::*; use silkthread_base::*; use silkthread_base::basic::*; /// /// ToolSet for dealing with the scripting language /// pub struct ScriptTools { } impl ToolSet for ScriptTools{ fn create_tools(self, _: &Environment) -> Vec<(String, Box<Tool>)> { ...
Rename to ScriptTools for consistency with the toolkit library
Rename to ScriptTools for consistency with the toolkit library
Rust
apache-2.0
Logicalshift/gossyp,Logicalshift/gossyp
77ca3acf14421e4193128d613195c363b773f975
src/main.rs
src/main.rs
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); loop { println!("Please input your guess."); ...
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); loop { println!("Please input your guess."); ...
Exit after correctly guessing secret number
Exit after correctly guessing secret number
Rust
mit
juliangrosshauser/guessing_game
ea586633392a5755147578b0f8e0221865c7bb99
src/main.rs
src/main.rs
fn main() { println!("Hello, world!"); }
extern crate piston; extern crate graphics; extern crate glutin_window; extern crate opengl_graphics; use piston::window::WindowSettings; use piston::event_loop::*; use piston::input::*; use glutin_window::GlutinWindow as Window; use opengl_graphics::{ GlGraphics, OpenGL }; pub struct App { gl: GlGraphics, // Ope...
Add the piston tutorials initial code as a base
Add the piston tutorials initial code as a base
Rust
mit
mateusmedeiros/rust_of_life
f85e32852cd3265bd515853c2cd71a42af4cce22
src/util/mod.rs
src/util/mod.rs
#[macro_use] pub mod error; use std::path::{Path, PathBuf}; use std::fs::File; use std::io::{self, Read}; pub fn local_path(path: &str) -> io::Result<PathBuf> { let mut base = ::std::env::current_exe()?; base.pop(); base.push(path); Ok(base) } /// Creates a file only if it doesn't already exist and r...
#[macro_use] pub mod error; use std::path::{Path, PathBuf}; use std::fs::File; use std::io::{self, Read, Error, ErrorKind}; pub fn local_path(path: &str) -> io::Result<PathBuf> { let mut base = ::std::env::current_exe()?; base.pop(); base.push(path); Ok(base) } /// Creates a file only if it doesn't a...
Return error when a file is empty
Return error when a file is empty
Rust
agpl-3.0
Acizza/bcnotif
0fbcad3eff2f6db8dad0fa66d3fdc7fca2358008
benches/buffer_tokens.rs
benches/buffer_tokens.rs
#![feature(test)] extern crate test; extern crate scribe; use test::Bencher; use scribe::Workspace; use std::path::PathBuf; #[bench] fn bench_tokens(b: &mut Bencher) { // Create a workspace with this benchmark test as a buffer. let mut workspace = Workspace::new(Path::new(".")); let path = Path::new("ben...
#![feature(test)] extern crate test; extern crate scribe; use test::Bencher; use scribe::Workspace; use std::path::Path; #[bench] fn bench_tokens(b: &mut Bencher) { // Create a workspace with this benchmark test as a buffer. let mut workspace = Workspace::new(Path::new(".")).unwrap(); let path = Path::ne...
Update benchmark test to work with workspace result
Update benchmark test to work with workspace result
Rust
mit
jmacdonald/scribe
59bbae76e1317c1810afc661ddd88285f7710568
src/lib.rs
src/lib.rs
#![feature(no_std, lang_items, asm, const_fn)] #![feature(core_str_ext)] #![no_std] #[macro_use] pub mod xen; pub mod arch; pub mod utils; extern { fn main(_: isize, _: *const *const u8) -> isize; } // 8KB const STACK_SIZE: usize = 8192; #[no_mangle] #[allow(non_upper_case_globals)] #[link_section=".stack"] pu...
#![feature(no_std, lang_items, asm, const_fn)] #![feature(core_str_ext)] #![no_std] #[macro_use] pub mod xen; pub mod arch; pub mod utils; extern { fn main(_: isize, _: *const *const u8) -> isize; } // 8KB const STACK_SIZE: usize = 8192; #[no_mangle] #[allow(non_upper_case_globals)] #[link_section=".stack"] pu...
Add boot message + console flush() on exit
uni: Add boot message + console flush() on exit
Rust
mit
uni-rs/uni.rs
17c033030ba6deda3f32755f06e4da04f46ab532
src/server/utils.rs
src/server/utils.rs
use bytes::{BufMut, BytesMut}; use futures::Poll; use std::io; use super::IoStream; const LW_BUFFER_SIZE: usize = 4096; const HW_BUFFER_SIZE: usize = 32_768; pub fn read_from_io<T: IoStream>( io: &mut T, buf: &mut BytesMut, ) -> Poll<usize, io::Error> { if buf.remaining_mut() < LW_BUFFER_SIZE { buf.r...
use bytes::{BufMut, BytesMut}; use futures::{Async, Poll}; use std::io; use super::IoStream; const LW_BUFFER_SIZE: usize = 4096; const HW_BUFFER_SIZE: usize = 32_768; pub fn read_from_io<T: IoStream>( io: &mut T, buf: &mut BytesMut, ) -> Poll<usize, io::Error> { unsafe { if buf.remaining_mut() < LW_B...
Revert "remove unnecessary use of unsafe in read_from_io"
Revert "remove unnecessary use of unsafe in read_from_io" This reverts commit da237611cb429da5fb42ab9d6be52837d1de3dda.
Rust
apache-2.0
actix/actix-web,actix/actix-web,actix/actix-web
946071ed66279fc80bd7b5c3f5fa325cbd3193f7
examples/dummy-span.rs
examples/dummy-span.rs
extern crate xswag_base as base; use base::code::{SrcOffset, BytePos, Span, FileMap}; use base::diag; const TEXT: &'static str = "no-content"; fn main() { let file = FileMap::new("src/examples/dummy.txt", TEXT); file.find_lines(); let e = diag::Report::simple_error( "Oh noes, this `Report` conta...
extern crate xswag_base as base; use base::code::{Span, FileMap}; use base::diag; const TEXT: &'static str = "no-content"; fn main() { let file = FileMap::new("src/examples/dummy.txt", TEXT); file.find_lines(); let e = diag::Report::simple_error( "Oh noes, this `Report` contains a dummy span :("...
Remove unnecessary imports in example
Remove unnecessary imports in example
Rust
mit
LukasKalbertodt/xswag-base,LukasKalbertodt/xswag-base
72447c459621242426f73f58980f0b940674e125
src/lib.rs
src/lib.rs
#![feature(collections, std_misc)] extern crate tcod; pub mod engine; pub mod gui; pub mod util;
#![feature(std_misc)] extern crate tcod; pub mod engine; pub mod gui; pub mod util;
Remove unused collections feature gate
Remove unused collections feature gate
Rust
bsd-3-clause
jgilchrist/rslike
5ffe99abdfa28ef02511e4c5fb681fdf71637f50
examples/create_customer_with_card.rs
examples/create_customer_with_card.rs
extern crate stripe; use std::env; fn main() { // Create a new client let secret_key = env::var("STRIPE_SECRET_KEY").expect("Missing STRIPE_SECRET_KEY in env"); let client = stripe::Client::new(&secret_key); // Build request params let mut params = stripe::CustomerParams::default(); params.em...
extern crate stripe; use std::env; fn main() { // Create a new client let secret_key = env::var("STRIPE_SECRET_KEY").expect("Missing STRIPE_SECRET_KEY in env"); let client = stripe::Client::new(&secret_key); // Define a card for the customer let mut card = stripe::CardParams::default(); card....
Simplify the customer w/ card example
Simplify the customer w/ card example
Rust
apache-2.0
rapiditynetworks/stripe-rust
e81a8fbebba05af9a35e6c019585db879cd8f3aa
tests/lib.rs
tests/lib.rs
/// extern test-lib for zwreec /// to test the whole zwreec library /// for the future: real twee and z-code test-data extern crate zwreec; #[test] fn file_test() { assert_eq!("hello from file", zwreec::utils::file::temp_hello()); } #[test] fn frontend_test() { assert_eq!("hello from frontend", zwreec::front...
/// extern test-lib for zwreec /// to test the whole zwreec library /// for the future: real twee and z-code test-data extern crate zwreec; #[test] fn file_test() { assert_eq!("hello from file", zwreec::utils::file::temp_hello()); } #[test] fn frontend_test() { } #[test] fn backend_test() { assert_eq!("hell...
Remove old assert statement from frontend test
Remove old assert statement from frontend test
Rust
bsd-2-clause
Drakulix/zwreec,Drakulix/zwreec
9a57aeb7834dfd25a89f6cdcbab29320c0bc992f
src/noise.rs
src/noise.rs
use std::f32::consts::PI; use rand::{self, XorShiftRng, Rng}; #[derive(Clone)] pub struct Noise(XorShiftRng); impl Noise { pub fn new() -> Noise { Noise(rand::weak_rng()) } pub fn next(&mut self) -> f32 { self.0.next_f32() } pub fn next_phase(&mut self) -> f32 { self.0.g...
use std::f32::consts::PI; use rand::{self, XorShiftRng, Rng}; #[derive(Clone)] pub struct Noise(XorShiftRng); impl Noise { pub fn new() -> Noise { Noise(rand::weak_rng()) } #[cfg(test)] pub fn new_rng(rng: XorShiftRng) -> Noise { Noise(rng) } pub fn next(&mut self) -> f32 { ...
Add new_rng to Noise for testing
Add new_rng to Noise for testing
Rust
mit
kchmck/imbe.rs
74c5a82f3b0838f5ff53b654f655f00f6d7a4d39
src/lib.rs
src/lib.rs
//! An XML-RPC implementation in Rust. //! //! The `xmlrpc` crate provides a minimal implementation of the [XML-RPC spec][spec]. //! //! [Repo link][repo]. //! //! [spec]: http://xmlrpc.scripting.com/spec.html //! [repo]: https://github.com/jonas-schievink/xml-rpc-rs extern crate base64; extern crate iso8601; extern c...
//! An XML-RPC implementation in Rust. //! //! The `xmlrpc` crate provides a minimal implementation of the [XML-RPC spec][spec]. //! //! //! [spec]: http://xmlrpc.scripting.com/spec.html extern crate base64; extern crate iso8601; extern crate xml; mod error; mod parser; mod request; mod value; mod utils; mod transpor...
Remove repo link from crate docs
Remove repo link from crate docs
Rust
cc0-1.0
jonas-schievink/xml-rpc-rs
e2df889a80415c415f915fb1a5f8119b242025dd
src/lib.rs
src/lib.rs
#![cfg(any(target_arch="x86", target_arch="x86_64"))] #![no_std] #![crate_name="cpu"] #![crate_type="rlib"] #![feature(no_std)] #![feature(asm)] #![feature(associated_consts)] #![feature(core, core_slice_ext)] #[macro_use] extern crate bitflags; pub use cpu::*; #[cfg(target_arch="x86")] #[path = "x86.rs"] mod cpu; ...
#![cfg(any(target_arch="x86", target_arch="x86_64"))] #![no_std] #![crate_name="cpu"] #![crate_type="rlib"] #![feature(asm)] #![feature(associated_consts)] #[macro_use] extern crate bitflags; pub use cpu::*; #[cfg(target_arch="x86")] #[path = "x86.rs"] mod cpu; #[cfg(target_arch="x86_64")] #[path = "x86_64.rs"] mod...
Remove gates for stablized features
Remove gates for stablized features
Rust
mit
rexlunae/redox,gz/rust-x86,gz/rust-x86,rexlunae/redox,phil-opp/rust-x86_64,RustOS-Fork-Holding-Ground/libcpu,rexlunae/redox
576579d2903db8957ce336788a8774bf5f306ec5
src/main.rs
src/main.rs
extern crate chifir; extern crate termion; use termion::raw::IntoRawMode; use termion::async_stdin; use std::io::{self, Write}; fn main() { let stdout = io::stdout(); let mut stdout = stdout.lock().into_raw_mode().unwrap(); let stdin = async_stdin(); write!(stdout, "{}{}", term...
extern crate chifir; extern crate termion; use termion::raw::IntoRawMode; use termion::async_stdin; use std::io::{self, Write}; fn main() { let stdout = io::stdout(); let mut stdout = stdout.lock().into_raw_mode().unwrap(); let stdin = async_stdin(); write!(stdout, "{}{}", term...
Allow an opcode of zero (break) as a starting point.
Allow an opcode of zero (break) as a starting point.
Rust
mit
onefrankguy/chifir
856ee4286a109e4e638927059338c068be28dd58
src/lib.rs
src/lib.rs
#![feature(convert)] extern crate tcod; pub mod engine; pub mod gui; pub mod util;
extern crate tcod; pub mod engine; pub mod gui; pub mod util;
Remove the 'convert' feature gate which is now stable
Remove the 'convert' feature gate which is now stable
Rust
bsd-3-clause
jgilchrist/rslike
eeb91a1cdadc55d5770643c6327afcf7e45a2f8b
wavefront/mod.rs
wavefront/mod.rs
use std::error::Error; use std::fs::File; use std::io::prelude::*; use std::path::Path; struct Vertex { x: f32, y: f32, z: f32 } pub struct WavefrontModel { vertices: Vec<Vertex> } impl WavefrontModel { pub fn new(path: &'static str) { let mut file = match File::open(&path) { // The `description` method of...
use std::fs::File; use std::io::{ BufReader, BufRead }; struct Vertex { x: f32, y: f32, z: f32 } pub struct WavefrontModel { vertices: Vec<Vertex> } impl WavefrontModel { pub fn new(path: &'static str) { let file = BufReader::new(File::open(&path).unwrap()); for line in file.lines() { println!("{}", li...
Print file line by line
Print file line by line
Rust
mit
jamwaffles/Wavefront.rs
8c94f8be992719a6e6652018e39a653366b4227f
src/test/rustdoc/redirect-rename.rs
src/test/rustdoc/redirect-rename.rs
#![crate_name = "foo"] mod hidden { // @has foo/hidden/struct.Foo.html // @has - '//p/a' '../../foo/struct.FooBar.html' pub struct Foo {} // @has foo/hidden/bar/index.html // @has - '//p/a' '../../foo/baz/index.html' pub mod bar { // @has foo/hidden/bar/struct.Thing.html // @ha...
#![crate_name = "foo"] mod hidden { // @has foo/hidden/struct.Foo.html // @has - '//p/a' '../../foo/struct.FooBar.html' pub struct Foo {} pub union U { a: usize } pub enum Empty {} pub const C: usize = 1; pub static S: usize = 1; // @has foo/hidden/bar/index.html // @has - '//p/a' ...
Add more tests for renamed items
Add more tests for renamed items
Rust
apache-2.0
graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust
c0933b29bf6effaefc3df95c6a164f2ada414c49
src/lib.rs
src/lib.rs
//! This crate exposes functionality to create receivers that //! receive notifications after a specified period of time or at //! a specified frequency. //! //! # Examples //! //! At its simplest, oneshot_ms can be used to put the thread to //! sleep. Unlike with std::thread::sleep, this could be used with //! Select ...
//! This crate exposes functionality to create receivers that //! receive notifications after a specified period of time or at //! a specified frequency. //! //! # Examples //! //! At its simplest, oneshot_ms can be used to put the thread to //! sleep. Unlike with std::thread::sleep, this could be used with //! Select ...
Update documentation to use the Duration-taking functions
Update documentation to use the Duration-taking functions
Rust
mit
PeterReid/schedule_recv
ffd4ad1ca62dd63737ad882f07c40c6716503299
src/lib.rs
src/lib.rs
pub mod ui { extern crate term; pub fn online() { let mut t = term::stdout().unwrap(); t.fg(term::color::GREEN).unwrap(); writeln!(t, "Online").unwrap(); } pub fn offline() { let mut t = term::stdout().unwrap(); t.fg(term::color::RED).unwrap(); writeln!(...
pub mod ui { extern crate term; pub fn online() { let mut t = term::stdout().unwrap(); t.fg(term::color::GREEN).unwrap(); writeln!(t, "Online").unwrap(); t.reset(); } pub fn offline() { let mut t = term::stdout().unwrap(); t.fg(term::color::RED).unwrap();...
Fix up indention & reset terminal
Fix up indention & reset terminal
Rust
mit
bascht/binichonline
32d0b594a1c2a03d5a1c8b4019e2307af6d91483
src/url.rs
src/url.rs
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // 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 // // Unl...
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // 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 // // Unl...
Add channel support to builder-worker
Add channel support to builder-worker Signed-off-by: Salim Alam <18ae4dd1e3db1d49a738226169e3b099325c79a0@chef.io>
Rust
apache-2.0
habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat
33c71a7c2e3c0592e97f7d796d8e8a1396d69e09
src/xml/mod.rs
src/xml/mod.rs
mod reader; mod writer; pub use self::reader::StreamingParser; pub use self::writer::Writer;
mod reader; mod writer; pub use self::reader::StreamingParser; /// WIP: Does not work correctly pub use self::writer::Writer;
Add warning to xml writer
Add warning to xml writer
Rust
mit
ebarnard/rust-plist
8c859f92fd0d2900c80b05022c5861e797db0051
src/common.rs
src/common.rs
use num_traits::{FromPrimitive, Signed}; use std::fmt::Debug; pub trait FFTnum: Copy + FromPrimitive + Signed + Debug + 'static {} impl FFTnum for f32 {} impl FFTnum for f64 {} #[inline(always)] pub fn verify_length<T>(input: &[T], output: &[T], expected: usize) { assert_eq!(input.len(), expected, "Input is the wr...
use num_traits::{FromPrimitive, Signed}; pub trait FFTnum: Copy + FromPrimitive + Signed + 'static {} impl FFTnum for f32 {} impl FFTnum for f64 {} #[inline(always)] pub fn verify_length<T>(input: &[T], output: &[T], expected: usize) { assert_eq!(input.len(), expected, "Input is the wrong length. Expected {}, got ...
Revert "FFTnum now requires Debug"
Revert "FFTnum now requires Debug" This reverts commit e0ba38387e0fadd8088f40148d003ff4cebac3b1.
Rust
apache-2.0
ejmahler/RustFFT,ejmahler/RustFFT
a534d23e81ce593cd567cb1cb0edbe08d6168440
src/base.rs
src/base.rs
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // 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 http://opensource.org/licenses/MIT>, at ...
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // 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 http://opensource.org/licenses/MIT>, at ...
Fix CGFloat type definition for 32-bit.
Fix CGFloat type definition for 32-bit.
Rust
apache-2.0
pcwalton/rust-core-graphics,servo/core-graphics-rs
84b66706e762d866e3c6e162b5a307accd2905d0
puzzles/99_Bottles/Rust/99_Bottles.rs
puzzles/99_Bottles/Rust/99_Bottles.rs
// Sings '99 Bottles of Beer' fn main() { for bottle in (0..100).rev() { if bottle > 1 { println!("{} bottles of beer on the wall, {} bottles of beer.", bottle, bottle); if bottle > 2 { println!("Take one down and pass it around, {} bottles of ...
// Sings '99 Bottles of Beer' fn main() { for bottle in (1..100).rev() { if bottle > 1 { println!("{} bottles of beer on the wall, {} bottles of beer.", bottle, bottle); if bottle > 2 { println!("Take one down and pass it around, {} bottles of ...
Fix off-by-one issue and formatting
Fix off-by-one issue and formatting
Rust
cc0-1.0
ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs...
fadf6b94caec4c9fc1afd4cc7767afdb1105668c
src/dist.rs
src/dist.rs
use std::error::Error; use conduit::{Request, Response, Handler}; use conduit_static::Static; use conduit_middleware::AroundMiddleware; use util::RequestProxy; pub struct Middleware { handler: Option<Box<Handler>>, dist: Static, } impl Middleware { pub fn new() -> Middleware { Middleware { ...
use std::error::Error; use conduit::{Request, Response, Handler}; use conduit_static::Static; use conduit_middleware::AroundMiddleware; use util::RequestProxy; pub struct Middleware { handler: Option<Box<Handler>>, dist: Static, } impl Middleware { pub fn new() -> Middleware { Middleware { ...
Revert "Assume html if no Accept header is presented"
Revert "Assume html if no Accept header is presented" This reverts commit c9e1c375841ddc4a21d7792ecabbe4b7c7cc0a46.
Rust
apache-2.0
achanda/crates.io,steveklabnik/crates.io,rust-lang/crates.io,rust-lang/crates.io,achanda/crates.io,Susurrus/crates.io,Susurrus/crates.io,Susurrus/crates.io,achanda/crates.io,rust-lang/crates.io,achanda/crates.io,steveklabnik/crates.io,steveklabnik/crates.io,steveklabnik/crates.io,Susurrus/crates.io,rust-lang/crates.io
cc2998731f9a40bf79126ca802c6d3aff955586d
src/game.rs
src/game.rs
use crate::colour::Colour; use crate::graph::{Graph, Position}; use crate::grid::Grid; pub enum GameState { Solving, Solved, } pub struct Game { pub state: GameState, pub graph: Graph, } const top_left_cell: Position = Position{column: 0_usize, row: 0_usize}; impl Game { pub fn create(size: usiz...
use crate::colour::Colour; use crate::graph::{Graph, Position}; use crate::grid::Grid; pub enum GameState { Solving, Solved, } pub struct Game { pub state: GameState, pub graph: Graph, } const TOP_LEFT_CELL: Position = Position{column: 0_usize, row: 0_usize}; impl Game { pub fn create(size: usiz...
Use SHOUTING_CASE for top-level constant
Use SHOUTING_CASE for top-level constant
Rust
mit
yzhs/flood-it
68b0a504dfbc6a610df70a3f8f47a3e89cc98268
src/tree.rs
src/tree.rs
pub enum Tree<T> { Nil, Node(T, Vec<Tree<T>>), }
struct TreeNode<T> { data: T, children: Vec<TreeNode<T>>, } pub struct Tree<T> { root: Option<TreeNode<T>> } impl<T> Tree<T> { pub fn new() -> Tree<T> { Tree { root: None } } pub fn leaf(val: T) -> Tree<T> { Tree { root: Some(TreeNode { data: val, children: vec!() }) } } }...
Rewrite Tree data structure, add new() and leaf() methods
Rewrite Tree data structure, add new() and leaf() methods
Rust
mit
nham/gymnosporangium
9d6ab9ae2326ef130a1a43876f49f00933d234e6
src/test/compile-fail/regions-var-type-out-of-scope.rs
src/test/compile-fail/regions-var-type-out-of-scope.rs
// xfail-test fn foo(cond: bool) { // Here we will infer a type that uses the // region of the if stmt then block: let mut x; //~ ERROR foo if cond { x = &3; } } fn main() {}
fn foo(cond: bool) { // Here we will infer a type that uses the // region of the if stmt then block: let mut x; if cond { x = &3; //~ ERROR illegal borrow: borrowed value does not live long enough assert (*x == 3); } } fn main() {}
Update error message and un-xfail test
Update error message and un-xfail test
Rust
apache-2.0
victorvde/rust,bhickey/rand,AerialX/rust,seanrivera/rust,KokaKiwi/rust,michaelballantyne/rust-gpu,j16r/rust,j16r/rust,pelmers/rust,mdinger/rust,michaelballantyne/rust-gpu,gifnksm/rust,aneeshusa/rust,bombless/rust,GBGamer/rust,vhbit/rust,0x73/rust,vhbit/rust,vhbit/rust,barosl/rust,pythonesque/rust,seanrivera/rust,stepan...
83a5e1829a58a92fa6e37f93b51c7df046aea890
src/configuration.rs
src/configuration.rs
extern crate yaml_rust; use self::yaml_rust::{YamlLoader, Yaml}; pub fn from_yaml(yaml_file: String) -> Vec<String> { let docs = YamlLoader::load_from_str(&yaml_file).unwrap(); let doc = &docs[0]; let key = Yaml::from_str("default"); let default_command_list = doc.as_hash().unwrap().get(&key).unwrap()...
extern crate yaml_rust; use self::yaml_rust::{YamlLoader, Yaml}; pub fn from_yaml(yaml_file: String) -> Vec<String> { let docs = YamlLoader::load_from_str(&yaml_file).unwrap(); let doc = &docs[0]; let key = Yaml::from_str("default"); let default_command_list = doc.as_hash().unwrap().get(&key).unwrap()...
Use extend instead of custom interation
Use extend instead of custom interation
Rust
mit
schultyy/Sokan
52f8b22d4f304abd6227f1476396b0a3a94e241f
src/test/compile-fail/unresolved-import.rs
src/test/compile-fail/unresolved-import.rs
// Copyright 2013 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 2013 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 ...
Add test for resolution errors
Add test for resolution errors
Rust
apache-2.0
hauleth/rust,defuz/rust,reem/rust,AerialX/rust-rt-minimal,defuz/rust,hauleth/rust,zaeleus/rust,ejjeong/rust,jroesch/rust,richo/rust,cllns/rust,pelmers/rust,SiegeLord/rust,avdi/rust,aidancully/rust,ruud-v-a/rust,pelmers/rust,fabricedesre/rust,aepsil0n/rust,avdi/rust,quornian/rust,bombless/rust,stepancheg/rust-ide-rust,m...
6869bdc4ebf6a872dcd2042c273564b429a3811d
src/main.rs
src/main.rs
extern crate rand; use std::io; use rand::Rng; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); println!("Please input your guess."); let mut guess = String::new(); ...
extern crate rand; use std::io; use rand::Rng; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); println!("Please input your guess."); let mut guess = String::new(); ...
Convert `guess` from `String` into `u32`
Convert `guess` from `String` into `u32`
Rust
mit
juliangrosshauser/guessing_game
b6d84ddfc2ddaf5f97bf8db7ef66f586a186fa21
src/main.rs
src/main.rs
extern crate integrate; use integrate::cquad; use std::num::FloatMath; use std::f64::consts; fn main() { // Integrate sin(x)/2 from 0 to pi let (result, err, neval) = cquad(|x| 0.5f64 * FloatMath::sin(x), 0f64, consts::PI); println!("result: {}, err {}, neval {}", result, err, neval); }
extern crate integrate; use integrate::cquad; use std::num::FloatMath; use std::f64::consts; fn main() { // Integrate sin(x)/2 from 0 to pi let (result, err, neval) = cquad(|x| 0.5f64 * FloatMath::sin(x), 0f64, consts::PI); println!("result: {:.10e}, err {:.10e}, neval {}", result, err, neval); }
Increase output precision in example
Increase output precision in example
Rust
mit
ibab/rust-gsl-integrate
55398a945abc0ea6f5bd35aad54d18ce3e1f9ed0
src/main.rs
src/main.rs
mod vm; mod command; mod parse; mod program; use vm::VM; use program::Program; use std::io::Write; use std::env; fn main() { for argument in env::args() { println!("{}", argument); } let vm = VM::new(); let program = Program::new(); match env::args().nth(1) { None => repl(vm, pro...
mod vm; mod command; mod parse; mod program; use vm::VM; use program::Program; use std::io::Write; use std::env; use std::path::Path; use std::fs::File; use std::io::prelude::*; fn main() { for argument in env::args() { println!("{}", argument); } let vm = VM::new(); let program = Program::n...
Add function to provide interpreter interface
Add function to provide interpreter interface
Rust
mit
nafarlee/thoughtfuck
b2366ebfd529f769685d84bb9d8cbee5f06749df
src/main.rs
src/main.rs
#[macro_use] extern crate clap; extern crate riscan_pro; extern crate serde_json; use clap::{App, Arg, SubCommand}; use riscan_pro::Project; fn main() { let matches = App::new("RiSCAN Pro") .author("Pete Gadomski <pete@gadom.ski>") .about("Query RiSCAN Pro projects") .subcommand( ...
#[macro_use] extern crate clap; extern crate riscan_pro; extern crate serde_json; use clap::{App, Arg, SubCommand}; use riscan_pro::Project; fn main() { let matches = App::new("RiSCAN Pro") .author("Pete Gadomski <pete@gadom.ski>") .about("Query RiSCAN Pro projects") .subcommand( ...
Add compact option to info command line
Add compact option to info command line
Rust
mit
gadomski/riscan-pro
9619c12f2232fdf637f64d125b4e692005c2f5c1
src/main.rs
src/main.rs
mod vm; mod command; mod parse; use vm::VM; use std::io::Write; fn main() { let mut vm = VM::new(); loop { print!("{}", "bf> "); std::io::stdout().flush().unwrap(); let mut line = String::new(); let commands = match std::io::stdin().read_line(&mut line) { Ok(0) => ...
mod vm; mod command; mod parse; use vm::VM; use std::io::Write; fn main() { let mut vm = VM::new(); loop { print!("{}", "bf> "); std::io::stdout().flush().unwrap(); let mut line = String::new(); let commands = match std::io::stdin().read_line(&mut line) { Ok(0) => ...
Apply commands to vm on each loop
Apply commands to vm on each loop
Rust
mit
nafarlee/thoughtfuck
8ef5ddaf829bff3d671544e7ca45e50d7e75787b
src/main.rs
src/main.rs
extern crate iron; extern crate mount; extern crate logger; extern crate staticfile; use iron::prelude::*; use iron::mime::Mime; use iron::status; use mount::Mount; use logger::Logger; use staticfile::Static; static JSON_RESPONSE: &'static str = "{ \"ingredients\": [ { \"name\": \"Creep Cluste...
extern crate iron; extern crate mount; extern crate logger; extern crate staticfile; use iron::prelude::*; use iron::mime::Mime; use iron::status; use mount::Mount; use logger::Logger; use staticfile::Static; static JSON_RESPONSE: &'static str = "{ \"ingredients\": [ { \"name\": \"Creep Cluste...
Add image to example JSON response.
Add image to example JSON response.
Rust
mit
zsiciarz/skyrim-alchemy-toolbox,zsiciarz/skyrim-alchemy-toolbox,zsiciarz/skyrim-alchemy-toolbox
1fa642e41b145fcf0109822c1864842f34ff8653
src/main.rs
src/main.rs
use std::io::File; mod parser; fn main() { let input = r#"{ let x = 0; loop { __clear(); __draw_pos(x, 5); __get_font(3); __draw(5); x = x + 1; __key_wait(0); } }"#; let code = parser::parse(input); for &op in code.iter() { print!("{:02x}", op); } println!(""); ...
use std::io::File; use std::os; mod parser; fn main() { let args = os::args(); if args.len() != 2 { println!("Invalid usage"); return; } let input = match File::open(&Path::new(args[1])) { Some(mut f) => f.read_to_str(), None => { println!("Error reading file"); return;...
Change to reading input from file
Change to reading input from file
Rust
mit
mchesser/pchip,quvarxa/pchip
625d349ffb2be7855d51a1c1ec88f75417d28f24
tests/compiletest.rs
tests/compiletest.rs
#![deny(clippy::all, clippy::pedantic)] #[rustversion::attr(not(nightly), ignore)] #[test] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/*.rs"); }
#![deny(clippy::all, clippy::pedantic)] #[rustversion::attr(not(nightly), ignore)] #[cfg_attr(miri, ignore)] #[test] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/*.rs"); }
Disable ui test on miri
Disable ui test on miri
Rust
apache-2.0
dtolnay/thiserror
5f7f69ff44c0ffb014223cb397b874569a093d04
src/bin/cat.rs
src/bin/cat.rs
// Copyright 2015 James Bostock. See the LICENSE file at the top-level // directory of this distribution. // An implementation of the cat(1) command in Rust. // See http://man.cat-v.org/unix-6th/1/cat use std::env; use std::fs::File; use std::io; use std::path::Path; fn cat(filename: &str) -> io::Result<u64> { le...
// Copyright 2015 James Bostock. See the LICENSE file at the top-level // directory of this distribution. // An implementation of the cat(1) command in Rust. // See http://man.cat-v.org/unix-6th/1/cat use std::env; use std::fs::File; use std::io; use std::io::Write; use std::path::Path; fn cat(filename: &str) -> io::...
Write error message to standard error.
Write error message to standard error.
Rust
mit
james-bostock/rust-v6-cmd
a8bd0aa2d801acc145774a37317e43bea03e3b35
tests/integration.rs
tests/integration.rs
extern crate thoughtfuck; mod common; use std::fs::File; use std::io::Read; use common::FauxStdout; use thoughtfuck::vm::*; use thoughtfuck::program::*; use thoughtfuck::parse::parse; fn read_file(filename: &str) -> String { let mut file = File::open(filename).unwrap(); let mut source = String::new(); f...
extern crate thoughtfuck; mod common; use std::fs::File; use std::io::Read; use common::FauxStdout; use thoughtfuck::vm::*; use thoughtfuck::program::*; use thoughtfuck::parse::parse; fn read_file(filename: &str) -> String { let mut file = File::open(filename).unwrap(); let mut source = String::new(); f...
Add test_ouput testing helper function
Add test_ouput testing helper function
Rust
mit
nafarlee/thoughtfuck
9613b10b8dec0f1fb7e08c99d5f2191305902b3a
test/sys/mod.rs
test/sys/mod.rs
mod test_event; mod test_socket; mod test_sockopt; mod test_termios; mod test_ioctl; mod test_wait; mod test_select; mod test_uio;
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))] mod test_event; mod test_socket; mod test_sockopt; mod test_termios; mod test_ioctl; mod test_wait; mod test_select; mod test_uio;
Disable sys/event tests on Linux
Disable sys/event tests on Linux
Rust
mit
carllerche/nix-rust,xd009642/nix,carllerche/nix-rust,carllerche/nix-rust,geofft/nix-rust,kamalmarhubi/nix-rust,Susurrus/nix,posborne/rust-nix,berkowski/nix,xd009642/nix,berkowski/nix,geofft/nix-rust,nix-rust/nix,geofft/nix-rust,xd009642/nix,Susurrus/nix,MarkusJais/nix-rust,Susurrus/nix,kamalmarhubi/nix-rust,MarkusJais/...
14994ac6b67cdaff1692f836e3495a75f4f7d71b
src/librustc_back/target/emscripten_base.rs
src/librustc_back/target/emscripten_base.rs
// Copyright 2014-2015 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-MI...
// Copyright 2014-2015 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-MI...
Use cfg!() to get type checking everywhere.
Use cfg!() to get type checking everywhere.
Rust
apache-2.0
graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust
9f2e49b5cb281187d3967e400f5996745f21429f
src/lib.rs
src/lib.rs
#![feature(inclusive_range_syntax)] extern crate arrayvec; extern crate collect_slice; extern crate crossbeam; extern crate map_in_place; extern crate num; extern crate quad_osc; extern crate rand; pub mod consts; pub mod decoder; pub mod frame; mod allocs; mod coefs; mod descramble; mod enhance; mod gain; mod param...
#![feature(inclusive_range_syntax)] extern crate arrayvec; extern crate collect_slice; extern crate crossbeam; extern crate map_in_place; extern crate num; extern crate quad_osc; extern crate rand; pub mod allocs; pub mod coefs; pub mod consts; pub mod decoder; pub mod descramble; pub mod enhance; pub mod frame; pub ...
Make all modules public, reexport key parts
Make all modules public, reexport key parts
Rust
mit
kchmck/imbe.rs
946572177c4b25f2e16773983b82e183f833e7fd
src/lib.rs
src/lib.rs
// Copyright 2012-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-MI...
// Copyright 2012-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-MI...
Allow unstable warnings during tests
Allow unstable warnings during tests
Rust
apache-2.0
rust-lang/rustc-serialize,gbersac/rustc-serialize,rust-lang-nursery/rustc-serialize,rust-lang-deprecated/rustc-serialize,DenisKolodin/rustc-serialize,ajroetker/rustc-serialize,shepmaster/rustc-serialize,SimonSapin/rustc-serialize,indefini/rustc-serialize
1fa0b5f7558309a194d411840526c4a6d66ce010
src/bin/08-process-cntl/e06-zombie.rs
src/bin/08-process-cntl/e06-zombie.rs
/// Exercise 8.6: Write a program that creates a zombie, and then call system /// to execute the ps(1) command to verify that the process is a zombie. /// /// Takeaway: does only work on Linux, on MacOs the child process is somehow /// reaped automatically, at least ps doesn't show it extern crate libc; #[macro_use(cs...
/// Exercise 8.6: Write a program that creates a zombie, and then call system /// to execute the ps(1) command to verify that the process is a zombie. /// /// Takeaway: does only work on Linux, on MacOs the child process is somehow /// reaped automatically, at least ps doesn't show it /// More details here: http://stac...
Add link to SO question
Add link to SO question
Rust
mit
philippkeller/apue-rust,philippkeller/apue-rust,philippkeller/apue-rust
9317ff137a9f62a51b177147451bf3e494387020
src/components/script/dom/validitystate.rs
src/components/script/dom/validitystate.rs
/* 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/. */ use dom::bindings::codegen::Bindings::ValidityStateBinding; use dom::bindings::js::{JS, JSRef, Temporary}; use dom...
/* 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/. */ use dom::bindings::codegen::Bindings::ValidityStateBinding; use dom::bindings::js::{JSRef, Temporary}; use dom::bi...
Remove the unused window field from ValidityState.
Remove the unused window field from ValidityState. It is only necessary if the ValidityState would create new objects, which it doesn't.
Rust
mpl-2.0
huonw/servo,kindersung/servo,nick-thompson/servo,mdibaiee/servo,emilio/servo,dagnir/servo,zhangjunlei26/servo,dati91/servo,mdibaiee/servo,meh/servo,Shraddha512/servo,bjwbell/servo,DominoTree/servo,evilpie/servo,paulrouget/servo,hyowon/servo,tempbottle/servo,GyrosOfWar/servo,huonw/servo,juzer10/servo,Shraddha512/servo,s...
d1cd17161e16a8fbc289db27b9feb331d301ab24
src/serialization.rs
src/serialization.rs
use commit::Commit; pub trait Serializable { fn encode(&self) -> Vec<u8>; fn encode_body(&self) -> Vec<u8>; } pub fn encode_author_info(commit: &Commit) -> Vec<u8> { (format!("author {} <{}> {}\n", commit.author_name, commit.author_email, encode_date(commit.author_da...
use commit::Commit; use std::str::UnicodeStrSlice; use std::from_str::FromStr; use reader::Reader; pub trait Serializable { fn encode(&self) -> Vec<u8>; fn encode_body(&self) -> Vec<u8>; } pub fn encode_author_info(commit: &Commit) -> Vec<u8> { (format!("author {} <{}> {}\n", commit.author_na...
Implement some rudimentary user info parsing
Implement some rudimentary user info parsing
Rust
mit
kaisellgren/rust_git
2d32daa27305c93131145e63aff93fd1e4a599d4
src/utils.rs
src/utils.rs
use stdio; pub unsafe fn outb(port: u16, value: u8) { asm!("outb %al, %dx" : : "{dx}" (port), "{al}" (value) : : "volatile" ); } pub unsafe fn inb(port: u16) -> u8 { let mut ret: u8; stdio::putc(66); asm!("inb %dx, %al" : "={al}"(ret) : "{dx}"(port)...
use stdio; pub unsafe fn outb(port: u16, value: u8) { asm!("outb %al, %dx" : : "{dx}" (port), "{al}" (value) : : "volatile" ); } pub unsafe fn inb(port: u16) -> u8 { let mut ret: u8; asm!("inb %dx, %al" : "={al}"(ret) : "{dx}"(port) : ...
Remove debug code from putc()
Remove debug code from putc()
Rust
mit
jvns/puddle,jvns/puddle
eec60836625d124ef6386e6d519296afbe989374
src/libinterval/lib.rs
src/libinterval/lib.rs
// Copyright 2015 Pierre Talbot (IRCAM) // 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...
// Copyright 2015 Pierre Talbot (IRCAM) // 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...
Fix warnings generated by the latest Rust version.
Fix warnings generated by the latest Rust version.
Rust
apache-2.0
ptal/rust-interval
f1e66c6ab05054baa0bc0767cb37a59dd1bd6e36
tests/integration.rs
tests/integration.rs
extern crate thoughtfuck; mod common; use thoughtfuck::vm::*; use thoughtfuck::program::*; use thoughtfuck::parse::parse; #[test] fn hello_world () { const SOURCE: &str = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."; let commands = parse(SOURCE);...
extern crate thoughtfuck; mod common; use common::FauxStdout; use thoughtfuck::vm::*; use thoughtfuck::program::*; use thoughtfuck::parse::parse; #[test] fn hello_world () { const SOURCE: &str = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."; let c...
Change test to instantiate VM with FauxStdout
Change test to instantiate VM with FauxStdout
Rust
mit
nafarlee/thoughtfuck
c7c58cb7eff2b33f92b5196d6b30de7642df4a3c
src/linspace.rs
src/linspace.rs
use std::iter; use std::num::{Float, NumCast}; /// An iterator of `n` evenly spaced floats. /// /// Iterator element type is `F`. pub type Linspace<F> = iter::Take<iter::Counter<F>>; /// Return an iterator with `n` elements, where the first /// element is `a` and the last element is `b`. /// /// Iterator element typ...
use std::ops::RangeFrom; use std::iter; use std::num::{Float, NumCast}; /// An iterator of `n` evenly spaced floats. /// /// Iterator element type is `F`. pub type Linspace<F> = iter::Take<iter::StepBy<F, RangeFrom<F>>>; /// Return an iterator with `n` elements, where the first /// element is `a` and the last elemen...
Use .step_by instead of iter::counter
Use .step_by instead of iter::counter
Rust
apache-2.0
imp/rust-itertools,rust-itertools/itertools,DanielKeep/rust-itertools,tempbottle/rust-itertools,stepancheg/rust-itertools,Wilfred/rust-itertools,flo-l/rust-itertools
7aef3d83f97b5d5cde26599495ec5ee2eaad829a
lib.rs
lib.rs
/* 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/. */ #[crate_id = "github.com/mozilla-servo/rust-cssparser#cssparser:0.1"]; #[feature(globs, macro_rules)]; #[crate_typ...
/* 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/. */ #![crate_id = "github.com/mozilla-servo/rust-cssparser#cssparser:0.1"] #![crate_type = "lib"] #![crate_type = "dyl...
Update to current rust: use the new attributes syntax.
Update to current rust: use the new attributes syntax. Builds with mozilla/rust@e263ef1df7b892ed29e53313565eb05ab75e52f4.
Rust
mpl-2.0
disjukr/rust-cssparser,disjukr/rust-cssparser,frewsxcv/rust-cssparser,servo/rust-cssparser,notriddle/rust-cssparser,tempbottle/rust-cssparser,tempbottle/rust-cssparser,notriddle/rust-cssparser,frewsxcv/rust-cssparser,servo/rust-cssparser
4afdbe89c2bb1820e25b586b52d3f2948f9d1988
src/servo/servo.rs
src/servo/servo.rs
fn main() { }
import azure::cairo; fn on_main(f: fn~()) { let builder = task::builder(); let opts = { sched: some({ mode: task::osmain, native_stack_size: none }) with task::get_opts(builder) }; task::set_opts(builder, opts); task::run(builder, f); } fn main() { ...
Use SDL to display a window
Use SDL to display a window
Rust
mpl-2.0
wartman4404/servo,DominoTree/servo,shrenikgala/servo,luniv/servo,dhananjay92/servo,ryancanhelpyou/servo,upsuper/servo,emilio/servo,emilio/servo,RenaudParis/servo,fiji-flo/servo,akosel/servo,caldwell/servo,kindersung/servo,DominoTree/servo,nrc/servo,seanmonstar/servo,GreenRecycleBin/servo,dsandeephegde/servo,j3parker/se...
11d3c647b045db9f9c6628374695a07d54951a51
src/index_data.rs
src/index_data.rs
pub use std::mem; pub use std::slice; pub enum IndexDatumType { UnsignedByte, UnsignedShort } pub trait IndexData { fn index_datum_type() -> IndexDatumType; fn index_bytes(&self) -> &[u8]; fn index_elements(&self) -> usize; } pub trait IndexDatum { fn index_datum_type() -> IndexDatumType; } ...
pub use std::mem; pub use std::slice; pub enum IndexDatumType { UnsignedByte, UnsignedShort } pub trait IndexData { fn index_datum_type() -> IndexDatumType; fn index_bytes(&self) -> &[u8]; fn index_elements(&self) -> usize; } pub trait IndexDatum { fn index_datum_type() -> IndexDatumType; } ...
Add impl of `IndexData` for arrays of `IndexDatum`s
Add impl of `IndexData` for arrays of `IndexDatum`s
Rust
apache-2.0
kylewlacy/glitter,kylewlacy/glitter
a3e464078af39e10132bac3d1ac37dbebae8b41a
beacon_node/store/src/impls.rs
beacon_node/store/src/impls.rs
use crate::*; use ssz::{Decode, Encode}; mod beacon_state; impl<T: EthSpec> StoreItem for BeaconBlock<T> { fn db_column() -> DBColumn { DBColumn::BeaconBlock } fn as_store_bytes(&self) -> Vec<u8> { let timer = metrics::start_timer(&metrics::BEACON_STATE_WRITE_TIMES); let bytes = s...
use crate::*; use ssz::{Decode, Encode}; mod beacon_state; impl<T: EthSpec> StoreItem for BeaconBlock<T> { fn db_column() -> DBColumn { DBColumn::BeaconBlock } fn as_store_bytes(&self) -> Vec<u8> { let timer = metrics::start_timer(&metrics::BEACON_BLOCK_WRITE_TIMES); let bytes = s...
Fix store block read metrics
Fix store block read metrics
Rust
apache-2.0
sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse
e0e8885d9aaff4c04f5826d0f9e99ccffe0d84b1
src/main.rs
src/main.rs
use std::io::{Write, BufWriter}; use std::fs::File; mod vector; use vector::Vec3; fn main() { let nx = 300; let ny = 200; let data = format!("{}\n{} {}\n{}\n", "P3", nx, ny, 255); let f = File::create("target/image.ppm").expect("Unable to create file"); let mut f = BufWriter::new(f); f.write_all(data.as_by...
use std::io::{Write, BufWriter}; use std::fs::File; mod vector; use vector::Vec3; fn main() { let nx = 300; let ny = 200; let data = format!("{}\n{} {}\n{}\n", "P3", nx, ny, 255); let f = File::create("target/image.ppm").expect("Unable to create file"); let mut f = BufWriter::new(f); f.write_all(data.as_by...
Update vector use with new syntax
Update vector use with new syntax
Rust
mit
corragon/rust-raytracer
2fa5a7706b8c3f303e896a8a48937647cddaf5f1
src/main.rs
src/main.rs
// Copyright 2014 Birunthan Mohanathas // // Licensed under the MIT license <http://opensource.org/licenses/MIT>. This // file may not be copied, modified, or distributed except according to those // terms. mod measure; mod skin; mod time_measure; fn main() { }
// Copyright 2014 Birunthan Mohanathas // // Licensed under the MIT license <http://opensource.org/licenses/MIT>. This // file may not be copied, modified, or distributed except according to those // terms. #![allow(dead_code)] mod measure; mod skin; mod time_measure; fn main() { }
Allow dead code for entire crate
Allow dead code for entire crate
Rust
mit
poiru/rainmeter-rust
1666883e2ec43251bb71eecc2c127b899c661e0a
src/path.rs
src/path.rs
use std::fmt::{self, Display}; /// Path to the current value in the input, like `dependencies.serde.typo1`. #[derive(Copy, Clone)] pub enum Path<'a> { Root, Seq { parent: &'a Path<'a>, index: usize }, Map { parent: &'a Path<'a>, key: &'a str }, Some { parent: &'a Path<'a> }, NewtypeStruct { parent:...
use std::fmt::{self, Display}; /// Path to the current value in the input, like `dependencies.serde.typo1`. #[derive(Copy, Clone)] pub enum Path<'a> { Root, Seq { parent: &'a Path<'a>, index: usize }, Map { parent: &'a Path<'a>, key: &'a str }, Alias { parent: &'a Path<'a> }, Unknown { parent: &'a ...
Remove Path variants that were never constructed
Remove Path variants that were never constructed
Rust
apache-2.0
dtolnay/serde-yaml
9d005a808174c8c24ec89c3b1cd92377d5875765
main.rs
main.rs
extern mod rsfml; use rsfml::window::{ContextSettings, VideoMode}; use rsfml::graphics::{RenderWindow, sfClose}; mod cpu; #[cfg(target_os="macos")] #[start] fn start(argc: int, argv: **u8) -> int { std::rt::start_on_main_thread(argc, argv, main) } fn main() { // Create the window of the application let ...
extern mod rsfml; use rsfml::window::{ContextSettings, VideoMode, event}; use rsfml::graphics::{RenderWindow, sfClose}; mod cpu; #[cfg(target_os="macos")] #[start] fn start(argc: int, argv: **u8) -> int { std::rt::start_on_main_thread(argc, argv, main) } fn main() { // Create the window of the application ...
Check for window events so we don't lock up the program
Check for window events so we don't lock up the program
Rust
mit
dguenther/rustchip
dde12554a37742e32524f99853e8d7bd24236f4b
examples/receive.rs
examples/receive.rs
extern crate rosc; fn main() { println!("hello"); }
extern crate rosc; use std::{net, env, process}; fn main() { let args: Vec<String> = env::args().collect(); if args.len() < 3 { println!("Usage ./receive IP PORT"); process::exit(1); } let addr: net::Ipv4Addr = parse_ip_v4(&args[1]); let port: u16 = args[2] ...
Implement socket creation address parsing
Implement socket creation address parsing
Rust
apache-2.0
klingtnet/rosc
cd1773da9f8cb6cb76631ad1c1f5598de84d58e9
exonum/src/storage2/entry.rs
exonum/src/storage2/entry.rs
use std::marker::PhantomData; use super::{BaseIndex, BaseIndexIter, Result, Snapshot, Fork, StorageKey, StorageValue}; pub struct Entry<T, V> { base: BaseIndex<T>, _v: PhantomData<V>, } impl<T, V> Entry<T, V> { pub fn new(prefix: Vec<u8>, base: T) -> Self { Entry { base: BaseIndex::ne...
use std::marker::PhantomData; use crypto::Hash; use super::{BaseIndex, BaseIndexIter, Result, Snapshot, Fork, StorageKey, StorageValue}; pub struct Entry<T, V> { base: BaseIndex<T>, _v: PhantomData<V>, } impl<T, V> Entry<T, V> { pub fn new(prefix: Vec<u8>, base: T) -> Self { Entry { ...
Implement method hash for Entry
Implement method hash for Entry Former-commit-id: 83a82707f122ae14a204ea50723eeae0aa8e871a
Rust
apache-2.0
alekseysidorov/exonum,exonum/exonum,exonum/exonum,alekseysidorov/exonum,alekseysidorov/exonum,exonum/exonum,alekseysidorov/exonum,exonum/exonum
49396715e1c6f3ac8b03ddfad147003d353d2803
build.rs
build.rs
extern crate bindgen; extern crate gcc; use bindgen::RustTarget; use gcc::Build; use std::env; use std::path::PathBuf; fn main() { let mut c = Build::new(); c.flag("-std=c99"); c.file("src/c/YGEnums.c"); c.file("src/c/YGNodeList.c"); c.file("src/c/Yoga.c"); c.compile("libyoga.a"); let bindings = bindgen::Bui...
extern crate bindgen; extern crate gcc; use bindgen::RustTarget; use gcc::Build; use std::env; use std::path::PathBuf; fn main() { let mut c = Build::new(); c.flag("-std=c99"); c.file("src/c/YGEnums.c"); c.file("src/c/YGNodeList.c"); c.file("src/c/Yoga.c"); c.compile("libyoga.a"); let bindings = bindgen::Bui...
Fix `FP_` types binding errors
Fix `FP_` types binding errors Signed-off-by: Victor Porof <4f672cb979ca45495d0cccc37abaefc8713fcc24@gmail.com>
Rust
mit
bschwind/yoga-rs,bschwind/yoga-rs,bschwind/yoga-rs,bschwind/yoga-rs
7dbec297a18e6c5cffeac212f7fc93718eb26047
dining_philosophers/src/main.rs
dining_philosophers/src/main.rs
fn main() { println!("Hello, world!"); }
use std::thread; use std::sync::{Mutex, Arc}; struct Philosopher { name: String, left: usize, right: usize, } impl Philosopher { fn new(name: &str, left: usize, right: usize) -> Philosopher { Philosopher { name: name.to_string(), left: left, right: right, ...
Implement the 'Dining Philosophers' in one go.
Implement the 'Dining Philosophers' in one go.
Rust
mit
wahn/Rust_Examples
ead877ae937cafb7338b9c32a6d89f3da0f1c1ce
build.rs
build.rs
fn main() { let git_hash = option_env!("TRAVIS_COMMIT") .map(ToOwned::to_owned) .unwrap_or_else(|| { let stdout = std::process::Command::new("git") .arg("rev-parse") .arg("HEAD") .output() .expect("Failed to get git commit S...
use std::fs::read_to_string; fn main() { let git_hash = option_env!("TRAVIS_COMMIT") .map(|s| s.into()) .unwrap_or_else(|| read_to_string(".git/refs/heads/next").unwrap_or_default()); println!("cargo:rustc-env=GIT_HASH={}", git_hash); }
Revert "Get proper git SHA when TRAVIS_COMMIT is not available."
Revert "Get proper git SHA when TRAVIS_COMMIT is not available." This reverts commit 2e3b4b774a9ff2eec46d04b48023cbfc2617ccea.
Rust
mit
autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/L...
ad25ef85b3d6730da76d8cdba4b50a42e2a6d8d9
build.rs
build.rs
extern crate git2; use std::env; use std::process::Command; use git2::Repository; const REPO_URL: &str = "https://github.com/iris-edu/libmseed"; const BUILD_DIR: &str = "src/libmseed"; const GIT_REF: &str = "refs/heads/2.x"; // libmseed v3 broke the ABI fn main() { let repo = match Repository::clone(REPO_URL, B...
extern crate git2; use std::env; use std::process::Command; use git2::Repository; const REPO_URL: &str = "https://github.com/iris-edu/libmseed"; const BUILD_DIR: &str = "src/libmseed"; const GIT_REF: &str = "refs/remotes/origin/2.x"; // libmseed v3 broke the ABI fn main() { let repo = match Repository::clone(RE...
Fix inconsistently working git ref
Fix inconsistently working git ref
Rust
mit
savage13/miniseed-rs
02080b8baefa76a8ec18b5119cd10691eed22599
numbers/prime_factorization.rs
numbers/prime_factorization.rs
fn is_prime(num :u64) -> bool { for i in range(2, num) { if num % i == 0 { return false } } true } fn fatorize_prime(num :u64) { for i in range(2, num) { if num % i == 0 && is_prime(i) { println!("{}", i); } } } #[test] fn is_prime_test() { ...
fn is_prime(num :f64) -> bool { for i in range(2, num.sqrt() as u64) { if num as u64 % i == 0 { return false } } true } fn fatorize_prime(num :f64) { for i in range(2, num.sqrt() as u64) { if num as u64 % i == 0 && is_prime(i as f64) { println!("{}", i); ...
Build a more perfomant function that utilizes sqrt.
Build a more perfomant function that utilizes sqrt.
Rust
mit
leonkunert/Projects-Rust
0ffb76f5d6996c2fe1323e1a14c1b1b5c21fe7d1
macro/src/clang.rs
macro/src/clang.rs
use crate::syntax::report::Errors; use crate::syntax::Api; use serde::Deserialize; type Node = clang_ast::Node<Clang>; #[derive(Deserialize)] enum Clang { Unknown, } pub fn load(cx: &mut Errors, apis: &mut [Api]) { let _ = cx; let _ = apis; unimplemented!() }
use crate::syntax::report::Errors; use crate::syntax::Api; use serde::Deserialize; type Node = clang_ast::Node<Clang>; #[derive(Deserialize)] enum Clang { Unknown, } pub fn load(cx: &mut Errors, apis: &mut [Api]) { let mut variants_from_header = Vec::new(); for api in apis { if let Api::Enum(enm)...
Determine whether AST dump loading is necessary
Determine whether AST dump loading is necessary
Rust
apache-2.0
dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx
4f0a3ff79a54522da1491b44ea61a883baddb64e
wgfem.rs
wgfem.rs
#[link(name = "wgfem", vers = "0.1", url = "https://github.com/scharris/WGFEM-Rust")]; #[license = "MIT"]; #[crate_type = "lib"]; extern mod extra; pub mod common; pub mod monomial; pub mod polynomial; pub mod vector_monomial; pub mod mesh; pub mod rectangle_mesh; pub mod dense_matrix; pub mod weak_gradient; pub...
#[link(name = "wgfem", vers = "0.1", url = "https://github.com/scharris/WGFEM-Rust")]; #[license = "MIT"]; #[crate_type = "lib"]; #[feature(globs)]; #[feature(macro_rules)]; extern mod extra; pub mod common; pub mod monomial; pub mod polynomial; pub mod vector_monomial; pub mod mesh; pub mod rectangle_mesh; pub ...
Add options to use glob imports and macros which are required in the new nightly.
Add options to use glob imports and macros which are required in the new nightly.
Rust
mit
scharris/WGFEM-Rust,scharris/WGFEM-Rust,scharris/WGFEM-Rust
020ff6575fa39c15bde1973bad1f24550a0f8d44
src/error.rs
src/error.rs
error_chain! { links { Config (::config::Error, ::config::ErrorKind); Feed (::feed::Error, ::feed::ErrorKind); Listeners (::feed::listeners::Error, ::feed::listeners::ErrorKind); Notification(::notification::Error, ::notification::ErrorKind); ...
error_chain! { links { Config (::config::Error, ::config::ErrorKind); Feed (::feed::Error, ::feed::ErrorKind); Listeners (::feed::listeners::Error, ::feed::listeners::ErrorKind); Notification(::notification::Error, ::notification::ErrorKind); ...
Move backtrace printing to function
Move backtrace printing to function
Rust
agpl-3.0
Acizza/bcnotif
f231fd5c6c48bad44111ed41ca689166f31e8e23
src/pascal_str.rs
src/pascal_str.rs
use ascii::AsciiChar; pub struct PascalStr { chars: [AsciiChar] }
use ascii::{AsciiChar, AsciiStr}; use std::convert::AsRef; use ::PASCAL_STRING_BUF_SIZE; /// A borrowed slice from a `PascalString`. Does not own its data. #[derive(Eq, Hash, PartialEq, PartialOrd)] pub struct PascalStr { /// The `AsciiStr`, borrowed from the original `PascalString` string: AsciiStr } impl Pa...
Replace `PascalStr` internals with an `AsciiStr` for convenience. Also, various improvements.
Replace `PascalStr` internals with an `AsciiStr` for convenience. Also, various improvements.
Rust
mit
burtonageo/pascal_string
73e45bf032d701225e84b22645786d02e3154d99
src/sss/encode.rs
src/sss/encode.rs
use gf256::Gf256; use std::io; use std::io::prelude::*; /// evaluates a polynomial at x=1, 2, 3, ... n (inclusive) pub(crate) fn encode_secret_byte<W: Write>(src: &[u8], n: u8, w: &mut W) -> io::Result<()> { for raw_x in 1..(u16::from(n) + 1) { let x = Gf256::from_byte(raw_x as u8); let mut fac = G...
use gf256::Gf256; use std::io; use std::io::prelude::*; /// evaluates a polynomial at x=1, 2, 3, ... n (inclusive) pub(crate) fn encode_secret_byte<W: Write>(src: &[u8], n: u8, w: &mut W) -> io::Result<()> { for raw_x in 1..(u16::from(n) + 1) { let x = Gf256::from_byte(raw_x as u8); let sum = src.i...
Use Horner's method for evaluating polynomials
Use Horner's method for evaluating polynomials Horner's method is an algorithm for calculating polynomials, which consists of transforming the monomial form into a computationally efficient form. It is pretty easy to understand: https://en.wikipedia.org/wiki/Horner%27s_method#Description_of_the_algorithm This impleme...
Rust
bsd-3-clause
SpinResearch/RustySecrets
291a9ee42031f6e6cf0ee1a30d0cd225d6a49260
tests/try-compile.rs
tests/try-compile.rs
// Copyright 2015 Sean Patrick Santos // // Licensed under the Apache License, Version 2.0. // License available at: // http://www.apache.org/licenses/LICENSE-2.0 // // Copyright and license information should be present in the top // level directory of this package. #![crate_type="bin"] extern crate probe_c_api; us...
// Copyright 2015 Sean Patrick Santos // // Licensed under the Apache License, Version 2.0. // License available at: // http://www.apache.org/licenses/LICENSE-2.0 // // Copyright and license information should be present in the top // level directory of this package. extern crate probe_c_api; use std::default::Defaul...
Remove `crate_type` attribute from test file.
Remove `crate_type` attribute from test file.
Rust
apache-2.0
quantheory/probe-c-api,quantheory/probe-c-api
2fb97140c2d346e0404a4f95a1593d85d62d0739
code/11/io.rs
code/11/io.rs
use std::io; use std::rand; fn generate_secret_number() -> int { (rand::random::<int>() % 100).abs() + 1 } fn process_guess(secret:int, guess: int) -> bool { println!("You guessed: {:d}", guess); if guess > secret { println("Your guess was too high!"); false } else if guess < s...
use std::io; use std::rand; fn generate_secret_number() -> int { (rand::random::<int>() % 100).abs() + 1 } fn process_guess(secret: int, guess: int) -> bool { println!("You guessed: {:d}", guess); if guess > secret { println!("Your guess was too high!"); false } else if guess < secret...
Update code sample for chapter 11.
Update code sample for chapter 11.
Rust
agpl-3.0
gpbonillas/rust_for_rubyists,steveklabnik/rust_for_rubyists,gpbonillas/rust_for_rubyists,dskecse/rust_for_rubyists,gpbonillas/rust_for_rubyists,steveklabnik/rust_for_rubyists,dskecse/rust_for_rubyists,dskecse/rust_for_rubyists,steveklabnik/rust_for_rubyists
3cbc3f4802b9dd8125f2605cf4dab7a18839c4e8
src/test/compile-fail/type-parameter-names.rs
src/test/compile-fail/type-parameter-names.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 ...
Add a test for failure to unify type parameters
Add a test for failure to unify type parameters
Rust
apache-2.0
avdi/rust,kimroen/rust,aepsil0n/rust,ebfull/rust,gifnksm/rust,rprichard/rust,defuz/rust,0x73/rust,andars/rust,zaeleus/rust,mvdnes/rust,zaeleus/rust,zubron/rust,ktossell/rust,rprichard/rust,reem/rust,XMPPwocky/rust,hauleth/rust,aidancully/rust,emk/rust,AerialX/rust,AerialX/rust-rt-minimal,TheNeikos/rust,victorvde/rust,s...
c35327681914bed7e80a9a566caedc75b22ba6f3
src/prob4.rs
src/prob4.rs
use std::num; use std::collections::PriorityQueue; fn is_palindrome(num: uint) -> bool { let s = num.to_string(); let b = s.as_bytes(); for i in range(0, b.len() / 2) { if b[i] != b[b.len() - i - 1] { return false; } } true } fn largest_palindrome_product(digits: uint) ...
use std::num; use std::collections::PriorityQueue; fn is_palindrome(num: uint) -> bool { let s = num.to_string(); let b = s.as_bytes(); for i in range(0, b.len() / 2) { if b[i] != b[b.len() - i - 1] { return false; } } true } fn largest_palindrome_product(digits: uint) ...
Fix problem 4 tests, remove unused variable.
Fix problem 4 tests, remove unused variable.
Rust
mit
niax/euler-rust
9ba3b5056fd59a847fd103cfd61c68dffa368291
src/main.rs
src/main.rs
extern crate nalgebra; mod cube; mod resource; use cube::*; fn main() { let point = Point::new(1024, 197, 293); let mut tree = Tree::new(10); { let mut cube = tree.cursor_mut(); let mut cube = cube.subdivide().unwrap().resolve(&point, 0); let mut cube = cube.subdivide().unwrap().r...
extern crate nalgebra; mod cube; mod render; mod resource; use cube::*; fn main() { let point = Point::new(1024, 197, 293); let mut tree = Tree::new(10); { let mut cube = tree.cursor_mut(); let mut cube = cube.subdivide().unwrap().resolve(&point, 0); let mut cube = cube.subdivide(...
Print width and origin of cubes.
Print width and origin of cubes.
Rust
mit
olson-sean-k/bismuth
55fe667df5eeaa5dd28ea6bd16d64541bb8d2877
src/main.rs
src/main.rs
extern crate libterminal_cribbage; use libterminal_cribbage::cards::Deck; fn main() { let d = Deck::new(); println!("D: {}", d); }
extern crate libterminal_cribbage; use libterminal_cribbage::cards::Deck; fn main() { let mut d = Deck::new(); for _ in 0..100000 { d = Deck::new(); } }
Test benchmark for Deck::new(). Will remove.
Test benchmark for Deck::new(). Will remove.
Rust
mit
DirtGrubDylan/terminal_cribbage
05318f2ba1db86d06ec26f652cbcd696be4a9983
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_number = "CLIII"; let decimal_number = to_decimal(&roman_number); println!("The roman number {} is equal to {} in decimal numbers", roman_number, decimal_number); let ...
Fix current implementation to allow subtractive notation.
Fix current implementation to allow subtractive notation.
Rust
mit
tzkhan/roman-rust
fbfd1876a3144b6a844dfbad61aa6a482b99660a
src/framebuffer.rs
src/framebuffer.rs
use gl::types::*; pub struct Framebuffer { gl_id: GLuint } impl Framebuffer { pub fn gl_id(&self) -> GLuint { self.gl_id } }
use gl; use gl::types::*; pub struct Framebuffer { gl_id: GLuint } impl Framebuffer { pub fn gl_id(&self) -> GLuint { self.gl_id } } impl Drop for Framebuffer { fn drop(&mut self) { unsafe { gl::DeleteFramebuffers(1, &self.gl_id as *const GLuint); } } }
Add `Drop` impl for `Framebuffer`
Add `Drop` impl for `Framebuffer`
Rust
apache-2.0
kylewlacy/glitter,kylewlacy/glitter
f22aee65177ac5955ce2b9fc0fdfc28e704ba8f5
build.rs
build.rs
extern crate gcc; fn main() { gcc::Config::new().cpp(true) .file("wrapper/wrapper.cpp") .file("pugixml/src/pugixml.cpp") .include("pugixml/src") .compile("libpugixml.a") }
extern crate gcc; fn main() { gcc::Config::new().cpp(true) .file("wrapper/wrapper.cpp") .file("pugixml/src/pugixml.cpp") .include("pugixml/src") .flag("-std=c++11") .compile("libpugixml.a") }
Revert "Removing std c++11 to fix travis CI"
Revert "Removing std c++11 to fix travis CI" This reverts commit 708f981eca0366cd7384b21770a4277eafbfa61d.
Rust
mit
sezaru/rust-pugixml,sezaru/rust-pugixml
6de8c7ad42533ca5edc39b4bb702ea6c9c06edfd
src/package/package.rs
src/package/package.rs
//Following semver here #[derive(Clone, RustcDecodable, RustcEncodable)] pub struct Version { pub major: u16, pub minor: u16, pub patch: u32 } #[derive(Clone, RustcDecodable, RustcEncodable)] pub struct Package { pub name: String, pub version: Version, pub crc32: u32, pub url: String, p...
//Following semver here #[derive(Clone, RustcDecodable, RustcEncodable)] pub struct Version { pub major: u16, pub minor: u16, pub patch: u32 } #[derive(Clone, RustcDecodable, RustcEncodable)] pub struct Package { pub name: String, pub version: Version, pub crc32: u32, pub child_url: String,...
Implement PartialEq for Package and Version
Implement PartialEq for Package and Version
Rust
bsd-3-clause
hch12907/wiz
e62c9d7917052db098c6f27314f4daa5b9513387
src/librustc_data_structures/macros.rs
src/librustc_data_structures/macros.rs
/// A simple static assertion macro. #[macro_export] #[cfg_attr(stage0, allow_internal_unstable(type_ascription, underscore_const_names))] #[cfg_attr(not(stage0), allow_internal_unstable(type_ascription))] macro_rules! static_assert { ($test:expr) => { // Use the bool to access an array such that if the boo...
/// A simple static assertion macro. #[macro_export] #[cfg_attr(bootstrap, allow_internal_unstable(type_ascription, underscore_const_names))] #[cfg_attr(not(bootstrap), allow_internal_unstable(type_ascription))] macro_rules! static_assert { ($test:expr) => { // Use the bool to access an array such that if t...
Stabilize underscore_const_names: stage0 -> bootstrap.
Stabilize underscore_const_names: stage0 -> bootstrap.
Rust
apache-2.0
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust
92ac26adb206eb18fc875c249e4e6e1af27c5979
src/coercions/string.rs
src/coercions/string.rs
use libc; use std; use sys; use sys::{VALUE}; use std::ffi::CString; use super::{UncheckedValue, CheckResult, CheckedValue, ToRust, ToRuby}; // VALUE -> to_coercible_rust<String> -> CheckResult<String> -> unwrap() -> Coercible<String> -> to_rust() -> String impl UncheckedValue<String> for VALUE { fn to_checked(s...
use libc; use std; use sys; use sys::{VALUE}; use std::ffi::CString; use super::{UncheckedValue, CheckResult, CheckedValue, ToRust, ToRuby}; // VALUE -> to_coercible_rust<String> -> CheckResult<String> -> unwrap() -> Coercible<String> -> to_rust() -> String impl UncheckedValue<String> for VALUE { fn to_checked(s...
Improve error message for String conversion
Improve error message for String conversion
Rust
isc
tildeio/helix,tildeio/turboruby,tildeio/helix,tildeio/helix,tildeio/turboruby,tildeio/helix,tildeio/turboruby,tildeio/turboruby
67673d41fcec01b8a10ac5b73b3ffb7cd553da55
examples/fsevent-demo.rs
examples/fsevent-demo.rs
extern crate fsevent; use std::sync::mpsc::channel; use std::thread; #[allow(dead_code)] fn main() { let (sender, receiver) = channel(); let _t = thread::spawn(move || { let fsevent = fsevent::FsEvent::new(sender); fsevent.append_path("../../"); fsevent.observe(); }); loop { select! ( v...
extern crate fsevent; use std::sync::mpsc::channel; use std::thread; fn main() { let (sender, receiver) = channel(); let _t = thread::spawn(move || { let fsevent = fsevent::FsEvent::new(sender); fsevent.append_path("../../"); fsevent.observe(); }); loop { let val = receiver.recv(); printl...
Remove select and fix sample code
Remove select and fix sample code
Rust
mit
octplane/fsevent-rust,jakerr/fsevent-rust
9c58b6f19a51a49926e420bb134367aa743aec9f
src/lib.rs
src/lib.rs
mod obj; pub use obj::LoadingError; pub use obj::ObjData; #[cfg(test)] mod test;
mod obj; pub use obj::LoadingError; pub use obj::ObjData; pub use obj::Object; pub use obj::Group; #[cfg(test)] mod test;
Change visibility of Group and Object
Change visibility of Group and Object
Rust
mit
Daepso/lwobj
8c10af24b839e8a7ec2d7920f710c985199b17ee
binary-search/src/lib.rs
binary-search/src/lib.rs
pub fn find<T: PartialEq>(array: &[T], item: T) -> Option<usize> { find_by_ref(array, &item) } fn find_by_ref<T: PartialEq>(array: &[T], item: &T) -> Option<usize> { if array.is_empty() { return None; } let index = array.len() / 2; if &array[index] == item { return Some(index); ...
pub fn find<T: PartialOrd>(array: &[T], item: T) -> Option<usize> { find_by_ref(array, &item) } fn find_by_ref<T: PartialOrd>(array: &[T], item: &T) -> Option<usize> { if array.is_empty() { return None; } let index = array.len() / 2; if *item == array[index] { Some(index) } el...
Fix solution for Binary Search
Fix solution for Binary Search
Rust
mit
attilahorvath/exercism-rust
ceccebe794707fff2e68be9ab0bbeefd5906f818
traits/src/lib.rs
traits/src/lib.rs
pub trait Summarizable { fn author_summary(&self) -> String; fn summary(&self) -> String { String::from("Read more from {}...", self.author_summary()) } } pub struct NewsArticle { pub headline: String, pub location: String, pub author: String, pub content: String, } impl Summariza...
pub trait Summarizable { fn author_summary(&self) -> String; fn summary(&self) -> String { format!("Read more from {}...", self.author_summary()) } } pub struct NewsArticle { pub headline: String, pub location: String, pub author: String, pub content: String, } impl Summarizable f...
Fix summary default and implement author summary on structs
Fix summary default and implement author summary on structs
Rust
mit
pgrzesik/learning-rust
6f1d09c2d42fbc813cc304479c8a112cc3045d69
tests/sexp.rs
tests/sexp.rs
extern crate lang; use lang::sexp; fn ast(code: &str) -> String { sexp::parse(code.to_owned()).dump() } fn match_ast(actual: &str, expected: &str) { let actual = actual.trim(); let expected = expected.trim(); if actual != expected { panic!("Actual:\n{}\nExpected:\n{}\n", actual, expected) ...
extern crate lang; use lang::sexp; fn ast(code: &str) -> String { sexp::parse(code.to_owned()).dump() } fn match_ast(actual: &str, expected: &str) { let actual = actual.trim(); let expected = expected.trim(); if actual != expected { panic!("Actual:\n{}\nExpected:\n{}\n", actual, expected) ...
Test for empty file and whitespace
Test for empty file and whitespace
Rust
mit
matklad/fall,matklad/fall,matklad/fall
bac68e4af3592dfcd6867fb8a73d2999daff744f
src/test/run-pass/lib-list.rs
src/test/run-pass/lib-list.rs
use std; import std::list; import std::list::car; import std::list::cdr; import std::list::from_vec; fn test_from_vec() { auto l = from_vec([0, 1, 2]); assert (car(l) == 0); assert (car(cdr(l)) == 1); assert (car(cdr(cdr(l))) == 2); } fn main() { test_from_vec(); }
use std; import std::list; import std::list::car; import std::list::cdr; import std::list::from_vec; import std::option; fn test_from_vec() { auto l = from_vec([0, 1, 2]); assert (car(l) == 0); assert (car(cdr(l)) == 1); assert (car(cdr(cdr(l))) == 2); } fn test_foldl() { auto l = from_vec([0, 1, 2, 3, 4]);...
Add regression tests for std::list
stdlib: Add regression tests for std::list
Rust
apache-2.0
bombless/rust-docs-chinese,aepsil0n/rust,carols10cents/rust,mahkoh/rust,zachwick/rust,seanrivera/rust,philyoon/rust,ejjeong/rust,mihneadb/rust,zaeleus/rust,emk/rust,fabricedesre/rust,AerialX/rust,mahkoh/rust,servo/rust,kwantam/rust,emk/rust,TheNeikos/rust,krzysz00/rust,miniupnp/rust,krzysz00/rust,krzysz00/rust,vhbit/ru...
9388433a38ed1742a8b5c4c08d746b42d0b7ce42
rust/pangram/src/lib.rs
rust/pangram/src/lib.rs
#![feature(ascii_ctype)] use std::ascii::AsciiExt; pub fn is_pangram(words: &str) -> bool { let r = words .chars() .filter(|x| x.is_ascii_alphabetic()) .map(|x| x.to_ascii_lowercase() as u8 - b'a') .collect::<Vec<_>>(); let score = &mut [0u8; 26]; for v in r { scor...
#![feature(ascii_ctype)] use std::ascii::AsciiExt; pub fn is_pangram(words: &str) -> bool { let score = &mut [0u8; 26]; for v in words.chars() { if !v.is_ascii_alphabetic() { continue; } score[v.to_ascii_lowercase() as usize - 'a' as usize] = 1; } score.iter().all...
Remove the code in functional style
Remove the code in functional style I like this one since it is clean and effecient
Rust
bsd-2-clause
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism