Skip to main content

get_blob_field_optional

Function get_blob_field_optional 

Source
pub fn get_blob_field_optional<const N: usize, const CODE: i32>(
    slot: i32,
    field: SField<Blob<N>, CODE>,
) -> Result<Option<Blob<N>>>
Expand description

Optional variant of get_blob_field: returns Ok(None) if the field is not present, otherwise behaves identically (including the direct-write zero-copy behavior). Implemented in terms of get_blob_field itself rather than duplicating its body — Error::FieldNotFound round-trips exactly through Error::from_code/.code() (both are just FIELD_NOT_FOUND), so translating that one error case into None is all this needs to do.