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 |
|---|---|---|---|---|---|---|---|---|---|
5b1f2361f23a9d479004d8cdf063c708ebacf92a | src/lib.rs | src/lib.rs | // Copyright 2015 Philipp Oppermann
//
// 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 t... | // Copyright 2015 Philipp Oppermann
//
// 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 t... | Use `println!` to print the `Hello World! | Use `println!` to print the `Hello World!
| Rust | apache-2.0 | phil-opp/blog_os,rafalmiel/blog_os,phil-opp/blogOS,phil-opp/blogOS,rafalmiel/blog_os,phil-opp/blog_os,phil-opp/blog_os,phil-opp/blog_os |
1c3205aa66b2a0ae5a3d7902f434cf68a9a207b1 | imag-ruby/src/lib.rs | imag-ruby/src/lib.rs | //
// imag - the personal information management suite for the commandline
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the ... | //
// imag - the personal information management suite for the commandline
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the ... | Add function to initialize the ruby extension | Add function to initialize the ruby extension
| Rust | lgpl-2.1 | matthiasbeyer/imag,mario-kr/imag,matthiasbeyer/imag,mario-kr/imag |
82b689ce09d79e8aa579caec64976a9711e211df | tests/text.rs | tests/text.rs | extern crate text;
#[cfg(test)]
mod tests {
use text::Text;
// #[test]
// fn typename_as_constructor() {
// let t = Text(String::from("XYZ"));
// println!("{:?}", t);
// assert!(false);
// }
#[test]
fn from_str() {
let text = Text::from("ABCDEFG");
asse... | extern crate easystring;
#[cfg(test)]
mod tests {
use easystring::Text;
// #[test]
// fn typename_as_constructor() {
// let t = Text(String::from("XYZ"));
// println!("{:?}", t);
// assert!(false);
// }
#[test]
fn from_str() {
let text = Text::from("ABCDEFG");
... | Fix package name in tests | Fix package name in tests
| Rust | apache-2.0 | imp/easystring-rs |
f038ff87b78ddc9456914171f0231910f7f05ff6 | tests/utils_test.rs | tests/utils_test.rs | extern crate rosc;
use std::net;
#[test]
fn test_parse_ip_and_port() {
let valid_addr = "127.0.0.1:8080".to_string();
let mut addr = rosc::utils::parse_ip_and_port(&valid_addr);
assert!(addr.is_ok());
let (ip, port) = addr.unwrap();
assert_eq!(port, 8080u16);
assert_eq!(ip, net::Ipv4Addr::new(... | extern crate rosc;
use std::net;
#[test]
fn test_parse_ip_and_port() {
let valid_addr = "127.0.0.1:8080".to_string();
let mut addr = rosc::utils::parse_ip_and_port(&valid_addr);
assert!(addr.is_ok());
let (ip, port) = addr.unwrap();
assert_eq!(port, 8080u16);
assert_eq!(ip, net::Ipv4Addr::new(... | Add test for `pad` function | Add test for `pad` function
| Rust | apache-2.0 | klingtnet/rosc |
7d08efac7ab91235e8c586de3dbdda52150dd7b4 | src/rename_a_file.rs | src/rename_a_file.rs | use std::io::fs;
fn main() {
fs::rename(&Path::new("input.txt"), &Path::new("output.txt")).ok();
fs::rename(&Path::new("docs"), &Path::new("mydocs")).ok();
fs::rename(&Path::new("/input.txt"), &Path::new("/output.txt")).ok();
fs::rename(&Path::new("/docs"), &Path::new("/mydocs")).ok();
}
| use std::io::fs;
fn main() {
fs::rename(&Path::new("input.txt"), &Path::new("output.txt")).unwrap();
fs::rename(&Path::new("docs"), &Path::new("mydocs")).unwrap();
fs::rename(&Path::new("/input.txt"), &Path::new("/output.txt")).unwrap();
fs::rename(&Path::new("/docs"), &Path::new("/mydocs")).unwrap();
... | Use unwrap instead of ok | Use unwrap instead of ok
| Rust | unlicense | crespyl/rust-rosetta,ZoomRmc/rust-rosetta,pfalabella/rust-rosetta,sakeven/rust-rosetta,magum/rust-rosetta,Hoverbear/rust-rosetta,JIghtuse/rust-rosetta,ghotiphud/rust-rosetta,crr0004/rust-rosetta,magum/rust-rosetta |
6982d66a595a5078ae5383b071ba5d4739bb5bd4 | tests/examples.rs | tests/examples.rs | #[macro_use]
extern crate duct;
#[test]
fn examples() {
let mut error = false;
for file in std::fs::read_dir("clippy_tests/examples").unwrap() {
let file = file.unwrap().path();
// only test *.rs files
if file.extension().map_or(true, |file| file != "rs") {
continue;
... | #[macro_use]
extern crate duct;
use std::io::{BufRead, BufReader};
use std::fs::File;
#[test]
fn examples() {
let mut error = false;
for file in std::fs::read_dir("clippy_tests/examples").unwrap() {
let file = file.unwrap().path();
// only test *.rs files
if file.extension().map_or(tru... | Enable 64bit vs 32bit tests | Enable 64bit vs 32bit tests
| Rust | apache-2.0 | graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust |
dca2bb68b3010a7cd47ae1e79674dcc7812828ce | src/shims/unix/freebsd/foreign_items.rs | src/shims/unix/freebsd/foreign_items.rs | use rustc_middle::mir;
use rustc_span::Symbol;
use rustc_target::spec::abi::Abi;
use crate::*;
use shims::foreign_items::EmulateByNameResult;
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {... | use rustc_middle::mir;
use rustc_span::Symbol;
use rustc_target::spec::abi::Abi;
use crate::*;
use shims::foreign_items::EmulateByNameResult;
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {... | Add `__error` to freebsd shims | Add `__error` to freebsd shims
Signed-off-by: InfRandomness <869edcf8359095948eaaa37ad8a94f96bdf1079b@gmail.com>
| Rust | apache-2.0 | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri |
65db00e0484a890e7a318750747761db39a0f8aa | src/main.rs | src/main.rs | struct Philosopher {
name: String
}
fn main() {
}
| struct Philosopher {
name: String
}
impl Philosopher {
fn new(name: &str) -> Philosopher {
Philosopher {
name: name.to_string()
}
}
}
fn main() {
}
| Add associated function `new()` to `Philosopher` | Add associated function `new()` to `Philosopher`
| Rust | mit | juliangrosshauser/dining_philosophers |
12fb91bafee024b3775c11eaa39cf348c4d7db11 | src/utf8/mod.rs | src/utf8/mod.rs | #![allow(missing_docs, unused_variables)]
mod pascal_str;
mod pascal_string;
pub use self::pascal_str::{Chars, Bytes, Lines, PascalStr};
pub use self::pascal_string::PascalString;
#[cfg(test)]
mod tests {
}
| #![allow(missing_docs, unused_variables)]
mod pascal_str;
mod pascal_string;
pub use self::pascal_str::{Chars, Bytes, Lines, PascalStr};
pub use self::pascal_string::PascalString;
#[cfg(test)]
mod tests {
use super::*;
use std::borrow::Cow;
use std::ffi::{CStr, CString};
use std::iter::IntoIterator;
... | Add some tests for utf8 string | Add some tests for utf8 string
| Rust | mit | burtonageo/pascal_string |
3106d28bfa9ec50a769884f5d9529893ed98d1dc | beacon_chain/utils/slot_clock/src/lib.rs | beacon_chain/utils/slot_clock/src/lib.rs | mod system_time_slot_clock;
mod testing_slot_clock;
pub use crate::system_time_slot_clock::{Error as SystemTimeSlotClockError, SystemTimeSlotClock};
pub use crate::testing_slot_clock::{Error as TestingSlotClockError, TestingSlotClock};
pub trait SlotClock {
type Error;
fn present_slot(&self) -> Result<Option... | mod system_time_slot_clock;
mod testing_slot_clock;
pub use crate::system_time_slot_clock::{Error as SystemTimeSlotClockError, SystemTimeSlotClock};
pub use crate::testing_slot_clock::{Error as TestingSlotClockError, TestingSlotClock};
pub trait SlotClock: Send + Sync {
type Error;
fn present_slot(&self) -> ... | Add Send + Sync to slot_clock | Add Send + Sync to slot_clock
| Rust | apache-2.0 | sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse |
9e3cb44a8aa1e3418263ceed74945692a40c5ab6 | src/js_types/js_type.rs | src/js_types/js_type.rs | use std::string::String;
use js_types::js_obj::JsObjStruct;
use js_types::js_str::JsStrStruct;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use uuid::Uuid;
pub struct JsT {
pub uuid: Uuid,
pub t: JsType,
}
impl JsT {
pub fn new(t: JsType) -> JsT {
JsT {
uuid: Uuid::new_v4(),
... | use std::string::String;
use js_types::js_obj::JsObjStruct;
use js_types::js_str::JsStrStruct;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use uuid::Uuid;
pub struct JsT {
pub binding: Option<String>,
pub uuid: Uuid,
pub t: JsType,
}
impl JsT {
pub fn new(t: JsType) -> JsT {
JsT {
... | Add binding field to JsT | Add binding field to JsT
| Rust | mit | rustoscript/french-press |
7b007d196f205293e0e3b1b8c99ecbfa850dcdb9 | src/chip8/codecache.rs | src/chip8/codecache.rs | extern crate libc;
use std::ops::Index;
use std::{ptr, mem};
use chip8::MEMORY_SIZE;
use chip8::codeblock::CodeBlock;
pub struct CodeCache {
code_blocks: [*mut CodeBlock; MEMORY_SIZE]
}
impl CodeCache {
pub fn new() -> CodeCache {
CodeCache {
code_blocks: [ptr::null_mut(); MEMORY_SIZE]
}
}
pub fn contai... | extern crate libc;
use std::ops::Index;
use std::{ptr, mem};
use chip8::MEMORY_SIZE;
use chip8::codeblock::CodeBlock;
pub struct CodeCache {
code_blocks: [*mut CodeBlock; MEMORY_SIZE]
}
impl CodeCache {
pub fn new() -> CodeCache {
CodeCache {
code_blocks: [ptr::null_mut(); MEMORY_SIZE]
}
}
pub fn contai... | Implement "Drop" trait for CodeCache | Implement "Drop" trait for CodeCache
| Rust | mit | WisterToub/chip8dynarec |
6ca15ddb0c9d0d001fd32cfeea8925f55b87fd69 | tests/ui/mut_return.rs | tests/ui/mut_return.rs | #[cxx::bridge]
mod ffi {
extern "Rust" {
type Mut<'a>;
}
unsafe extern "C++" {
type Thing;
fn f(t: &Thing) -> Pin<&mut CxxString>;
unsafe fn g(t: &Thing) -> Pin<&mut CxxString>;
fn h(t: Box<Mut>) -> Pin<&mut CxxString>;
fn i<'a>(t: Box<Mut<'a>>) -> Pin<&'a m... | #[cxx::bridge]
mod ffi {
extern "Rust" {
type Mut<'a>;
}
unsafe extern "C++" {
type Thing;
fn f(t: &Thing) -> Pin<&mut CxxString>;
unsafe fn g(t: &Thing) -> Pin<&mut CxxString>;
fn h(t: Box<Mut>) -> Pin<&mut CxxString>;
fn i<'a>(t: Box<Mut<'a>>) -> Pin<&'a m... | Add ui test of mutable slice return from reference arguments | Add ui test of mutable slice return from reference arguments
| Rust | apache-2.0 | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx |
d55a89c50cecb35314449bcf208db25a6478fd08 | build.rs | build.rs | use std::env;
use std::error::Error;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;
struct Ignore;
impl<E> From<E> for Ignore where E: Error
{
fn from(_: E) -> Ignore { Ignore }
}
fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::cr... | use std::env;
use std::error::Error;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;
struct Ignore;
impl<E> From<E> for Ignore where E: Error
{
fn from(_: E) -> Ignore { Ignore }
}
fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::cr... | Use trim_end instead of trim_right | Use trim_end instead of trim_right
| Rust | mit | yasuyuky/ghteam-auth,yasuyuky/ghteam-auth |
95254f5a64877b79239edc2f695bd36fa78d2664 | build.rs | build.rs | fn main() {
#[cfg(target_os = "macos")]
#[cfg(feature = "private_api")]
println!("cargo:rustc-link-search=framework={}", "/System/Library/PrivateFrameworks");
}
| fn main() {
#[cfg(target_os = "macos")]
#[cfg(feature = "private_api")]
// PrivateFramework dir:
// `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/
let xcode_dir = std::process::Command::new("xcode-select")
.arg("-p")
.output()... | Use xcode-select to find PrivateFramework directory | Use xcode-select to find PrivateFramework directory
| Rust | apache-2.0 | mrmekon/rubrail-rs |
c762858305850285b05b95e49fe7e0681d80282f | src/actions/print.rs | src/actions/print.rs | use actions::Action;
use notify::Event;
pub struct PrintAction;
impl PrintAction {
pub fn new() -> PrintAction {
PrintAction
}
}
impl Action for PrintAction {
fn handle_change(&self, event: &Event) {
match event.path {
None => println!("No path for event"),
Some(re... | use actions::Action;
use notify::Event;
use notify::op;
use notify::op::Op;
pub struct PrintAction;
impl PrintAction {
pub fn new() -> PrintAction {
PrintAction
}
pub fn flag_to_str(&self, flag: &Op) -> &'static str {
match flag {
&op::CHMOD => "Permissions or timestamps chang... | Add event type to output from PrintAction | Add event type to output from PrintAction
| Rust | mit | aag/eagle-eye |
0b76470e8e58131e750373fc4b37088d55c5a63a | build.rs | build.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/. */
extern crate cmake;
use std::env;
fn main() {
let dst = cmake::Config::new(".").build();
println!("cargo:... | /* 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/. */
extern crate cmake;
use std::env;
fn main() {
let dst = cmake::Config::new(".").build();
println!("cargo:... | Switch to libc++ on OS X | Switch to libc++ on OS X
| Rust | bsd-3-clause | ecoal95/angle,ecoal95/angle,ecoal95/angle,ecoal95/angle,ecoal95/angle |
58b54dffbafd14a26ae4f3a8bd51b3f230fc1af4 | src/bin/cli.rs | src/bin/cli.rs | use docopt::{self, Docopt, ArgvMap};
const USAGE: &'static str = "
mprovision
A tool that helps iOS developers to manage mobileprovision files.
Usage:
mprovision list [--filter <text>] [--expires-in-days <days>] [<directory>]
Options:
-h --help Show this help message.
--version Show version.
";
pub fn... | use docopt::{self, Docopt, ArgvMap};
const USAGE: &'static str = "
mprovision
A tool that helps iOS developers to manage mobileprovision files.
Usage:
mprovision list [--filter <text>] [--expires-in-days <days>] [<directory>]
Options:
-h --help Show this help message.
--version Show version.
";
pub fn... | Make parse to accept IntoIterator | Make parse to accept IntoIterator
| Rust | mit | zummenix/mprovision |
bd287fa5084f2e153c1044632f9f3d190f090d69 | compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs | compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs | use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let mut base = super::linux_musl_base::opts();
base.max_atomic_width = Some(128);
Target {
llvm_target: "aarch64-unknown-linux-musl".to_string(),
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i1... | use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let mut base = super::linux_musl_base::opts();
base.max_atomic_width = Some(128);
Target {
llvm_target: "aarch64-unknown-linux-musl".to_string(),
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i1... | Disable aarch64 outline atomics with musl for now. | Disable aarch64 outline atomics with musl for now.
The introduced dependency on `getauxval`causes linking
problems with musl, see #89626.
| Rust | apache-2.0 | aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust |
103bd257d6132c88db1e8b70796e13cbbecbe5a5 | guess.rs | guess.rs | use std::rand::random;
mod guess {
pub fn guessed_correctly(guess: uint, machine: uint) -> bool {
guess == machine
}
}
fn main() {
let random_value = random::<uint>() % 10u;
let mut guess = 0u;
guess += 1;
println!("{}", random_value);
println!("{}", guess::guessed_correctly(guess,... | use std::io;
use std::rand::random;
mod guess {
pub fn guessed_correctly(guess: uint, machine: uint) -> bool {
guess == machine
}
}
#[cfg(not(target_os = "linux"))]
fn test_os() {
println!("You are not running Linux!")
}
fn main() {
test_os();
let random_value = random::<uint>() % 10u;
... | Add OS checking using cfg | Add OS checking using cfg
| Rust | bsd-2-clause | ambidextrousTx/ToyRustPrograms |
5bef429dacb216b45a6bfa4c020d108c1d8e726e | src/test/ui/inline-const/const-match-pat-range.rs | src/test/ui/inline-const/const-match-pat-range.rs | // build-pass
#![allow(incomplete_features)]
#![feature(inline_const, half_open_range_patterns, exclusive_range_pattern)]
fn main() {
const N: u32 = 10;
let x: u32 = 3;
match x {
const { N - 1 } ..= 10 => {},
_ => {},
}
match x {
const { N - 1 } ..= const { N + 1 } => {},
... | // build-pass
#![allow(incomplete_features)]
#![feature(inline_const, half_open_range_patterns, exclusive_range_pattern)]
fn main() {
const N: u32 = 10;
let x: u32 = 3;
match x {
1 ..= const { N + 1 } => {},
_ => {},
}
match x {
const { N - 1 } ..= 10 => {},
_ => {... | Add ..= const { .. } missing tests and sort them properly | Add ..= const { .. } missing tests and sort them properly
| Rust | apache-2.0 | graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust |
d4df52e9e85f84f1dbacdbdce6f1c1e016f741c2 | parser/src/lib.rs | parser/src/lib.rs | extern crate combine;
extern crate combine_language;
extern crate rsstreem;
pub mod parse;
#[cfg(test)]
mod tests {
use super::*;
use rsstreem::ast::*;
#[test]
fn add_expr_test() {
let expr_string = "1 + 2";
let correct_expr = Box::new(Ast::Op {
... | extern crate combine;
extern crate combine_language;
extern crate rsstreem;
pub mod parse;
#[cfg(test)]
mod tests {
use super::*;
use rsstreem::ast::*;
#[test]
fn add_expr_test() {
let expr_string = "1 + 2";
let correct_expr = Ast::Op {
op: Biop::Plus,
lhs: Box... | Delete boxied structure in test | Delete boxied structure in test
| Rust | mit | Everysick/rsstreem |
2367b6156634cdf161eb107e5918b6d6249ac45d | examples/httpbin.rs | examples/httpbin.rs | #![feature(associated_consts)]
#![feature(use_extern_macros)]
#[macro_use]
extern crate tapioca;
infer_api!(httpbin, "https://raw.githubusercontent.com/OJFord/tapioca/master/tests/schemata/httpbin.yml");
fn main() {
let auth = httpbin::ServerAuth::new();
match httpbin::ip::get(auth) {
Ok(response) ... | #![feature(associated_consts)]
#![feature(use_extern_macros)]
#[macro_use]
extern crate tapioca;
infer_api!(httpbin, "https://raw.githubusercontent.com/OJFord/tapioca/master/tests/schemata/httpbin.yml");
use httpbin::basic_auth__user__hunter_2 as basic_auth;
use basic_auth::get::OpAuth::HttpBasic;
static USER: &str... | Add HTTP Basic auth to example | Add HTTP Basic auth to example
| Rust | mit | OJFord/tapioca |
307aed56f8cd203d554ac4c4c6aa3e5cc60de44e | src/lib/recorder.rs | src/lib/recorder.rs | extern crate arguments;
extern crate hiredis;
extern crate mcpat;
extern crate sql;
extern crate sqlite;
#[macro_use]
extern crate log;
/// Raise an error.
#[macro_export]
macro_rules! raise(
($message:expr) => (return Err($crate::Error::new($message)));
);
/// Unwrap a result or raise an error.
#[macro_export]
... | //! Recording of workload patterns.
extern crate arguments;
extern crate hiredis;
extern crate mcpat;
extern crate sql;
extern crate sqlite;
#[macro_use]
extern crate log;
/// Raise an error.
#[macro_export]
macro_rules! raise(
($message:expr) => (return Err($crate::Error::new($message)));
);
/// Unwrap a resul... | Add a description to the library | Add a description to the library
| Rust | mit | learning-on-chip/recorder |
bf9d02087410d79db8ebefd311ab96c2ae444eac | src/vertexarray.rs | src/vertexarray.rs |
use super::IndexBufferHandle;
use super::VertexBufferHandle;
pub enum AttributeType {
AttributeByte,
AttributeUnsignedByte,
AttributeShort,
AttributeUnsignedShort,
AttributeInt,
AttributeUnsignedInt,
AttributeHalfFloat,
AttributeFloat,
AttributeDouble,
AttributeInt2101010Rev,
... |
use super::IndexBufferHandle;
use super::VertexBufferHandle;
pub enum AttributeType {
AttributeByte,
AttributeUnsignedByte,
AttributeShort,
AttributeUnsignedShort,
AttributeInt,
AttributeUnsignedInt,
AttributeHalfFloat,
AttributeFloat,
AttributeDouble,
AttributeInt2101010Rev,
... | Add quick sketch of convenience constructor for VAO, now commented. | Add quick sketch of convenience constructor for VAO, now commented.
| Rust | apache-2.0 | irauta/htgl |
0656062cfb4ef894812c828da927ec3297a9c6b7 | core/src/lib.rs | core/src/lib.rs | #![crate_name = "mnemosyne"]
#![crate_type = "lib"]
#![feature(rustc_private)]
#![feature(cstr_memory)]
extern crate rustc;
extern crate combine;
extern crate seax_util as seax;
pub mod position;
pub mod ast;
pub mod compile;
use rustc::lib::llvm::{LLVMVersionMajor, LLVMVersionMinor}
const VERSION_MAJOR: u32 = 0;
c... | //
// 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"... | Add license to main source file | Add license to main source file
| Rust | mit | hawkw/mnemosyne |
c6ae4a50b9b3a0a8d9f39a3c23d8ae97fcd6be0b | src/settings.rs | src/settings.rs | use encoding::EncodingRef;
use encoding::all::UTF_8;
use loirc::{MonitorSettings, ReconnectionSettings};
/// Settings for the dispatcher.
pub struct Settings<'a> {
/// Address of the irc server.
pub addr: &'a str,
/// Preferred nickname.
pub nickname: &'a str,
/// Username.
pub username: &'a st... | use encoding::EncodingRef;
use encoding::all::UTF_8;
use loirc::{MonitorSettings, ReconnectionSettings};
/// Settings for the dispatcher.
pub struct Settings<'a> {
/// Address of the irc server.
pub addr: &'a str,
/// Preferred nickname.
pub nickname: &'a str,
/// Username.
pub username: &'a st... | Document the default values of Settings::new | Document the default values of Settings::new
| Rust | mit | SBSTP/hiirc,SBSTP/hiirc |
2740cd97abefaf8390644a100d7e7a1fb44c9bff | util/collection.rs | util/collection.rs | //! Collection Utility
/// Clone a vector consisting of item references to
/// a new vector owning cloned items.
#[inline]
pub fn to_owned_vec<T: Clone>(v: &Vec<&T>) -> Vec<T>
{
v.iter().map(|e| (*e).clone()).collect::<Vec<T>>()
}
/// Convert Vec<T> into Vec<Box<T>>
///
/// It is usually used for arguments of nes... | //! Collection Utility
pub mod vec {
/// Clone a vector consisting of item references to
/// a new vector owning cloned items.
#[inline]
pub fn to_owned<T: Clone>(v: &Vec<&T>) -> Vec<T>
{
v.iter().map(|e| (*e).clone()).collect::<Vec<T>>()
}
/// Convert Vec<T> into Vec<Box<T>>
///
/// It is... | Move some util functions into vec module. | Move some util functions into vec module.
| Rust | apache-2.0 | hyunsik/tokamak,hyunsik/tokamak,hyunsik/tokamak,hyunsik/tokamak,hyunsik/tokamak,hyunsik/tokamak |
6b3edc2f8933a987ed956b4d720be1be9b02e036 | src/test/compile-fail/expanded-cfg.rs | src/test/compile-fail/expanded-cfg.rs | // Copyright 2016 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 2016 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 ... | Test that unconfigured macro-expanded macro invocations are not expanded. | Test that unconfigured macro-expanded macro invocations are not expanded.
| Rust | apache-2.0 | graydon/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust |
228422303fbaf41b7bae23e52c0b80d0d4ddf3be | src/test/run-pass/obj-self-4.rs | src/test/run-pass/obj-self-4.rs |
// xfail-boot
fn main() {
obj foo(mutable i: int) {
fn inc_by(incr: int) -> int { i += incr; ret i; }
fn inc_by_5() -> int { ret self.inc_by(5); }
// A test case showing that issue #324 is resolved. (It used to
// be that commenting out this (unused!) function produced a
... | fn main() {
obj foo(mutable i: int) {
fn inc_by(incr: int) -> int { i += incr; ret i; }
fn inc_by_5() -> int { ret self.inc_by(5); }
// A test case showing that issue #324 is resolved. (It used to
// be that commenting out this (unused!) function produced a
// type error.)
... | Remove the last remaining xfail-boot directive | Remove the last remaining xfail-boot directive
| Rust | apache-2.0 | hauleth/rust,andars/rust,mitsuhiko/rust,ktossell/rust,sae-bom/rust,zubron/rust,bombless/rust,pelmers/rust,emk/rust,erickt/rust,LeoTestard/rust,michaelballantyne/rust-gpu,mvdnes/rust,zachwick/rust,victorvde/rust,robertg/rust,aidancully/rust,barosl/rust,mitsuhiko/rust,0x73/rust,mihneadb/rust,XMPPwocky/rust,krzysz00/rust,... |
4f70162f54ceaa4ff68a5ab74e31b5dda7ac9444 | crates/ra_proc_macro_srv/src/lib.rs | crates/ra_proc_macro_srv/src/lib.rs | //! RA Proc Macro Server
//!
//! This library is able to call compiled Rust custom derive dynamic libraries on arbitrary code.
//! The general idea here is based on https://github.com/fedochet/rust-proc-macro-expander.
//!
//! But we change some several design for fitting RA needs:
//!
//! * We use `ra_tt` for proc-mac... | //! RA Proc Macro Server
//!
//! This library is able to call compiled Rust custom derive dynamic libraries on arbitrary code.
//! The general idea here is based on https://github.com/fedochet/rust-proc-macro-expander.
//!
//! But we change some several design for fitting RA needs:
//!
//! * We use `ra_tt` for proc-mac... | Add bridge::TokenStream to crate scope | Add bridge::TokenStream to crate scope
| Rust | apache-2.0 | rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer |
56f1217f505fc997106ce0853cef622566326db4 | src/main.rs | src/main.rs | #[macro_use]
mod lib;
mod command;
mod constant;
use constant::*;
use std::env;
fn main() {
if let Some(message) = validate_at_first() {
return println!("{}", message);
}
let args = env::args()
.skip(1)
.collect::<Vec<String>>();
command::execute(args);
}
fn validate_at_fir... | #[macro_use]
mod lib;
mod command;
mod constant;
use constant::*;
use std::env;
fn main() {
if let Err(message) = validate_at_first() {
return println!("{}", message);
}
let args = env::args()
.skip(1)
.collect::<Vec<String>>();
command::execute(args);
}
fn validate_at_firs... | Change type of validate_at_first()'s return value | Change type of validate_at_first()'s return value
| Rust | mit | ttokutake/kic,ttokutake/kic,ttokutake/kic |
5e0e665e16fca918977163df6b3bc612f4d86081 | src/pombase/web/config.rs | src/pombase/web/config.rs | pub const POMBASE_ANN_EXT_TERM_CV_NAME: &'static str = "PomBase annotation extension terms";
pub const ANNOTATION_EXT_REL_PREFIX: &'static str = "annotation_extension_relation-";
pub enum FeatureRelAnnotationType {
Interaction,
Ortholog,
Paralog,
}
pub struct FeatureRelConfig {
pub rel_type_name: &'sta... | pub const POMBASE_ANN_EXT_TERM_CV_NAME: &'static str = "PomBase annotation extension terms";
pub const ANNOTATION_EXT_REL_PREFIX: &'static str = "annotation_extension_relation-";
pub enum FeatureRelAnnotationType {
Interaction,
Ortholog,
Paralog,
}
pub struct FeatureRelConfig {
pub rel_type_name: &'sta... | Add regulates rel for finding descendant terms | Add regulates rel for finding descendant terms
| Rust | mit | pombase/pombase-chado-json,pombase/pombase-chado-json |
97a405600fb97eba4532ca318e255c709ae01a2f | src/algorithm/store.rs | src/algorithm/store.rs | pub trait Store {
type Algorithm: ?Sized;
fn get(&self, key_id: &str) -> Option<&Self::Algorithm>;
}
| use std::ops::Index;
/// A store of keys that can be retrieved by key id.
pub trait Store {
type Algorithm: ?Sized;
fn get(&self, key_id: &str) -> Option<&Self::Algorithm>;
}
impl<T, A> Store for T
where
for<'a> T: Index<&'a str, Output = A>,
{
type Algorithm = A;
fn get(&self, key_id: &str) -> ... | Implement Store for all Index types that take in strings | Implement Store for all Index types that take in strings
| Rust | mit | mikkyang/rust-jwt |
e06b714bce89f2ba2f389cc07699fcc3e9f58524 | metal-sys/src/protocols/mtl_command_buffer.rs | metal-sys/src/protocols/mtl_command_buffer.rs | use cocoa::base::id;
pub trait MTLCommandBuffer {
}
impl MTLCommandBuffer for id {
}
| use cocoa::base::id;
pub trait MTLCommandBuffer {
fn renderCommandEncoderWithDescriptor(self, renderPassDescriptor: id) -> id;
}
impl MTLCommandBuffer for id {
}
| Add MTLCommandBuffer::renderCommandEncoderWithDescriptor to MTLCommandBuffer trait def | Add MTLCommandBuffer::renderCommandEncoderWithDescriptor to MTLCommandBuffer trait def
| Rust | apache-2.0 | burtonageo/metl |
edc87b12ed9c158fd45fcd9223c117d281dd3a08 | src/runtime.rs | src/runtime.rs | #![cfg(not(test))]
#[lang = "eh_personality"]
#[no_mangle]
pub extern "C" fn eh_personality() {}
#[lang = "eh_unwind_resume"]
#[no_mangle]
pub extern "C" fn rust_eh_unwind_resume() {}
#[no_mangle]
pub extern "C" fn __udivti3() {}
#[no_mangle]
pub extern "C" fn __umodti3() {}
#[no_mangle]
pub extern "C" fn __muloti4(... | #![cfg(not(test))]
#[lang = "eh_personality"]
#[no_mangle]
pub extern "C" fn eh_personality() {}
#[lang = "eh_unwind_resume"]
#[no_mangle]
pub extern "C" fn rust_eh_unwind_resume() {}
#[no_mangle]
pub extern "C" fn __udivti3() {}
#[no_mangle]
pub extern "C" fn __umodti3() {}
#[no_mangle]
pub extern "C" fn __muloti4(... | Halt CPU when hanging during panic | Halt CPU when hanging during panic
| Rust | mit | iankronquist/rustyvisor,iankronquist/rustyvisor,iankronquist/rustyvisor |
8aafc62cb3ac71d33c20d4ecf118f4701ef0d59e | src/lib.rs | src/lib.rs | //! An implementation of [FLAC](https://xiph.org/flac), free lossless audio
//! codec, written in Rust.
//!
//! The code is available on [GitHub](https://github.com/sourrust/flac).
//!
//! # Examples
//!
//! Basic decoding from a file.
//!
//! ```
//! use flac::StreamReader;
//! use std::fs::File;
//!
//! match StreamR... | //! An implementation of [FLAC](https://xiph.org/flac), free lossless audio
//! codec, written in Rust.
//!
//! The code is available on [GitHub](https://github.com/sourrust/flac).
//!
//! # Examples
//!
//! Basic decoding from a file.
//!
//! ```
//! use flac::StreamReader;
//! use std::fs::File;
//!
//! match StreamR... | Add comment about the explicit iter type | Add comment about the explicit iter type
I should figure out a better way to do this without having the user
having to remember the integer sizes.
| Rust | bsd-3-clause | sourrust/flac |
221f196684173326af5954f3263f4c6d42484bb8 | api_server/src/main.rs | api_server/src/main.rs | #![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
// #[macro_use]
extern crate diesel;
mod schema;
// mod models;
use rocket_contrib::databases::diesel::PgConnection;
#[get("/")]
fn index() -> &'static str {
"Hello, from Rust!"
}
#[databas... | #![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
// #[macro_use]
extern crate diesel;
mod schema;
// mod models;
use rocket_contrib::databases::diesel::PgConnection;
#[get("/")]
fn index(_db_conn: RustyDbConn) -> &'static str {
// Rocket u... | Add a sample (albeit unused) request guard parameter to the root api call. | Add a sample (albeit unused) request guard parameter to the root api call.
| Rust | mit | ghotiphud/rust-web-starter,ghotiphud/rust-web-starter,ghotiphud/rust-web-starter,ghotiphud/rust-web-starter |
1465c23745b3fde45074356fec6935aa51e5a92e | src/rust/src/actions_process.rs | src/rust/src/actions_process.rs | use actions_process_list_provides;
use cfg;
use clap::ArgMatches;
use db;
use rusqlite::Connection;
use std::collections::HashSet;
fn process_session(conn: &Connection) {}
pub fn process(conn: &Connection, rt_cfg: &cfg::Config) {
let matcher_session = String::from("session");
if rt_cfg.actions.contains(&cfg::... | use actions_process_list_provides;
use cfg;
use db;
use rusqlite::Connection;
fn process_session(conn: &Connection) {}
pub fn process(conn: &Connection, rt_cfg: &cfg::Config) {
if rt_cfg.actions.contains(&cfg::Action::SessionStart) {
process_session(conn);
}
if rt_cfg.actions.contains(&cfg::Action... | Remove unused variabales and unused 'use' | Remove unused variabales and unused 'use'
Signed-off-by: Owen Synge <ea78e0e20fce5319fd66b8fd4f543d9e30ef46a5@googlemail.com>
| Rust | lgpl-2.1 | osynge/whenenv-rust,osynge/whenenv-rust |
2aba6bd6735c828306ad199215a6f5c72c7864b0 | src/test/stdtest/rand.rs | src/test/stdtest/rand.rs |
// -*- rust -*-
use std;
import std::rand;
import std::str;
#[test]
fn test() {
let r1: rand::rng = rand::mk_rng();
log r1.next();
log r1.next();
{
let r2 = rand::mk_rng();
log r1.next();
log r2.next();
log r1.next();
log r1.next();
log r2.next();
... | import core::*;
// -*- rust -*-
use std;
import std::rand;
import str;
#[test]
fn test() {
let r1: rand::rng = rand::mk_rng();
log r1.next();
log r1.next();
{
let r2 = rand::mk_rng();
log r1.next();
log r2.next();
log r1.next();
log r1.next();
log r2.nex... | Copy first batch of material from libstd to libcore. | Copy first batch of material from libstd to libcore.
| Rust | apache-2.0 | rust-lang/rand |
1c65e28e1b36bc420ce221a3e239abf2bb33f044 | src/sierpinski_triangle.rs | src/sierpinski_triangle.rs | // not_tested
use std::iter::range_step;
fn main() {
let order = 4u;
let height = 1u << order;
let mut state = Vec::from_elem(height + 1, true);
// Compute the triangle line-by-line by viewing it as Pascal's triangle (mod 2)
for i in range(0u, height) {
for j in range(0u, height - i - 1) ... | // http://rosettacode.org/wiki/Sierpinski_triangle
// not_tested
use std::iter::range_step;
fn main() {
let order = 4u;
let height = 1u << order;
let mut state = Vec::from_elem(height + 1, true);
// Compute the triangle line-by-line by viewing it as Pascal's triangle (mod 2)
for i in range(0u, he... | Add link to Sierpinski triangle | Add link to Sierpinski triangle
| Rust | unlicense | Hoverbear/rust-rosetta,pfalabella/rust-rosetta,crr0004/rust-rosetta,magum/rust-rosetta,crespyl/rust-rosetta,sakeven/rust-rosetta,ZoomRmc/rust-rosetta,magum/rust-rosetta,JIghtuse/rust-rosetta,ghotiphud/rust-rosetta |
fb20ffdf8b545668055b1deac13226229ea72038 | src/traits/vector_space.rs | src/traits/vector_space.rs | use std::num::Zero;
use traits::division_ring::DivisionRing;
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv};
/// Trait of elements of a vector space. A vector space is an algebraic
/// structure, the elements of which have addition, substraction, negation,
/// scalar multiplication (the scalar being a elem... | use std::num::Zero;
use traits::division_ring::DivisionRing;
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv};
/// Trait of elements of a vector space. A vector space is an algebraic
/// structure, the elements of which have addition, substraction, negation,
/// scalar multiplication (the scalar being a elem... | Add automatic implementation of VectorSpace. | Add automatic implementation of VectorSpace.
| Rust | bsd-3-clause | sebcrozet/nalgebra,tikue/nalgebra,ProtectedMode/nalgebra,tempbottle/nalgebra,sebcrozet/nalgebra,tomaka/nalgebra,jaredly/nalgebra,mbStavola/nalgebra |
19109189e431870dba5766fc6f82f38a19d79def | src/lib.rs | src/lib.rs | use std::thread;
#[no_mangle]
fn process() {
let handles: Vec<_> = (0..10).map(|_| {
thread::spawn(|| {
let mut x = 0;
for _ in (0..5_000_000) {
x += 1
}
x
})
}).collect();
for h in handles {
println!("Thread finished with... | use std::thread;
#[no_mangle]
pub extern fn process() {
let handles: Vec<_> = (0..10).map(|_| {
thread::spawn(|| {
let mut x = 0;
for _ in (0..5_000_000) {
x += 1
}
x
})
}).collect();
for h in handles {
println!("Thread fi... | Make `process()` public and callable from C | Make `process()` public and callable from C
| Rust | mit | juliangrosshauser/embed,juliangrosshauser/embed,juliangrosshauser/embed,juliangrosshauser/embed |
90d71f4ac2a8803b04c65943bed41f89c9844065 | src/lib.rs | src/lib.rs | mod callbacks;
mod channel;
mod parsers;
mod types;
mod utils;
// Re-export public interfaces.
pub use channel::Channel;
pub use parsers::{
parse_a_result,
parse_aaaa_result,
};
pub use types::{
AresError,
AResult,
AAAAResult,
INVALID_FD,
};
pub use utils::str_error;
| //! A safe wrapper for the [`c-ares`](http://c-ares.haxx.se/) library.
mod callbacks;
mod channel;
mod parsers;
mod types;
mod utils;
// Re-export public interfaces.
pub use channel::Channel;
pub use parsers::{
parse_a_result,
parse_aaaa_result,
};
pub use types::{
AresError,
AResult,
AAAAResult,
... | Add a single line of documentation | Add a single line of documentation
To test that the automatic publish is working
| Rust | mit | CJTozer/rust-c-ares,dimbleby/rust-c-ares,dimbleby/rust-c-ares,CJTozer/rust-c-ares,dimbleby/rust-c-ares |
30985523b35df85d3454060e2167b51a7f402474 | src/lib.rs | src/lib.rs | #![feature(libc)]
extern crate libc;
pub fn readline() -> Option<String> {
// Buffer to hold readline input
let buffer = String::new();
let isatty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
if isatty {
println!("stdin is a tty");
} else {
println!("stdin is not a ... | #![feature(libc)]
extern crate libc;
fn isatty() -> bool {
let isatty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
isatty
}
pub fn readline() -> Option<String> {
if isatty() {
Some(buffer)
} else {
None
}
}
| Split out tty check to a separate function | Split out tty check to a separate function
| Rust | mit | kkawakam/rustyline,dubrowgn/rustyline,dubrowgn/rustyline,gwenn/rustyline,cavedweller/rustyline |
ddb5e53c085c6b1e55b733d993c351d5c091c081 | test-crates/protobuf-test/src/v3/test_optional.rs | test-crates/protobuf-test/src/v3/test_optional.rs | use protobuf::MessageFull;
use super::test_optional_pb::*;
#[test]
fn test() {
let _message = TestOptionalProto3::new();
}
#[test]
fn reflect_all_oneofs() {
let descriptor = TestOptionalProto3::descriptor_static();
let oneofs = descriptor.all_oneofs().collect::<Vec<_>>();
assert!(oneofs.len() > 1);
... | use protobuf::MessageFull;
use super::test_optional_pb::*;
#[test]
fn test() {
let _message = TestOptionalProto3::new();
}
#[test]
fn field_types() {
let message = TestOptionalProto3::new();
let _iii: &Option<i32> = &message.iii;
let _sss: &Option<String> = &message.sss;
}
#[test]
fn reflect_all_one... | Test proto3 oneof field types | Test proto3 oneof field types
| Rust | mit | stepancheg/rust-protobuf,stepancheg/rust-protobuf,stepancheg/rust-protobuf |
35c4879853202fb9152e50d61d71281c16427d9e | src/lib.rs | src/lib.rs | pub fn puzzle(input: &str) -> u8 {
1
}
#[cfg(test)]
mod test {
use super::*;
}
| use std::collections::HashMap;
struct Keypad {
layout: HashMap<u8, Key>,
current_value: u8,
}
impl Keypad {
fn new() -> Keypad {
let mut layout = HashMap::new();
layout.insert(1, Key {
value: 1,
left: None,
up: None,
right: Some(2),
d... | Set up keypad/key abstraction and relationships | Set up keypad/key abstraction and relationships
This was a lot of manual typing... but should only need to be done once,
in theory...
| Rust | mit | carols10cents/adventofcode-rs |
22116f3c0821e532ce7bc81e201d75a71a43f262 | 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 `VertexBufferContext` and `IndexBufferContext` into the prelude | Add `VertexBufferContext` and `IndexBufferContext` into the prelude
| Rust | apache-2.0 | kylewlacy/glitter,kylewlacy/glitter |
e11fcf329ad86f1ae327bbda7177a193594094a0 | src/lib.rs | src/lib.rs | #[macro_use]
extern crate nom;
pub mod metadata;
mod frame;
mod utility;
use metadata::metadata_parser;
pub struct Stream {
pub info: metadata::StreamInfo,
pub metadata: Vec<metadata::Block>,
pub frames: Vec<frame::Frame>
}
named!(stream <&[u8], Stream>,
chain!(
metadata: metadata_parser,
|| {
... | #[macro_use]
extern crate nom;
pub mod metadata;
mod frame;
mod utility;
use metadata::metadata_parser;
pub struct Stream {
pub info: metadata::StreamInfo,
pub metadata: Vec<metadata::Block>,
pub frames: Vec<frame::Frame>
}
named!(stream <&[u8], Stream>,
chain!(
blocks: metadata_parser ~
move|| {
... | Add info and metadata to `Stream` struct | Add info and metadata to `Stream` struct
| Rust | bsd-3-clause | sourrust/flac |
3ee22d335eafa75e23261e07d05eebfb70caa26e | src/ios.rs | src/ios.rs | use crate::{Error, ErrorKind, Result};
use objc::{class, msg_send, runtime::Object, sel, sel_impl};
/// Deal with opening of browsers on iOS
#[inline]
pub fn open_browser_internal(
_browser: Browser,
url: &str,
_options: &BrowserOptions,
) -> Result<()> {
// always return true for a dry run
if _opt... | use crate::{Browser, BrowserOptions, Error, ErrorKind, Result};
use objc::{class, msg_send, runtime::Object, sel, sel_impl};
/// Deal with opening of browsers on iOS
#[inline]
pub fn open_browser_internal(
_browser: Browser,
url: &str,
_options: &BrowserOptions,
) -> Result<()> {
// always return true ... | Fix typos & missing imports | Fix typos & missing imports
| Rust | apache-2.0 | amodm/webbrowser-rs,amodm/webbrowser-rs,amodm/webbrowser-rs,amodm/webbrowser-rs,amodm/webbrowser-rs |
92710890d9aa6db1be0ff5f679c14397f678e6f3 | futures/tests/async_await/pinned.rs | futures/tests/async_await/pinned.rs | use futures::stable::block_on_stable;
use futures::prelude::*;
#[async]
fn foo() -> Result<i32, i32> {
Ok(1)
}
#[async]
fn bar(x: &i32) -> Result<i32, i32> {
Ok(*x)
}
#[async]
fn baz(x: i32) -> Result<i32, i32> {
await!(bar(&x))
}
#[async_stream(item = u64)]
fn _stream1() -> Result<(), i32> {
fn int... | use futures::stable::{block_on_stable, StableFuture};
use futures::prelude::*;
#[async]
fn foo() -> Result<i32, i32> {
Ok(1)
}
#[async]
fn bar(x: &i32) -> Result<i32, i32> {
Ok(*x)
}
#[async]
fn baz(x: i32) -> Result<i32, i32> {
await!(bar(&x))
}
#[async_move]
fn qux(x: i32) -> Result<i32, i32> {
aw... | Add test of awaiting StableFuture from an async_move function | Add test of awaiting StableFuture from an async_move function
| Rust | apache-2.0 | alexcrichton/futures-rs |
5e188f5803bdbfdf3ff000e8b7e266405531c8d7 | src/test/ui/const-generics/type-dependent/auxiliary/type_dependent_lib.rs | src/test/ui/const-generics/type-dependent/auxiliary/type_dependent_lib.rs | #![feature(const_generics)]
#![allow(incomplete_features)]
pub struct Struct<const N: usize>(());
impl<const N: usize> Struct<N> {
pub fn new() -> Self {
Struct(())
}
pub fn same_ty<const M: usize>(&self) -> (usize, usize) {
(N, M)
}
pub fn different_ty<const M: u8>(&self) -> (us... | #![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
pub struct Struct<const N: usize>(());
impl<const N: usize> Struct<N> {
pub fn new() -> Self {
Struct(())
}
pub fn same_ty<const M: usize>(&self) -> (usize, us... | Add revisions to const generic type-dependent UI tests. | Add revisions to const generic type-dependent UI tests.
| Rust | apache-2.0 | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust |
64105e9ffbd5ed37d63a08f065edfaaa48a42e59 | tests/settings_backward_compatibility.rs | tests/settings_backward_compatibility.rs | use std::path::PathBuf;
use anyhow::{Context, Result};
use pueue_lib::settings::Settings;
/// From 0.12.2 on, we aim to have full backward compatibility.
/// For this reason, an old v0.12.2 serialized state has been checked in.
///
/// We have to be able to restore from that state at all costs.
/// Everything else r... | use std::path::PathBuf;
use anyhow::{Context, Result};
use pueue_lib::settings::Settings;
/// From 0.15.0 on, we aim to have full backward compatibility.
/// For this reason, an old (slightly modified) v0.15.0 serialized state
/// has been checked in.
///
/// We have to be able to restore from that state at all cost... | Fix docstring for backward compatibility test | docs: Fix docstring for backward compatibility test
| Rust | mit | Nukesor/Pueue,Nukesor/Pueuew |
d549150ee16818509688762cdd6c0f16eb5e3b4c | src/main.rs | src/main.rs | use std::io::{Read, Write};
use std::net::{TcpListener, TcpStream};
use std::sync::mpsc::channel;
use std::thread;
fn main() {
let listener = TcpListener::bind("127.0.0.1:8080").unwrap();
// accept connections and process them, spawning a new thread for each one
for stream in listener.incoming() {
... | use std::io::{BufRead, BufReader, Write};
use std::net::{TcpListener, TcpStream};
use std::sync::mpsc::channel;
use std::thread;
fn main() {
let listener = TcpListener::bind("127.0.0.1:8080").unwrap();
// accept connections and process them, spawning a new thread for each one
for stream in listener.incomi... | Create client with each connection | Create client with each connection
| Rust | mit | kevinwilde/chat_server |
33e9e09be5a39f136720d39808026ddd18964eec | src/stream.rs | src/stream.rs | use metadata::{Metadata, StreamInfo, metadata_parser};
use frame::{frame_parser, Frame};
pub struct Stream {
pub info: StreamInfo,
pub metadata: Vec<Metadata>,
pub frames: Vec<Frame>,
}
named!(pub stream_parser <&[u8], Stream>,
chain!(
blocks: metadata_parser ~
frames: many1!(apply!(frame_parser, &blo... | use metadata::{Metadata, StreamInfo, metadata_parser};
use frame::{frame_parser, Frame};
enum ParserState {
Marker,
Metadata,
Frame,
}
pub struct Stream {
pub info: StreamInfo,
pub metadata: Vec<Metadata>,
pub frames: Vec<Frame>,
}
named!(pub stream_parser <&[u8], Stream>,
chain!(
blocks: metadata_... | Add `ParserState` for moving to different parsers | Add `ParserState` for moving to different parsers
| Rust | bsd-3-clause | sourrust/flac |
761a260e5940591df2388733e8c5d90a46faba13 | sdl2-sys/build.rs | sdl2-sys/build.rs | #[cfg(feature="pkg-config")]
extern crate pkg_config;
fn main() {
if !build_pkgconfig() {
let target = ::std::env::var("TARGET").expect("Cargo build scripts always have TARGET");
let target_os = target.splitn(3, "-").nth(2).unwrap();
if cfg!(feature="use_mac_framework") && target_os == "da... | #[cfg(feature="pkg-config")]
extern crate pkg_config;
fn main() {
let target = ::std::env::var("TARGET").expect("Cargo build scripts always have TARGET");
let target_os = target.splitn(3, "-").nth(2).unwrap();
if !build_pkgconfig() {
if cfg!(feature="use_mac_framework") && target_os == "darwin" {
... | Add link directives for iOS frameworks | Add link directives for iOS frameworks
| Rust | mit | Cobrand/rust-sdl2,Rust-SDL2/rust-sdl2,Rust-SDL2/rust-sdl2,Rust-SDL2/rust-sdl2,Cobrand/rust-sdl2,Cobrand/rust-sdl2,AngryLawyer/rust-sdl2 |
b6ba5eac46f1604af46e9f0812713f3df4236dab | src/analysis/general.rs | src/analysis/general.rs | use gobjects::*;
use library::*;
pub struct StatusedTypeId{
pub type_id: TypeId,
pub name: String,
pub status: GStatus,
}
pub fn widget_tid(library: &Library) -> TypeId {
library.find_type(0, "Gtk.Widget").unwrap_or_else(|| unreachable!())
}
pub trait IsWidget {
fn is_widget(&self, library: &Libr... | use gobjects::*;
use library::*;
pub struct StatusedTypeId{
pub type_id: TypeId,
pub name: String,
pub status: GStatus,
}
pub fn widget_tid(library: &Library) -> TypeId {
library.find_type(0, "Gtk.Widget").unwrap_or_else(|| unreachable!())
}
pub trait IsWidget {
fn is_widget(&self, library: &Libr... | Fix "no talking" panic on bad object names in Gir.toml | Fix "no talking" panic on bad object names in Gir.toml
| Rust | mit | GuillaumeGomez/gir,EPashkin/gir,gkoz/gir,gkoz/gir,gtk-rs/gir,gtk-rs/gir,GuillaumeGomez/gir,insanebits/gir,GuillaumeGomez/gir,gtk-rs/gir,EPashkin/gir,insanebits/gir |
1ba6178ee82038be8cc49eba55bc242bdad60ec6 | 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,
number_of_clicks: u32,
}
const TOP_LEFT_CELL: Position = Position{column: 0_usize, row: 0_usize};
impl Game {
... | 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,
number_of_clicks: u32,
allowed_clicks: u32,
}
const TOP_LEFT_CELL: Position = Position{column: 0_usize, row:... | Store number of allowed clicks | Store number of allowed clicks
| Rust | mit | yzhs/flood-it |
7fae10b266bc620a04a03dc8ffb5fd71170e13b3 | src/main.rs | src/main.rs | extern crate sonos_discovery;
use sonos_discovery::Discover;
fn main() {
let discovery = Discover::new().unwrap();
let devices = discovery.start(None, Some(3)).unwrap();
for device in devices {
println!("{:?}", device)
}
}
| extern crate sonos_discovery;
use sonos_discovery::Discover;
use std::time::Instant;
fn main() {
let start_time = Instant::now();
let discovery = Discover::new().unwrap();
let ips = discovery.start(None, Some(3)).unwrap();
for ip in ips {
println!("{:?}", ip)
}
println!("\nTime: {:?}... | Add elapsed time to binary | Add elapsed time to binary
| Rust | mit | Chabare/sonos_discovery |
e5b6ee2533cd2c32faaab6f14a70551135dd8099 | src/main.rs | src/main.rs | #[macro_use]
extern crate clap;
extern crate ultra;
use ultra::enigma::Enigma;
fn main() {
let app = clap_app!(ultra =>
(version: crate_version!())
(@setting ArgRequiredElseHelp)
(@setting ColoredHelp)
(@arg MESSAGE: +required "The message to encrypt/decrypt")
);
let match... | #[macro_use]
extern crate clap;
extern crate ultra;
use ultra::enigma::Enigma;
fn main() {
let app = clap_app!(ultra =>
(version: crate_version!())
(@setting ArgRequiredElseHelp)
(@setting ColoredHelp)
(@arg ROTORS: --rotor -w +takes_value "Rotor order (default: \"123\")")
... | Make Enigma settings configurable from CLI | Make Enigma settings configurable from CLI
| Rust | mit | iKevinY/ultra |
dd488f791fdd83e6dd40d852e576ee8b574f2894 | 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);
println!("Please input your guess.");
let mut gue... | 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.");
... | Add loop to be able to guess several times | Add loop to be able to guess several times
| Rust | mit | juliangrosshauser/guessing_game |
5c0e6671f79cab8959822116bafc142bd3cbd985 | src/main.rs | src/main.rs | use std::env;
extern crate zwreec;
fn main() {
println!("#main started");
// handling commandline parameters
let args: Vec<String> = env::args().collect();
let mut input_file_name: &str;
let mut output_file_name: &str;
match args.len() {
1 => {
input_file_name = "a.in";... | use std::env;
extern crate zwreec;
fn main() {
println!("#main started");
// handling commandline parameters
let args: Vec<String> = env::args().collect();
let mut input_file_name: &str;
let mut output_file_name: &str;
match args.len() {
1 => {
input_file_name = "a.in";... | Return if invalid number of arguments | Return if invalid number of arguments
| Rust | bsd-2-clause | Drakulix/zwreec,Drakulix/zwreec |
1eef71dab7610fceea009c81a86e10a7084cd1e0 | rust/pascals-triangle/src/lib.rs | rust/pascals-triangle/src/lib.rs | pub struct PascalsTriangle;
impl PascalsTriangle {
pub fn new(row_count: u32) -> Self {
unimplemented!();
}
pub fn rows(&self) -> Vec<Vec<u32>> {
unimplemented!();
}
}
| pub struct PascalsTriangle {
row: u32,
}
impl PascalsTriangle {
pub fn new(row_count: u32) -> Self {
PascalsTriangle { row: row_count }
}
fn pascal(row: u32) -> Vec<u32> {
let mut result = Vec::with_capacity(row as usize);
result.push(1);
for k in 0..row {
... | Add rust code for pascals-triangle case | Add rust code for pascals-triangle case
It passed all testcases
| Rust | bsd-2-clause | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism |
767f9e57ac43020cdcd44677c6a1aba13c0c9e4d | rust/leftpad/src/main.rs | rust/leftpad/src/main.rs | extern crate iron;
extern crate rustc_serialize;
extern crate queryst;
use rustc_serialize::json::{self, Json};
use iron::prelude::*;
use iron::status;
use queryst::parse;
#[derive(RustcEncodable)]
pub struct PadJson {
str: String
}
fn main() {
fn handler(req: &mut Request) -> IronResult<Response> {
... | extern crate iron;
extern crate rustc_serialize;
extern crate queryst;
use rustc_serialize::json::{self, Json};
use iron::prelude::*;
use iron::status;
use queryst::parse;
#[derive(RustcEncodable)]
pub struct PadJson {
str: String
}
fn main() {
fn handler(req: &mut Request) -> IronResult<Response> {
... | Add query parameter parsing to Rust example | Add query parameter parsing to Rust example
No error handling at unwrapping yet!
| Rust | mit | melonmanchan/left-pad-services,melonmanchan/left-pad-services,melonmanchan/left-pad-services,melonmanchan/left-pad-services,melonmanchan/left-pad-services,melonmanchan/left-pad-services,melonmanchan/left-pad-services,melonmanchan/left-pad-services |
43309decf65bd9b5a1856b31cbde6dcbe10136c5 | src/main.rs | src/main.rs | use std::env;
extern crate git2;
extern crate tiny_http;
static INDEX_GIT_URL: &'static str = "https://github.com/rust-lang/crates.io-index";
fn main() {
git2::Repository::clone(INDEX_GIT_URL, "crates.io-index").unwrap();
let port = match env::var("PORT") {
Ok(p) => p.parse::<u16>().unwrap(),
... | use std::env;
extern crate git2;
extern crate tiny_http;
static INDEX_GIT_URL: &'static str = "https://github.com/rust-lang/crates.io-index";
fn main() {
println!("Cloning crates.io-index");
git2::Repository::clone(INDEX_GIT_URL, "crates.io-index").unwrap();
let port = match env::var("PORT") {
... | Add a couple print messages | Add a couple print messages
| Rust | apache-2.0 | frewsxcv/crate-deps |
8c58e6a468f4a4aa368a5cd4b4753eee8c3ffa29 | src/main.rs | src/main.rs | mod vm;
mod command;
mod parse;
mod program;
use vm::VM;
use program::Program;
use std::io::Write;
fn main() {
let mut vm = VM::new();
let mut program = Program::new();
loop {
print!("{}", if program.is_seeking {"... "} else {"bf> "});
std::io::stdout().flush().unwrap();
let mut l... | 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 mut vm = VM::new();
let mut program = Program::new();
loop {
print!("{}", if program.is_seekin... | Print out arguments supplied (testing purposes) | Print out arguments supplied (testing purposes)
| Rust | mit | nafarlee/thoughtfuck |
ddb779ea652678ea755017420d2d0ab72cac09b1 | set1/challenge3/src/main.rs | set1/challenge3/src/main.rs | // Crypto challenge Set1 / Challenge 3
// Decrypt single XOR chiffre
extern crate codec;
extern crate challenge3;
#[cfg(not(test))]
fn main() {
let args = std::os::args();
if args.len() != 2 {
println!("USAGE: challenge3 HEX_ENCODED_STRING");
} else {
let input = args[1].as_slice();
... | // Crypto challenge Set1 / Challenge 3
// Decrypt single XOR chiffre
extern crate codec;
extern crate challenge3;
#[cfg(not(test))]
fn main() {
let args = std::os::args();
if args.len() != 2 {
println!("USAGE: challenge3 HEX_ENCODED_STRING");
} else {
let input = args[1].as_slice();
... | Improve output of Challenge 3 | Improve output of Challenge 3
| Rust | unlicense | imhof/matsano-crypto |
afbd1fdcaaba1bd82b38d30dbc93272122e2fc7c | util.rs | util.rs | use ll::stylesheet::css_fixed;
pub fn css_fixed_to_float(f: css_fixed) -> float {
const before: i32 = 10;
f as float * 1.0f / ((1i32 << before) as float)
}
| use ll::stylesheet::css_fixed;
use core::libc::c_void;
pub fn css_fixed_to_float(f: css_fixed) -> float {
const before: i32 = 10;
f as float * 1.0f / ((1i32 << before) as float)
}
pub trait VoidPtrLike {
static fn from_void_ptr(*c_void) -> self;
fn to_void_ptr(&self) -> *c_void;
} | Add VoidPtrLike trait for converting between *c_void | Add VoidPtrLike trait for converting between *c_void
| Rust | apache-2.0 | servo/rust-netsurfcss |
765768d10c96cc09f3a0ccf169cea98cd283465c | tests/no_std_build.rs | tests/no_std_build.rs | #![cfg_attr(feature = "nightly", feature(lang_items, core_intrinsics, panic_implementation))]
#![cfg_attr(feature = "nightly", no_std)]
#![cfg_attr(feature = "nightly", no_main)]
// Pull in the system libc library for what crt0.o likely requires.
extern crate libc;
extern crate raw_cpuid;
#[cfg(feature = "nightly")]
... | #![cfg_attr(feature = "nightly", feature(lang_items, core_intrinsics, panic_implementation))]
#![cfg_attr(feature = "nightly", no_std)]
#![cfg_attr(feature = "nightly", no_main)]
// Pull in the system libc library for what crt0.o likely requires.
extern crate libc;
extern crate raw_cpuid;
#[cfg(feature = "nightly")]
... | Update test a bit more to hopefully work on Linux/Win. | Update test a bit more to hopefully work on Linux/Win.
Signed-off-by: Gerd Zellweger <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@gerdzellweger.com>
| Rust | mit | gz/rust-cpuid |
e80234a19a780228977d39eaebe58a8e1907897f | uchardet-sys/build.rs | uchardet-sys/build.rs | // Parts of this are based on the work on alexcrichton, here:
// https://github.com/alexcrichton/git2-rs/blob/master/libgit2-sys/build.rs
//
// This has been tested on Ubuntu and it assumes that CMake is available.
// Patches are welcome to help make it work on other operating systems!
extern crate pkg_config;
extern ... | // Parts of this are based on the work on alexcrichton, here:
// https://github.com/alexcrichton/git2-rs/blob/master/libgit2-sys/build.rs
//
// This has been tested on Ubuntu and it assumes that CMake is available.
// Patches are welcome to help make it work on other operating systems!
extern crate pkg_config;
extern ... | Make it work on windows-msvc | Make it work on windows-msvc
| Rust | unlicense | emk/rust-uchardet |
c4a850078cbcc8cd3d79483b51767f1171d81f88 | src/test/run-pass-fulldeps/newtype_index.rs | src/test/run-pass-fulldeps/newtype_index.rs | #![feature(rustc_attrs, rustc_private, step_trait)]
#[macro_use] extern crate rustc_data_structures;
extern crate rustc_serialize;
use rustc_data_structures::indexed_vec::Idx;
newtype_index!(struct MyIdx { MAX = 0xFFFF_FFFA });
use std::mem::size_of;
fn main() {
assert_eq!(size_of::<MyIdx>(), 4);
assert_eq... | #![feature(rustc_attrs, rustc_private, step_trait, min_const_unsafe_fn)]
#[macro_use] extern crate rustc_data_structures;
extern crate rustc_serialize;
use rustc_serialize::{Decodable, Decoder};
use rustc_data_structures::indexed_vec::Idx;
newtype_index!(struct MyIdx { MAX = 0xFFFF_FFFA });
use std::mem::size_of;
... | Adjust a rustc test to the safety changes | Adjust a rustc test to the safety changes
| Rust | apache-2.0 | GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust |
03968527c0d7da7108976bb2dc7a31bebae93cc4 | src/tests.rs | src/tests.rs | use std::time;
use ::{CANSocket, ShouldRetry};
#[test]
fn test_nonexistant_device() {
assert!(CANSocket::open("invalid").is_err());
}
#[test]
#[cfg(feature = "vcan_tests")]
fn vcan0_timeout() {
let cs = CANSocket::open("vcan1").unwrap();
cs.set_read_timeout(time::Duration::from_millis(100)).unwrap();
... | use std::time;
use ::{CANSocket, ShouldRetry};
#[test]
fn test_nonexistant_device() {
assert!(CANSocket::open("invalid").is_err());
}
#[test]
#[cfg(feature = "vcan_tests")]
fn vcan0_timeout() {
let cs = CANSocket::open("vcan0").unwrap();
cs.set_read_timeout(time::Duration::from_millis(100)).unwrap();
... | Test setting and clearing of error mask. | Test setting and clearing of error mask.
| Rust | mit | marcelbuesing/socketcan-rs,marcelbuesing/socketcan-rs |
04acdb4584cbd49ddd950dcb15b828d124782d5a | tests/zex.rs | tests/zex.rs | extern crate z80emulib;
#[cfg(test)]
mod test_zex {
use z80emulib::memory::*;
use z80emulib::cpu::*;
static ZEXDOC: &'static [u8] = include_bytes!("zexdoc.com");
#[test]
fn test_zexdoc() {
let mut dummyrom0: Vec<u8> = vec![0; 16 * 1024];
let dummyrom1: Vec<u8> = vec![0; 16 * 1024]... | extern crate z80emulib;
#[cfg(test)]
mod test_zex {
use z80emulib::memory::*;
use z80emulib::cpu::*;
static ZEXDOC: &'static [u8] = include_bytes!("zexdoc.com");
#[test]
fn test_zexdoc() {
let mut dummyrom0: Vec<u8> = vec![0; 16 * 1024];
let dummyrom1: Vec<u8> = vec![0; 16 * 1024]... | Fix SP in ZEXDOC test | Fix SP in ZEXDOC test
| Rust | mit | Daedrus/rustz80emu |
985498810af8cc3f01d682568ed4720d680d3cba | src/libinterval/ops.rs | src/libinterval/ops.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... | Remove the PartialOrd bound due to some limitation of the genericity in Rust. | Remove the PartialOrd bound due to some limitation of the genericity in Rust.
| Rust | apache-2.0 | ptal/rust-interval |
05b4a22a7cd27dd202465c5b231ca38ce82fe43c | src/engine/messages.rs | src/engine/messages.rs | use std::string::String;
use std::slice::Iter;
pub struct MessageList {
messages: Vec<Message>,
}
pub enum MessageType {
Info,
Error,
}
pub struct Message {
text: String,
ty: MessageType,
}
impl Message {
pub fn text(&self) -> &str {
&self.text
}
}
impl MessageList {
pub fn... | use std::string::String;
use std::slice::Iter;
pub struct MessageList {
messages: Vec<Message>,
}
pub enum MessageType {
Info,
Error,
}
pub struct Message {
text: String,
ty: MessageType,
}
impl Message {
pub fn text(&self) -> &str {
&self.text
}
pub fn ty(&self) -> &Message... | Allow fetching the MessageType of a message | Allow fetching the MessageType of a message
| Rust | bsd-3-clause | jgilchrist/rslike |
c98e96b8dd1795ded4adff6842f5caa89240ce54 | 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> {
x: T,
y: T,
}
fn main() {
let numbers = vec![1, 3, 2, 5, 0];
let result = largest(&numbers);
pr... | 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> {
x: T,
y: T,
}
impl<T> Point<T> {
fn x(&self) -> &T {
&self.x
}
}
fn main() {
let numbers... | Define a method on struct that uses generics | Define a method on struct that uses generics
| Rust | mit | pgrzesik/learning-rust |
69d161d5e262f3a9724510670e8d95e4cbc8195e | src/test_helpers.rs | src/test_helpers.rs | use std::str;
use interpreter::Interpretable;
use result::BfResult;
pub const FACTOR_SRC: &'static [u8] = include_bytes!("../bf/factor.bf");
pub const HELLO_WORLD_SRC: &'static [u8] =
b"++++++[>++++++++++++<-]>.\
>++++++++++[>++++++++++<-]>+.\
+++++++..+++.>++++[>+++++++++++<-]>.\
<+++[>----<-]... | use std::str;
use interpreter::Interpretable;
pub const FACTOR_SRC: &'static [u8] = include_bytes!("../bf/factor.bf");
pub const HELLO_WORLD_SRC: &'static [u8] =
b"++++++[>++++++++++++<-]>.\
>++++++++++[>++++++++++<-]>+.\
+++++++..+++.>++++[>+++++++++++<-]>.\
<+++[>----<-]>.<<<<<+++[>+++++<-]>.... | Make assert_interpret a bit simpler. | Make assert_interpret a bit simpler.
| Rust | mit | tov/bf-rs,tov/bf-rs,tov/bf-rs |
2d5196147fed8bc1b84725bcdf8e3744fd806819 | test/errors.rs | test/errors.rs | #![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
#[miri_run]
fn overwriting_part_of_relocation_makes_the_rest_undefined() -> i32 {
let mut p: *const i32 = &42;
unsafe {
let ptr = &mut p as *mut *const i32 as *mut u32;
*ptr = 123;
*p
}
}
| #![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
#[miri_run]
fn overwriting_part_of_relocation_makes_the_rest_undefined() -> i32 {
let mut p = &42;
unsafe {
let ptr: *mut _ = &mut p;
*(ptr as *mut u32) = 123;
}
*p
}
#[miri_run]
fn pointers_to_different_allocations_... | Add test for comparing ptrs into different allocs. | Add test for comparing ptrs into different allocs.
| Rust | apache-2.0 | rust-lang/miri,rust-lang/miri,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,tsion/miri,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,rust-lang/miri,aidancully/rust,ai... |
6f43c9c253ee5f09434a321e21d610b7e2b543eb | lib.rs | lib.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 ... | Update to current rust: use the new attributes syntax. | Update to current rust: use the new attributes syntax.
| Rust | apache-2.0 | mbrubeck/rust-geom,ruud-v-a/rust-geom,servo/rust-geom |
9830ae079f9e1bdb6ad6cb3e88093d6882322921 | examples/systray-example.rs | examples/systray-example.rs | extern crate systray;
//#[cfg(target_os = "windows")]
fn main() {
let mut app;
match systray::Application::new() {
Ok(w) => app = w,
Err(e) => panic!("Can't create window!")
}
// w.set_icon_from_file(&"C:\\Users\\qdot\\code\\git-projects\\systray-rs\\resources\\rust.ico".to_string());
... | extern crate systray;
//#[cfg(target_os = "windows")]
fn main() {
let mut app;
match systray::Application::new() {
Ok(w) => app = w,
Err(_) => panic!("Can't create window!")
}
// w.set_icon_from_file(&"C:\\Users\\qdot\\code\\git-projects\\systray-rs\\resources\\rust.ico".to_string());
... | Clean up warnings in example | chore: Clean up warnings in example
| Rust | bsd-3-clause | qdot/systray-rs,qdot/systray-rs |
df408e2d0ee18f9105d101f32396276c95dfec12 | src/dbus_api/macros.rs | src/dbus_api/macros.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/.
/// Macro for early return with Ok dbus message on failure to get pool.
macro_rules! get_pool {
( $engine:ident;... | // 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 for early return with Ok dbus message on failure to get pool.
macro_rules! get_pool {
( $engine:ident;... | Use an if-let construction in a macro | Use an if-let construction in a macro
It is less cumbersome and requires less indentation.
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
| Rust | mpl-2.0 | stratis-storage/stratisd,trgill/stratisd,stratis-storage/stratisd,mulkieran/stratisd,trgill/stratisd,stratis-storage/stratisd,mulkieran/stratisd |
1aa53e00a18b953caa5ea57b19ca2d1e70515c68 | example/src/main.rs | example/src/main.rs | #![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
if data == b"banana!" {
panic!("success!");
}
});
| #![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
if data == "banana!".as_bytes() {
panic!("success!");
}
});
| Change example to use `str::as_bytes` instead of array comparison | Change example to use `str::as_bytes` instead of array comparison
See #90.
| Rust | apache-2.0 | rust-fuzz/libfuzzer,rust-fuzz/libfuzzer,rust-fuzz/libfuzzer,rust-fuzz/libfuzzer,rust-fuzz/libfuzzer |
7dafc8f681e28a9e43ef94af9d308191530b807e | src/day01_2016.rs | src/day01_2016.rs | use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
pub fn taxicab(file: &str) -> i64 {
let input = File::open(file).expect("File open fail.");
let reader = BufReader::new(input);
let cur_dir = Direction::North;
for line in reader.lines() {
let line = line.unwrap();
pr... | use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
pub fn taxicab(file: &str) -> i64 {
let input = File::open(file).expect("File open fail.");
let reader = BufReader::new(input);
let cur_dir = Direction::North;
reader.lines()
.filter_map(Result::ok)
.flat_map(|line| {... | Add iterator to parse file. | Add iterator to parse file.
| Rust | mit | nathanjent/adventofcode-rust |
b543a78017f5733e70cb6236c22c827fbdb865c0 | src/shared/mod.rs | src/shared/mod.rs | pub mod control_regs;
pub mod descriptor;
pub mod dtables;
pub mod io;
pub mod irq;
pub mod msr;
pub mod paging;
pub mod flags;
pub mod segmentation;
pub mod task;
pub mod tlb;
#[derive(Copy, Clone, PartialEq, Eq)]
#[repr(u8)]
pub enum PrivilegeLevel {
Ring0 = 0,
Ring1 = 1,
Ring2 = 2,
Ring3 = 3,
}
#[i... | pub mod control_regs;
pub mod descriptor;
pub mod dtables;
pub mod io;
pub mod irq;
pub mod msr;
pub mod paging;
pub mod flags;
pub mod segmentation;
pub mod task;
pub mod tlb;
#[derive(Copy, Clone, PartialEq, Eq)]
#[repr(u8)]
pub enum PrivilegeLevel {
Ring0 = 0,
Ring1 = 1,
Ring2 = 2,
Ring3 = 3,
}
#[i... | Revert "Added nop as a function." | Revert "Added nop as a function."
This reverts commit f0d695c44622483fb1d1775fc9fd134cee3f9568.
| Rust | mit | gz/rust-x86,gz/rust-x86,phil-opp/rust-x86_64 |
f498ad40a77772f30368a245eff5dad65c59b9f3 | src/macos.rs | src/macos.rs | use std::ffi::{CString, NulError};
use std::os::raw::c_char;
use std::path::PathBuf;
use libc::{c_int, uint32_t};
extern {
#[link(name = "dyld")]
fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut uint32_t) -> c_int;
}
pub fn get_executable_path() -> Option<PathBuf> {
fn get_executable_path(len: uin... | use std::ffi::CString;
use std::os::raw::c_char;
use std::path::PathBuf;
use libc::{c_int, uint32_t};
extern {
#[link(name = "dyld")]
fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut uint32_t) -> c_int;
}
pub fn get_executable_path() -> Option<PathBuf> {
fn get_executable_path(len: uint32_t) -> Op... | Clean up the mac code a little | Clean up the mac code a little
| Rust | apache-2.0 | wesleywiser/process_path |
f65473efcf93dd944cc1727e3cbe9e8285d06e58 | build.rs | build.rs | #[cfg(feature="gnustep_runtime")]
extern crate gcc;
#[cfg(not(feature="gnustep_runtime"))]
fn compile() {
}
#[cfg(feature="gnustep_runtime")]
fn compile() {
gcc::Config::new().flag("-lobjc")
.flag("-fobjc-runtime=gnustep-1.8")
.flag("-fno-objc-legacy-dispatch")
... | #[cfg(feature="gnustep_runtime")]
extern crate gcc;
#[cfg(feature="gnustep_runtime")]
use std::path::PathBuf;
#[cfg(not(feature="gnustep_runtime"))]
fn compile() {
}
#[cfg(feature="gnustep_runtime")]
fn compile() {
gcc::Config::new().flag("-lobjc")
.flag("-fobjc-runtime=gnustep-1.8")
... | Update to track proposed gcc-rs API | Update to track proposed gcc-rs API
| Rust | mit | ngrewe/rust-objc,ngrewe/rust-objc |
acc30cc253e4835c60407bf304369846f90becd4 | server/src/api/queue/pod.rs | server/src/api/queue/pod.rs | use diesel::prelude::*;
use helpers::db::DB;
use models::user::User;
use models::queue::QueueEntry;
use schema::queue_entries::dsl as queue_entry_dsl;
use responses::{APIResponse, ok};
/// The user needs to be logged in to access this route!
///
/// This route returns the list of the currently running entries in t... | use diesel::prelude::*;
use helpers::db::DB;
use models::user::User;
use models::queue::QueueEntry;
use schema::queue_entries::dsl as queue_entry_dsl;
use responses::{APIResponse, ok};
/// The user needs to be logged in to access this route!
///
/// This route returns the list of the currently running entries in t... | Sort queue entries by creation date | Sort queue entries by creation date
| Rust | mit | Nukesor/spacesurvival,Nukesor/spacesurvival,Nukesor/spacesurvival,Nukesor/spacesurvival |
61c75bdb11e782ee50ff1e4de6d29fd5ff4f0e31 | src/test/ui/type-alias-impl-trait/fallback.rs | src/test/ui/type-alias-impl-trait/fallback.rs | // Tests that we correctly handle the instantiated
// inference variable being completely unconstrained.
//
// check-pass
#![feature(type_alias_impl_trait)]
type Foo = impl Copy;
enum Wrapper<T> {
First(T),
Second
}
fn _make_iter() -> Foo {
true
}
fn _produce() -> Wrapper<Foo> {
Wrapper::Second
}
f... | // Tests that we correctly handle the instantiated
// inference variable being completely unconstrained.
//
// check-pass
#![feature(type_alias_impl_trait)]
type Foo = impl Copy;
enum Wrapper<T> {
First(T),
Second
}
// This method constrains `Foo` to be `bool`
fn constrained_foo() -> Foo {
true
}
// Th... | Add explanation of unconstrained opaque type | Add explanation of unconstrained opaque type
| Rust | apache-2.0 | graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust |
2e60fffe123ee82365a65b77d17148ed4d56b8f0 | src/object.rs | src/object.rs | // Copyright 2015, 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::marker::PhantomData;
use glib::object::{Ref, Wrapper};
use glib::types::StaticType;
pub ... | // Copyright 2015, 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::marker::PhantomData;
use glib::object::{Ref, Wrapper};
use glib::types::StaticType;
pub ... | Prepare for soundness fixes in glib | Prepare for soundness fixes in glib
| Rust | mit | rust-gnome/gdk,hmeyer/gdk,gkoz/gtk-rs-gdk,hmeyer/gdk,gkoz/rust-gnome-gdk,gkoz/rust-gnome-gdk,gkoz/gtk-rs-gdk,rust-gnome/gdk |
0aafd6507d3882de2ada259c71d2d8ec1dd25fd3 | src/stream.rs | src/stream.rs | use nom::{ConsumerState, Move};
use metadata::{Metadata, StreamInfo, metadata_parser};
use frame::{frame_parser, Frame};
enum ParserState {
Marker,
Metadata,
Frame,
}
pub struct Stream {
pub info: StreamInfo,
pub metadata: Vec<Metadata>,
pub frames: Vec<Frame>,
state: ParserState,
consumer_state: Co... | use nom::{ConsumerState, ErrorKind, HexDisplay, IResult, Move};
use metadata::{Metadata, StreamInfo, metadata_parser};
use frame::{frame_parser, Frame};
enum ParserState {
Marker,
Metadata,
Frame,
}
pub struct Stream {
pub info: StreamInfo,
pub metadata: Vec<Metadata>,
pub frames: Vec<Frame>,
state: P... | Add a implementation for handling `fLaC` marker | Add a implementation for handling `fLaC` marker
| Rust | bsd-3-clause | sourrust/flac |
97cecbd9edad3fc3b2dbdf70a52ff51360848079 | tests/book.rs | tests/book.rs | extern crate crowbook;
use crowbook::Book;
use std::io;
#[test]
fn test_book() {
let mut book = Book::new();
book.load_file(&format!("{}/{}", env!("CARGO_MANIFEST_DIR"), "tests/test.book"))
.unwrap();
book.render_format_to("html", &mut io::sink()).unwrap();
book.render_format_to("tex", &mut io:... | use crowbook::Book;
use std::io;
#[test]
fn test_book() {
let mut book = Book::new();
book.load_file(&format!("{}/{}", env!("CARGO_MANIFEST_DIR"), "tests/test.book"))
.unwrap();
book.render_format_to("html", &mut io::sink()).unwrap();
book.render_format_to("tex", &mut io::sink()).unwrap();
}
#... | Update tests for Rust 2018 | Update tests for Rust 2018
| Rust | lgpl-2.1 | lise-henry/crowbook,lise-henry/crowbook,lise-henry/crowbook,lise-henry/crowbook |
18857725519fa7974a64edebafddebf1965183f0 | rust/beer-song/src/lib.rs | rust/beer-song/src/lib.rs | pub fn verse(index: usize) -> String {
match index {
2 => {
"2 bottles of beer on the wall, 2 bottles of beer.\n\
Take one down and pass it around, 1 bottle of beer \
on the wall.\n"
.to_string()
}
1 => {
"1 bottle of beer on ... | pub fn verse(index: usize) -> String {
match index {
2 => {
"2 bottles of beer on the wall, 2 bottles of beer.\n\
Take one down and pass it around, 1 bottle of beer \
on the wall.\n"
.to_string()
}
1 => {
"1 bottle of beer on ... | Use {0} and {1} in format | Use {0} and {1} in format
So I could save some type
| Rust | bsd-2-clause | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism |
3f7b4b2a393e310c54c349347ecd0b036d91973e | src/platformer/world.rs | src/platformer/world.rs | use std;
use extra::comm::DuplexStream;
use player;
struct WorldState {
player_state: ~player::PlayerState,
ticks: int,
}
impl WorldState {
pub fn new(player_state: ~player::PlayerState) -> WorldState {
WorldState{ticks: 0, player_state: player_state}
}
pub fn clone(&self) -> WorldState ... | use std;
use extra::comm::DuplexStream;
use player;
struct WorldState {
player_state: ~player::PlayerState,
ticks: int,
}
impl WorldState {
pub fn new(player_state: ~player::PlayerState) -> WorldState {
WorldState{ticks: 0, player_state: player_state}
}
}
impl Clone for WorldState {
fn c... | Fix impl of Clone for WorldState | Fix impl of Clone for WorldState
| Rust | bsd-2-clause | brendonjustin/platformer |
485716be091d0a7a147ba41560f8bc5befb984ab | parser/build.rs | parser/build.rs | extern crate lalrpop;
fn main() {
::std::env::set_var("LALRPOP_LANE_TABLE", "disabled");
lalrpop::Configuration::new().process_current_dir().unwrap();
println!("cargo:rerun-if-changed=src/grammar.lalrpop");
}
| extern crate lalrpop;
fn main() {
::std::env::set_var("LALRPOP_LANE_TABLE", "disabled");
lalrpop::Configuration::new()
.process_current_dir()
.unwrap();
println!("cargo:rerun-if-changed=src/grammar.lalrpop");
}
| Update lalrpop to 0.13.1 (with LALRPOP_LANE_TABLE=disabled) | chore: Update lalrpop to 0.13.1 (with LALRPOP_LANE_TABLE=disabled)
Fixes the petgrapth regression causing nightly to fail on travis
| Rust | mit | Marwes/embed_lang,gluon-lang/gluon,gluon-lang/gluon,Marwes/embed_lang |
2035956642801b48136261f40b56fc1da4daf143 | src/main.rs | src/main.rs | use std::net::{TcpListener, TcpStream};
extern crate rust_ofp;
use rust_ofp::ofp_controller::OfpController;
use rust_ofp::ofp_controller::openflow0x01::OF0x01Controller;
use rust_ofp::openflow0x01::{SwitchFeatures, PacketIn, Pattern};
use rust_ofp::openflow0x01::message::{add_flow, Message};
fn main() {
struct OF... | use std::net::{TcpListener, TcpStream};
extern crate rust_ofp;
use rust_ofp::ofp_controller::OfpController;
use rust_ofp::ofp_controller::openflow0x01::OF0x01Controller;
use rust_ofp::openflow0x01::{SwitchFeatures, PacketIn, Pattern};
use rust_ofp::openflow0x01::message::{add_flow, Message};
fn main() {
struct OF... | Fix trait impl for exe controller | Fix trait impl for exe controller
| Rust | mit | baxtersa/rust_ofp |
d3035a1b205caef6279c91b276e672c54318838c | src/test/run-pass/loop-break-cont.rs | src/test/run-pass/loop-break-cont.rs | // xfail-test
// runs forever for some reason -- investigating
fn main() {
let i = 0u;
loop {
log(error, "a");
i += 1u;
if i == 10u {
break;
}
}
assert (i == 10u);
let is_even = false;
loop {
log(error, "b");
is_even = false;
i += 1u;
if i % 2u != 0u {
cont;
... | fn main() {
let i = 0u;
loop {
log(error, "a");
i += 1u;
if i == 10u {
break;
}
}
assert (i == 10u);
let is_even = false;
loop {
if i == 21u {
break;
}
log(error, "b");
is_even = false;
i += 1u;
if i % 2u != 0u {
cont;
}
is_even = true;
... | Fix test so it terminates, and un-xfail it | Fix test so it terminates, and un-xfail it
Still need more tests for loop{}
| Rust | apache-2.0 | GBGamer/rust,pythonesque/rust,j16r/rust,dwillmer/rust,nwin/rust,rprichard/rust,pythonesque/rust,Ryman/rust,GBGamer/rust,kmcallister/rust,barosl/rust,dwillmer/rust,LeoTestard/rust,sarojaba/rust-doc-korean,gifnksm/rust,l0kod/rust,barosl/rust,barosl/rust,pshc/rust,jbclements/rust,ktossell/rust,dinfuehr/rust,quornian/rust,... |
6c1529b34fcf57d8292cd121f2261b8119bf5fcf | src/test/ui/span/E0535.rs | src/test/ui/span/E0535.rs | // Copyright 2016 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 2016 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 invalid inline arg test. | Update invalid inline arg test.
| Rust | apache-2.0 | GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust |
2d99255b87e36ad057cc94011f1e34ee3f107f59 | src/js_types/js_type.rs | src/js_types/js_type.rs | use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use uuid::Uuid;
pub trait JsTrait {}
pub struct JsT {
uid: Uuid,
t: Box<JsTrait>,
}
impl JsT {
pub fn new(t: Box<JsTrait>) -> JsT {
JsT {
uid: Uuid::new_v4(),
t: t,
}
}
}
impl PartialEq for JsT {
fn eq... | use std::string::String;
use js_types::js_obj::JsObjStruct;
use js_types::js_str::JsStrStruct;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use uuid::Uuid;
pub struct JsT {
pub uuid: Uuid,
pub t: JsType,
}
impl JsT {
pub fn new(t: JsType) -> JsT {
JsT {
uuid: Uuid::new_v4(),
... | Create new enum of all standard JS types | Create new enum of all standard JS types
| Rust | mit | rustoscript/french-press |
3fcfa78a2394f1be76b018f98a55dbce46458156 | examples/rust/hello_world/src/lib.rs | examples/rust/hello_world/src/lib.rs | extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern {
fn oak_print(s: &str);
}
#[wasm_bindgen]
pub fn oak_main() {
oak_print("HELLO OAK");
}
| extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern {
fn oak_print(s: &str);
fn oak_get_time() -> i32;
}
#[wasm_bindgen]
pub fn oak_main() {
oak_print("HELLO OAK");
}
| Add empty get time exported function | Add empty get time exported function
| Rust | apache-2.0 | project-oak/oak,project-oak/oak,project-oak/oak,project-oak/oak,project-oak/oak,project-oak/oak,project-oak/oak |
3599ada976568d0b5326e890d4b0c2f22dcdc985 | src/test/ui/feature-gates/feature-gate-unsafe_block_in_unsafe_fn.rs | src/test/ui/feature-gates/feature-gate-unsafe_block_in_unsafe_fn.rs | #![deny(unsafe_op_in_unsafe_fn)]
//~^ ERROR the `unsafe_op_in_unsafe_fn` lint is unstable
fn main() {}
| #![deny(unsafe_op_in_unsafe_fn)]
//~^ ERROR the `unsafe_op_in_unsafe_fn` lint is unstable
//~| ERROR the `unsafe_op_in_unsafe_fn` lint is unstable
//~| ERROR the `unsafe_op_in_unsafe_fn` lint is unstable
fn main() {}
| Mark deduplicated errors as expected in gate test | Mark deduplicated errors as expected in gate test
| Rust | apache-2.0 | graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.