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]

[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!

[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]

[src]

Performs the conversion.

impl<T: Debug + HarfbuzzObject> Debug for Owned<T> where
    T::Raw: Debug
[src]

[src]

Formats the value using the given formatter. Read more

impl<T: PartialEq + HarfbuzzObject> PartialEq for Owned<T> where
    T::Raw: PartialEq
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<T: Eq + HarfbuzzObject> Eq for Owned<T> where
    T::Raw: Eq
[src]

impl<T: HarfbuzzObject> Drop for Owned<T>
[src]

[src]

Executes the destructor for this type. Read more

impl<T: HarfbuzzObject> Deref for Owned<T>
[src]

The resulting type after dereferencing.

Important traits for &'a mut W
[src]

Dereferences the value.

impl<T: HarfbuzzObject> DerefMut for Owned<T>
[src]

Important traits for &'a mut W
[src]

Mutably dereferences the value.

Auto Trait Implementations

impl<T> !Send for Owned<T>

impl<T> !Sync for Owned<T>