pub struct TypedSegment<T: Pod, const OFFSET: u32> { /* private fields */ }Expand description
Compile-time typed segment descriptor: T is the overlay type,
OFFSET is the absolute byte offset from the start of account
data. Zero-sized.
ⓘ
// Matches Vault.balance at body offset 0, past the 16-byte header:
const VAULT_BALANCE: TypedSegment<WireU64, { HopperHeader::SIZE as u32 }>
= TypedSegment::new();
let bal = account.segment_ref_typed(&mut borrows, VAULT_BALANCE)?;Implementations§
Source§impl<T: Pod, const OFFSET: u32> TypedSegment<T, OFFSET>
impl<T: Pod, const OFFSET: u32> TypedSegment<T, OFFSET>
Trait Implementations§
Source§impl<T: Clone + Pod, const OFFSET: u32> Clone for TypedSegment<T, OFFSET>
impl<T: Clone + Pod, const OFFSET: u32> Clone for TypedSegment<T, OFFSET>
Source§fn clone(&self) -> TypedSegment<T, OFFSET>
fn clone(&self) -> TypedSegment<T, OFFSET>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Default + Pod, const OFFSET: u32> Default for TypedSegment<T, OFFSET>
impl<T: Default + Pod, const OFFSET: u32> Default for TypedSegment<T, OFFSET>
Source§fn default() -> TypedSegment<T, OFFSET>
fn default() -> TypedSegment<T, OFFSET>
Returns the “default value” for a type. Read more
impl<T: Copy + Pod, const OFFSET: u32> Copy for TypedSegment<T, OFFSET>
Auto Trait Implementations§
impl<T, const OFFSET: u32> Freeze for TypedSegment<T, OFFSET>
impl<T, const OFFSET: u32> RefUnwindSafe for TypedSegment<T, OFFSET>
impl<T, const OFFSET: u32> Send for TypedSegment<T, OFFSET>
impl<T, const OFFSET: u32> Sync for TypedSegment<T, OFFSET>
impl<T, const OFFSET: u32> Unpin for TypedSegment<T, OFFSET>
impl<T, const OFFSET: u32> UnsafeUnpin for TypedSegment<T, OFFSET>
impl<T, const OFFSET: u32> UnwindSafe for TypedSegment<T, OFFSET>
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