[−][src]Struct harfbuzz_rs::Shared
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_owned(raw: *mut T::Raw) -> Self
[src]
Creates a Shared
from an owned 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 unsafe fn from_raw_ref(raw: *mut T::Raw) -> Self
[src]
Creates a Shared
by cloning a raw harfbuzz pointer.
The original pointer can still be safely used but must be released at the end to avoid memory leaks.
Trait Implementations
impl<T: Eq + HarfbuzzObject> Eq for Shared<T>
[src]
impl<T: HarfbuzzObject> Clone for Shared<T>
[src]
fn clone(&self) -> Self
[src]
Returns a copy and increases the reference count.
This behaviour is exactly like Arc::clone
in the standard library.
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: HarfbuzzObject + Sync + Send> Send for Shared<T>
[src]
impl<T: HarfbuzzObject> Drop for Shared<T>
[src]
impl<T: PartialEq + HarfbuzzObject> PartialEq<Shared<T>> for Shared<T>
[src]
impl<T: HarfbuzzObject + Sync + Send> Sync for Shared<T>
[src]
impl<'a> Default for Shared<Font<'a>>
[src]
impl<'a, T> From<T> for Shared<Blob<'a>> where
T: 'a + Send + AsRef<[u8]>,
[src]
T: 'a + Send + AsRef<[u8]>,
impl<T: HarfbuzzObject> From<Owned<T>> for Shared<T>
[src]
impl<T: HarfbuzzObject> Deref for Shared<T>
[src]
impl<T: Debug + HarfbuzzObject> Debug for Shared<T>
[src]
impl<T: HarfbuzzObject> Borrow<T> for Shared<T>
[src]
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)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,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,