Skip to main content

AnchorDeserialize

Derive Macro AnchorDeserialize 

Source
#[derive(AnchorDeserialize)]
{
    // Attributes available to this derive:
    #[borsh]
}
Expand description

Implements borsh deserialization for this structure, as well as implementing lazy deserialization if the lazy-account feature is enabled. #[borsh(use_discriminant = false)] is supported with lazy-account; use_discriminant = true and other #[borsh] attributes (e.g. skip) are not yet supported in conjunction with lazy-account.

#[derive(AnchorDeserialize)]
#[borsh(use_discriminant = false)]
pub enum Example {
    Foo = 1,
    Bar = 2,
}
#[derive(AnchorDeserialize)]
pub struct Example {
    #[borsh(skip)]
    x: u8,
}