Created
October 27, 2019 02:35
-
-
Save martinmroz/f609cd21dc50ca1ff18727fa53325732 to your computer and use it in GitHub Desktop.
A functional take on generating a span over an entire byte string
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
/// Computes the flux over the provided input byte string. | |
fn flux_over_byte_string<T>(input: T) -> Option<Flux> | |
where | |
T: AsRef<[u8]> { | |
input.as_ref() | |
.iter() | |
.cloned() | |
.map(Flux::from) | |
.fold(None, |acc, next| span_opt(acc, Some(next))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment