Skip to main content

read_field

Function read_field 

Source
pub fn read_field<T: Projectable>(
    account: &AccountView,
    offset: usize,
) -> Result<&T, ProgramError>
Expand description

Read a Projectable field from account data at the given byte offset.

Tier-C escape hatch per the Hopper Safety Audit. Projectable only requires Copy + 'static, which is too permissive to protect against padding/alignment bugs. New code should prefer read_field_pod which enforces the stronger crate::Pod bound at the type level.