Crate io_interner
source ·Expand description
A simple crate implementing a struct wrapping a reader and writer that’s used to create readers to unique data.
Structs
- A struct wrapping a
Mutex<T>
used for storing and retrieving data thought readers. - A struct generated by [
IOEntry::get_object
]. - Struct stating which data
IOObj
will read from theIOInterner
internal IO object.
Constants
- Internal buffer length used in many free functions of this crate,put here if in the future some way of create it at compile time it’s implemented,only thinkable way it’s
option_env!("IOINTERNER_BUF_LEN").and_then(|e| e.trim().parse().ok()).unwrap_or(512)
but, except foroption_env!
andOption::{and_then, unwrap_or}
,cannot be put into a constant.
Functions
- Checks if the contents of the reader
x
are the ones ofy
. - Checks if the contents of
needle
are inhaystack
. - Hash the contents of the reader
x
tostate
. - Pass to
callback
slices with lenght up to 512 contained in both readers until either one reach EOF and returnsNone
or whencallback
returnsSome
,that case this function will return it. - Like
io_op
,but with only one reader and slice passed down tocallback
. - Checks if the contents of
needle
are inhaystack
starting from the end. - Checks if the first contents of the reader
haystack
are the ones ofneedle
,an empty needle is always true. - Convert the contents of the
reader
into valid UTF-8 and pass it to callback,passing inNone
when some bytes are not.