pub struct IdePermissionPolicy { /* private fields */ }Expand description
Normalized IDE permission policy: the merged permission object from the IDE
config (project entries override global ones per top-level key).
Implementations§
Source§impl IdePermissionPolicy
impl IdePermissionPolicy
pub fn is_empty(&self) -> bool
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Number of top-level permission rules in the merged policy.
Sourcepub fn from_rules(rules: Map<String, Value>) -> Self
pub fn from_rules(rules: Map<String, Value>) -> Self
Construct directly from a raw permission object (test/utility hook).
Sourcepub fn resolve(
&self,
tool_key: &str,
input: Option<&str>,
) -> Option<PermDecision>
pub fn resolve( &self, tool_key: &str, input: Option<&str>, ) -> Option<PermDecision>
Resolve the effective action for an OpenCode tool key (e.g. bash,
read) given the relevant tool input (command / path / pattern).
Returns None when no rule matches — the caller treats that as the IDE
default (allow for the tools we mirror), so inheritance never adds
friction that the IDE itself would not impose.
Resolution is order-independent (serde_json maps are not insertion-ordered
without preserve_order): the most specific rule wins (longest
pattern by non-wildcard character count; a named tool beats the global
*), ties broken by the most restrictive action.
Trait Implementations§
Source§impl Clone for IdePermissionPolicy
impl Clone for IdePermissionPolicy
Source§fn clone(&self) -> IdePermissionPolicy
fn clone(&self) -> IdePermissionPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IdePermissionPolicy
impl Debug for IdePermissionPolicy
Source§impl Default for IdePermissionPolicy
impl Default for IdePermissionPolicy
Source§fn default() -> IdePermissionPolicy
fn default() -> IdePermissionPolicy
Auto Trait Implementations§
impl Freeze for IdePermissionPolicy
impl RefUnwindSafe for IdePermissionPolicy
impl Send for IdePermissionPolicy
impl Sync for IdePermissionPolicy
impl Unpin for IdePermissionPolicy
impl UnsafeUnpin for IdePermissionPolicy
impl UnwindSafe for IdePermissionPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more