Struct harfbuzz_rs::Shared
[−]
[src]
pub struct Shared<T: HarfbuzzObject> { /* fields omitted */ }
A smart pointer that wraps an atomically reference counted HarfBuzz object.
Usually you don't create a Shared
yourself, but get it from another function in this crate.
You can just use the methods of the wrapped object through its Deref
implementation.
A Shared
is a safe wrapper for reference counted HarfBuzz objects and provides shared immutable
access to its inner object. As HarfBuzz' objects are all thread-safe Shared
implements Send
and Sync
.
Tries to mirror the stdlib Arc
interface where applicable as HarfBuzz' reference counting has
similar semantics.
Methods
impl<T: HarfbuzzObject> Shared<T>
[src]
pub unsafe fn from_raw(raw: *mut T::Raw) -> Self
[src]
Creates a Shared
from a raw harfbuzz pointer.
Transfers ownership. Use of the original pointer is now forbidden! Unsafe because dereferencing a raw pointer is necessary.
pub fn into_raw(shared: Shared<T>) -> *mut T::Raw
[src]
Converts self
into the underlying harfbuzz object pointer value. The resulting pointer
has to be manually destroyed using hb_TYPE_destroy
or be converted back into the wrapper
using the from_raw
function to avoid leaking memory.
pub fn from_ref(reference: &T) -> Self
[src]
Trait Implementations
impl<'a, T> From<T> for Shared<Blob<'a>> where
T: 'static + Send + AsRef<[u8]>,
[src]
T: 'static + Send + AsRef<[u8]>,
impl<T: Debug + HarfbuzzObject> Debug for Shared<T> where
T::Raw: Debug,
[src]
T::Raw: Debug,
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: PartialEq + HarfbuzzObject> PartialEq for Shared<T> where
T::Raw: PartialEq,
[src]
T::Raw: PartialEq,
fn eq(&self, __arg_0: &Shared<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Shared<T>) -> bool
[src]
This method tests for !=
.
impl<T: Eq + HarfbuzzObject> Eq for Shared<T> where
T::Raw: Eq,
[src]
T::Raw: Eq,
impl<T: HarfbuzzObject> Clone for Shared<T>
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: HarfbuzzObject> Deref for Shared<T>
[src]
type Target = T
The resulting type after dereferencing.
ⓘImportant traits for &'a mut Wfn deref(&self) -> &T
[src]
Dereferences the value.
impl<T: HarfbuzzObject> Borrow<T> for Shared<T>
[src]
ⓘImportant traits for &'a mut Wfn borrow(&self) -> &T
[src]
Immutably borrows from an owned value. Read more