pub struct DeclarationCollector { /* private fields */ }Expand description
DeclarationCollector
Mutable builder for this binary’s allocation declarations.
The collector is transient runtime state. Sealing rejects duplicate stable
keys and duplicate slots within one binary snapshot; historical compatibility
is checked later by crate::validate_allocations.
Implementations§
Source§impl DeclarationCollector
impl DeclarationCollector
Sourcepub fn push(&mut self, declaration: AllocationDeclaration)
pub fn push(&mut self, declaration: AllocationDeclaration)
Add one allocation declaration.
Sourcepub fn declare(&mut self, declaration: AllocationDeclaration) -> &mut Self
pub fn declare(&mut self, declaration: AllocationDeclaration) -> &mut Self
Add one allocation declaration and return the collector for chaining.
Sourcepub fn with_declaration(self, declaration: AllocationDeclaration) -> Self
pub fn with_declaration(self, declaration: AllocationDeclaration) -> Self
Add one allocation declaration by value for builder-style chaining.
Sourcepub fn declare_memory_manager(
&mut self,
stable_key: impl AsRef<str>,
id: u8,
label: impl Into<String>,
) -> Result<&mut Self, DeclarationSnapshotError>
pub fn declare_memory_manager( &mut self, stable_key: impl AsRef<str>, id: u8, label: impl Into<String>, ) -> Result<&mut Self, DeclarationSnapshotError>
Add a MemoryManager declaration with a diagnostic label.
Sourcepub fn declare_memory_manager_unlabeled(
&mut self,
stable_key: impl AsRef<str>,
id: u8,
) -> Result<&mut Self, DeclarationSnapshotError>
pub fn declare_memory_manager_unlabeled( &mut self, stable_key: impl AsRef<str>, id: u8, ) -> Result<&mut Self, DeclarationSnapshotError>
Add an unlabeled MemoryManager declaration.
Sourcepub fn declare_memory_manager_with_schema(
&mut self,
stable_key: impl AsRef<str>,
id: u8,
label: impl Into<String>,
schema: SchemaMetadata,
) -> Result<&mut Self, DeclarationSnapshotError>
pub fn declare_memory_manager_with_schema( &mut self, stable_key: impl AsRef<str>, id: u8, label: impl Into<String>, schema: SchemaMetadata, ) -> Result<&mut Self, DeclarationSnapshotError>
Add a MemoryManager declaration with a diagnostic label and schema metadata.
Sourcepub fn declare_memory_manager_unlabeled_with_schema(
&mut self,
stable_key: impl AsRef<str>,
id: u8,
schema: SchemaMetadata,
) -> Result<&mut Self, DeclarationSnapshotError>
pub fn declare_memory_manager_unlabeled_with_schema( &mut self, stable_key: impl AsRef<str>, id: u8, schema: SchemaMetadata, ) -> Result<&mut Self, DeclarationSnapshotError>
Add an unlabeled MemoryManager declaration with schema metadata.
Sourcepub fn with_memory_manager(
self,
stable_key: impl AsRef<str>,
id: u8,
label: impl Into<String>,
) -> Result<Self, DeclarationSnapshotError>
pub fn with_memory_manager( self, stable_key: impl AsRef<str>, id: u8, label: impl Into<String>, ) -> Result<Self, DeclarationSnapshotError>
Add a MemoryManager declaration by value for builder-style chaining.
Sourcepub fn with_memory_manager_unlabeled(
self,
stable_key: impl AsRef<str>,
id: u8,
) -> Result<Self, DeclarationSnapshotError>
pub fn with_memory_manager_unlabeled( self, stable_key: impl AsRef<str>, id: u8, ) -> Result<Self, DeclarationSnapshotError>
Add an unlabeled MemoryManager declaration by value for builder-style chaining.
Sourcepub fn with_memory_manager_schema(
self,
stable_key: impl AsRef<str>,
id: u8,
label: impl Into<String>,
schema: SchemaMetadata,
) -> Result<Self, DeclarationSnapshotError>
pub fn with_memory_manager_schema( self, stable_key: impl AsRef<str>, id: u8, label: impl Into<String>, schema: SchemaMetadata, ) -> Result<Self, DeclarationSnapshotError>
Add a MemoryManager declaration with schema metadata by value for builder-style chaining.
Sourcepub fn with_memory_manager_unlabeled_schema(
self,
stable_key: impl AsRef<str>,
id: u8,
schema: SchemaMetadata,
) -> Result<Self, DeclarationSnapshotError>
pub fn with_memory_manager_unlabeled_schema( self, stable_key: impl AsRef<str>, id: u8, schema: SchemaMetadata, ) -> Result<Self, DeclarationSnapshotError>
Add an unlabeled MemoryManager declaration with schema metadata by value.
Sourcepub fn seal(self) -> Result<DeclarationSnapshot, DeclarationSnapshotError>
pub fn seal(self) -> Result<DeclarationSnapshot, DeclarationSnapshotError>
Seal collected declarations into a duplicate-free snapshot.
Trait Implementations§
Source§impl Clone for DeclarationCollector
impl Clone for DeclarationCollector
Source§fn clone(&self) -> DeclarationCollector
fn clone(&self) -> DeclarationCollector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more