pub struct AccountConstraint { /* private fields */ }Expand description
A builder for constructing validation constraints on a single account.
ⓘ
AccountConstraint::on(0)
.signer()
.writable()
.owned_by_program()
.validate(&ctx)?;Implementations§
Source§impl AccountConstraint
impl AccountConstraint
Sourcepub const fn on(index: usize) -> AccountConstraint
pub const fn on(index: usize) -> AccountConstraint
Start building constraints for an account at the given index.
Sourcepub const fn signer(self) -> AccountConstraint
pub const fn signer(self) -> AccountConstraint
Require the account to be a signer.
Sourcepub const fn writable(self) -> AccountConstraint
pub const fn writable(self) -> AccountConstraint
Require the account to be writable.
Sourcepub const fn owned(self) -> AccountConstraint
pub const fn owned(self) -> AccountConstraint
Require the account to be owned by the program.
Sourcepub const fn executable(self) -> AccountConstraint
pub const fn executable(self) -> AccountConstraint
Require the account to be executable.
Sourcepub fn validate(&self, ctx: &ValidationContext<'_>) -> Result<(), ProgramError>
pub fn validate(&self, ctx: &ValidationContext<'_>) -> Result<(), ProgramError>
Validate all constraints against the context.
Auto Trait Implementations§
impl Freeze for AccountConstraint
impl RefUnwindSafe for AccountConstraint
impl Send for AccountConstraint
impl Sync for AccountConstraint
impl Unpin for AccountConstraint
impl UnsafeUnpin for AccountConstraint
impl UnwindSafe for AccountConstraint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more