use AccountMeta;
use Pubkey;
/// Returns the next account's pubkey from the iterator, or `None` if there are no more accounts.
///
/// # Usage
/// - Use with `?` to indicate the account is required:
/// ```
/// let required = next_account(&mut iter)?;
/// ```
/// This will propagate `None` if the account is missing.
/// - Use without `?` to handle optional accounts:
/// ```
/// let optional = next_account(&mut iter);
/// ```
/// This returns `Option<Pubkey>` that you can match or use directly.
///
/// # Example
/// ```
/// let mut iter = accounts.iter();
/// let required = next_account(&mut iter)?; // required account
/// let optional = next_account(&mut iter); // optional account
/// `