pub struct ReturnData { /* private fields */ }Expand description
Stack-backed snapshot of CPI return data.
The 1 KiB buffer is deliberately left uninitialized until the
sol_get_return_data syscall fills it; only the syscall-initialized prefix
(data_len bytes) is ever exposed to callers.
Implementations§
Source§impl ReturnData
impl ReturnData
Sourcepub const fn program_id(&self) -> &Address
pub const fn program_id(&self) -> &Address
Program id that set this return data.
Sourcepub const fn actual_len(&self) -> usize
pub const fn actual_len(&self) -> usize
Runtime-reported byte length before truncation to Hopper’s stack buffer.
Sourcepub const fn is_truncated(&self) -> bool
pub const fn is_truncated(&self) -> bool
Whether the runtime reported more bytes than Hopper copied.
Sourcepub fn copy_to(&self, dst: &mut [u8]) -> ProgramResult
pub fn copy_to(&self, dst: &mut [u8]) -> ProgramResult
Copy return bytes into dst.
Sourcepub fn read_pod<T: Pod>(&self) -> Result<T, ProgramError>
pub fn read_pod<T: Pod>(&self) -> Result<T, ProgramError>
Read a Pod value from the first bytes of the return-data payload.
Trait Implementations§
Source§impl Clone for ReturnData
impl Clone for ReturnData
Auto Trait Implementations§
impl Freeze for ReturnData
impl RefUnwindSafe for ReturnData
impl Send for ReturnData
impl Sync for ReturnData
impl Unpin for ReturnData
impl UnsafeUnpin for ReturnData
impl UnwindSafe for ReturnData
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