[−][src]Struct harfbuzz_rs::Owned
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.
pub fn to_shared(self) -> Shared<T>
[src]
Demotes an Owned
pointer to a Shared
pointer.
Use this method when you don't need exclusive (mutable) access to the
object anymore. For differences between Owned
and Shared
pointers
see the documentation on the respective structs.
Note that Shared<T>
also implements From<Owned<T>>
which allows
implicit conversions in many functions.
Trait Implementations
impl<T: Eq + HarfbuzzObject> Eq for Owned<T>
[src]
impl<T: HarfbuzzObject> Drop for Owned<T>
[src]
impl<T: PartialEq + HarfbuzzObject> PartialEq<Owned<T>> for Owned<T>
[src]
impl<'a> Default for Owned<Font<'a>>
[src]
impl<T: HarfbuzzObject> From<Owned<T>> for Shared<T>
[src]
impl<T: HarfbuzzObject> DerefMut for Owned<T>
[src]
impl<T: HarfbuzzObject> Deref for Owned<T>
[src]
impl<T: Debug + HarfbuzzObject> Debug for Owned<T>
[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 = !
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,