Skip to content

Instantly share code, notes, and snippets.

BPS File Format Specification

by byuu. Public domain. https://byuu.org/

BPS patches encode the differences between two files.

string "BPS1"
number source-size
number target-size

number metadata-size

@khadiwala
khadiwala / example.rs
Last active February 15, 2017 03:23
chat.rs with unfold
// from chat.rs
// Model the read portion of this socket by mapping an infinite
// iterator to each line off the socket. This "loop" is then
// terminated with an error once we hit EOF on the socket.
let iter = stream::iter(iter::repeat(()).map(Ok::<(), Error>));
let socket_reader = iter.fold(reader, move |reader, _| {
// Read a line off the socket, failing if we're at EOF
let line = io::read_until(reader, b'\n', Vec::new());
let line = line.and_then(|(reader, vec)| {
if vec.len() == 0 {