/// Adds a route between components within the realm
Adds a route between components within the realm
Adds a route between components within the realm
pub async fn add_route(&self, mut route: Route) -> Result<(), Error> {
        if let Some(source) = &route.from {
            source.check_scope(&self.realm_path)?;
        }
        for target in &route.to {
            target.check_scope(&self.realm_path)?;
        }
        if !route.capabilities.is_empty() {
            let mut route_targets =
                route.to.into_iter().map(Into::into).collect::<Vec<fdecl::Ref>>();
            // If we don't name the future with `let` and then await it in a second step, rustc
            // will decide this function is not Send and then Realm Builder won't be usable on
            // multi-threaded executors. This is caused by the mutable references held in the
            // future generated by `add_route`.
            let fut = self.realm_proxy.add_route(
                &mut route.capabilities.iter_mut(),
                &mut route.from.ok_or(Error::MissingSource)?.into(),
                &mut route_targets.iter_mut(),
            );
            fut.await??;
        }
        Ok(())
    }
pub async fn add_route ( & self , mut route : Route ) -> Result < ( ) , Error > { if let Some ( source ) = & route . from { source . check_scope ( & self . realm_path ) ? ; } for target in & route . to { target . check_scope ( & self . realm_path ) ? ; } if ! route . capabilities . is_empty ( ) { let mut route_targets = route . to . into_iter ( ) . map ( Into :: into ) . collect :: < Vec < fdecl :: Ref > > ( ) ; // If we don't name the future with `let` and then await it in a second step, rustc // will decide this function is not Send and then Realm Builder won't be usable on // multi-threaded executors. This is caused by the mutable references held in the // future generated by `add_route`. let fut = self . realm_proxy . add_route ( & mut route . capabilities . iter_mut ( ) , & mut route . from . ok_or ( Error :: MissingSource ) ? . into ( ) , & mut route_targets . iter_mut ( ) , ) ; fut . await ? ? ; } Ok ( ( ) ) }
Adds a route between components within the realm
Adds a route between components within the realm
&self
route
Route