[][src]Struct harfbuzz::Blob

pub struct Blob<'a> { /* fields omitted */ }

Blobs wrap a chunk of binary data to handle lifecycle management of data while it is passed between client and HarfBuzz.

Blobs are primarily used to create font faces, but also to access font face tables, as well as pass around other binary data.

Implementations

impl<'a> Blob<'a>[src]

pub fn new_read_only(data: &'a [u8]) -> Blob<'a>[src]

Create a new read-only blob.

The data is not copied, so it must outlive the Blob.

let data = vec![1; 256];
let blob = Blob::new_read_only(&data);
assert_eq!(blob.len(), 256);
assert!(!blob.is_empty());

pub fn new_from_arc_vec(data: Arc<Vec<u8>>) -> Blob<'static>[src]

Create a blob wrapping an Arc<Vec<u8>>.

This method allows creation of a blob without copying, where the data may be shared by Rust code and the blob. The Vec is freed when all references are dropped.

let data = vec![1; 256];
let blob = Blob::new_from_arc_vec(Arc::new(data));
assert_eq!(blob.len(), 256);
assert!(!blob.is_empty());

pub unsafe fn from_raw(raw: *mut hb_blob_t) -> Self[src]

Construct a Blob from a raw pointer. Takes ownership of the blob.

pub fn len(&self) -> usize[src]

Returns the size of the blob in bytes.

pub fn is_empty(&self) -> bool[src]

Returns true if the length is zero.

pub fn make_immutable(&mut self)[src]

Make this blob immutable.

pub fn is_immutable(&self) -> bool[src]

Returns true if the blob is immutable.

pub fn as_raw(&self) -> *mut hb_blob_t[src]

Borrows a raw pointer to the blob.

pub fn into_raw(self) -> *mut hb_blob_t[src]

Gives up ownership and returns a raw pointer to the blob.

Trait Implementations

impl<'a> Deref for Blob<'a>[src]

type Target = [u8]

The resulting type after dereferencing.

impl<'a> DerefMut for Blob<'a>[src]

impl<'a> Drop for Blob<'a>[src]

fn drop(&mut self)[src]

Decrement the reference count, and destroy the blob if the reference count is zero.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Blob<'a>

impl<'a> !Send for Blob<'a>

impl<'a> !Sync for Blob<'a>

impl<'a> Unpin for Blob<'a>

impl<'a> UnwindSafe for Blob<'a>

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.