pub struct PolicyFile {
pub blocked_producers: Vec<BlockedProducer>,
pub required_attestations: Vec<RequiredAttestation>,
}Fields§
§blocked_producers: Vec<BlockedProducer>§required_attestations: Vec<RequiredAttestation>Positive gate on branch advance (#245). Empty means “no requirements” — same behavior as before this field existed.
Implementations§
Source§impl PolicyFile
impl PolicyFile
Sourcepub fn is_blocked(&self, tool: &str) -> bool
pub fn is_blocked(&self, tool: &str) -> bool
Whether the named tool is on the block list.
Sourcepub fn find(&self, tool: &str) -> Option<&BlockedProducer>
pub fn find(&self, tool: &str) -> Option<&BlockedProducer>
Look up the block entry, if any. Useful for “blocked since X — reason: Y” rendering.
Sourcepub fn block(&mut self, tool: String, reason: String, now: u64)
pub fn block(&mut self, tool: String, reason: String, now: u64)
Add a producer to the block list. Idempotent: blocking an
already-blocked tool is a no-op (preserves the original
blocked_at); the new reason is dropped. Callers that
want to update a reason should unblock then block.
Sourcepub fn unblock(&mut self, tool: &str) -> bool
pub fn unblock(&mut self, tool: &str) -> bool
Remove a producer from the block list. Returns whether the entry was present.
Sourcepub fn require_attestation(
&mut self,
kind: RequiredAttestationKind,
when: AttestationCondition,
) -> bool
pub fn require_attestation( &mut self, kind: RequiredAttestationKind, when: AttestationCondition, ) -> bool
Add a RequiredAttestation rule. Idempotent on (kind, when)
— the same rule submitted twice is a single entry. Different
when clauses for the same kind are distinct rules and
stack (e.g. “always require Spec” plus “require SandboxRun
when effects intersect io”).
Sourcepub fn unrequire_attestation(&mut self, kind: RequiredAttestationKind) -> usize
pub fn unrequire_attestation(&mut self, kind: RequiredAttestationKind) -> usize
Remove every rule with the given kind. Returns how many
rules were removed. Use this to drop a requirement entirely;
for narrowing a rule (e.g. Always → EffectsIntersect)
remove + re-add.
Trait Implementations§
Source§impl Clone for PolicyFile
impl Clone for PolicyFile
Source§fn clone(&self) -> PolicyFile
fn clone(&self) -> PolicyFile
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 PolicyFile
impl Debug for PolicyFile
Source§impl Default for PolicyFile
impl Default for PolicyFile
Source§fn default() -> PolicyFile
fn default() -> PolicyFile
Source§impl<'de> Deserialize<'de> for PolicyFile
impl<'de> Deserialize<'de> for PolicyFile
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>,
Source§impl PartialEq for PolicyFile
impl PartialEq for PolicyFile
Source§fn eq(&self, other: &PolicyFile) -> bool
fn eq(&self, other: &PolicyFile) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PolicyFile
impl Serialize for PolicyFile
impl Eq for PolicyFile
impl StructuralPartialEq for PolicyFile
Auto Trait Implementations§
impl Freeze for PolicyFile
impl RefUnwindSafe for PolicyFile
impl Send for PolicyFile
impl Sync for PolicyFile
impl Unpin for PolicyFile
impl UnsafeUnpin for PolicyFile
impl UnwindSafe for PolicyFile
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§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.