pub struct ModelEntry { /* private fields */ }Expand description
One model a host can offer: its declarations, and the factory that builds it on any device.
Cheap to clone. Clones share the declarations and the factory.
Implementations§
Source§impl ModelEntry
impl ModelEntry
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Stable id that identifies the model in a model set, on the command line and in a spec file.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
One-line description shown in the UI.
Sourcepub fn param_descriptors(&self) -> &[ParamDescriptor]
pub fn param_descriptors(&self) -> &[ParamDescriptor]
Every parameter, in the order a build reads its values.
Sourcepub fn stat_descriptors(&self) -> &[StatDescriptor]
pub fn stat_descriptors(&self) -> &[StatDescriptor]
Stats the model reports, in the order its state returns them.
Sourcepub fn action_descriptors(&self) -> &[ActionDescriptor]
pub fn action_descriptors(&self) -> &[ActionDescriptor]
One-off steps the model offers, in the order the Parameters panel draws their buttons.
Sourcepub fn topology_hint(&self) -> TopologyHint
pub fn topology_hint(&self) -> TopologyHint
Display layers the model presents.
Sourcepub fn metadata(&self) -> &ModelMetadata
pub fn metadata(&self) -> &ModelMetadata
Declared facts about the model, derived from its trait consts.
Sourcepub fn schema(&self) -> ModelSchema<'_>
pub fn schema(&self) -> ModelSchema<'_>
Declarations a plan checks a spec against, readable with no device.
Sourcepub fn gpu_needs(&self) -> Option<GpuNeeds>
pub fn gpu_needs(&self) -> Option<GpuNeeds>
Device needs above the WebGPU baseline. None for a CPU model.
Sourcepub fn source(&self) -> &ModelSource
pub fn source(&self) -> &ModelSource
Origin of the model’s code: its type path always, and the registering crate’s build once a set records it.
Sourcepub fn param_index(&self, id: &str) -> Option<usize>
pub fn param_index(&self, id: &str) -> Option<usize>
Returns the position of parameter id in Self::param_descriptors.
Sourcepub fn action_index(&self, id: &str) -> Option<usize>
pub fn action_index(&self, id: &str) -> Option<usize>
Returns the position of action id in Self::action_descriptors.
Sourcepub fn setup(&self) -> RunSetup
pub fn setup(&self) -> RunSetup
Returns a setup at the declared defaults, the default seed and no actions.
Sourcepub fn build(
&self,
params: &[ParamValue],
seed: Option<u64>,
gpu: Option<&GpuContext>,
) -> Result<ModelState, Fault>
pub fn build( &self, params: &[ParamValue], seed: Option<u64>, gpu: Option<&GpuContext>, ) -> Result<ModelState, Fault>
Sourcepub fn demand(&self, params: &[ParamValue], limits: &Limits) -> Option<Demand>
pub fn demand(&self, params: &[ParamValue], limits: &Limits) -> Option<Demand>
Returns the device resources the model would allocate at params on a device with limits.
Returns None for a CPU model. It allocates on the host and knows its footprint only once built.
Sourcepub fn shortfalls(&self, params: &[ParamValue], limits: &Limits) -> Vec<String>
pub fn shortfalls(&self, params: &[ParamValue], limits: &Limits) -> Vec<String>
Returns the reasons a device with limits cannot build the model at params, empty when it can.
Trait Implementations§
Source§impl Clone for ModelEntry
impl Clone for ModelEntry
Auto Trait Implementations§
impl !RefUnwindSafe for ModelEntry
impl !UnwindSafe for ModelEntry
impl Freeze for ModelEntry
impl Send for ModelEntry
impl Sync for ModelEntry
impl Unpin for ModelEntry
impl UnsafeUnpin for ModelEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more