Skip to main content

ApprovalEngine

Struct ApprovalEngine 

Source
pub struct ApprovalEngine { /* private fields */ }
Expand description

Approval gate engine — rich approval workflow with escalation.

Implementations§

Source§

impl ApprovalEngine

Source

pub fn new() -> Self

Source

pub fn define_gate(&mut self, gate: ApprovalGate) -> WorkflowResult<()>

Define an approval gate.

Source

pub fn request_approval( &mut self, gate_id: &str, execution_id: &str, step_id: &str, context: Value, ) -> WorkflowResult<String>

Request approval — creates a pending approval.

Source

pub fn decide( &mut self, pending_id: &str, decision: ApprovalDecision, decided_by: &str, reason: Option<String>, ) -> WorkflowResult<ApprovalReceipt>

Decide on a pending approval.

Source

pub fn list_pending(&self) -> Vec<(&str, &PendingApproval)>

List pending approvals.

Source

pub fn get_receipts(&self, gate_id: Option<&str>) -> Vec<&ApprovalReceipt>

Get approval audit trail.

Source

pub fn escalate(&mut self, pending_id: &str) -> WorkflowResult<()>

Escalate a pending approval to the next approver in the chain.

Source

pub fn get_gate(&self, gate_id: &str) -> Option<&ApprovalGate>

Get a gate definition.

Trait Implementations§

Source§

impl Default for ApprovalEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.