Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/content/docs/references/space.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,9 @@ pub struct Initialize<'info> {
A few important things to know:

- Don't forget the discriminator when defining `space`
- The `max_len` length represents the length of the structure, not the total
length. (ie: the `max_len` of a Vec\<u32\> will be `max_len` \* 4)
- The `max_len` attribute specifies the maximum number of elements in a Vec, not the total size in bytes.
For example, if you specify `#[max_len(10)]` for a `Vec<u32>`, it means:
- Maximum 10 elements
- Each element (u32) takes 4 bytes
- The Vec itself has a 4-byte length prefix
- Total space = 4 + (10 * 4) = 44 bytes