Struct harfbuzz_rs::Owned
[−]
[src]
pub struct Owned<T: HarfbuzzObject> { /* fields omitted */ }
A smart pointer that wraps a singly owned harfbuzz object.
A Owned
is used to wrap freshly created owned HarfBuzz objects. It permits mutable, non-shared
access to the enclosed HarfBuzz value so it can be used e.g. to set up a Font
or Face
after
its creation.
There is no safe way to construct an Owned
pointer and usually you don't need to create a
Owned
yourself, but get it from another function in this crate.
You can just use the methods of the wrapped object through its Deref
implementation.
Interaction with Shared
When you are finished mutating the inner value, you usually want to pass it to other HarfBuzz
functions that expect shared access. Thus you need to convert the Owned
to a Shared
pointer
using .into()
. Note however that once a value is
converted to a Shared<T>
, it will not possible to mutate it anymore.
Methods
impl<T: HarfbuzzObject> Owned<T>
[src]
pub unsafe fn from_raw(raw: *mut T::Raw) -> Self
[src]
Creates a Owned
safely wrapping a raw harfbuzz pointer.
This fully transfers ownership. Use of the original pointer is now forbidden! Unsafe because a dereference of a raw pointer is necessary.
Use this only to wrap freshly created HarfBuzz object that is not shared!
pub fn into_raw(owned: Owned<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.
Trait Implementations
impl<T: HarfbuzzObject> From<Owned<T>> for Shared<T>
[src]
impl<T: Debug + HarfbuzzObject> Debug for Owned<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 Owned<T> where
T::Raw: PartialEq,
[src]
T::Raw: PartialEq,
fn eq(&self, __arg_0: &Owned<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: &Owned<T>) -> bool
[src]
This method tests for !=
.
impl<T: Eq + HarfbuzzObject> Eq for Owned<T> where
T::Raw: Eq,
[src]
T::Raw: Eq,
impl<T: HarfbuzzObject> Drop for Owned<T>
[src]
impl<T: HarfbuzzObject> Deref for Owned<T>
[src]
type Target = T
The resulting type after dereferencing.
ⓘImportant traits for &'a mut Wfn deref(&self) -> &T
[src]
Dereferences the value.