Struct io_interner::IOInterner [−][src]
A struct wrapping a Mutex<T>
used for storing and retrieving data thought readers.
Note that T
it's wrapped into a Mutex
for ensure IOObj
does not lock access to the
IOInterner
and to guarantee will only lock at Read
methods.
Fields
inner: Mutex<T>
The underlying writer wrapped into a Mutex
.
The IOEntry
comparison algorithm would mess up if you do not ensure that already
allocated data remain equal after releasing a lock,it's advisable to only write at the end.
Implementations
impl<T: Write + Read + Seek> IOInterner<T>
[src]
pub fn new(x: T) -> Self
[src]
Create a new IOInterner
that uses as common storage x
.
pub fn flush(&self) -> Result<()>
[src]
pub fn get_or_intern<U: Read + Seek>(&self, buf: U) -> Result<IOEntry<'_, T>>
[src]
Creates a new IOEntry
object that will be able to generate IOObj
that always read
same bytes as buf
from T
so buf
will be written at the end if it's not already.
The IOObj
does not implement Write
as that would mess up equality of two
IOEntry
instances pointing to the same position with same length which it's actually
the comparison algorithm.
Panics
This function panics if the Mutex
it's poisoned.
Auto Trait Implementations
impl<T> RefUnwindSafe for IOInterner<T>
[src]
impl<T> Send for IOInterner<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for IOInterner<T> where
T: Send,
[src]
T: Send,
impl<T> Unpin for IOInterner<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for IOInterner<T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,