Which would be the space required for an account containing a struct like the following anchor example?
#[derive(AnchorSerialize, AnchorDeserialize)]
pub struct MyStruct {
subfield: u8
}
#[account]
pub struct MyAccount {
field: u8,
my_struct: Vec<MyStruct>, // Allow Maximum 10 items.
}
#[derive(Accounts)]
pub struct Example1<'info> {
#[account(mut)]
pub payer: Signer<'info>,
#[account(
init,
payer = payer,
space = 8 + 1 + 4 + (10 * 1)
)]
pub my_account: Account<'info, MyAccount>,
pub system_program: Program<'info, System>,
My guess is the following:
+ 8 bytes (Discriminator)
+ 1 byte (u8 field)
+ 4 bytes (Vector)
+ 10 x 1 bytes (Max 10 items in the vector with size of 1 byte: u8)
But I am not sure if using a struct inside an account has additional space requirements. Is this correct?