pub struct SegmentedAccount<'a, T: Pod + FixedLayout + HopperLayout> { /* private fields */ }Expand description
A segmented account with role-aware region access.
The account data is divided into a segment registry header followed by typed segments. Each segment has a role (Core, Extension, Journal, etc.) and can be accessed individually.
Implementations§
Source§impl<'a, T: Pod + FixedLayout + HopperLayout> SegmentedAccount<'a, T>
impl<'a, T: Pod + FixedLayout + HopperLayout> SegmentedAccount<'a, T>
Sourcepub fn from_account(
account: &'a AccountView,
program_id: &'a Address,
) -> Result<Self, ProgramError>
pub fn from_account( account: &'a AccountView, program_id: &'a Address, ) -> Result<Self, ProgramError>
Construct from an AccountView with header and owner validation.
Sourcepub fn registry(&self) -> Result<BorrowedSegmentRegistry<'_>, ProgramError>
pub fn registry(&self) -> Result<BorrowedSegmentRegistry<'_>, ProgramError>
Access the segment registry.
Sourcepub fn segment_by_index(
&self,
index: usize,
) -> Result<Ref<'_, [u8]>, ProgramError>
pub fn segment_by_index( &self, index: usize, ) -> Result<Ref<'_, [u8]>, ProgramError>
Read a segment’s raw bytes by index.
Sourcepub fn segment_data(
&self,
id: &SegmentId,
) -> Result<Ref<'_, [u8]>, ProgramError>
pub fn segment_data( &self, id: &SegmentId, ) -> Result<Ref<'_, [u8]>, ProgramError>
Read a segment’s data by its 4-byte ID.
Sourcepub fn segment_by_index_mut(
&self,
index: usize,
) -> Result<RefMut<'_, [u8]>, ProgramError>
pub fn segment_by_index_mut( &self, index: usize, ) -> Result<RefMut<'_, [u8]>, ProgramError>
Read a segment’s raw bytes mutably by index.
Sourcepub fn to_account_view(&self) -> &'a AccountView
pub fn to_account_view(&self) -> &'a AccountView
The underlying AccountView.
Auto Trait Implementations§
impl<'a, T> Freeze for SegmentedAccount<'a, T>
impl<'a, T> RefUnwindSafe for SegmentedAccount<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for SegmentedAccount<'a, T>where
T: Send,
impl<'a, T> Sync for SegmentedAccount<'a, T>where
T: Sync,
impl<'a, T> Unpin for SegmentedAccount<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for SegmentedAccount<'a, T>
impl<'a, T> UnwindSafe for SegmentedAccount<'a, T>where
T: UnwindSafe,
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