pub enum PermissionResult {
Allow {
updated_input: Value,
updated_permissions: Option<Vec<Value>>,
},
Deny {
message: String,
interrupt: bool,
},
}Expand description
Result of a permission decision
This type represents the decision made by the permission callback. It can be serialized directly into the control response format.
Variants§
Implementations§
Source§impl PermissionResult
impl PermissionResult
Sourcepub fn allow_with_permissions(input: Value, permissions: Vec<Value>) -> Self
pub fn allow_with_permissions(input: Value, permissions: Vec<Value>) -> Self
Create an allow result with raw permissions (as JSON Values).
Prefer using allow_with_typed_permissions for type safety.
Sourcepub fn allow_with_typed_permissions(
input: Value,
permissions: Vec<Permission>,
) -> Self
pub fn allow_with_typed_permissions( input: Value, permissions: Vec<Permission>, ) -> Self
Create an allow result with typed permissions.
This is the preferred way to grant permissions for “remember this decision” functionality.
§Example
use claude_codes::{Permission, PermissionResult};
use serde_json::json;
let result = PermissionResult::allow_with_typed_permissions(
json!({"command": "npm test"}),
vec![Permission::allow_tool("Bash", "npm test")],
);Sourcepub fn deny_and_interrupt(message: impl Into<String>) -> Self
pub fn deny_and_interrupt(message: impl Into<String>) -> Self
Create a deny result that also interrupts the session
Trait Implementations§
Source§impl Clone for PermissionResult
impl Clone for PermissionResult
Source§fn clone(&self) -> PermissionResult
fn clone(&self) -> PermissionResult
Returns a duplicate of the value. Read more
1.0.0 · 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 PermissionResult
impl Debug for PermissionResult
Source§impl<'de> Deserialize<'de> for PermissionResult
impl<'de> Deserialize<'de> for PermissionResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PermissionResult
impl RefUnwindSafe for PermissionResult
impl Send for PermissionResult
impl Sync for PermissionResult
impl Unpin for PermissionResult
impl UnsafeUnpin for PermissionResult
impl UnwindSafe for PermissionResult
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