This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use itoap::Integer; | |
use std::io::*; | |
const FIZZ: *const u8 = "Fizz\n".as_ptr(); | |
const FIZZBUZZ: *const u8 = "FizzBuzz\n".as_ptr(); | |
const FIZZ_THEN_BUZZ: *const u8 = "Fizz\nBuzz\n".as_ptr(); | |
const BUZZ_THEN_FIZZ: *const u8 = "Buzz\nFizz\n".as_ptr(); | |
const BUF_SIZE: usize = 256 * 1024; | |
const BLOCK_SIZE: usize = 15 * i32::MAX_LEN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hydration, hydras | |
import timeit | |
class HydrasFoo(hydras.Struct): | |
a = hydras.u8 | |
b = hydras.u8 | |
c = hydras.u16 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T_hash> | |
class Hash | |
{ | |
public: | |
static void Calc(const uint8_t *d, size_t n, uint8_t *o_h, size_t n2) | |
{ | |
T_hash hash; | |
hash.Digest(d, n); | |
hash.Finalize(o_h, n2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T_hashPolicy> | |
class Hash : public T_hashPolicy | |
{ | |
public: | |
static const size_t HASH_SIZE = T_hashPolicy::HASH_SIZE; | |
/*************** | |
* Interface methods | |
***************/ | |
void Digest(const uint8_t *data, size_t size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define NLOG_OBJECT_ID 0 | |
#define NLOG_MAGIC 0x676F4C4E | |
#define NLOG(msg) ({ \ | |
static Entry<sizeof(msg)> NLOG_MESSAGE __attribute__((section(".nlog_entries"))) = { NLOG_MAGIC, 0, __LINE__, sizeof(msg), msg}; \ | |
(((uint64_t)NLOG_OBJECT_ID) << 32) | __LINE__; \ | |
}) | |
template <size_t N> | |
struct Entry | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl GlobSet { | |
pub fn iter_at<P: AsRef<Path>>(self, dir: P) -> GlobWalker { | |
GlobWalker { | |
glob: self, | |
walker: walkdir::WalkDir::new(dir).into_iter() | |
} | |
} | |
} | |
struct GlobWalker { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs | |
index d69a9f493f..dece7816a3 100644 | |
--- a/src/libtest/lib.rs | |
+++ b/src/libtest/lib.rs | |
@@ -887,10 +887,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu | |
.map(|t| t.desc.name.as_slice().len()) | |
.unwrap_or(0); | |
- let is_multithreaded = match opts.test_threads { | |
- Some(n) => n > 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT | |
// file at the top-level directory of this distribution and at | |
// http://rust-lang.org/COPYRIGHT. | |
// | |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
// option. This file may not be copied, modified, or distributed | |
// except according to those terms. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{Read, Write}; | |
/// A PartialStream allows to prepand a header to a stream. | |
/// This is useful for emulating "pushing" data back into a stream. | |
/// | |
/// # Example | |
/// ```ignore | |
/// let mut file = File::open("foo.txt")?; | |
/// let mut first_two_bytes = [u8; 2]; | |
/// file.read(&mut first_two_bytes)?; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
println!("Hello, world!"); | |
} |
NewerOlder