pub struct Cap { /* private fields */ }Expand description
Specialization of Ref<M> for messages/assertions of type
AnyValue.
All polyglot and network communication is done in terms of Caps.
Caps can also be attenuated (Hardy 2017; Miller 2006) to
reduce (or otherwise transform) the range of assertions and
messages they can be used to send to their referent. The
Syndicated Actor model uses
Macaroon-style
capability attenuation.
Implementations§
source§impl Cap
impl Cap
sourcepub fn guard<L: 'static + Sync + Send, M>(
literals: &Arc<L>,
underlying: Arc<Ref<M>>
) -> Arc<Self>where
M: for<'a> Unparse<&'a L, AnyValue> + for<'a> Parse<&'a L, AnyValue> + 'static + Send,
pub fn guard<L: 'static + Sync + Send, M>( literals: &Arc<L>, underlying: Arc<Ref<M>> ) -> Arc<Self>where M: for<'a> Unparse<&'a L, AnyValue> + for<'a> Parse<&'a L, AnyValue> + 'static + Send,
Given a Ref<M>, where M is interconvertible with
AnyValue, yields a Cap for the referenced entity. The
Cap automatically decodes presented AnyValues into
instances of M.
sourcepub fn new(underlying: &Arc<Ref<AnyValue>>) -> Arc<Self>
pub fn new(underlying: &Arc<Ref<AnyValue>>) -> Arc<Self>
Directly constructs a Cap for underlying.
sourcepub fn attenuate(&self, caveats: &[Caveat]) -> Result<Arc<Self>, CaveatError>
pub fn attenuate(&self, caveats: &[Caveat]) -> Result<Arc<Self>, CaveatError>
Yields a fresh Cap for self’s underlying, copying the
existing attenuation of self to the new Cap and adding the
caveats to it.
sourcepub fn rewrite(&self, a: AnyValue) -> Option<AnyValue>
pub fn rewrite(&self, a: AnyValue) -> Option<AnyValue>
Applies the contained attenuation to a, yielding None if
a is filtered out, or Some(_) if it is accepted (and
possibly transformed).
sourcepub fn assert<L, M: Unparse<L, AnyValue>>(
&self,
t: &mut Activation<'_>,
literals: L,
m: &M
) -> Option<Handle>
pub fn assert<L, M: Unparse<L, AnyValue>>( &self, t: &mut Activation<'_>, literals: L, m: &M ) -> Option<Handle>
sourcepub fn update<L, M: Unparse<L, AnyValue>>(
&self,
t: &mut Activation<'_>,
handle: &mut Option<Handle>,
literals: L,
m: Option<&M>
)
pub fn update<L, M: Unparse<L, AnyValue>>( &self, t: &mut Activation<'_>, handle: &mut Option<Handle>, literals: L, m: Option<&M> )
update is to assert as Activation::update is to Activation::assert.
sourcepub fn message<L, M: Unparse<L, AnyValue>>(
&self,
t: &mut Activation<'_>,
literals: L,
m: &M
)
pub fn message<L, M: Unparse<L, AnyValue>>( &self, t: &mut Activation<'_>, literals: L, m: &M )
sourcepub fn sync(&self, t: &mut Activation<'_>, peer: Arc<Ref<Synced>>)
pub fn sync(&self, t: &mut Activation<'_>, peer: Arc<Ref<Synced>>)
Synchronizes with the reference underlying the cap.
pub fn debug_str(&self) -> String
Trait Implementations§
source§impl Ord for Cap
impl Ord for Cap
source§impl PartialOrd<Cap> for Cap
impl PartialOrd<Cap> for Cap
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more