pub struct DynamicListVariableSlot<S> {
pub entity: EntityClassId,
pub variable: VariableId,
pub entity_type_name: &'static str,
pub variable_name: &'static str,
/* private fields */
}Expand description
Public dynamic list variable slot.
Fields§
§entity: EntityClassIdLogical entity class ID the slot is bound to.
variable: VariableIdLogical variable ID the slot is bound to.
entity_type_name: &'static strEntity type name, checked against the SolutionDescriptor on resolution.
variable_name: &'static strVariable name, checked against the SolutionDescriptor on resolution.
Implementations§
Source§impl<S> DynamicListVariableSlot<S>
impl<S> DynamicListVariableSlot<S>
Sourcepub fn try_with_access(
entity: EntityClassId,
variable: VariableId,
entity_type_name: &'static str,
variable_name: &'static str,
access: Arc<dyn DynamicListAccess<S>>,
) -> Result<Self, String>
pub fn try_with_access( entity: EntityClassId, variable: VariableId, entity_type_name: &'static str, variable_name: &'static str, access: Arc<dyn DynamicListAccess<S>>, ) -> Result<Self, String>
Fallible access constructor for integrations that compile a slot from runtime schema. This verifies that the object supplying mutations is bound to exactly the same logical entity and variable as the slot.
Integrations requiring immutable metadata can use
Self::with_access_and_metadata to validate both bindings together.
Sourcepub fn with_access_and_metadata(
entity: EntityClassId,
variable: VariableId,
entity_type_name: &'static str,
variable_name: &'static str,
access: Arc<dyn DynamicListAccess<S>>,
metadata: Arc<dyn DynamicListMetadata<S>>,
) -> Result<Self, String>
pub fn with_access_and_metadata( entity: EntityClassId, variable: VariableId, entity_type_name: &'static str, variable_name: &'static str, access: Arc<dyn DynamicListAccess<S>>, metadata: Arc<dyn DynamicListMetadata<S>>, ) -> Result<Self, String>
Constructs a slot with its immutable, structurally bound metadata.
Metadata identity is checked immediately; a binding implementation cannot accidentally be reused for a same-named variable in another entity class. Phase assembly remains responsible for rejecting a selected family whose specific capability bit is absent.
Sourcepub fn with_metadata(
self,
metadata: Arc<dyn DynamicListMetadata<S>>,
) -> Result<Self, String>
pub fn with_metadata( self, metadata: Arc<dyn DynamicListMetadata<S>>, ) -> Result<Self, String>
Attaches immutable metadata after access construction while preserving
the same structural identity validation as
Self::with_access_and_metadata.
Sourcepub fn resolve_descriptor_index(
&mut self,
descriptor: &SolutionDescriptor,
) -> Result<(), String>
pub fn resolve_descriptor_index( &mut self, descriptor: &SolutionDescriptor, ) -> Result<(), String>
Resolves this slot’s descriptor and variable indexes against descriptor.
Fails when the logical entity ID, entity type name, logical variable ID, variable name or variable kind do not match the descriptor, or when the slot was pre-bound to a different descriptor index.
Sourcepub fn resolved_against(
self,
descriptor: &SolutionDescriptor,
) -> Result<Self, String>
pub fn resolved_against( self, descriptor: &SolutionDescriptor, ) -> Result<Self, String>
Consuming form of resolve_descriptor_index.
Sourcepub fn is_descriptor_resolved(&self) -> bool
pub fn is_descriptor_resolved(&self) -> bool
Returns true once both the descriptor index and the variable index are resolved.
Sourcepub fn descriptor_index(&self) -> usize
pub fn descriptor_index(&self) -> usize
Index of this slot’s entity descriptor in the SolutionDescriptor.
§Panics
Panics if the slot has not been resolved against a SolutionDescriptor.
Sourcepub fn descriptor_variable_index(&self) -> usize
pub fn descriptor_variable_index(&self) -> usize
Index of this slot’s variable within its entity descriptor.
§Panics
Panics if the slot has not been resolved against a SolutionDescriptor.
Sourcepub fn matches_target(
&self,
entity_class: Option<&str>,
variable_name: Option<&str>,
) -> bool
pub fn matches_target( &self, entity_class: Option<&str>, variable_name: Option<&str>, ) -> bool
Returns true when this slot matches a configuration target; None for
either name matches any entity class or variable.
Sourcepub fn entity_count(&self, solution: &S) -> usize
pub fn entity_count(&self, solution: &S) -> usize
Number of rows of the bound entity class.
Sourcepub fn element_count(&self, solution: &S) -> usize
pub fn element_count(&self, solution: &S) -> usize
Number of declared elements the list variable distributes.
Sourcepub fn element(&self, solution: &S, element_index: usize) -> Option<usize>
pub fn element(&self, solution: &S, element_index: usize) -> Option<usize>
Element value at declared source index element_index; None when the element is missing.
Sourcepub fn assigned_elements(&self, solution: &S) -> Vec<usize>
pub fn assigned_elements(&self, solution: &S) -> Vec<usize>
Elements currently placed in any row’s list.
Sourcepub fn list_get(&self, solution: &S, row: usize, pos: usize) -> Option<usize>
pub fn list_get(&self, solution: &S, row: usize, pos: usize) -> Option<usize>
Element at pos in one row’s list; None when pos is out of range.
Sourcepub fn list_insert(
&self,
solution: &mut S,
row: usize,
pos: usize,
value: usize,
)
pub fn list_insert( &self, solution: &mut S, row: usize, pos: usize, value: usize, )
Inserts value at pos in one row’s list.
Sourcepub fn list_remove(
&self,
solution: &mut S,
row: usize,
pos: usize,
) -> Option<usize>
pub fn list_remove( &self, solution: &mut S, row: usize, pos: usize, ) -> Option<usize>
Removes and returns the element at pos in one row’s list; None when
pos is out of range.
Sourcepub fn access_capabilities(&self) -> DynamicListAccessCapabilities
pub fn access_capabilities(&self) -> DynamicListAccessCapabilities
Optional list operations the access binds.
Sourcepub fn list_set(
&self,
solution: &mut S,
row: usize,
pos: usize,
value: usize,
) -> bool
pub fn list_set( &self, solution: &mut S, row: usize, pos: usize, value: usize, ) -> bool
Overwrites the element at pos; returns false when the access does not bind set.
Sourcepub fn list_replace(
&self,
solution: &mut S,
row: usize,
values: Vec<usize>,
) -> bool
pub fn list_replace( &self, solution: &mut S, row: usize, values: Vec<usize>, ) -> bool
Replaces a complete list row as one logical mutation. Dynamic kernels use this for route replacement rather than composing remove/insert and accidentally publishing multiple dirty/revision transitions.
Sourcepub fn list_reverse(
&self,
solution: &mut S,
row: usize,
start: usize,
end: usize,
) -> bool
pub fn list_reverse( &self, solution: &mut S, row: usize, start: usize, end: usize, ) -> bool
Reverses positions start..end of one row’s list; returns false when
the access does not bind reverse.
Sourcepub fn sublist_remove(
&self,
solution: &mut S,
row: usize,
start: usize,
end: usize,
) -> Option<Vec<usize>>
pub fn sublist_remove( &self, solution: &mut S, row: usize, start: usize, end: usize, ) -> Option<Vec<usize>>
Removes and returns positions start..end of one row’s list; None
when the access does not bind sublist operations.
Sourcepub fn sublist_insert(
&self,
solution: &mut S,
row: usize,
pos: usize,
values: Vec<usize>,
) -> bool
pub fn sublist_insert( &self, solution: &mut S, row: usize, pos: usize, values: Vec<usize>, ) -> bool
Inserts values at pos in one row’s list; returns false when the
access does not bind sublist operations.
Sourcepub fn metadata(&self) -> Option<&dyn DynamicListMetadata<S>>
pub fn metadata(&self) -> Option<&dyn DynamicListMetadata<S>>
Returns slot-bound metadata when the integration compiled it.
Absence is intentional and must cause a selected metadata-dependent phase to fail validation; it is never a request to synthesize defaults.
Sourcepub fn metadata_capabilities(&self) -> Option<DynamicListMetadataCapabilities>
pub fn metadata_capabilities(&self) -> Option<DynamicListMetadataCapabilities>
Capabilities of the attached metadata; None when no metadata is attached.
Sourcepub fn require_metadata(&self) -> Result<&dyn DynamicListMetadata<S>, String>
pub fn require_metadata(&self) -> Result<&dyn DynamicListMetadata<S>, String>
Returns the attached metadata, or an error naming the slot when none is attached.
Source§impl<S> DynamicListVariableSlot<S>where
S: DynamicModelBackend,
impl<S> DynamicListVariableSlot<S>where
S: DynamicModelBackend,
Sourcepub fn new(
entity: EntityClassId,
variable: VariableId,
entity_type_name: &'static str,
variable_name: &'static str,
) -> Self
pub fn new( entity: EntityClassId, variable: VariableId, entity_type_name: &'static str, variable_name: &'static str, ) -> Self
Creates a slot whose access is the model backend itself, without metadata.
Sourcepub fn new_with_metadata(
entity: EntityClassId,
variable: VariableId,
entity_type_name: &'static str,
variable_name: &'static str,
metadata: Arc<dyn DynamicListMetadata<S>>,
) -> Result<Self, String>
pub fn new_with_metadata( entity: EntityClassId, variable: VariableId, entity_type_name: &'static str, variable_name: &'static str, metadata: Arc<dyn DynamicListMetadata<S>>, ) -> Result<Self, String>
Backend-access convenience constructor with immutable metadata.