pub enum OnionRole<X, I = OnionInvokeOffer> {
Client,
Relay,
Invoke(I),
Exit(X),
Both {
exit: X,
invoke: I,
},
}Expand description
The registration role of one node process over Σ = {relay} ⊎ Σ_I ⊎ Σ_W (#834 D2).
Variants§
Client
Registers no symbol: builds loops, evaluates no position.
Relay
Registers relay only.
Invoke(I)
Registers relay and the intermediate (shape, backend) pairs of I.
Exit(X)
Registers relay and the world-facing symbols of X.
Both
Registers relay, the world-facing symbols of X, and the intermediate pairs of I.
Implementations§
Source§impl<X, I> OnionRole<X, I>
impl<X, I> OnionRole<X, I>
Sourcepub const fn registers_relay(&self) -> bool
pub const fn registers_relay(&self) -> bool
Return whether this role registers relay: every rung above OnionRole::Client.
Sourcepub const fn exit(&self) -> Option<&X>
pub const fn exit(&self) -> Option<&X>
Return the exit’s data when this role registers world-facing symbols.
Sourcepub const fn invoke(&self) -> Option<&I>
pub const fn invoke(&self) -> Option<&I>
Return the invoke offer when this role registers intermediate (shape, backend) pairs.
Sourcepub const fn as_ref(&self) -> OnionRole<&X, &I>
pub const fn as_ref(&self) -> OnionRole<&X, &I>
Borrow the role’s offers: OnionRole<X, I> → OnionRole<&X, &I>.
Sourcepub fn map<Y>(self, exit: impl FnOnce(X) -> Y) -> OnionRole<Y, I>
pub fn map<Y>(self, exit: impl FnOnce(X) -> Y) -> OnionRole<Y, I>
Relabel the exit’s data, preserving the rung: the functor action in X.
Sourcepub fn try_map<Y, E>(
self,
exit: impl FnOnce(X) -> Result<Y, E>,
) -> Result<OnionRole<Y, I>, E>
pub fn try_map<Y, E>( self, exit: impl FnOnce(X) -> Result<Y, E>, ) -> Result<OnionRole<Y, I>, E>
Relabel the exit’s data by a fallible function, preserving the rung.
Sourcepub fn with_invoke(self, invoke: I) -> Self
pub fn with_invoke(self, invoke: I) -> Self
Attach an intermediate invoke offer to this role, promoting Client/Relay to Invoke
and Exit to Both (Reg_n ≠ ∅ ⇒ relay ∈ Reg_n).
Source§impl OnionRole<OnionExitOffer>
impl OnionRole<OnionExitOffer>
Sourcepub fn from_flags(
advertise_relay: bool,
advertise_exit: bool,
services: Vec<OnionServiceName>,
policy: OnionExitPolicy,
) -> Result<Self>
pub fn from_flags( advertise_relay: bool, advertise_exit: bool, services: Vec<OnionServiceName>, policy: OnionExitPolicy, ) -> Result<Self>
Parse the textual registration flags of a configuration file or command line.
The flags are the only place where “exit without relay” can be written; it is rejected
here, once, so no typed role can carry it. services and policy are read only for an
exit.
Trait Implementations§
impl<X: Copy, I: Copy> Copy for OnionRole<X, I>
impl<X: Eq, I: Eq> Eq for OnionRole<X, I>
impl<X: PartialEq, I: PartialEq> StructuralPartialEq for OnionRole<X, I>
Auto Trait Implementations§
impl<X, I> Forget for OnionRole<X, I>
impl<X, I> Freeze for OnionRole<X, I>
impl<X, I> Move for OnionRole<X, I>
impl<X, I> RefUnwindSafe for OnionRole<X, I>where
I: RefUnwindSafe,
X: RefUnwindSafe,
impl<X, I> Send for OnionRole<X, I>
impl<X, I> Sync for OnionRole<X, I>
impl<X, I> Unpin for OnionRole<X, I>
impl<X, I> UnsafeUnpin for OnionRole<X, I>where
I: UnsafeUnpin,
X: UnsafeUnpin,
impl<X, I> UnwindSafe for OnionRole<X, I>where
I: UnwindSafe,
X: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for T
impl<T> MaybeSendSync for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.