[−][src]Struct notmecab::Blob
A blob of bytes.
Implementations
impl Blob
[src]
pub fn new(data: impl AsRef<[u8]> + Sync + Send + 'static) -> Self
[src]
Constructs a new Blob
. The data
object will be kept alive until
the Blob
is dropped.
Examples
static STATIC_SLICE: &[u8] = &[1, 2, 3]; let blob_1 = Blob::new(STATIC_SLICE); assert_eq!(blob_1.len(), 3); assert_eq!(&*blob_1, &[1, 2, 3]); let vector: Vec<u8> = vec![4, 5]; let blob_2 = Blob::new(vector); assert_eq!(blob_2.len(), 2); assert_eq!(&*blob_2, &[4, 5])
pub fn open(path: impl AsRef<Path>) -> Result<Self>
[src]
Opens a file at a given path and creates a Blob
from it. Will use mmap
.
pub fn from_file(fp: &File) -> Result<Self>
[src]
Creates a Blob
from a File
. Will use mmap
.
Trait Implementations
impl AsRef<[u8]> for Blob
[src]
impl Deref for Blob
[src]
impl Send for Blob
[src]
impl Sync for Blob
[src]
Auto Trait Implementations
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,
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.
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>,