More ergonomic guard api
This commit is contained in:
parent
c3571a2faf
commit
94040ae566
|
@ -108,7 +108,7 @@ async fn main() -> ActorResult {
|
|||
}));
|
||||
}
|
||||
|
||||
let gatekeeper = Cap::guard(Arc::clone(Language::arc()), t.create(
|
||||
let gatekeeper = Cap::guard(Language::arc(), t.create(
|
||||
syndicate::entity(Arc::clone(&server_config_ds))
|
||||
.on_asserted(gatekeeper::handle_assertion)));
|
||||
|
||||
|
|
|
@ -2246,13 +2246,14 @@ impl Cap {
|
|||
/// `Cap` automatically decodes presented `AnyValue`s into
|
||||
/// instances of `M`.
|
||||
pub fn guard<L: 'static + Sync + Send, M: 'static + Send>(
|
||||
literals: Arc<L>,
|
||||
literals: &Arc<L>,
|
||||
underlying: Arc<Ref<M>>,
|
||||
) -> Arc<Self>
|
||||
where
|
||||
M: for<'a> Unparse<&'a L, AnyValue>,
|
||||
M: for<'a> Parse<&'a L, AnyValue>,
|
||||
{
|
||||
let literals = Arc::clone(literals);
|
||||
Self::new(&Arc::new(Ref {
|
||||
mailbox: Arc::clone(&underlying.mailbox),
|
||||
facet_id: underlying.facet_id,
|
||||
|
|
|
@ -761,7 +761,7 @@ impl Entity<AnyValue> for RelayEntity {
|
|||
fn sync(&mut self, t: &mut Activation, peer: Arc<Ref<Synced>>) -> ActorResult {
|
||||
self.relay_ref.lock().as_mut().expect("initialized")
|
||||
.send_event(t, self.oid.clone(), P::Event::Sync(Box::new(P::Sync {
|
||||
peer: Cap::guard(Arc::new(()), peer)
|
||||
peer: Cap::guard(&Arc::new(()), peer)
|
||||
})))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue