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. Construction and decoding check the stable key, slot and schema metadata. A declaration becomes authoritative only after validation against the recovered ledger and commitment in a generation.
Implementations§
Source§impl AllocationDeclaration
impl AllocationDeclaration
Sourcepub fn new(
stable_key: impl AsRef<str>,
slot: MemoryManagerSlot,
schema: SchemaMetadata,
) -> Result<Self, DeclarationSnapshotError>
pub fn new( stable_key: impl AsRef<str>, slot: MemoryManagerSlot, 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,
) -> Result<Self, DeclarationSnapshotError>
pub fn memory_manager( stable_key: impl AsRef<str>, id: u8, ) -> Result<Self, DeclarationSnapshotError>
Build a checked MemoryManager declaration with default schema metadata.
Sourcepub fn memory_manager_with_schema(
stable_key: impl AsRef<str>,
id: u8,
schema: SchemaMetadata,
) -> Result<Self, DeclarationSnapshotError>
pub fn memory_manager_with_schema( stable_key: impl AsRef<str>, id: u8, schema: SchemaMetadata, ) -> Result<Self, DeclarationSnapshotError>
Build a checked 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) -> &MemoryManagerSlot
pub const fn slot(&self) -> &MemoryManagerSlot
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§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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for AllocationDeclaration
Source§impl PartialEq for AllocationDeclaration
impl PartialEq for AllocationDeclaration
Source§impl Serialize for AllocationDeclaration
impl Serialize for AllocationDeclaration
impl StructuralPartialEq for AllocationDeclaration
Auto Trait Implementations§
impl Freeze for AllocationDeclaration
impl RefUnwindSafe for AllocationDeclaration
impl Send for AllocationDeclaration
impl Sync for AllocationDeclaration
impl Unpin for AllocationDeclaration
impl UnsafeUnpin for AllocationDeclaration
impl UnwindSafe for AllocationDeclaration
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
Mutably borrows from an owned value. Read more