Skip to main content

OnlyRule

Struct OnlyRule 

Source
pub struct OnlyRule {
    pub from: String,
    pub to: Vec<String>,
    pub raw: String,
}
Expand description

⟨0.29⟩ One only <A> -> <B> [<C> …] PERMISSION rule (AS-EFF-011): a function in scope A may reach A itself and the listed scopes, and NOTHING else.

forbid FAILS OPEN; only FAILS SAFE, and that is the whole reason the form exists. A dependency you forgot to prohibit is silently permitted, so “this package is a leaf” can only be spelled by enumerating what it must not reach — a list that does not cover a package added later, and nothing says so. That is the allowlist hazard this project refuses everywhere in the analysis, living in the POLICY LANGUAGE instead. Under only, a dependency you forgot to permit is a loud violation.

Found by pointing candor’s own architecture gate at candor: the natural forbid io.poly.candor.model -> io.poly.candor SELF-FIRES at 58 violations, because a scope matches a contiguous run of segments and model sits under the very prefix it is trying to protect itself from.

THE WALK STOPS AT A PERMITTED SCOPE, and that is a semantic decision rather than an optimisation: a permitted callee’s own dependencies are governed by the rules about IT, not by this one. Descending past it would make only require the transitive closure of everything you permit — which is the enumeration-that-rots this form exists to replace, one level down.

Fields§

§from: String

The scope being constrained. It may always reach ITSELF: an explicit A -> A would be noise, and without the implicit permission the form is unusable for exactly the case it exists for.

§to: Vec<String>

The scopes from may reach. At least one — only A -> with nothing after the arrow is DROPPED as malformed rather than read as “A may reach nothing at all”, which is a different rule (and one a reader is far more likely to have typed by accident than to have meant).

§raw: String

Trait Implementations§

Source§

impl Clone for OnlyRule

Source§

fn clone(&self) -> OnlyRule

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OnlyRule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.