[−][src]Trait harfbuzz_rs::HarfbuzzObject
A trait which is implemented for all harffbuzz wrapper structs. It exposes common functionality for converting from and to the underlying raw harfbuzz pointers that are useful for ffi.
Safety
This trait may only be implemented for structs that are zero-sized and is therefore unsafe to implement.
Associated Types
type Raw
Type of the raw harfbuzz object.
Required methods
unsafe fn from_raw(val: *const Self::Raw) -> Self
Creates a reference from a harfbuzz object pointer.
Unsafe because a raw pointer may be accessed. The reference count is not changed. Should not be called directly by a library user.
Use the Owned and Shared abstractions instead.
fn as_raw(&self) -> *mut Self::Raw
Returns the underlying harfbuzz object pointer.
The caller must ensure, that this pointer is not used after self
's
destruction.
unsafe fn reference(&self)
Increases the reference count of the HarfBuzz object.
Wraps a hb_TYPE_reference()
call.
Safety
While no undefined behavior can be introduced only by increasing the reference count (I think) this method is still marked unsafe since there should be no need for it to be called from safe code.
unsafe fn dereference(&self)
Decreases the reference count of the HarfBuzz object and destroys it if the reference count reaches zero.
Wraps a hb_TYPE_destroy()
call.
Safety
You always have to call reference
first before using this method.
Otherwise you might accidentally hold on to already destroyed objects
and causing UB.