[−][src]Struct harfbuzz::Blob
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.
Methods
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> Drop for Blob<'a>
[src]
fn drop(&mut self)
[src]
Decrement the reference count, and destroy the blob if the reference count is zero.
impl<'a> DerefMut for Blob<'a>
[src]
impl<'a> Deref for Blob<'a>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,