pub enum Rule {
Show 14 variants All { rules: Vec<Rule>, }, Any { rules: Vec<Rule>, }, Not { rule: Box<Rule>, }, AdditionalSigner { account: Pubkey, }, PubkeyMatch { pubkey: Pubkey, field: String, }, PubkeyListMatch { pubkeys: Vec<Pubkey>, field: String, }, PubkeyTreeMatch { root: [u8; 32], field: String, }, PDAMatch { program: Option<Pubkey>, pda_field: String, seeds_field: String, }, ProgramOwned { program: Pubkey, field: String, }, ProgramOwnedList { programs: Vec<Pubkey>, field: String, }, ProgramOwnedTree { _root: [u8; 32], _program_field: String, _merkle_proof_field: String, }, Amount { amount: u64, operator: CompareOp, field: String, }, Frequency { authority: Pubkey, }, Pass,
}
Expand description

The struct containing every type of Rule and its associated data.

Variants§

§

All

Fields

§rules: Vec<Rule>

The vector of Rules contained under All.

Group AND, where every rule contained must pass.

§

Any

Fields

§rules: Vec<Rule>

The vector of Rules contained under Any.

Group OR, where at least one rule contained must pass.

§

Not

Fields

§rule: Box<Rule>

The Rule contained under Not.

Negation, where the contained rule must fail.

§

AdditionalSigner

Fields

§account: Pubkey

The public key that must have also signed the transaction.

An additional signer must be present.

§

PubkeyMatch

Fields

§pubkey: Pubkey

The public key to be compared against.

§field: String

The field in the Payload to be compared.

Direct comparison between Pubkeys.

§

PubkeyListMatch

Fields

§pubkeys: Vec<Pubkey>

The list of public keys to be compared against.

§field: String

The field in the Payload to be compared.

The comparing Pubkey must be in the list of Pubkeys.

§

PubkeyTreeMatch

Fields

§root: [u8; 32]

The root of the Merkle tree.

§field: String

The field in the Payload to be compared.

The pubkey must be a member of the Merkle tree.

§

PDAMatch

Fields

§program: Option<Pubkey>

The program used for the PDA derivation. If None then the account owner is used.

§pda_field: String

The field in the Payload to be compared when looking for the PDA.

§seeds_field: String

The field in the Payload to be compared when looking for the seeds.

A resulting PDA derivation of seeds must prove the account is a PDA.

§

ProgramOwned

Fields

§program: Pubkey

The program that must own the Pubkey.

§field: String

The field in the Payload to be compared.

The Pubkey must be owned by a given program.

§

ProgramOwnedList

Fields

§programs: Vec<Pubkey>

The program that must own the Pubkey.

§field: String

The field in the Payload to be compared.

The Pubkey must be owned by a program in the list of Pubkeys.

§

ProgramOwnedTree

Fields

§_root: [u8; 32]

The root of the Merkle tree.

§_program_field: String

The field in the Payload to be compared when looking for the program.

§_merkle_proof_field: String

The field in the Payload to be compared when looking for the Merkle Proof.

The Pubkey must be owned a member of the Merkle tree.

§

Amount

Fields

§amount: u64

The amount to be compared against.

§operator: CompareOp

The operator to be used in the comparison.

§field: String

The field the amount is stored in.

Comparison against the amount of tokens being transferred.

§

Frequency

Fields

§authority: Pubkey

The authority of the frequency account.

Comparison based on time between operations.

§

Pass

An operation that always succeeds.

Implementations§

The top level validation function which parses an entire rule tree.

Lower level validation function which iterates through a rule tree and applies boolean logic to rule results.

Convert the rule to a corresponding error resulting from the rule failure.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.