pub struct PolicyDescriptor {
pub id: PolicyId,
pub name: &'static str,
pub default_severity: Severity,
pub warn_safe: bool,
pub accepts_options: bool,
pub off_unless_listed: bool,
}Expand description
What:
struct PolicyDescriptor is one registry row.
&'static str is a borrowed string baked into the executable for its whole run
('static is that “lives forever” lifetime).
Sibling:
String,
an owned copy.
bool is true/false,
exactly TS boolean.
Why:
Registry text is compiled in and never changes,
so borrowing forever is free,
while String would allocate at startup for no gain.
In TS you’d write (pseudocode):
type PolicyDescriptor = { id: PolicyId; name: string; defaultSeverity: Severity;
warnSafe: boolean; acceptsOptions: boolean; offUnlessListed: boolean };Fields§
§id: PolicyIdTyped identity used by Rust callers.
name: &'static strStable configuration key and JSONL policyId.
default_severity: SeverityThe incumbent policy definition’s defaultSeverity.
A built-in policy the
repository configuration does not name runs at this severity.
warn_safe: boolWhether warn keeps the policy’s protection (an unsafe warn earns a warning event).
accepts_options: boolWhether the ["severity", { ... }] form is accepted for this policy.
off_unless_listed: boolWhether the policy runs only where cli-git.config.jsonc names it.
The four
policies that plugins used to provide are off everywhere else,
with or without
a configuration file (decided 2026-10-05).
Trait Implementations§
Source§impl Clone for PolicyDescriptor
impl Clone for PolicyDescriptor
impl Copy for PolicyDescriptor
Source§impl Debug for PolicyDescriptor
impl Debug for PolicyDescriptor
impl Eq for PolicyDescriptor
Source§impl PartialEq for PolicyDescriptor
impl PartialEq for PolicyDescriptor
impl StructuralPartialEq for PolicyDescriptor
Auto Trait Implementations§
impl Freeze for PolicyDescriptor
impl RefUnwindSafe for PolicyDescriptor
impl Send for PolicyDescriptor
impl Sync for PolicyDescriptor
impl Unpin for PolicyDescriptor
impl UnsafeUnpin for PolicyDescriptor
impl UnwindSafe for PolicyDescriptor
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,
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
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> ⓘ
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