pub struct OwnedSource<S>(/* private fields */);Expand description
Wrapper for owned source content.
OwnedSource wraps any type that can be viewed as bytes (AsRef<[u8]>),
such as Vec<u8>, Box<[u8]>, or custom buffer types. The content is
stored directly in the cache’s internal memory managed by the C library.
§Example
let buffer = vec![b'c', b'o', b'd', b'e'];
let cache = Cache::new()
.with_source((OwnedSource::new(buffer), "data.bin"));
let mut report = Report::new()
.with_title(Level::Error, "Error in binary data")
.with_label(0..4)
.render_to_string(&cache)?;Implementations§
Trait Implementations§
Source§impl<S: AsRef<[u8]>> AddToCache for OwnedSource<S>
impl<S: AsRef<[u8]>> AddToCache for OwnedSource<S>
Auto Trait Implementations§
impl<S> Freeze for OwnedSource<S>where
S: Freeze,
impl<S> RefUnwindSafe for OwnedSource<S>where
S: RefUnwindSafe,
impl<S> Send for OwnedSource<S>where
S: Send,
impl<S> Sync for OwnedSource<S>where
S: Sync,
impl<S> Unpin for OwnedSource<S>where
S: Unpin,
impl<S> UnwindSafe for OwnedSource<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more