Struct symbolic_common::ByteViewHandle
[−]
[src]
pub struct ByteViewHandle<'a, T> { /* fields omitted */ }
A smart pointer for byte data that owns a derived object.
In some situations symbolic needs to deal with types that are based on potentially owned or borrowed bytes and wants to provide another view at them. This for instance is used when symbolic works with partially parsed files (like headers) of byte data.
Upon deref
the inner type is returned. Additionally the bytes
are exposed through the static get_bytes
method.
Methods
impl<'a, T> ByteViewHandle<'a, T>
[src]
fn from_byteview<F>(view: ByteView<'a>, f: F) -> Result<ByteViewHandle<'a, T>> where
F: FnOnce(&'a [u8]) -> Result<T>,
[src]
F: FnOnce(&'a [u8]) -> Result<T>,
Creates a new ByteViewHandle
from a ByteView
.
The closure is invoked with the borrowed bytes from the original byte view and the return value is retained in the handle.
fn from_slice<F>(buffer: &'a [u8], f: F) -> Result<ByteViewHandle<'a, T>> where
F: FnOnce(&'a [u8]) -> Result<T>,
[src]
F: FnOnce(&'a [u8]) -> Result<T>,
Constructs an object file from a byte slice.
fn from_vec<F>(vec: Vec<u8>, f: F) -> Result<ByteViewHandle<'static, T>> where
F: FnOnce(&'static [u8]) -> Result<T>,
[src]
F: FnOnce(&'static [u8]) -> Result<T>,
Constructs an object file from a vec
fn from_path<F, P>(path: P, f: F) -> Result<ByteViewHandle<'static, T>> where
F: FnOnce(&'static [u8]) -> Result<T>,
P: AsRef<Path>,
[src]
F: FnOnce(&'static [u8]) -> Result<T>,
P: AsRef<Path>,
Constructs an object file from a file path.
fn get_bytes<'b>(this: &'b ByteViewHandle<'a, T>) -> &'b [u8]
[src]
Returns the underlying storage (byte slice).
Trait Implementations
impl<'a, T> Deref for ByteViewHandle<'a, T>
[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
Dereferences the value.