[][src]Struct notmecab::Blob

pub struct Blob { /* fields omitted */ }

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]

type Target = [u8]

The resulting type after dereferencing.

impl Send for Blob[src]

impl Sync for Blob[src]

Auto Trait Implementations

impl !RefUnwindSafe for Blob

impl Unpin for Blob

impl !UnwindSafe for Blob

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.