pub enum GrantTarget {
Path {
path: PathBuf,
recursive: bool,
},
Domain {
pattern: String,
},
Command {
pattern: String,
},
}Expand description
The target of a permission grant.
Each target type has its own matching semantics:
Path: Matches file system paths with optional recursionDomain: Matches network domains with wildcard supportCommand: Matches shell commands with glob patterns
Variants§
Path
File or directory path target.
Fields
Domain
Network domain target for HTTP requests.
Command
Shell command pattern target.
Implementations§
Source§impl GrantTarget
impl GrantTarget
Sourcepub fn path(path: impl Into<PathBuf>, recursive: bool) -> GrantTarget
pub fn path(path: impl Into<PathBuf>, recursive: bool) -> GrantTarget
Creates a new path target.
§Arguments
path- The directory or file pathrecursive- Whether to apply to subdirectories
Sourcepub fn domain(pattern: impl Into<String>) -> GrantTarget
pub fn domain(pattern: impl Into<String>) -> GrantTarget
Creates a new domain target.
§Arguments
pattern- Domain pattern (e.g., “api.github.com”, “*.example.com”)
Sourcepub fn command(pattern: impl Into<String>) -> GrantTarget
pub fn command(pattern: impl Into<String>) -> GrantTarget
Sourcepub fn covers(&self, request: &GrantTarget) -> bool
pub fn covers(&self, request: &GrantTarget) -> bool
Checks if this grant target covers a request target.
Coverage rules:
- Path: Grant path must be ancestor of request path (if recursive) or parent/equal (if not)
- Domain: Grant pattern must match request domain (wildcards supported)
- Command: Grant pattern must match request command (glob matching)
§Arguments
request- The target being requested
§Returns
true if this grant target covers the request target
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Returns a display-friendly description of this target.
Sourcepub fn target_type(&self) -> &'static str
pub fn target_type(&self) -> &'static str
Returns the target type as a string for display purposes.
Trait Implementations§
Source§impl Clone for GrantTarget
impl Clone for GrantTarget
Source§fn clone(&self) -> GrantTarget
fn clone(&self) -> GrantTarget
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 GrantTarget
impl Debug for GrantTarget
Source§impl<'de> Deserialize<'de> for GrantTarget
impl<'de> Deserialize<'de> for GrantTarget
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GrantTarget, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GrantTarget, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for GrantTarget
impl Display for GrantTarget
Source§impl Hash for GrantTarget
impl Hash for GrantTarget
Source§impl PartialEq for GrantTarget
impl PartialEq for GrantTarget
Source§impl Serialize for GrantTarget
impl Serialize for GrantTarget
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for GrantTarget
impl StructuralPartialEq for GrantTarget
Auto Trait Implementations§
impl Freeze for GrantTarget
impl RefUnwindSafe for GrantTarget
impl Send for GrantTarget
impl Sync for GrantTarget
impl Unpin for GrantTarget
impl UnwindSafe for GrantTarget
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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 moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more