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
[package] | |
name = "warp-tracing" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
futures-util = "0.3.18" | |
tokio = { version = "1.14.0", features = ["full"] } |
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::{ | |
fs::File, | |
str::from_utf8, | |
io::{Read, Write}, | |
os::unix::io::AsRawFd, | |
}; | |
fn main() -> std::io::Result<()> { | |
let mut write_file = File::create("test.txt")?; | |
let mut read_file = File::open("test.txt")?; |
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
#![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
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> |
NewerOlder