Skip to content

Instantly share code, notes, and snippets.

View lambdageek's full-sized avatar
🦀

Aleksey Kliger (λgeek) lambdageek

🦀
View GitHub Profile
//! A server with some middleware
//!
//! We have some server process [`server`]
//! that produces byte slices `&[u8]` and feeds them to some
//! [`ServerResponder`] client. Since the client gets the
//! bytes by reference and it must be prepared to receive them
//! for any lifetime, it's effectively a `for<'a> Fn(&'a [u8])` callback.
//!
//! Now to make things more interesting, we also want to have some middleware
//! that transforms the initial vector slice into something.