pub struct Principal {
pub id: String,
pub role: Role,
pub grants: Vec<String>,
pub rate: Option<String>,
pub budget: Option<Budget>,
}Expand description
A resolved caller.
Fields§
§id: StringA stable id for logs/audit/context (operator, user:<sub>, agent:<id>).
role: Role§grants: Vec<String>Explicit tool-name grants (patterns) beyond the role defaults.
rate: Option<String>The rate quota ("<burst>/<per>s") and budget scope key, if any.
budget: Option<Budget>Implementations§
Source§impl Principal
impl Principal
pub fn anonymous() -> Principal
pub fn is_operator(&self) -> bool
pub fn is_anonymous(&self) -> bool
Sourcepub fn may(&self, method: &str, op: Option<&str>) -> bool
pub fn may(&self, method: &str, op: Option<&str>) -> bool
May this principal invoke A2A method method (RFC 0029 §2 matrix)?
op is the command tool name for a command DataPart (else None).
Sourcepub fn may_command(&self, tool: &str) -> bool
pub fn may_command(&self, tool: &str) -> bool
May this principal run command tool tool?
pub fn scope_key(&self) -> String
Trait Implementations§
impl StructuralPartialEq for Principal
Auto Trait Implementations§
impl Freeze for Principal
impl RefUnwindSafe for Principal
impl Send for Principal
impl Sync for Principal
impl Unpin for Principal
impl UnsafeUnpin for Principal
impl UnwindSafe for Principal
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