Learning anchor and getting it going just by following patterns. I don't fully understand what's going on underneath, though. For example, what is 'info when creating structs? In this line:
pub struct Create<'info>
I'm assuming 'info is pointing to some Anchor struct definition - but unsure which because it appears pretty much everywhere regardless of what's being created. Or here:
pub base_account: Account<'info, BaseAccount>
Same question - and are we overloading with the fields from BaseAccount as well? Trying to learn rust & anchor at the same time, so not sure if this is an anchor question or rust question.
To answer my own question, 'info is a rust parameter for managing lifetime of references. The single quote is the operator and "info" is just a variable name (could be anything). All references tagged with 'info must be active until all are complete. More here: blog.logrocket.com/understanding-l...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Learning anchor and getting it going just by following patterns. I don't fully understand what's going on underneath, though. For example, what is 'info when creating structs? In this line:
pub struct Create<'info>
I'm assuming 'info is pointing to some Anchor struct definition - but unsure which because it appears pretty much everywhere regardless of what's being created. Or here:
pub base_account: Account<'info, BaseAccount>
Same question - and are we overloading with the fields from BaseAccount as well? Trying to learn rust & anchor at the same time, so not sure if this is an anchor question or rust question.
To answer my own question, 'info is a rust parameter for managing lifetime of references. The single quote is the operator and "info" is just a variable name (could be anything). All references tagged with 'info must be active until all are complete. More here: blog.logrocket.com/understanding-l...