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 |
|---|---|---|---|---|---|---|---|---|---|
a55f4863b08f9f66eec614dcad5ef5bbcb4c545c | src/request_timeoutable/mod.rs | src/request_timeoutable/mod.rs | pub trait RequestTimeoutable {
type Output;
fn append_request_timeout(self, timeout: u64) -> Self::Output;
}
macro_rules! request_timeoutable {
($($t:ty), +) => (
$(impl RequestTimeoutable for $t {
type Output = $t;
fn append_request_timeout(mut self, timeout: u64) -> Self... | pub trait RequestTimeoutable {
type Output;
/// Specify `timeout` value. Unit: second
///
/// Panics if specified negative float value.
fn append_request_timeout(self, timeout: f64) -> Self::Output;
}
macro_rules! request_timeoutable {
($($t:ty), +) => (
$(impl RequestTimeoutable for $... | Use 64bit float type to represent under 1 second value | request_timeoutable: Use 64bit float type to represent under 1 second value
| Rust | mit | cosmo0920/ruroonga_command |
44f1f889f89e787730b787fdf418fbc47d140092 | src/derive/mod.rs | src/derive/mod.rs | extern crate syn;
use std::env;
use std::fs::File;
use std::io::{Write, BufWriter};
use syn::DeriveInput;
pub fn generate_elm(_: &DeriveInput) {
let mut path = env::current_dir().unwrap();
path.push("generated/test.txt");
let file = File::create(path).unwrap();
let ref mut w = BufWriter::new(file);
... | extern crate syn;
use std::env;
use std::fs::File;
use std::io::{Write, BufWriter};
use syn::DeriveInput;
pub fn generate_elm(ast: &DeriveInput) {
let mut path = env::current_dir().unwrap();
let name = &ast.ident;
path.push(format!("generated/{}.elm", name));
let file = File::create(path).unwrap();
... | Write a test file with the name of the struct | Write a test file with the name of the struct
| Rust | mit | mijnadres/serde_elm |
cd26e032a51d957e4fc6a951c6c71cf19dfff87e | src/osc_server.rs | src/osc_server.rs | use {osc_types, errors};
/// Common MTP size for ethernet
pub const MTP: usize = 1536;
pub fn destruct(message: &mut [u8], size: usize) -> Result<osc_types::OscPacket, errors::OscError> {
Ok(osc_types::OscPacket::OscMessage)
} | use {osc_types, errors};
use std::{io, str};
use std::io::BufRead; // trait
/// Common MTP size for ethernet
pub const MTP: usize = 1536;
pub fn destruct(msg: &[u8], size: usize) -> Result<osc_types::OscPacket, errors::OscError> {
match msg[0] as char {
'/' => {
destruct_message(msg, size);
... | Add destruct and helper methods | Add destruct and helper methods
| Rust | apache-2.0 | klingtnet/rosc |
7bfe3ae00a36e8162e2f8f5b47eb7127562e1d17 | src/test/run-pass/issue-23304-2.rs | src/test/run-pass/issue-23304-2.rs | // Copyright 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-MIT or ... | // Copyright 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-MIT or ... | Add a test for casts of univariant C-like enums | Add a test for casts of univariant C-like enums
| Rust | apache-2.0 | graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust |
fe90373c67b7a826a2200379c26cb320d6cad366 | challenges/src/set6/challenge41.rs | challenges/src/set6/challenge41.rs | use errors::*;
use rsa::Rsa;
use bignum::BigNumTrait;
use bignum::OpensslBigNum as BigNum;
pub fn run() -> Result<(), Error> {
let bits = 512;
let rsa = Rsa::<BigNum>::generate(bits);
let m = BigNumTrait::gen_random(bits - 1);
let c = rsa.encrypt(&m);
let oracle = |x: &BigNum| -> Option<BigNum>... | use errors::*;
use rsa::Rsa;
use bignum::BigNumTrait;
use bignum::OpensslBigNum as BigNum;
const BITS:usize = 512;
struct Server {
rsa: Rsa<BigNum>,
cleartext: BigNum,
ciphertext: BigNum,
}
impl Server {
fn new() -> Self {
let rsa = Rsa::<BigNum>::generate(BITS);
let cleartext = Big... | Use struct instead of closure | Use struct instead of closure
| Rust | mit | aopicier/cryptopals-rust |
7f3397f623c4c748e50c6980ffe8a9ac6084aaf9 | tests/lib.rs | tests/lib.rs | extern crate mtl;
extern crate libc;
use mtl::sys::{MTLCopyAllDevices,MTLOrigin, MTLOriginMake, MTLClearColorMake};
#[test]
fn it_works() {
let _origin = MTLOriginMake(50, 21, 11);
let _color = MTLClearColorMake(50.0, 21.0, 11.0, 100.0);
let _hi = unsafe { MTLCopyAllDevices() };
}
| extern crate mtl;
extern crate libc;
use mtl::{Device};
#[test]
fn get_device() {
let device = Device::system_default_device();
assert!(device.is_ok());
}
#[test]
fn get_device_name() {
let device = Device::system_default_device().unwrap();
assert!(!device.name().into_owned().is_empty());
}
| Add some proper high level tests | Add some proper high level tests
| Rust | apache-2.0 | burtonageo/metl |
f7f6e73438177020a1be04584a2d66381de0bd06 | src/tui/displayarea.rs | src/tui/displayarea.rs | use ncurses::*;
use irc::client::prelude::*;
pub struct DisplayArea {
window: WINDOW,
}
impl DisplayArea {
pub fn new() -> DisplayArea {
let mut w = 0;
let mut h = 0;
getmaxyx(stdscr, &mut h, &mut w);
let window = subwin(stdscr, h - 2, w, 0, 0);
scrollok(window, true);... | use ncurses::*;
use irc::client::prelude::*;
pub struct DisplayArea {
window: WINDOW,
}
impl DisplayArea {
pub fn new() -> DisplayArea {
let mut w = 0;
let mut h = 0;
getmaxyx(stdscr, &mut h, &mut w);
let window = subwin(stdscr, h - 1, w, 0, 0);
scrollok(window, true);... | Make full use of the display area. | Make full use of the display area.
| Rust | mit | FreeFull/ircclient |
76d80d0014f5869b084b414b38f4567147ff14b3 | tests/common/mod.rs | tests/common/mod.rs | use std::io::{Write,Result};
use std::str;
pub struct FauxStdout {
buffer: String
}
impl Write for FauxStdout {
fn write(&mut self, buf: &[u8]) -> Result<usize> {
self.buffer += str::from_utf8(buf).expect("u8 slice provided to FauxStdout.write() was not valid UTF-8");
Ok(0)
}
fn flu... | use std::io::{Write,Result};
use std::str;
pub struct FauxStdout {
buffer: String
}
impl Write for FauxStdout {
fn write(&mut self, buf: &[u8]) -> Result<usize> {
match str::from_utf8(buf) {
Err(e) => panic!(e),
Ok(s) => {
self.buffer += s;
ret... | Create a more correct implementation of FauxStdout.write | Create a more correct implementation of FauxStdout.write
| Rust | mit | nafarlee/thoughtfuck |
c2a004469c319be6f71fac6b1ab2da2e41d2da2e | src/librlua/lib.rs | src/librlua/lib.rs | #[crate_id = "rlua#0.3.0"];
#[crate_type = "lib"];
#[license = "MIT"];
#[feature(globs)];
#[feature(macro_rules)];
pub use lua::Lua;
pub mod ffi;
pub mod lua;
pub mod state;
pub mod traits;
pub mod types;
pub mod status;
pub mod macros;
| #[crate_id = "rlua#0.3.0"];
#[crate_type = "lib"];
#[license = "MIT"];
#[feature(globs)];
#[feature(macro_rules)];
pub use lua::Lua;
#[allow(non_camel_case_types)]
pub mod ffi;
pub mod lua;
pub mod state;
pub mod traits;
pub mod types;
pub mod status;
pub mod macros;
| Allow non camel-case types for FFI | Allow non camel-case types for FFI
| Rust | mit | KokaKiwi/lua-rs,KokaKiwi/lua-rs,KokaKiwi/lua-rs |
bf15d040c0aa7c6b99221e1b13ae12b5b811a795 | src/test/compile-fail/gated-associated_consts.rs | src/test/compile-fail/gated-associated_consts.rs | // Copyright 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-MIT or ... | // Copyright 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-MIT or ... | Make a test compatible with the beta channel | Make a test compatible with the beta channel
| Rust | apache-2.0 | aidancully/rust,rohitjoshi/rust,pshc/rust,KokaKiwi/rust,pelmers/rust,andars/rust,nwin/rust,omasanori/rust,rohitjoshi/rust,krzysz00/rust,dwillmer/rust,reem/rust,dwillmer/rust,KokaKiwi/rust,vhbit/rust,l0kod/rust,gifnksm/rust,aneeshusa/rust,rohitjoshi/rust,jashank/rust,jashank/rust,cllns/rust,KokaKiwi/rust,cllns/rust,jash... |
01b26332ef434288c5eec694416f7fb93267e1f9 | src/lib.rs | src/lib.rs | #![crate_name = "irc"]
#![crate_type = "dylib"]
#![feature(convert, hasher_write, slice_patterns)]
#![allow(stable_features)]
// hasher_write was stabilised in rust 1.4
#![deny(unused_must_use, warnings, unused_variables, unused_mut)]
#[macro_use] extern crate log;
pub use self::event::IrcEvent;
pub use self::watc... | #![crate_name = "irc"]
#![crate_type = "dylib"]
#![feature(convert, hasher_write, slice_patterns)]
#![allow(stable_features)]
// hasher_write was stabilised in rust 1.4
#![deny(unused_must_use, unused_variables, unused_mut)]
#[macro_use] extern crate log;
pub use self::event::IrcEvent;
pub use self::watchers::{
... | Remove deny(warnings): seems harmful for forwards compat | Remove deny(warnings): seems harmful for forwards compat
| Rust | apache-2.0 | infinityb/rust-irc |
b1d05ae8e1261ee681439ca204366938e7dbcb37 | lib/rs/src/transport/server/mod.rs | lib/rs/src/transport/server/mod.rs | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ma... | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ma... | Implement TransportServer for closures of the correct signature. | Implement TransportServer for closures of the correct signature.
| Rust | apache-2.0 | terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift |
1e38c705b8e99fd920ea4de60cfa39b2a90cec12 | autobuilder/src/main.rs | autobuilder/src/main.rs | use std::env;
use std::path::PathBuf;
use std::process::Command;
fn main() -> std::io::Result<()> {
let dist = env::var("CODEQL_DIST").expect("CODEQL_DIST not set");
let db = env::var("CODEQL_EXTRACTOR_RUBY_WIP_DATABASE")
.expect("CODEQL_EXTRACTOR_RUBY_WIP_DATABASE not set");
let codeql = if env::c... | use std::env;
use std::path::PathBuf;
use std::process::Command;
fn main() -> std::io::Result<()> {
let dist = env::var("CODEQL_DIST").expect("CODEQL_DIST not set");
let db = env::var("CODEQL_EXTRACTOR_RUBY_WIP_DATABASE")
.expect("CODEQL_EXTRACTOR_RUBY_WIP_DATABASE not set");
let codeql = if env::c... | Fix clippy warnings in autobuilder | Fix clippy warnings in autobuilder
| Rust | mit | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql |
0ff7316096a397748fcea9e5536cb28232fd7f4a | src/main.rs | src/main.rs | extern crate txtpic;
use txtpic::calculate_string_brightness::calculate_string_brightness;
fn main() {
println!("{}", calculate_string_brightness("@"));
println!("{}", calculate_string_brightness("%"));
println!("{}", calculate_string_brightness("#"));
println!("{}", calculate_string_brightness("x"));
... | extern crate txtpic;
use txtpic::calculate_string_brightness::calculate_string_brightness;
fn main() {
println!("{}", calculate_string_brightness('M'));
println!("{}", calculate_string_brightness('@'));
println!("{}", calculate_string_brightness('%'));
println!("{}", calculate_string_brightness('#'));
... | Use new API in test code | Use new API in test code
| Rust | mit | jdormit/txtpic |
6efacc72a63af7c8dd35c7e5dd77fe1a823c075d | src/main.rs | src/main.rs |
fn main() {
println!("CRTP")
}
| // ================================================================================================
type SSRC = u32;
type RtpTimestamp = u32;
type NtpTimestamp = u64;
#[deriving(Clone)]
struct SenderInfo {
ntp_ts : NtpTimestamp,
rtp_ts : RtpTimestamp,
pckt_count : u32,
byte_count : u32
}
#[deriving(C... | Add structs to represent RTCP packets (SR, RR, SDES, BYE) | Add structs to represent RTCP packets (SR, RR, SDES, BYE)
| Rust | bsd-2-clause | csperkins/crtp |
2131647655d0a0726f49601c98903e4d151206f4 | build-common.rs | build-common.rs | // The target triplets have the form of 'arch-vendor-system'.
//
// When building for Linux (e.g. the 'system' part is
// 'linux-something'), replace the vendor with 'unknown'
// so that mapping to rust standard targets happens correctly.
fn convert_custom_linux_target(target: String) -> String {
let mut parts: Vec... | // The target triplets have the form of 'arch-vendor-system'.
//
// When building for Linux (e.g. the 'system' part is
// 'linux-something'), replace the vendor with 'unknown'
// so that mapping to rust standard targets happens correctly.
fn convert_custom_linux_target(target: String) -> String {
let mut parts: Vec... | Fix panicking when target triplets has less than three elements | Fix panicking when target triplets has less than three elements | Rust | apache-2.0 | crossbeam-rs/crossbeam,crossbeam-rs/crossbeam,crossbeam-rs/crossbeam,crossbeam-rs/crossbeam |
c85768ed71eb09689e2065b122310dad2e1c42f6 | src/librustc_target/spec/fuchsia_base.rs | src/librustc_target/spec/fuchsia_base.rs | use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions};
pub fn opts() -> TargetOptions {
let mut pre_link_args = LinkArgs::new();
pre_link_args.insert(
LinkerFlavor::Lld(LldFlavor::Ld),
vec![
"--build-id".to_string(),
"--eh-frame-hdr".to_string(),
... | use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions};
pub fn opts() -> TargetOptions {
let mut pre_link_args = LinkArgs::new();
pre_link_args.insert(
LinkerFlavor::Lld(LldFlavor::Ld),
vec![
"--build-id".to_string(),
"--eh-frame-hdr".to_string(),
... | Update the Fuchsia linker defaults | Update the Fuchsia linker defaults
This updates the linker defaults aligning them with Clang. Specifically,
we use 4K pages on all platforms, we always use BIND_NOW, we prefer all
loadable segments be separate and page aligned, and we support RELR
relocations.
| Rust | apache-2.0 | graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust |
1fc8172889e981d45e819c9f394fe4b6b41dbc38 | tests/expectations/tests/issue-511.rs | tests/expectations/tests/issue-511.rs | /* automatically generated by rust-bindgen */
extern "C" {
#[link_name = "\u{1}a"]
pub static mut a: *mut ::std::os::raw::c_char;
}
extern "C" {
#[link_name = "\u{1}b"]
pub static mut b: *const ::std::os::raw::c_char;
}
extern "C" {
#[link_name = "\u{1}c"]
pub static mut c: *mut ::std::os::raw:... | /* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
extern "C" {
#[link_name = "\u{1}a"]
pub static mut a: *mut ::std::os::raw::c_char;
}
extern "C" {
#[link_name = "\u{1}b"]
pub static mut b: *const ::std::os::raw::c_char;
}... | Add missing line in test expectation | Add missing line in test expectation
| Rust | bsd-3-clause | emilio/rust-bindgen,rust-lang/rust-bindgen,rust-lang/rust-bindgen,emilio/rust-bindgen,emilio/rust-bindgen,emilio/rust-bindgen,emilio/rust-bindgen,rust-lang/rust-bindgen,rust-lang/rust-bindgen |
76403e574231ae54dc7ccf227750af907ea13db3 | src/test/codegen/ffi-returns-twice.rs | src/test/codegen/ffi-returns-twice.rs | // compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(ffi_returns_twice)]
extern {
// CHECK-LABEL: @foo()
// CHECK: attributes #1 = { {{.*}}returns_twice{{.*}} }
#[no_mangle]
#[ffi_returns_twice]
pub fn foo();
}
pub fn bar() {
unsafe { foo() }
}
| // compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(ffi_returns_twice)]
pub fn bar() { unsafe { foo() } }
extern {
#[ffi_returns_twice] pub fn foo();
}
// CHECK: declare void @foo(){{.*}}#1{{.*}}
// CHECK: attributes #1 = { {{.*}}returns_twice{{.*}} }
| Use pattern to match attributes | Use pattern to match attributes
| Rust | apache-2.0 | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust |
d0fc5d9e6b932139755e2141bfdfa7a1380925ba | src/etc/test-float-parse/u64-pow2.rs | src/etc/test-float-parse/u64-pow2.rs | mod _common;
use _common::validate;
use std::u64;
fn main() {
for exp in 19..64 {
let power: u64 = 1 << exp;
validate(&power.to_string());
for offset in 1..123 {
validate(&(power + offset).to_string());
validate(&(power - offset).to_string());
}
}
fo... | mod _common;
use _common::validate;
fn main() {
for exp in 19..64 {
let power: u64 = 1 << exp;
validate(&power.to_string());
for offset in 1..123 {
validate(&(power + offset).to_string());
validate(&(power - offset).to_string());
}
}
for offset in 0.... | Stop importing int module in float parse test | Stop importing int module in float parse test
| Rust | apache-2.0 | aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust |
8aaecbd725d25c08111185c474539a2c656f8f09 | tests/test_macos.rs | tests/test_macos.rs | mod common;
#[cfg(target_os = "macos")]
mod tests {
const TEST_PLATFORM: &str = "macos";
use super::common::check_browser;
use webbrowser::Browser;
#[actix_rt::test]
async fn test_open_default() {
check_browser(Browser::Default, TEST_PLATFORM).await;
}
#[actix_rt::test]
async... | #[cfg(target_os = "macos")]
mod common;
#[cfg(target_os = "macos")]
mod tests {
const TEST_PLATFORM: &str = "macos";
use super::common::check_browser;
use webbrowser::Browser;
#[actix_rt::test]
async fn test_open_default() {
check_browser(Browser::Default, TEST_PLATFORM).await;
}
... | Fix macos test leakage into other platforms | Fix macos test leakage into other platforms
| Rust | apache-2.0 | amodm/webbrowser-rs,amodm/webbrowser-rs,amodm/webbrowser-rs,amodm/webbrowser-rs,amodm/webbrowser-rs |
2ec5f2b839c9012b15fd280ea0135d26a1af29db | tests/compiletest.rs | tests/compiletest.rs | #[rustversion::attr(not(nightly), ignore)]
#[cfg_attr(skip_ui_tests, ignore)]
#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/*.rs");
}
| #[rustversion::attr(not(nightly), ignore)]
#[cfg_attr(skip_ui_tests, 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/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx |
a49ccac879e884db8984233b9e56fd952783ca61 | examples/mtlinfo.rs | examples/mtlinfo.rs | //! A simple example which prints out information about available Metal devices
extern crate mtl;
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
fn main() {
println!("Metal is not supported on this platform");
}
#[cfg(any(target_os = "macos", target_os = "ios"))]
fn main() {
let device = match mtl:... | //! A simple example which prints out information about available Metal devices
extern crate mtl;
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
fn main() {
println!("Metal is not supported on this platform");
}
#[cfg(any(target_os = "macos", target_os = "ios"))]
fn main() {
let device = match mtl:... | Print out result of `Device::is_depth24_stencil8_pixel_format_supported` | Print out result of `Device::is_depth24_stencil8_pixel_format_supported`
| Rust | apache-2.0 | burtonageo/metl |
bdad94a00c6c3f99a43c5b7094906d52e18f418e | examples/reqwest.rs | examples/reqwest.rs | extern crate reqwest;
extern crate env_logger;
use std::env;
fn main() {
env_logger::init().unwrap();
let url = match env::args().nth(1) {
Some(url) => url,
None => {
println!("Usage: reqwest <url>");
return;
}
};
let res = reqwest::get(&url).unwrap();... | extern crate reqwest;
extern crate env_logger;
use std::env;
pub struct Opt {
url: Option<String>,
}
impl Opt {
pub fn new() -> Opt {
Opt {
url: None,
}
}
pub fn url(&mut self, url: String) {
self.url = Some(url);
}
pub fn is_valid(&self) -> bool {
... | Add --url option as command line argument | Add --url option as command line argument
| Rust | apache-2.0 | mysangle/reqwest,mysangle/reqwest |
2fd8e8870a10e31bbf71708c50a90ec19abd22bd | src/errors.rs | src/errors.rs | //! errors provides error generics for the gpx parser.
// This gives us our error boilerplate macros.
error_chain!{
errors {
/// InvalidChildElement signifies when an element has a child that isn't
/// valid per the GPX spec.
InvalidChildElement(child: String, parent: &'static str) {
... | //! errors provides error generics for the gpx parser.
// This gives us our error boilerplate macros.
error_chain!{
errors {
/// InvalidChildElement signifies when an element has a child that isn't
/// valid per the GPX spec.
InvalidChildElement(child: String, parent: &'static str) {
... | Remove unneeded String::from() in Errors | Remove unneeded String::from() in Errors
| Rust | mit | georust/rust-gpx |
f1a68c9432950243a5e7f94883181fa0d3841a5f | first/prime-sieve.rs | first/prime-sieve.rs | extern mod extra;
use std::task::spawn;
use std::comm::{stream,Chan,Port};
use std::cell::Cell;
fn generate(ch: &Chan<int>) {
let mut i = 2;
loop {
ch.send(i);
i = i + 1;
}
}
fn filter(in_ch: &Port<int>, out_ch: &Chan<int>, prime: int) {
loop {
let i = in_ch.recv();
if ... | extern mod extra;
use std::task::spawn_with;
use extra::comm::{SyncPort, SyncChan, rendezvous};
use std::iter::count;
fn generate(ch: SyncChan<int>) {
for i in count(2, 1) {
if !ch.try_send(i) {
break;
}
}
}
fn filter(in_ch: SyncPort<int>, out_ch: SyncChan<int>, prime: int) {
l... | Implement most of the fixes from @tikue | Implement most of the fixes from @tikue
| Rust | mit | am0d/rust-projects,am0d/rust-projects |
a0b048a0d8df16b657f0195b2096fac5d7a13540 | image/src/main.rs | image/src/main.rs | #![feature(old_path)]
extern crate piston;
extern crate graphics;
extern crate sdl2_window;
extern crate opengl_graphics;
use std::cell::RefCell;
use opengl_graphics::{
GlGraphics,
OpenGL,
Texture,
};
use sdl2_window::Sdl2Window;
fn main() {
let opengl = OpenGL::_3_2;
let window = Sdl2Window::new... | #![feature(old_path)]
extern crate piston;
extern crate graphics;
extern crate sdl2_window;
extern crate opengl_graphics;
use std::old_path::*;
use std::cell::RefCell;
use opengl_graphics::{
GlGraphics,
OpenGL,
Texture,
};
use sdl2_window::Sdl2Window;
fn main() {
let opengl = OpenGL::_3_2;
let w... | Fix old_path import in image example | Fix old_path import in image example
| Rust | mit | Abica/piston-examples,carols10cents/piston-examples,Potpourri/piston-examples,sinistersnare/piston-examples,placrosse/piston-examples,dannyflax/piston-examples |
5ecacf200f4eaaad68e5fddd497596049c978f53 | src/point.rs | src/point.rs | use rect::Rect;
use std::ops::{Add, Sub};
pub const ZERO: Point = Point { x: 0, y: 0 };
pub const UP: Point = Point { x: 0, y: -1 };
pub const DOWN: Point = Point { x: 0, y: 1 };
pub const LEFT: Point = Point { x: -1, y: 0 };
pub const RIGHT: Point = Point { x: 1, y: 0 };
/// A simple two-dimensional Point... | use rect::Rect;
use std::ops::{Add, Sub};
trait Point<T> {
fn new(x: T, y: T) -> Point<T>;
fn x() -> T;
fn y() -> T;
}
| Remove Point struct; Add Point trait | Remove Point struct; Add Point trait
| Rust | mit | Vectorious/geom-rs,Vectorious/geom-rs |
7efe276fcff4000b2554f837e96af3280d1bf987 | fuzz/fuzz_targets/fuzz_asn1_parse.rs | fuzz/fuzz_targets/fuzz_asn1_parse.rs | #![no_main]
#[macro_use]
extern crate libfuzzer_sys;
libfuzzer_sys::fuzz_target!(|data: &[u8]| {
let _ = asn1::parse(data, |d| {
d.read_element::<()>()?;
d.read_element::<bool>()?;
d.read_element::<i8>()?;
d.read_element::<u8>()?;
d.read_element::<i64>()?;
d.read_el... | #![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
let _ = asn1::parse(data, |d| {
d.read_element::<()>()?;
d.read_element::<bool>()?;
d.read_element::<i8>()?;
d.read_element::<u8>()?;
d.read_element::<i64>()?;
d.read_element::<u64>()?;
... | Update invocation to be 2018 edition | Update invocation to be 2018 edition
| Rust | bsd-3-clause | alex/rust-asn1,alex/rust-asn1 |
43e68c7e409778c4a01539734938e6a9e13e90b7 | rust/test/derive/inc.rs | rust/test/derive/inc.rs | use super::*;
mod basic_test;
#[ cfg( any( feature = "derive_clone_dyn" ) ) ]
mod clone_dyn_test;
| use super::*;
mod basic_test;
#[ cfg( any( feature = "derive_clone_dyn_use_std", feature = "derive_clone_dyn_use_alloc" ) ) ]
mod clone_dyn_test;
| Fix tests of module `derive_tools`, test with valid features | Fix tests of module `derive_tools`, test with valid features
| Rust | mit | Wandalen/wTools,Wandalen/wTools |
42eeb54af3652867e6c0d584a3fa16b0e459ce75 | proto/src/convert.rs | proto/src/convert.rs | // Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
pub trait FromLossy<T>: Sized {
fn from_lossy(_: T) -> Self;
}
pub trait IntoLossy<T>: Sized {
fn into_lossy(self) -> T;
}
impl<T,... | // Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
//! Traits for conversions between types.
//!
//! This module provides utility traits similar to what `std::convert` does and
//! can be tho... | Add documentation for the conversion module. | Add documentation for the conversion module.
| Rust | mit | google/rrg |
e8137d7ceadfa25b06e35e358870bb2687b0443d | src/test/compile-fail/issue-22560.rs | src/test/compile-fail/issue-22560.rs | // Copyright 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-MIT or ... | // Copyright 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-MIT or ... | Fix a test to recognize newly introduced errors. | Fix a test to recognize newly introduced errors.
| Rust | apache-2.0 | graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust |
d039e2645203fcb0a0fa4e2a4d8da15374e70f30 | diesel/src/pg/mod.rs | diesel/src/pg/mod.rs | //! Provides types and functions related to working with PostgreSQL
//!
//! Much of this module is re-exported from database agnostic locations.
//! However, if you are writing code specifically to extend Diesel on
//! PostgreSQL, you may need to work with this module directly.
pub mod expression;
pub mod types;
mod ... | //! Provides types and functions related to working with PostgreSQL
//!
//! Much of this module is re-exported from database agnostic locations.
//! However, if you are writing code specifically to extend Diesel on
//! PostgreSQL, you may need to work with this module directly.
pub mod expression;
pub mod types;
#[dep... | Add deprecated attribute to pg::upsert | Add deprecated attribute to pg::upsert
| Rust | apache-2.0 | sgrif/diesel,sgrif/diesel,diesel-rs/diesel,diesel-rs/diesel |
dc78224ec7f05b00781595a4177aa55fb54b8270 | src/grid_displayers/simple_terminal.rs | src/grid_displayers/simple_terminal.rs | use std::sync::{ RwLock, RwLockReadGuard, Arc };
use std::sync::mpsc::{ Receiver };
use models::Grid;
use grid_displayers::GridDisplayer;
pub struct SimpleTerminal;
impl SimpleTerminal {
pub fn new() -> SimpleTerminal {
SimpleTerminal
}
}
impl GridDisplayer for SimpleTerminal {
fn draw(&self, re... | use std::sync::{ RwLock, RwLockReadGuard, Arc };
use std::sync::mpsc::{ Receiver };
use models::Grid;
use grid_displayers::GridDisplayer;
#[allow(dead_code)]
pub struct SimpleTerminal;
impl SimpleTerminal {
#[allow(dead_code)]
pub fn new() -> SimpleTerminal {
SimpleTerminal
}
}
impl GridDisplaye... | Add allow(dead_code) on the SimpleTerminal GridDisplayer | Add allow(dead_code) on the SimpleTerminal GridDisplayer
| Rust | mit | mateusmedeiros/rust_of_life |
464d9ec401322972004e95dc6d90c4c504bbcd3b | build.rs | build.rs | use std::io::Command;
use std::os;
#[allow(unused_must_use)]
fn main() {
let mut build = os::getcwd().unwrap();
build.push_many(&["ext", "libqmlrswrapper", "build"]);
/* Ignore error, the return value is not reliable and we'll catch it when chdir'ing anyway. */
std::io::fs::mkdir(&build, std::io::USER... | use std::io::Command;
use std::os;
#[allow(unused_must_use)]
fn main() {
let mut build = os::getcwd().unwrap();
build.push_many(&["ext", "libqmlrswrapper", "build"]);
/* Ignore error, the return value is not reliable and we'll catch it when chdir'ing anyway. */
std::io::fs::mkdir(&build, std::io::USER... | Fix -L switch to rustc | Fix -L switch to rustc
| Rust | apache-2.0 | Jxspy/qmlrs,flanfly/qmlrs,Jxspy/qmlrs,cyndis/qmlrs,florianjacob/qmlrs,flanfly/qmlrs,cyndis/qmlrs,florianjacob/qmlrs |
bc91d32cb2a1456e70feee4e8f371fa0b08e8090 | src/main.rs | src/main.rs | use std::io;
fn main() {
println!("Guess the number!");
println!("Please input your guess.");
let mut guess = String::new();
io::stdin().read_line(&mut guess)
.ok()
.expect("Failed to read line");
println!("You guessed: {}", guess);
}
| 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();
... | Create secret number randomly and output it | Create secret number randomly and output it
| Rust | mit | juliangrosshauser/guessing_game |
e74e5b323fda25764f3d2ab56efd17e293ed4b9a | src/main.rs | src/main.rs | // Copyright 2016 Francis Gagné
//
// 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 your
// option. This file may not be copied, modified, or distributed
// except according t... | // Copyright 2016 Francis Gagné
//
// 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 your
// option. This file may not be copied, modified, or distributed
// except according t... | Fix building with feature 'unstable' | Fix building with feature 'unstable'
| Rust | apache-2.0 | FraGag/feeds-to-pocket |
e328227aecb7a2105a8a0d78706349126849ad64 | src/main.rs | src/main.rs | extern crate cairo_sys;
extern crate cairo;
extern crate chrono;
extern crate futures;
extern crate mio;
extern crate pango;
extern crate pangocairo;
extern crate tokio_core;
extern crate tokio_timer;
extern crate xcb_util;
extern crate xcb;
use tokio_core::reactor::Core;
mod text;
use text::*;
mod widgets;
use widge... | extern crate cairo_sys;
extern crate cairo;
extern crate chrono;
extern crate futures;
extern crate mio;
extern crate pango;
extern crate pangocairo;
extern crate tokio_core;
extern crate tokio_timer;
extern crate xcb_util;
extern crate xcb;
use tokio_core::reactor::Core;
mod text;
use text::*;
mod widgets;
use widge... | Change default widgets to more closely match my QTile layout. | Change default widgets to more closely match my QTile layout.
... it'll make debugging easier. :)
| Rust | mit | mjkillough/hue |
13fd89bb1936af38504e374a63f3a5e16bd59944 | src/main.rs | src/main.rs | use std::thread;
use std::sync::Mutex;
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,
}... | 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,
... | Create a table with five forks | Create a table with five forks
| Rust | mit | juliangrosshauser/dining_philosophers |
d203ab06a5b036cc518d24080d56aaf6d592aad5 | src/modbus_server.rs | src/modbus_server.rs |
use errors::*;
use libc::{c_char, c_int};
use libmodbus_sys;
use modbus::Modbus;
/// The server is waiting for request from clients and must answer when it is concerned by the request.
/// The libmodbus offers the following functions to handle requests:
pub trait ModbusServer {
}
impl ModbusServer for Modbus {
}
|
use errors::*;
use libc::{c_char, c_int};
use libmodbus_sys;
use modbus::Modbus;
/// The server is waiting for request from clients and must answer when it is concerned by the request. The libmodbus offers the following functions to handle requests:
///
/// * Receive
/// - [`receive()`](struct.Modbus.html#method... | Add Modbus::receive(), but this function segfaults | Add Modbus::receive(), but this function segfaults
| Rust | lgpl-2.1 | zzeroo/libmodbus-rs,zzeroo/libmodbus-rs,zzeroo/libmodbus-rs |
5987bb70fdc9721f5532d426930ace8ae716acff | examples/descriptor.rs | examples/descriptor.rs | #[macro_use]
extern crate descriptor;
extern crate expector;
use std::time::Duration;
use std::thread::sleep;
use descriptor::*;
use expector::*;
fn main() {
describe("example group 1", source_location!(), |eg| {
eg.it("1", source_location!(), || {
expect(1).to(eq(2));
});
eg.... | #[macro_use]
extern crate descriptor;
extern crate expector;
use std::time::Duration;
use std::thread::sleep;
use descriptor::*;
use expector::*;
fn main() {
describe("example group 1", source_location!(), |eg| {
it!(eg, "1", || {
expect(1).to(eq(2));
});
it!(eg, "2", || {
... | Update primary example to use the it! macro | Update primary example to use the it! macro
| Rust | mit | samphippen/descriptor |
86f2185ed9116cfe08e08c2930bf035483e69f5c | tests/wasm_bindgen/src/lib.rs | tests/wasm_bindgen/src/lib.rs | extern crate rand;
extern crate wasm_bindgen;
extern crate wasm_bindgen_test;
use rand::rngs::StdRng;
use rand::Rng;
use rand::SeedableRng;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen]
pub fn generate_from_seed(seed: u64) -> u64 {
StdRng::seed_from_u64(seed).gen()
}
pub mod tests {
... | extern crate rand;
extern crate wasm_bindgen;
extern crate wasm_bindgen_test;
use rand::rngs::StdRng;
use rand::Rng;
use rand::SeedableRng;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen]
pub fn generate_from_seed(seed: u32) -> u32 {
StdRng::seed_from_u64(seed as u64).gen()
}
pub mod test... | Use u32 instead of u64 in wasm_bindgen test interface | Use u32 instead of u64 in wasm_bindgen test interface
| Rust | apache-2.0 | rust-lang/rand |
e2abe9f5b06771bc3fe80112084eb1c3d1c70a32 | liblmdb-sys/build.rs | liblmdb-sys/build.rs | extern crate pkg_config;
extern crate gcc;
fn main() {
if !pkg_config::find_library("liblmdb").is_ok() {
gcc::compile_library("liblmdb.a",
&["mdb/libraries/liblmdb/mdb.c",
"mdb/libraries/liblmdb/midl.c"]);
}
}
| extern crate pkg_config;
extern crate gcc;
fn main() {
let target = std::env::var("TARGET").unwrap();
if !pkg_config::find_library("liblmdb").is_ok() {
let mut config = gcc::Config::new();
config.file("mdb/libraries/liblmdb/mdb.c")
.file("mdb/libraries/liblmdb/midl.c");
... | Set MDB_DSYNC and MDB_FDATASYNC on dragonflybsd. | Set MDB_DSYNC and MDB_FDATASYNC on dragonflybsd. | Rust | mit | vhbit/lmdb-rs,vhbit/lmdb-rs |
d0c8b1ef6ba86df2eb54b483128b8e66deb91c34 | src/plugins/control.rs | src/plugins/control.rs | /// This file contains commands to generally control and administer the bot.
extern crate irc;
use irc::Client;
use irc::interface::CommandEvent;
fn say(event: &mut CommandEvent) {
if event.args[0].starts_with("#") {
if !event.client.is_admin(event) {
return;
}
event.client.sen... | /// This file contains commands to generally control and administer the bot.
use irc::Client;
use irc::interface::CommandEvent;
fn say(event: &mut CommandEvent) {
if event.args[0].starts_with("#") {
if !event.client.is_admin(event) {
return;
}
event.client.send_message(event.arg... | Remove unrequired extern crate irc in plugin | Remove unrequired extern crate irc in plugin
| Rust | mit | daboross/zaldinar,daboross/zaldinar |
5542ac07d8f08934a7cb06e586f9a20514d91751 | tests/lib.rs | tests/lib.rs | #[macro_use(owned_tree, shared_tree)]
extern crate entmut;
// This will define macros for generalized tests of Nav and Editor impls.
#[cfg(test)]
#[macro_use]
mod view_tests;
#[cfg(test)]
#[macro_use]
mod owned {
view_tests!(owned_tree);
}
#[cfg(test)]
#[macro_use]
mod shared {
view_tests!(shared_tree);
}
| #[macro_use(owned_tree, shared_tree)]
extern crate entmut;
/// Defines macros for generalized tests of Nav impls.
#[macro_use]
mod view_tests;
#[macro_use]
mod owned {
view_tests!(owned_tree);
}
#[macro_use]
mod shared {
view_tests!(shared_tree);
}
| Tweak test definitions to clarify what's going on. | Tweak test definitions to clarify what's going on.
| Rust | apache-2.0 | dstu/entmut |
c034708e061101f6f53941466320d18d001becf2 | benches/construction.rs | benches/construction.rs | extern crate test;
extern crate rand;
extern crate "nalgebra" as na;
use rand::{IsaacRng, Rng};
use test::Bencher;
use na::{UnitQuat, Rot2, Rot3, Vec1, Vec3};
#[path="common/macros.rs"]
mod macros;
bench_construction!(_bench_quat_from_axisangle, UnitQuat::new, axisangle: Vec3<f32>);
bench_construction!(_bench_rot2_f... | #![feature(test)]
extern crate test;
extern crate rand;
extern crate nalgebra as na;
use rand::{IsaacRng, Rng};
use test::Bencher;
use na::{UnitQuat, Rot2, Rot3, Vec1, Vec3};
#[path="common/macros.rs"]
mod macros;
bench_construction!(_bench_quat_from_axisangle, UnitQuat::new, axisangle: Vec3<f32>);
bench_constructi... | Make the benchmarks compile again | Make the benchmarks compile again
| Rust | bsd-3-clause | mbStavola/nalgebra,tempbottle/nalgebra,tomaka/nalgebra,jaredly/nalgebra,sebcrozet/nalgebra,tikue/nalgebra,sebcrozet/nalgebra,ProtectedMode/nalgebra |
237483267fce790df1deb2b4e368edc1fc65321e | benches/benchmarks.rs | benches/benchmarks.rs | #![feature(test)]
extern crate test;
use test::Bencher;
extern crate lonlat_bng;
use lonlat_bng::convert_to_bng_threaded_vec;
extern crate rand;
use rand::distributions::{IndependentSample, Range};
#[bench]
fn bench_threads(b: &mut Bencher) {
let num_coords = 10000;
let between_lon = Range::new(-6.379880, 1.... | #![feature(test)]
extern crate test;
use test::Bencher;
extern crate lonlat_bng;
use lonlat_bng::convert_to_bng_threaded_vec;
extern crate rand;
use rand::distributions::{IndependentSample, Range};
#[bench]
fn bench_threads(b: &mut Bencher) {
let num_coords = 100000;
let between_lon = Range::new(-6.379880, 1... | Move point generation out of benchmark generation | Move point generation out of benchmark generation
| Rust | mit | urschrei/rust_bng,urschrei/lonlat_bng,urschrei/lonlat_bng,urschrei/rust_bng,urschrei/lonlat_bng |
83d4eb17571690dddfbfb79924179ab313add306 | src/lib.rs | src/lib.rs | // Copyright 2014 Jonathan Eyolfson
#![feature(globs)]
extern crate libc;
pub use buffer::Buffer;
pub use compositor::Compositor;
pub use display::Display;
pub use list::List;
pub use region::Region;
pub use registry::Registry;
pub use seat::Seat;
pub use shell::Shell;
pub use shell_surface::ShellSurface;
pub use sh... | // Copyright 2014 Jonathan Eyolfson
#![allow(missing_copy_implementations)]
#![allow(unstable)]
extern crate libc;
pub use buffer::Buffer;
pub use compositor::Compositor;
pub use display::Display;
pub use list::List;
pub use region::Region;
pub use registry::Registry;
pub use seat::Seat;
pub use shell::Shell;
pub us... | Allow some warnings to silence current nightly compiler messages | Allow some warnings to silence current nightly compiler messages
| Rust | mit | eyolfson/rust-wayland |
dbf2292fee15aa5ff7268a56eb450d3c9cec8396 | src/lib.rs | src/lib.rs | #![deny(missing_docs)]
//! An encoder and decoder for FITS images.
//!
//! The *Flexible Image Transport System* ([FITS][fits]) is
//! > an open standard defining a digital file format useful for storage,
//! > transmission and processing of scientific and other images.
#[cfg(test)]
mod tests {
#[test]
fn it_w... | #![deny(missing_docs)]
//! An encoder and decoder for FITS images.
//!
//! The *Flexible Image Transport System* ([FITS](https://en.wikipedia.org/wiki/FITS)) is
//! > an open standard defining a digital file format useful for storage,
//! > transmission and processing of scientific and other images.
#[cfg(test)]
mod t... | Correct link to FITS wikipedia page | Correct link to FITS wikipedia page
| Rust | mit | fifth-postulate/fits-rs |
f201fac99b4ae0e6485121e166c926988c8328b9 | src/lib.rs | src/lib.rs | use std::ascii::AsciiExt;
struct Rotor<'a> {
rotor: &'a [u8]
}
impl<'a> Rotor<'a> {
pub fn new(rotor: &'a str) -> Rotor<'a> {
Rotor {
rotor: rotor.as_bytes(),
}
}
fn substitute(&self, c: char) -> char {
if !c.is_ascii() || !c.is_alphabetic() {
return c;... | use std::ascii::AsciiExt;
struct Rotor<'a> {
rotor: &'a [u8],
length: usize,
}
impl<'a> Rotor<'a> {
pub fn new(rotor: &'a str) -> Rotor<'a> {
Rotor {
rotor: rotor.as_bytes(),
length: rotor.len(),
}
}
fn substitute(&self, c: char) -> char {
if !c.is_... | Add length field to Rotor struct | Add length field to Rotor struct
| Rust | mit | iKevinY/ultra |
070137ce905d0177e8d112385f1d8dc7b2407006 | src/test/run-pass/vec-matching.rs | src/test/run-pass/vec-matching.rs | pub fn main() {
let x = [1];
match x {
[_, _, _, _, _, .._] => ::core::util::unreachable(),
[.._, _, _, _, _] => ::core::util::unreachable(),
[_, .._, _, _] => ::core::util::unreachable(),
[_, _] => ::core::util::unreachable(),
[a] => {
fail_unless!(a == 1);
... | fn a() {
let x = [1];
match x {
[_, _, _, _, _, .._] => ::core::util::unreachable(),
[.._, _, _, _, _] => ::core::util::unreachable(),
[_, .._, _, _] => ::core::util::unreachable(),
[_, _] => ::core::util::unreachable(),
[a] => {
fail_unless!(a == 1);
... | Add one more test for vector destructuring | Add one more test for vector destructuring
| Rust | apache-2.0 | j16r/rust,zaeleus/rust,reem/rust,miniupnp/rust,rprichard/rust,mihneadb/rust,quornian/rust,hauleth/rust,AerialX/rust,ejjeong/rust,pczarn/rust,vhbit/rust,jbclements/rust,pelmers/rust,0x73/rust,Ryman/rust,pshc/rust,jashank/rust,erickt/rust,rohitjoshi/rust,sarojaba/rust-doc-korean,XMPPwocky/rust,pelmers/rust,jbclements/rus... |
4f4b5a3a65eed09fbb9578ce9df72076e0b05f66 | testing/tests/vars.rs | testing/tests/vars.rs | #[macro_use]
extern crate askama;
use askama::Template;
#[derive(Template)]
#[template(path = "let.html")]
struct LetTemplate<'a> {
s: &'a str,
}
#[test]
fn test_let() {
let t = LetTemplate { s: "foo" };
assert_eq!(t.render().unwrap(), "foo");
}
#[derive(Template)]
#[template(path = "let-decl.html")]
s... | #[macro_use]
extern crate askama;
use askama::Template;
#[derive(Template)]
#[template(source = "{% let v = s %}{{ v }}")]
struct LetTemplate<'a> {
s: &'a str,
}
#[test]
fn test_let() {
let t = LetTemplate { s: "foo" };
assert_eq!(t.render().unwrap(), "foo");
}
#[derive(Template)]
#[template(path = "le... | Change one test case to use source attribute | Change one test case to use source attribute
| Rust | apache-2.0 | djc/askama,djc/askama,djc/askama |
a5cdb46a511bda985f6121c36a7b17393b5edc8a | seax-svm/src/lib.rs | seax-svm/src/lib.rs | #[test]
fn it_works() {
}
mod SVM {
/// Singly-linked cons list.
///
/// This is used internally to represent list primitives in the machine.
pub enum List<T> {
Cons(T ~List<T>),
Nil
}
/// Public implementation for List.
pub impl List<T> {
pub fn new() -> List<T> ... | #[test]
fn it_works() {
}
mod SVM {
/// Singly-linked cons list.
///
/// This is used internally to represent list primitives in the machine.
pub enum List<T> {
Nil,
Cons(T, List<T>)
}
/// Public implementation for List.
impl<T> List<T> {
fn new() -> List<T> {
... | Use strict size for num expression | Use strict size for num expression
| Rust | mit | hawkw/seax,hawkw/seax |
eb7b0c6ddf644e2212e86872ad6d19de9d802b6a | src/selectable/mod.rs | src/selectable/mod.rs | //! Provides drilldown related procedures.
//! This module will be used with `SelectCommand` type by `+` operation
//! to concatinate `select` and `drilldown` queries.
//!
//! Also this module support `pseudo_table` and `staged_columns` manupilation.
pub mod drilldown;
pub mod labeled_drilldown;
pub mod drilldownable;
... | //! Provides drilldown related procedures.
//! This module will be used with `SelectCommand` type by `+` operation
//! to concatinate `select` and `drilldown` queries.
//!
//! Also this module support `pseudo_table` and `staged_columns` manupilation.
pub mod drilldown;
pub mod labeled_drilldown;
pub mod drilldownable;
... | Use `trait` to make more clarify | rustdoc: Use `trait` to make more clarify
| Rust | mit | cosmo0920/ruroonga_command |
362b291574e42e6698b0a354736fda29e50cf4eb | src/wrapper/term.rs | src/wrapper/term.rs | use std::fmt;
use std::os::raw::c_char;
use super::nif_interface::{ NIF_TERM };
pub fn fmt<'a>(term: NIF_TERM, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
const SIZE: usize = 1024;
let mut bytes: Vec<u8> = Vec::with_capacity(SIZE);
let mut n = 0;
for _ in 0 .. 10 {
let i = unsafe {
... | use std::fmt;
use std::os::raw::c_char;
use super::nif_interface::{ NIF_TERM };
pub fn fmt<'a>(term: NIF_TERM, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
const SIZE: usize = 1024;
let mut bytes: Vec<u8> = Vec::with_capacity(SIZE);
let mut n = 0;
for _ in 0 .. 10 {
let i = unsafe {
... | Fix unlikely-to-hit logic bug in Debug support. | Fix unlikely-to-hit logic bug in Debug support.
| Rust | apache-2.0 | hansihe/Rustler |
6dd04dadec68eb35f908d8dfa57e1a75a2644a9b | tests/compiletest.rs | tests/compiletest.rs | #[rustversion::attr(not(nightly), ignore)]
#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/*.rs");
}
| #[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/quote |
df803f1c85bfe832438edd2e6fd4623ae18f1ce2 | src/bits64/mod.rs | src/bits64/mod.rs | //! Data structures and functions used by IA-32e but not Protected Mode.
macro_rules! bit {
( $x:expr ) => {
1 << $x
};
}
macro_rules! check_flag {
($doc:meta, $fun:ident, $flag:ident) => (
#[$doc]
pub fn $fun(&self) -> bool {
self.contains($flag)
}
)
}
mac... | //! Data structures and functions used by IA-32e but not Protected Mode.
macro_rules! bit {
( $x:expr ) => {
1 << $x
};
}
macro_rules! check_flag {
($doc:meta, $fun:ident, $flag:ident) => (
#[$doc]
pub fn $fun(&self) -> bool {
self.contains($flag)
}
)
}
pub... | Remove unused macros causing compiler warnings. | Remove unused macros causing compiler warnings.
I also don't see how these are x86-64-specific, so they should be removed either way.
| Rust | mit | gz/rust-x86,gz/rust-x86 |
44db4d8ea4d28b68b6bbdf1e8edaaf40fad3cc9c | portaudio_sys/build.rs | portaudio_sys/build.rs | extern crate pkg_config;
fn main() {
match pkg_config::find_library("portaudio-2.0")
{
Ok(..) => {},
Err(e) => println!("Cloud not find pkg-config ({})", e),
}
}
| extern crate pkg_config;
fn main() {
match pkg_config::find_library("portaudio-2.0")
{
Ok(..) => {},
Err(e) => panic!("{}", e),
}
}
| Revert "Do not require pkgconfig to succeed" | Revert "Do not require pkgconfig to succeed"
This reverts commit 221e7419ea09f8bbf7922e1860dcff625f899f44.
| Rust | mit | mvdnes/portaudio-rs |
01d20f759b086009ed7ef4a9a7a2f2126476241a | src/lib.rs | src/lib.rs | extern crate rayon;
use rayon::prelude::*;
use rayon::par_iter::collect;
mod types;
pub use types::TestResult;
pub trait Runnable {
fn run(&self) -> TestResult;
}
mod reporters;
use reporters::{Reporter, CompositeReporter, ProgressReporter, StatisticsReporter};
pub struct TestRunner {
parallelism: bool,
}
... | extern crate rayon;
use rayon::prelude::*;
use rayon::par_iter::collect;
mod types;
pub use types::TestResult;
pub trait Runnable {
fn run(&self) -> TestResult;
}
mod reporters;
use reporters::{Reporter, CompositeReporter, ProgressReporter, StatisticsReporter};
pub struct TestRunner {
parallelism: bool,
}
... | Add a missing lifetime to the run function. | Add a missing lifetime to the run function.
| Rust | mit | justinlatimer/littletest |
b83593e75846b1305752b5d7bacaa39154875951 | src/lib.rs | src/lib.rs | //! Provides token definitions for HTML stream processing. The goal of this
//! library is to provide a simple API over which higher abstraction can be
//! built on.
//!
//! ## Example
//!
//! ```rust
//! #[macro_use]
//! extern crate hamlet;
//!
//! use std::fmt::Write;
//!
//! fn main() {
//! use hamlet::Token;
/... | //! Provides token definitions for HTML stream processing. The goal of this
//! library is to provide a simple API over which higher abstraction can be
//! built on.
//!
//! ## Example
//!
//! ```rust
//! #[macro_use]
//! extern crate hamlet;
//!
//! use std::fmt::Write;
//!
//! fn main() {
//! use hamlet::Token;
/... | Add docs on public modules | Add docs on public modules
| Rust | apache-2.0 | Nemo157/hamlet,Nemo157/hamlet |
d26c839719bb9ecdf63e927e453149c70db37752 | src/lib.rs | src/lib.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... | Allow this crate to build on non-Windows platforms. | [win-users] Allow this crate to build on non-Windows platforms.
This change allows a developer to run `cargo build`/`cargo test`/etc.
from the root of this project, regardless of which platform they are
currently running.
Signed-off-by: Fletcher Nichol <77a0fd9e8048bbacd11af4e957bc6ff03b549f49@nichol.ca>
| Rust | apache-2.0 | rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat |
ff9539503615362d6cddf0b13cafc1672adfb6a1 | day2/solution/src/main.rs | day2/solution/src/main.rs | use std::io;
use std::io::prelude::*;
fn main() {
let stdin = io::stdin();
for line in stdin.lock().lines() {
println!("{}", line.unwrap());
}
}
| use std::io;
use std::io::prelude::*;
fn main() {
let stdin = io::stdin();
let mut total = 0;
for line in stdin.lock().lines() {
let l = line.unwrap();
let split: Vec<i32> = l.split('x').map(|s| s.parse::<i32>().unwrap()).collect();
total += sqfootage(split[0], split[1], split[2]);
... | Implement naïve solution (TODO: replace with better use of iterators) | Implement naïve solution (TODO: replace with better use of iterators)
| Rust | mit | jmtuley/adventofcode2015 |
a3ec167561efbca2648767a6f60666c72e5afd56 | b002_fib_para.rs | b002_fib_para.rs | // Copyright (c) 2014 liquid_amber
// This file is distributed under MIT license.
// See LICENSE file.
extern crate green;
#[start]
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, green::basic::event_loop, main)
}
fn fibonacci(n: int) -> int {
if n < 2 {
return n;
}
... | // Copyright (c) 2014 liquid_amber
// This file is distributed under MIT license.
// See LICENSE file.
extern crate green;
extern crate rustuv;
fn fibonacci(n: int) -> int {
if n < 2 {
n
} else {
let mut n1 = std::sync::Future::spawn(
proc () fibonacci(n - 1));
let mut n2 =... | Use rustuv::event_loop instead of green::basic::event_loop | Use rustuv::event_loop instead of green::basic::event_loop
| Rust | mit | liquidamber/rust-examples,liquidamber/rust-examples,liquidamber/rust-examples,liquidamber/rust-examples,liquidamber/rust-examples |
87925bf4cb3fa6b4e01940938ce29d984eaa12a4 | sol_0052/main.rs | sol_0052/main.rs | #[macro_use] extern crate libeuler;
use libeuler::traits::DigitsHelper;
/// It can be seen that the number, 125874, and its double, 251748, contain exactly the same
/// digits, but in a different order.
///
/// Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same
/// digits.
fn ma... | #![feature(core)]
#[macro_use] extern crate libeuler;
use libeuler::traits::DigitsHelper;
use std::iter::range_inclusive;
/// It can be seen that the number, 125874, and its double, 251748, contain exactly the same
/// digits, but in a different order.
///
/// Find the smallest positive integer, x, such that 2x, 3x, ... | Use range_inclusive in problem 52 | Use range_inclusive in problem 52
| Rust | mit | zmbush/euler,zmbush/euler |
605c324df257b7b79e43027fe457885355a101d5 | saddle-points/src/lib.rs | saddle-points/src/lib.rs | fn is_saddle_point(input: &[Vec<u64>], px: usize, py: usize) -> bool {
let value = input[py][px];
for y in 0..input.len() {
if input[y][px] < value {
return false;
}
}
for x in 0..input[0].len() {
if input[py][x] > value {
return false;
}
}
... | pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
let mut row_max = vec![Vec::new(); input.len()];
let mut col_min: Vec<Vec<(usize, u64)>> = vec![Vec::new(); input[0].len()];
for (row, values) in input.iter().enumerate() {
for (col, &value) in values.iter().enumerate() {
... | Improve solution for Saddle Points | Improve solution for Saddle Points
| Rust | mit | attilahorvath/exercism-rust |
f4b786a67aaae324f6e7e1fbc90807d8e37e2a10 | src/bin/open.rs | src/bin/open.rs | extern crate document;
use std::cmp::min;
use std::io::File;
use document::parser::Parser;
fn pretty_error(xml: &str, position: uint) -> &str {
let s = xml.slice_from(position);
let l = s.char_len();
s.slice_chars(0, min(l, 15))
}
fn main() {
let mut args = std::os::args();
let filename = args.... | extern crate document;
use std::cmp::min;
use std::io::File;
use std::io::BufferedWriter;
use std::io::stdio::stdout_raw;
use document::parser::Parser;
fn pretty_error(xml: &str, position: uint) -> &str {
let s = xml.slice_from(position);
let l = s.char_len();
s.slice_chars(0, min(l, 15))
}
fn main() {
... | Use a byte-oriented buffer instead of line-oriented | Use a byte-oriented buffer instead of line-oriented
We don't care about interacting with the user here, so lines are an
artifical construct. Instead, just buffer it like anything else.
On a 100MB XML file, this reduced time to open, parse, and output it
to /dev/null by 1.4 seconds (taking 82% of the previous time).
| Rust | mit | shepmaster/sxd-document,shepmaster/sxd-document |
2e16bc5bbcbc6b921807e06fc38951b33bfb7093 | src/test_path.rs | src/test_path.rs | use std::path::PathBuf;
use parser::ArgumentParser;
use super::Parse;
use test_parser::{check_ok};
fn parse_str(args: &[&str]) -> PathBuf {
let mut val: PathBuf = From::from("");
{
let mut ap = ArgumentParser::new();
ap.refer(&mut val)
.add_option(&["-s", "--set"], Parse,
... | use std::path::PathBuf;
use parser::ArgumentParser;
use super::Parse;
use test_parser::{check_ok};
fn parse_str(args: &[&str]) -> PathBuf {
let mut val: PathBuf = From::from("");
{
let mut ap = ArgumentParser::new();
ap.refer(&mut val)
.add_option(&["-s", "--set"], Parse,
... | Fix tests for rust beta/nightly | Fix tests for rust beta/nightly
| Rust | mit | tailhook/rust-argparse,SamuelMarks/rust-argparse |
88b5426279e4313e1d8887d79b036fb5048c36ff | tests/relayout_test.rs | tests/relayout_test.rs | extern crate yoga;
use yoga::{Direction, Node, StyleUnit, Undefined};
#[test]
fn test_recalculate_resolved_dimension_onchange() {
let mut root = Node::new();
let mut root_child0 = Node::new();
root_child0.set_min_height(StyleUnit::Point(10.0.into()));
root_child0.set_max_height(StyleUnit::Point(10.0.into()));
r... | extern crate yoga;
use yoga::{Direction, Node, StyleUnit, Undefined};
#[test]
fn test_recalculate_resolved_dimension_onchange() {
let mut root = Node::new();
let mut root_child0 = Node::new();
root_child0.set_min_height(StyleUnit::Point(10.0.into()));
root_child0.set_max_height(StyleUnit::Point(10.0.into()));
r... | Add test for relayout on node drop | Add test for relayout on node drop
| Rust | mit | bschwind/yoga-rs,bschwind/yoga-rs,bschwind/yoga-rs,bschwind/yoga-rs |
ac9d3e636e8c50440d813d9f188abe1445ce9861 | tests/unit/stylo/build.rs | tests/unit/stylo/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/. */
use std::process::Command;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun... | /* 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 std::process::Command;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun... | Add rerun-if-changed for bindings file | Add rerun-if-changed for bindings file
check_bindings.py uses bindings.rs as input, so it should be rerun if
that file gets changed.
| Rust | mpl-2.0 | ConnorGBrewster/servo,SimonSapin/servo,upsuper/servo,eddyb/servo,jimberlage/servo,CJ8664/servo,peterjoel/servo,canaltinova/servo,jimberlage/servo,upsuper/servo,avadacatavra/servo,canaltinova/servo,CJ8664/servo,nnethercote/servo,rnestler/servo,thiagopnts/servo,szeged/servo,dati91/servo,DominoTree/servo,canaltinova/servo... |
7c04328868235282535ef38fe818480a2ab9ae87 | tests/v2.rs | tests/v2.rs | extern crate tvdb;
use tvdb::v2::Tvdb;
#[test]
fn basic() {
let t = Tvdb::new("0629B785CE550C8D");
t.login().unwrap();
println!("{:?}", t.search("scrubs"));
panic!();
}
| extern crate tvdb;
use tvdb::v2::Tvdb;
#[test]
fn basic() {
let t = Tvdb::new("0629B785CE550C8D");
t.login().unwrap();
let sr = t.search("scrubs").expect();
for s in sr.data.iter() {
println!("{}: ID {}", s.seriesName, s.id);
}
}
| Remove testing panic!() in test | Remove testing panic!() in test
| Rust | unlicense | dbr/tvdb-rs |
b4226f882ba13a0f0162acdf8af38004d5e06203 | crates/ruma-identifiers/src/device_id.rs | crates/ruma-identifiers/src/device_id.rs | #[cfg(feature = "rand")]
use crate::generate_localpart;
opaque_identifier! {
/// A Matrix key ID.
///
/// Device identifiers in Matrix are completely opaque character sequences. This type is
/// provided simply for its semantic value.
pub type DeviceId;
}
impl DeviceId {
/// Generates a random... | #[cfg(feature = "rand")]
use crate::generate_localpart;
opaque_identifier! {
/// A Matrix key ID.
///
/// Device identifiers in Matrix are completely opaque character sequences. This type is
/// provided simply for its semantic value.
///
/// # Example
///
/// ```
/// use ruma_ident... | Document how to create a DeviceId | identifiers: Document how to create a DeviceId
| Rust | mit | ruma/ruma |
8776382efe7a1e9fe426ec8365fa02cb0bbd0b5f | src/jira_client.rs | src/jira_client.rs | extern crate serde;
extern crate serde_json;
use hyper::Client;
use hyper::client::{Body, Response};
use hyper::header::Headers;
use hyper::status::StatusCode;
use jira_request::*;
use std::io::Read;
pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<T, String> {
let client = Client::new... | extern crate serde;
extern crate serde_json;
use hyper::Client;
use hyper::client::{Body, Response};
use hyper::header::Headers;
use hyper::status::StatusCode;
use jira_request::*;
use std::io::Read;
pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<T, String> {
let client = Client::new... | Improve structure of JIRA Client | :art: Improve structure of JIRA Client
| Rust | mit | dorayakikun/alfred_jira_workflow |
84656e28b5b514e894729460962edcda92289e9a | src/creator.rs | src/creator.rs | use std::io::{File,fs};
use std::path::posix::Path;
use std::os::{homedir};
use std::rand::random;
pub fn new<'r>(name: &str) {
let home_unwrap = homedir().unwrap();
let path = format!("{}/.muxed/{}", home_unwrap.display(), name);
File::create(&Path::new(path));
}
#[test]
fn new_writes_file_to_muxed_dir()... | use std::io::{File,fs};
use std::path::posix::Path;
use std::os::{homedir};
use std::rand::random;
pub fn new<'r>(name: &str) {
let home_unwrap = homedir().unwrap();
let path = format!("{}/.muxed/{}", home_unwrap.display(), name);
File::create(&Path::new(path));
}
fn create_muxed_dir(name: &String) -> Pat... | Create the mixed dir if it does not exist. | Create the mixed dir if it does not exist.
| Rust | mit | brianp/muxed,brianp/muxed |
3841af8071a45d0e1848de7a2a6ff74f04a3196d | tests/error-tests/tests/test_unicode.rs | tests/error-tests/tests/test_unicode.rs | // Ensures that unicode characters are handled in the JSON output.
fn main() {
let foo = "❤";
// ^^^WARN unused variable
// ^^^NOTE(>=1.17.0) #[warn(unused_variables)]
// ^^^NOTE(>=1.21.0,<1.22.0) to disable this warning
// ^^^NOTE(>=1.22.0,<1.25.0-beta) to avoid this warning
// ^^^HELP(>=... | // Ensures that unicode characters are handled in the JSON output.
fn main() {
let foo = "❤";
// ^^^WARN unused variable
// ^^^NOTE(>=1.17.0) #[warn(unused_variables)]
// ^^^NOTE(>=1.21.0,<1.22.0) to disable this warning
// ^^^NOTE(>=1.22.0,<1.25.0-beta) to avoid this warning
// ^^^HELP(>=... | Update minor wording change 1.34 | Tests: Update minor wording change 1.34
| Rust | mit | rust-lang/sublime-rust,jhasse/sublime-rust,rust-lang/sublime-rust |
02361de23a3698d964dd36b1b792f8a9dbbc74ca | primal-sieve/src/lib.rs | primal-sieve/src/lib.rs | //! Highly optimised prime sieves.
//!
//! This is designed to be used via the `primal` crate.
#![cfg_attr(feature = "unstable", feature(llvm_asm))]
// black boxes for pointers; LLVM isn't so happy without
// them. Unfortunately only usable with unstable, but the code isn't
// *too* much slower without them.
#[cfg(fe... | //! Highly optimised prime sieves.
//!
//! This is designed to be used via the `primal` crate.
// black boxes for pointers; LLVM isn't so happy without
// them. Unfortunately only usable with 1.59+ asm!, but the code isn't
// *too* much slower without them.
#[cfg(feature = "unstable")]
#[inline(always)]
fn b<T>(mut p:... | Use the new asm! in the unstable primal_sieve::b | Use the new asm! in the unstable primal_sieve::b
We should re-evaluate if this is still useful, because it made no
consistent difference on my machine, but at least this compiles.
| Rust | apache-2.0 | huonw/primal,cuviper/primal,cuviper/primal,huonw/primal |
ce6c4462aba101de546e6aa7d50780d35b652bc6 | src/example_generated.rs | src/example_generated.rs | //! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS
//! CRATE**.
bitflags! {
/// This is the same `Flags` struct defined in the [crate level example](../index.html#example).
/// Note that this struct is just for documentation purposes only, it must not be used ou... | //! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS
//! CRATE**.
bitflags! {
/// This is the same `Flags` struct defined in the [crate level example](../index.html#example).
/// Note that this struct is just for documentation purposes only, it must not be used ou... | Fix the example `Flags` struct | Fix the example `Flags` struct
So that it actually match the one in the crate level docs.
| Rust | apache-2.0 | bitflags/bitflags,rust-lang/bitflags |
c076c3b8f11d03102f36af49138dd70eb54543d8 | main.rs | main.rs | extern crate orbital;
pub use std::collections::VecDeque;
mod editor;
pub use self::editor::*;
mod parse;
pub use self::parse::*;
mod key_state;
pub use self::key_state::*;
mod key;
pub use self::key::*;
mod prompt;
pub use self::prompt::*;
mod open;
pub use self::open::*;
mod redraw;
pub use self::redraw::*;
... | extern crate orbital;
pub use std::collections::VecDeque;
mod editor;
pub use self::editor::*;
mod parse;
pub use self::parse::*;
mod key_state;
pub use self::key_state::*;
mod key;
pub use self::key::*;
mod prompt;
pub use self::prompt::*;
mod open;
pub use self::open::*;
mod redraw;
pub use self::redraw::*;
... | Fix compilation, login program is broken though | Fix compilation, login program is broken though
| Rust | mit | redox-os/sodium |
627621147877872f018c268f5d6b8235acd8721e | src/read_file_line.rs | src/read_file_line.rs | // Implements http://rosettacode.org/wiki/Read_a_file_line_by_line
use std::io::fs::File;
use std::io::BufferedReader;
use std::os::args;
fn main() {
let filename = match args().len() {
1 => fail!("You must enter a filename to read line by line"),
_ => args()[1]
};
let file = File::open(&P... | // Implements http://rosettacode.org/wiki/Read_a_file_line_by_line
use std::io::fs::File;
use std::io::BufferedReader;
use std::os::args;
fn main() {
let filename = match args().len() {
1 => fail!("You must enter a filename to read line by line"),
_ => args()[1]
};
let file = File::open(&P... | Fix read file by line | Fix read file by line
| Rust | unlicense | magum/rust-rosetta,magum/rust-rosetta,crespyl/rust-rosetta,Hoverbear/rust-rosetta,crr0004/rust-rosetta,ZoomRmc/rust-rosetta,JIghtuse/rust-rosetta,sakeven/rust-rosetta,pfalabella/rust-rosetta,ghotiphud/rust-rosetta |
892a2aa6f3c36fca8e1527edd354374284301420 | build.rs | build.rs | use gcc;
#[cfg(windows)]
fn main() { gcc::compile_library("libsid.a", &["./src/obtain_sid.c"]); }
#[cfg(not(windows))]
fn main() {}
| #[cfg(windows)]
fn main() {
use gcc;
gcc::compile_library("libsid.a", &["./src/obtain_sid.c"]);
}
#[cfg(not(windows))]
fn main() {}
| Fix platform-specific unused import warning | Fix platform-specific unused import warning
gcc crate is only used on windows, so move the use statement inside the
windows main implementation.
Signed-off-by: Jon Bauman <e6c6a4db54ad11b4de69fed67139594b59f3444f@users.noreply.github.com>
| Rust | apache-2.0 | habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat |
c6c719763ff934cfbf870b34f8835dd2b8599829 | src/js_types/js_obj.rs | src/js_types/js_obj.rs | use std::collections::hash_map::HashMap;
use js_types::js_type::{JsType, JsT};
pub struct JsObj {
proto: Option<Box<JsObj>>,
dict: HashMap<JsType, JsType>,
}
impl JsT for JsObj {}
impl JsObj {
pub fn new() -> JsObj {
JsObj {
proto: None,
dict: HashMap::new(),
}
... | use std::collections::hash_map::HashMap;
use std::vec::Vec;
use js_types::js_type::{JsType, JsT};
pub type JsProto = Option<Box<JsObj>>;
macro_rules! hash_map {
( $( $k:expr => $v:expr),* ) => {{
let mut temp_hash_map = HashMap::new();
$(
temp_hash_map.insert($k, $v);
... | Add JsProto type alias and allow JsObj to take a vec of (k,v) pairs | Add JsProto type alias and allow JsObj to take a vec of (k,v) pairs
| Rust | mit | rustoscript/french-press |
a3344d1a3aef9d8c1171899fcd34486a7038a984 | src/test/ui/variance-iterators-in-libcore.rs | src/test/ui/variance-iterators-in-libcore.rs | // run-pass
#![allow(warnings)]
use std::iter::Zip;
fn zip_covariant<'a, A, B>(iter: Zip<&'static A, &'static B>) -> Zip<&'a A, &'a B> { iter }
fn main() { }
| // run-pass
#![allow(dead_code)]
use std::iter::{Fuse, Zip};
fn fuse_covariant<'a, I>(iter: Fuse<&'static I>) -> Fuse<&'a I> { iter }
fn zip_covariant<'a, A, B>(iter: Zip<&'static A, &'static B>) -> Zip<&'a A, &'a B> { iter }
fn main() { }
| Add a test to ensure Fuse stays covariant | Add a test to ensure Fuse stays covariant
| Rust | apache-2.0 | aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust |
3b6a5fbeceff5a8910c07c6115396e0420e29bee | src/test/ui/generator/issue-69039.rs | src/test/ui/generator/issue-69039.rs | // run-pass
#![feature(generators, generator_trait)]
use std::ops::{Generator, GeneratorState};
fn my_scenario() -> impl Generator<String, Yield = &'static str, Return = String> {
|_arg: String| {
let my_name = yield "What is your name?";
let my_mood = yield "How are you feeling?";
format... | // run-pass
#![feature(generators, generator_trait)]
use std::ops::{Generator, GeneratorState};
fn mkstr(my_name: String, my_mood: String) -> String {
format!("{} is {}", my_name.trim(), my_mood.trim())
}
fn my_scenario() -> impl Generator<String, Yield = &'static str, Return = String> {
|_arg: String| {
... | Move formatting to different function | Move formatting to different function
This slims down the generator MIR considerably, which makes debugging
easier
| Rust | apache-2.0 | graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust |
1a15e5c4627d32c40a8e28b5d090fbf7622100dd | examples/get_os_release.rs | examples/get_os_release.rs | extern crate rs_release;
use rs_release::{get_os_release, parse_os_release};
use std::env;
fn main() {
let mut args = env::args();
let os_release = if let Some(os_release_path) = args.nth(1) {
parse_os_release(os_release_path)
} else {
get_os_release()
};
match os_release {
... | extern crate rs_release;
use rs_release::{get_os_release, parse_os_release, parse_os_release_str};
use std::env;
fn main() {
let mut args = env::args();
let os_release = if let Some(os_release_path) = args.nth(1) {
parse_os_release(os_release_path)
} else {
get_os_release()
};
ma... | Add parsing from &str example | examples: Add parsing from &str example
| Rust | mit | JIghtuse/rs-release |
428b457c5878261baef5311eb11198a45d12e111 | core/examples/dcmdump.rs | core/examples/dcmdump.rs | //! A reimplementation of dcmdump in Rust
//! WIP
extern crate dicom_core;
use dicom_core::{DicomElement, DicomObject};
use std::fs::File;
use std::path::Path;
fn main() {
println!("Sorry, this tool is not implemented yet.");
}
fn dump<P: AsRef<Path>>(path: P) {
let file = File::open(path).unwrap();
//le... | //! A reimplementation of dcmdump in Rust
//! WIP
extern crate dicom_core;
use dicom_core::{DicomElement, DicomObject};
use std::fs::File;
use std::path::Path;
fn main() {
println!("Sorry, this tool is not implemented yet.");
}
fn dump<P: AsRef<Path>>(path: P) {
let file = File::open(path).unwrap();
//le... | Update dump.rs for CI to pass | Update dump.rs for CI to pass | Rust | apache-2.0 | Enet4/dicom-rs,Enet4/dicom-rs |
e13562c11897a2b1502f6e44abd1fd43fae66f7a | src/test/rustdoc-ui/scrape-examples-ice.rs | src/test/rustdoc-ui/scrape-examples-ice.rs | // compile-flags: -Z unstable-options --scrape-examples-output-path t.calls --scrape-examples-target-crate foobar
// check-pass
#![no_std]
use core as _;
| // compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar
// check-pass
#![no_std]
use core as _;
| Change output path to {{build-base}} | Change output path to {{build-base}}
| Rust | apache-2.0 | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust |
1f2fc2a1c5367603003c7530496de2f1dbc2f736 | components/hab/src/command/origin/delete.rs | components/hab/src/command/origin/delete.rs | use crate::{api_client::Client,
common::ui::{Status,
UIWriter,
UI}};
use crate::{error::{Error,
Result},
PRODUCT,
VERSION};
pub fn start(ui: &mut UI, bldr_url: &str, token: &str, origin: &str) -> Result<()> {
... | use crate::{api_client::{self,
Client},
common::ui::{Status,
UIWriter,
UI},
error::{Error,
Result},
PRODUCT,
VERSION};
use hyper::status::StatusCode;
pub fn start(ui: &mut UI, ... | Update error handling for origin deletion | Update error handling for origin deletion
Signed-off-by: Salim Alam <18ae4dd1e3db1d49a738226169e3b099325c79a0@chef.io>
| Rust | apache-2.0 | rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat |
493c39e7f9769094ef762f4b264f51c93b4faa5a | lib/cretonne/src/lib.rs | lib/cretonne/src/lib.rs | //! Cretonne code generation library.
#![deny(missing_docs)]
pub use context::Context;
pub use legalizer::legalize_function;
pub use verifier::verify_function;
pub use write::write_function;
/// Version number of the cretonne crate.
pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");
#[macro_use]
pub mod d... | //! Cretonne code generation library.
#![deny(missing_docs)]
pub use context::Context;
pub use legalizer::legalize_function;
pub use verifier::verify_function;
pub use write::write_function;
/// Version number of the cretonne crate.
pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");
#[macro_use]
pub mod d... | Make the bitset module private. | Make the bitset module private.
This is just an implementation detail.
| Rust | apache-2.0 | stoklund/cretonne,sunfishcode/cretonne,sunfishcode/cretonne,stoklund/cretonne,stoklund/cretonne,sunfishcode/cretonne |
2a2126dee828172b478a2f048915290df177e452 | src/lib.rs | src/lib.rs | pub mod ui {
extern crate term;
use net;
pub fn update(state: Result<net::State, net::State>) {
match state {
Ok(net::State::Online) => online(),
Err(net::State::Offline) => offline(),
_ => println!("WHAT?"),
}
}
pub fn online() {
let mu... | pub mod ui {
extern crate term;
use net;
pub fn update(state: net::State) {
match state {
net::State::Online => online(),
net::State::Offline => offline()
}
}
pub fn online() {
let mut t = term::stdout().unwrap();
t.fg(term::color::GREEN).un... | Use net Enum for passing the result of is_online | Use net Enum for passing the result of is_online
Thanks @moonglum for untangling the unreachable! bit. :)
| Rust | mit | bascht/binichonline |
7b52f7ed0c03a1005a81db13e9f4f443b24fbe20 | wgfem.rs | wgfem.rs | #[link(name = "wgfem",
vers = "0.8",
url = "https://github.com/scharris/WGFEM-Rust")];
#[license = "MIT"];
#[crate_type = "exe"];
#[feature(globs)];
#[feature(macro_rules)];
#[feature(link_args)];
extern mod extra;
pub mod common;
pub mod monomial;
pub mod polynomial;
pub mod vector_monomial;
mod quadrature;
#[p... | #[crate_id = "wgfem#0.8.1"];
#[license = "MIT"];
#[crate_type = "exe"];
#[feature(globs)];
#[feature(macro_rules)];
#[feature(link_args)];
extern mod extra;
pub mod common;
pub mod monomial;
pub mod polynomial;
pub mod vector_monomial;
mod quadrature;
#[path="linear_algebra.rs"]
mod la;
pub mod dense_matrix;
pub mod... | Replace link attribute with new create_id attribute. | Replace link attribute with new create_id attribute.
| Rust | mit | scharris/WGFEM-Rust,scharris/WGFEM-Rust,scharris/WGFEM-Rust |
09f186101ed13e98d68c9bdeea1faf914fc887bb | benches/bench_stdlibs.rs | benches/bench_stdlibs.rs | #![feature(test)]
extern crate racer_testutils;
extern crate test;
use test::Bencher;
use racer_testutils::*;
#[bench]
fn completes_hashmap(b: &mut Bencher) {
let src = r"
use std::collections::HashM~
";
let mut var = vec![];
b.iter(|| {
var = get_all_completions(src, None);
})
}
#[bench]... | #![feature(test)]
extern crate racer_testutils;
extern crate test;
use test::Bencher;
use racer_testutils::*;
#[bench]
fn completes_hashmap(b: &mut Bencher) {
let src = r"
use std::collections::HashM~
";
let mut var = vec![];
b.iter(|| {
var = get_all_completions(src, None);
})
}
#[bench]... | Modify completes_methods_for_file_open so that racer work correctly | Modify completes_methods_for_file_open so that racer work correctly
| Rust | mit | birkenfeld/racer,phildawes/racer,racer-rust/racer |
35a4d12b8bcbace9d18713582b5554c46db74d70 | src/libheap/src/buddy.rs | src/libheap/src/buddy.rs | //! An implementation of a buddy allocator.
use types::{UnsafeList, PhantomNode};
pub type FreeBlock = PhantomNode;
#[allow(dead_code)]
pub struct Buddy<'a> {
min_block_size: usize,
max_order: u32,
free_lists: &'a mut [UnsafeList<FreeBlock>],
}
| //! An implementation of a buddy allocator.
use core::ptr;
use Allocator;
use types::{UnsafeList, PhantomNode};
pub type FreeBlock = PhantomNode;
#[allow(dead_code)]
pub struct Buddy<'a> {
min_block_size: usize,
max_order: u32,
free_lists: &'a mut [UnsafeList<FreeBlock>],
}
impl<'a> Allocator for Budd... | Add dummy implementation of Allocator for Buddy | libheap: Add dummy implementation of Allocator for Buddy
| Rust | mit | uni-rs/uni.rs |
4d49308dbe6c1216db9ea3f6301e3096d30927f4 | src/bin/xtc.rs | src/bin/xtc.rs | //! This module serves as the entry point into Xtensis's main binary.
// This file is part of Xtensis.
// This is the Xtensis text editor; it edits text.
// Copyright (C) 2016-2017 The Xtensis Developers
// This program is free software: you can redistribute it and/or
// modify it under the terms of the GNU General... | //! This module serves as the entry point into Xtensis's main binary.
// This file is part of Xtensis.
// This is the Xtensis text editor; it edits text.
// Copyright (C) 2016-2017 The Xtensis Developers
// This program is free software: you can redistribute it and/or
// modify it under the terms of the GNU General... | Add arguments and logging initialisation to binary | Add arguments and logging initialisation to binary
This commit adds arguments parsing (using Clap) and logging subsystem
initialisation to the main Xtensis binary.
Acked-by: Dom Rodriguez <877a6a6dba761704a720c755f2931c31cb0cc923@shymega.org.uk>
Reviewed-by: Dom Rodriguez <877a6a6dba761704a720c755f2931c31cb0cc923@shy... | Rust | apache-2.0 | shymega/slacs,shymega/slacs |
cdbfaa895b3c282fa7d50a4df14ea86fe12552a1 | src/lib.rs | src/lib.rs | #![no_std]
#[doc(hidden)]
pub extern crate core as _core;
/// Asserts at compile-time that the two types have equal sizes.
#[macro_export]
macro_rules! assert_eq_size {
($x:ty, $y:ty) => {
#[allow(unused_unsafe)]
unsafe {
use $crate::_core::mem::{forget, transmute, uninitialized};
... | #![no_std]
#[doc(hidden)]
pub extern crate core as _core;
/// Asserts at compile-time that the two types have equal sizes.
///
/// # Example
///
/// ```
/// #[macro_use]
/// extern crate static_assertions;
///
/// struct Byte(u8);
///
/// fn main() {
/// assert_eq_size!(Byte, u8);
/// // assert_eq_size!(Byte,... | Add example to assert_eq_size doc | Add example to assert_eq_size doc
| Rust | apache-2.0 | nvzqz/static-assertions-rs |
cc3ad1ce08987fd34681e9b5ebf199ba8178b5cd | code/rust/class_struct.rs | code/rust/class_struct.rs | // BEGIN_CODE
struct MyClass {
my_field: isize
}
impl MyClass {
// constructor, by convention
pub fn new(field: isize) -> MyClass {
MyClass { my_field: field }
}
// destructor
pub fn drop(&self) {
}
}
// END_CODE
| // BEGIN_CODE
struct MyClass {
my_field: isize
}
impl MyClass {
// constructor, by convention
pub fn new(field: isize) -> MyClass {
MyClass { my_field: field }
}
}
impl Drop for MyClass {
// destructor
fn drop(&mut self) {
}
}
// END_CODE
| Fix destructor example for rust | Fix destructor example for rust
The old code was just a normal method named drop, not a destructor. | Rust | apache-2.0 | wspeirs/rust-compare,wspeirs/rust-compare,wspeirs/rust-compare,wspeirs/rust-compare,wspeirs/rust-compare |
d895c18b22e8c0cbaf55b8db2525f1673c45a0a6 | 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: import the logging macros. | Update to current rust: import the logging macros.
| Rust | apache-2.0 | servo/sharegl |
a2246c9318bb8eaf0d56a57b7993c7f3d8aa7433 | src/fs.rs | src/fs.rs | // Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers
//
// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.
// and the party accessing this file ("Licensee") apply to Licensee's use of
// the Software until such time that the Software is made available under an
// open source license... | // Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers
//
// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.
// and the party accessing this file ("Licensee") apply to Licensee's use of
// the Software until such time that the Software is made available under an
// open source license... | Use `HAB_CACHE_ARTIFACT_PATH` for download path of package artifacts. | Use `HAB_CACHE_ARTIFACT_PATH` for download path of package artifacts.
`HAB_CACHE_ARTIFACT_PATH` is the default download root path for package
artifacts, used on package installation. It defaults to
`$HAB_ROOT_PATH/cache/artifacts`.
| Rust | apache-2.0 | rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat |
6e09bfa080819103f6b19d2cdc9cbfdcc5f27ec9 | src/lib.rs | src/lib.rs | //! An implementation of Google Protobuf's Variable-Length Integers
| //! An implementation of Google Protobuf's Variable-Length Integers
/// The maximum number of bytes used by a 32-bit Varint
pub const VARINT_32_MAX_BYTES: u8 = 5;
/// The maximum number of bytes used by a 32-bit Varint
pub const VARINT_64_MAX_BYTES: u8 = 10;
///Checks to see if the most signifigant bit exists in the... | Check for most signifigant bit in a byte | Check for most signifigant bit in a byte
| Rust | apache-2.0 | Techern/Varint-rs |
bba553a410ef5b9b0e2d734e5296175e5e46dc8f | src/lib.rs | src/lib.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 make lint target and clippy for all components | Add make lint target and clippy for all components
Signed-off-by: Vesa Kaihlavirta <4e694234bf4388a44a497ea591f3a9232cbf6c05@discord.tech>
| Rust | apache-2.0 | rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat |
1df4b8bc30d5dd9e55c5fd1091ea391f284370db | src/main.rs | src/main.rs | use parser::Parser;
mod token;
mod parser;
mod error;
fn main() {
let mut parser = Parser::new("C3HeH4");
println!("{:?}", parser.parse_molecule());
} | #![allow(unstable)]
use parser::Parser;
mod token;
mod parser;
mod error;
fn main() {
let mut parser = Parser::new("C3HeH4");
println!("{:?}", parser.parse_molecule());
} | Allow unstable note in the crate | Allow unstable note in the crate
| Rust | mit | opp11/chemtool2 |
16c146b6038ff8893f3d1d18cf53ebbeb538a265 | blog/src/lib.rs | blog/src/lib.rs | pub struct Post {
state: Option<Box<State>>,
content: String
}
impl Post {
pub fn new() -> Post {
Post {
state: Some(Box::new(Draft {})),
content: String::new()
}
}
pub fn add_text(&mut self, text: &str) {
self.content.push_str(text);
}
pub ... | pub struct Post {
state: Option<Box<State>>,
content: String
}
impl Post {
pub fn new() -> Post {
Post {
state: Some(Box::new(Draft {})),
content: String::new()
}
}
pub fn add_text(&mut self, text: &str) {
self.content.push_str(text);
}
pub ... | Implement approve for PendingReview, implement Published struct and State trait methods for that struct | Implement approve for PendingReview, implement Published struct and State trait methods for that struct
| Rust | mit | pgrzesik/learning-rust |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.