Skip to content

Instantly share code, notes, and snippets.

[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"] }
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")?;
#![cfg(feature = "alloc")]
use jemallocator;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use nom::{
branch::alt,
#![cfg(feature = "alloc")]
use jemallocator;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use nom::{
branch::alt,
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;
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();
@0xa9970031d0caaf6d;
struct Biscuit {
authority @0 :Block;
blocks @1 :List(Block);
# each element must be 32 bytes
keys @2 :List(Data);
signature @3 :Signature;
}
@Geal
Geal / http.rs
Created February 16, 2019 10:17
#[macro_use]
extern crate bencher;
#[macro_use]
extern crate nom;
extern crate nomfun;
use bencher::{black_box, Bencher};
use nom::IResult;
#[macro_use]
extern crate nom;
#[macro_use]
extern crate bencher;
extern crate fnv;
use fnv::FnvHashMap as HashMap;
use bencher::{Bencher, black_box};
@Geal
Geal / fun.rs
Created February 15, 2019 11:05
#[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>