pub struct Library(/* private fields */);Expand description
A collection of compiled shader functions.
C++ equivalent: MTL::Library
Implementations§
Source§impl Library
impl Library
Sourcepub fn label(&self) -> Option<String>
pub fn label(&self) -> Option<String>
Get the label for this library.
C++ equivalent: NS::String* label() const
Sourcepub fn set_label(&self, label: &str)
pub fn set_label(&self, label: &str)
Set the label for this library.
C++ equivalent: void setLabel(const NS::String*)
Sourcepub fn device(&self) -> Device
pub fn device(&self) -> Device
Get the device that created this library.
C++ equivalent: Device* device() const
Sourcepub fn library_type(&self) -> LibraryType
pub fn library_type(&self) -> LibraryType
Get the library type.
C++ equivalent: LibraryType type() const
Sourcepub fn install_name(&self) -> Option<String>
pub fn install_name(&self) -> Option<String>
Get the install name (for dynamic libraries).
C++ equivalent: NS::String* installName() const
Sourcepub fn new_function_with_name(&self, name: &str) -> Option<Function>
pub fn new_function_with_name(&self, name: &str) -> Option<Function>
Get a function by name.
C++ equivalent: Function* newFunction(const NS::String* name)
Sourcepub unsafe fn new_function_with_name_and_constants(
&self,
name: &str,
constant_values: *const c_void,
) -> Result<Function, Error>
pub unsafe fn new_function_with_name_and_constants( &self, name: &str, constant_values: *const c_void, ) -> Result<Function, Error>
Get a function by name with constant values.
C++ equivalent: Function* newFunction(const NS::String*, const FunctionConstantValues*, NS::Error**)
§Safety
The constant_values pointer must be valid if not null.
Sourcepub fn function_names(&self) -> Vec<String>
pub fn function_names(&self) -> Vec<String>
Get all function names in the library.
C++ equivalent: NS::Array* functionNames() const
Sourcepub fn new_function_with_descriptor(
&self,
descriptor: &FunctionDescriptor,
) -> Result<Function, Error>
pub fn new_function_with_descriptor( &self, descriptor: &FunctionDescriptor, ) -> Result<Function, Error>
Create a function with a descriptor.
C++ equivalent: Function* newFunction(const FunctionDescriptor*, NS::Error**)
Sourcepub fn new_intersection_function(
&self,
descriptor: &IntersectionFunctionDescriptor,
) -> Result<Function, Error>
pub fn new_intersection_function( &self, descriptor: &IntersectionFunctionDescriptor, ) -> Result<Function, Error>
Create an intersection function with a descriptor.
C++ equivalent: Function* newIntersectionFunction(const IntersectionFunctionDescriptor*, NS::Error**)
Sourcepub fn reflection_for_function(&self, name: &str) -> Option<FunctionReflection>
pub fn reflection_for_function(&self, name: &str) -> Option<FunctionReflection>
Get reflection information for a function by name.
C++ equivalent: FunctionReflection* reflectionForFunction(const NS::String*)
Sourcepub fn new_function_with_name_and_constants_async<F>(
&self,
name: &str,
constant_values: &FunctionConstantValues,
completion_handler: F,
)
pub fn new_function_with_name_and_constants_async<F>( &self, name: &str, constant_values: &FunctionConstantValues, completion_handler: F, )
Create a function with constant values asynchronously.
C++ equivalent: void newFunction(const NS::String*, const FunctionConstantValues*, void (^)(Function*, Error*))
Sourcepub fn new_function_with_descriptor_async<F>(
&self,
descriptor: &FunctionDescriptor,
completion_handler: F,
)
pub fn new_function_with_descriptor_async<F>( &self, descriptor: &FunctionDescriptor, completion_handler: F, )
Create a function with a descriptor asynchronously.
C++ equivalent: void newFunction(const FunctionDescriptor*, void (^)(Function*, Error*))
Sourcepub fn new_intersection_function_async<F>(
&self,
descriptor: &IntersectionFunctionDescriptor,
completion_handler: F,
)
pub fn new_intersection_function_async<F>( &self, descriptor: &IntersectionFunctionDescriptor, completion_handler: F, )
Create an intersection function with a descriptor asynchronously.
C++ equivalent: void newIntersectionFunction(const IntersectionFunctionDescriptor*, void (^)(Function*, Error*))