#[non_exhaustive]pub enum NeedsApproval {
Never,
Always,
Dynamic(ApprovalFn),
}Expand description
Tool-level approval declaration. Call-level approval policies configured on the generation take precedence over it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Never
Never ask.
Always
Always ask.
Dynamic(ApprovalFn)
Ask when the function returns true for the validated input.
Implementations§
Source§impl NeedsApproval
impl NeedsApproval
Sourcepub async fn resolve(&self, input: JsonValue, ctx: ToolContext) -> bool
pub async fn resolve(&self, input: JsonValue, ctx: ToolContext) -> bool
Resolves the declaration for one call.
Sourcepub fn is_declared(&self) -> bool
pub fn is_declared(&self) -> bool
Returns true unless the declaration is NeedsApproval::Never.
Trait Implementations§
Source§impl Clone for NeedsApproval
impl Clone for NeedsApproval
Source§fn clone(&self) -> NeedsApproval
fn clone(&self) -> NeedsApproval
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NeedsApproval
impl Debug for NeedsApproval
Source§impl Default for NeedsApproval
impl Default for NeedsApproval
Source§fn default() -> NeedsApproval
fn default() -> NeedsApproval
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for NeedsApproval
impl !UnwindSafe for NeedsApproval
impl Freeze for NeedsApproval
impl Send for NeedsApproval
impl Sync for NeedsApproval
impl Unpin for NeedsApproval
impl UnsafeUnpin for NeedsApproval
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