Skip to main content

ZL_MaterializerDesc_s

Struct ZL_MaterializerDesc_s 

Source
#[repr(C)]
pub struct ZL_MaterializerDesc_s { pub materializeFn: Option<unsafe extern "C" fn(matCtx: *mut ZL_Materializer, params: *const ZL_LocalParams) -> ZL_Result_ZL_VoidPtr>, pub dematerializeFn: Option<unsafe extern "C" fn(matCtx: *mut ZL_Materializer, materialized: *mut c_void)>, pub paramId: c_int, pub opaque: *const c_void, }
Expand description

@brief Descriptor for materializing and dematerializing local params

This structure defines functions to materialize an in-memory object from local parameters and to dematerialize (free) that object.

Materialized objects are available as a @ref ZL_RefParam via the typical local params access methods. Specify the retrieval key with the paramId field.

Fields§

§materializeFn: Option<unsafe extern "C" fn(matCtx: *mut ZL_Materializer, params: *const ZL_LocalParams) -> ZL_Result_ZL_VoidPtr>

@brief A custom function that materializes an in-memory object from a provided @p params object.

This function may arbitrarily use none, any, or all of the provided local params to generate the materialized object, but the generation MUST be deterministic and hermetic. In particular, materialization shall not depend on variables other than the provided @ref ZL_LocalParams object.

Materialized object lifetimes will be managed by the @ref ZL_Compressor on which the node is registered/parameterized. Objects will be materialized around the time of node registration/parameterization and will remain allocated for the lifetime of the associated @ref ZL_Compressor.

Do NOT rely on the materialization function being called at any specific time to do side-effect work. Doing so will result in undefined behavior.

The @ref ZL_Compressor may arbitrarily share the same materialized object between multiple nodes with the same @p params and the @ref ZL_CCtx may provide concurrent access to materialized objects. DO NOT attempt to modify the materialized object after creation, either directly or via API getters.

@param matCtx A pointer to a materializer context object associated with the @ref ZL_Compressor. The materialization function may use this to request managed memory from the ZL_Compressor as an alternative to managing allocations itself and via the dematerializeFn. @param params A pointer to the local params object to materialize. The provided params have no lifetime guarantees past the invocation of this function. You may not hold references into the params object in the materialized object.

@returns A ZL_RESULT containing a pointer to the materialized object on success, or an error. Returning NULL as a valid result (when there’s nothing to materialize) should be wrapped in ZL_WRAP_VALUE(NULL). Ensure the function declares a result scope with ZL_RESULT_DECLARE_SCOPE or you will get a compiler error.

§dematerializeFn: Option<unsafe extern "C" fn(matCtx: *mut ZL_Materializer, materialized: *mut c_void)>

@brief A custom function that destructs a materialized object.

You should use this to deallocate all non-arena memory and free any held resources. As a convenience, if there are no resources or memory to free, you may use ZL_NOOP_DEMATERIALIZE as a placeholder.

§paramId: c_int

The paramId to use for the materialized param. If there is an existing param that uses this paramId, the registration will fail.

§opaque: *const c_void

Optionally an opaque pointer that can be queried with ZL_Materializer_getOpaquePtr(). OpenZL does not take ownership of this pointer. If lifetime extension is needed, it should be managed by the ZL_OpaquePtr in the outer ZL_MIEncoderDesc.

Trait Implementations§

Source§

impl Clone for ZL_MaterializerDesc_s

Source§

fn clone(&self) -> ZL_MaterializerDesc_s

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ZL_MaterializerDesc_s

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for ZL_MaterializerDesc_s

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.