pub struct AllocationDeclaration { /* private fields */ }Expand description
AllocationDeclaration
Checked runtime claim that a stable key should own an allocation slot.
Declarations are supplied by the current binary before opening storage. Constructors validate the stable key, slot descriptor, label, and schema metadata, but a declaration is not authoritative until it has been validated against the recovered ledger and committed as part of a generation.
Implementations§
Source§impl AllocationDeclaration
impl AllocationDeclaration
Sourcepub fn new(
stable_key: impl AsRef<str>,
slot: AllocationSlotDescriptor,
label: Option<String>,
schema: SchemaMetadata,
) -> Result<Self, DeclarationSnapshotError>
pub fn new( stable_key: impl AsRef<str>, slot: AllocationSlotDescriptor, label: Option<String>, schema: SchemaMetadata, ) -> Result<Self, DeclarationSnapshotError>
Build a declaration from raw parts after validating diagnostic metadata.
Sourcepub fn memory_manager(
stable_key: impl AsRef<str>,
id: u8,
label: impl Into<String>,
) -> Result<Self, DeclarationSnapshotError>
pub fn memory_manager( stable_key: impl AsRef<str>, id: u8, label: impl Into<String>, ) -> Result<Self, DeclarationSnapshotError>
Build a MemoryManager declaration with a diagnostic label.
Sourcepub fn memory_manager_unlabeled(
stable_key: impl AsRef<str>,
id: u8,
) -> Result<Self, DeclarationSnapshotError>
pub fn memory_manager_unlabeled( stable_key: impl AsRef<str>, id: u8, ) -> Result<Self, DeclarationSnapshotError>
Build an unlabeled MemoryManager declaration.
Sourcepub fn memory_manager_with_schema(
stable_key: impl AsRef<str>,
id: u8,
label: impl Into<String>,
schema: SchemaMetadata,
) -> Result<Self, DeclarationSnapshotError>
pub fn memory_manager_with_schema( stable_key: impl AsRef<str>, id: u8, label: impl Into<String>, schema: SchemaMetadata, ) -> Result<Self, DeclarationSnapshotError>
Build a MemoryManager declaration with a diagnostic label and schema metadata.
Sourcepub fn memory_manager_unlabeled_with_schema(
stable_key: impl AsRef<str>,
id: u8,
schema: SchemaMetadata,
) -> Result<Self, DeclarationSnapshotError>
pub fn memory_manager_unlabeled_with_schema( stable_key: impl AsRef<str>, id: u8, schema: SchemaMetadata, ) -> Result<Self, DeclarationSnapshotError>
Build an unlabeled MemoryManager declaration with schema metadata.
Sourcepub const fn stable_key(&self) -> &StableKey
pub const fn stable_key(&self) -> &StableKey
Return the durable stable key claimed by this declaration.
Sourcepub const fn slot(&self) -> &AllocationSlotDescriptor
pub const fn slot(&self) -> &AllocationSlotDescriptor
Return the allocation slot claimed by this declaration.
Sourcepub const fn schema(&self) -> &SchemaMetadata
pub const fn schema(&self) -> &SchemaMetadata
Return the optional schema metadata.
Trait Implementations§
Source§impl Clone for AllocationDeclaration
impl Clone for AllocationDeclaration
Source§fn clone(&self) -> AllocationDeclaration
fn clone(&self) -> AllocationDeclaration
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AllocationDeclaration
impl Debug for AllocationDeclaration
Source§impl<'de> Deserialize<'de> for AllocationDeclaration
impl<'de> Deserialize<'de> for AllocationDeclaration
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AllocationDeclaration
impl PartialEq for AllocationDeclaration
Source§fn eq(&self, other: &AllocationDeclaration) -> bool
fn eq(&self, other: &AllocationDeclaration) -> bool
self and other values to be equal, and is used by ==.