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
#![cfg(feature = "alloc")] | |
use jemallocator; | |
#[global_allocator] | |
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; | |
use nom::{ | |
branch::alt, |
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
#include "ClientSocket.h" | |
#include "SocketException.h" | |
ClientSocket::ClientSocket ( std::string host, int port ){ | |
if ( ! Socket::create() ){ | |
throw SocketException ( "Could not create client socket." ); | |
} | |
if ( ! Socket::connect ( host, port ) ) { |
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
extern crate nom; | |
use nom::IResult; | |
use nom::bytes::complete::tag; | |
use nom::sequence::{separated_pair, terminated}; | |
use nom::character::complete::alphanumeric1; | |
use std::cell::{Cell, RefCell}; | |
use std::rc::Rc; | |
use std::iter::Iterator; | |
use std::collections::HashMap; |
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 gen::GenError; | |
pub trait SerializeFn<I>: Fn(I) -> Result<I, GenError> {} | |
impl<I, F: Fn(I) ->Result<I, GenError>> SerializeFn<I> for F {} | |
pub fn slice<'a, S: 'a + AsRef<[u8]>>(data: S) -> impl SerializeFn<&'a mut [u8]> { | |
let len = data.as_ref().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
@0xa9970031d0caaf6d; | |
struct Biscuit { | |
authority @0 :Block; | |
blocks @1 :List(Block); | |
# each element must be 32 bytes | |
keys @2 :List(Data); | |
signature @3 :Signature; | |
} |
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
#[macro_use] | |
extern crate bencher; | |
#[macro_use] | |
extern crate nom; | |
extern crate nomfun; | |
use bencher::{black_box, Bencher}; | |
use nom::IResult; |
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
#[macro_use] | |
extern crate nom; | |
#[macro_use] | |
extern crate bencher; | |
extern crate fnv; | |
use fnv::FnvHashMap as HashMap; | |
use bencher::{Bencher, black_box}; |
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
#[macro_use] | |
extern crate nom; | |
use nom::{digit, be_u32, IResult, Err}; | |
named!(first<u32>, flat_map!(digit, parse_to!(u32))); | |
named!(second<u32>, call!(be_u32)); | |
/*fn or<'a, 'b, F>(input: &'a [u8], left: F, right: F) -> IResult<&'a [u8], u32> |
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
//extern crate conform; | |
extern crate flate2; | |
extern crate image; | |
extern crate ndarray; | |
extern crate tar; | |
extern crate protobuf; | |
#[allow(unused_imports)] | |
#[macro_use] | |
extern crate tract_core; |
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
$ RUST_BACKTRACE=1 cargo run --bin wasmtime -- testload.wasm --function=load | |
Finished dev [unoptimized + debuginfo] target(s) in 0.21s | |
Running `target/debug/wasmtime testload.wasm --function=load` | |
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:355:21 | |
stack backtrace: | |
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace | |
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 | |
1: std::sys_common::backtrace::print | |
at libstd/sys_common/backtrace.rs:71 | |
at libstd/sys_common/backtrace.rs:59 |