Skip to main content

Reach

Struct Reach 

Source
pub struct Reach { /* private fields */ }
Expand description

Where a call may act: the scopes the caller holds the method’s grant on (within its ceiling), handed to the method beside auth. A read without a target (list, watch) answers only from these.

A reach is live when it came from a gate: Reach::allows and Reach::current ask the gate again, as memberships, roles and the ceiling stand now — so a stream checks each event (IDENTITY-37: a role revoked reaches an open stream at its next event). A hub without a gate hands every method Reach::everywhere, which allows everything.

Implementations§

Source§

impl Reach

Source

pub fn everywhere() -> Reach

Everything — what a method receives on a hub without a gate (login off), as today.

Source

pub fn nowhere() -> Reach

RETURNS-47: nothing — the reach of a call made for no one (a child under the anonymous forward policy, or one whose caller cannot be read). Covers and allows nothing, and names no grant.

Source

pub fn is_everywhere(&self) -> bool

Whether the grant is held on *.

Source

pub fn is_empty(&self) -> bool

Whether the grant is held nowhere (a public method called by a caller who holds no role listing it).

Source

pub fn held_on(&self) -> &[ScopeRef]

The scopes the grant is held on; [*] when everywhere.

Source

pub fn caller(&self) -> Option<&AuthContext>

PERF.115-49: the caller this reach was decided for — the context the gate was asked about, which it keeps to ask again; None for an anonymous caller and for a reach no gate made (Reach::everywhere, Reach::nowhere). Lets a holder of the reach read that caller rather than keep a second copy of it.

Source

pub fn grant(&self) -> Option<&Grant>

The grant this reach is for; None on a service without a gate.

Source

pub fn generation(&self) -> Option<&GrantsGeneration>

POLYGLOT-5: the grants generation of the gate this reach came from (BIDIR-8) — a call held open elsewhere (a child service’s stream) asks Reach::current again only when it moved. None without a gate.

Source

pub fn allows(&self, target: &str) -> bool

Whether the call may act on target — asked of the gate as it stands now. Without a gate: always. KEEL-31: a whole-service method’s reach allows a target only while the grant is held on *.

Source

pub fn current(&self) -> Option<Reach>

The reach as it stands now: None once the grant is held nowhere (a stream should end). Without a gate: unchanged.

Source

pub fn recheck(&self) -> Result<Reach, Refusal>

FRAME-5: Reach::current with the gate’s refusal kept — Err says why the grant is held nowhere now: Refusal::Ended when the sign-in no longer stands (signed out, expired, revoked session), Refusal::MissingGrant when the grants moved away, Refusal::Unauthenticated when the caller proves no one. A held open call that must say why it ends (a watch’s typed reason) asks this; one that only needs to know whether asks current. Without a gate: unchanged.

Source

pub fn covers(&self, chain: &[ScopeRef]) -> bool

Whether the reach covers a target whose chain is chain (as Resolve::chain gives it), by this snapshot — no new question to the gate. Prefer Reach::allows where the answer must be current.

Trait Implementations§

Source§

impl Clone for Reach

Source§

fn clone(&self) -> Reach

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 Reach

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Reach

Source§

fn eq(&self, other: &Reach) -> bool

Two reaches are equal when they hold the same scopes for the same grant (the gate behind them is not compared).

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Reach

§

impl !UnwindSafe for Reach

§

impl Forget for Reach

§

impl Freeze for Reach

§

impl Move for Reach

§

impl Send for Reach

§

impl Sync for Reach

§

impl Unpin for Reach

§

impl UnsafeUnpin for Reach

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more