Struct harfbuzz::Blob [−][src]
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]
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.