/// Routes a Directory capability from `target` to its source, starting from `use_decl`.
/// Returns the capability source, along with a `DirectoryState` accumulated from traversing
/// the route.
Routes a Directory capability from `target` to its source, starting from `use_decl`.
Returns the capability source, along with a `DirectoryState` accumulated from traversing
the route.
Routes a Directory capability from ` target ` to its source starting from ` use_decl ` . Returns the capability source along with a ` DirectoryState ` accumulated from traversing the route .
pub async fn route_directory(
    use_decl: UseDirectoryDecl,
    target: &Arc<ComponentInstance>,
) -> Result<(CapabilitySource, DirectoryState), RoutingError> {
    let mut state = DirectoryState::new(use_decl.rights.clone(), use_decl.subdir.clone());
    if let UseSource::Framework = &use_decl.source {
        state.finalize(*READ_RIGHTS, None)?;
    }
    let allowed_sources = AllowedSourcesBuilder::new()
        .framework(InternalCapability::Directory)
        .builtin(InternalCapability::Directory)
        .namespace()
        .component();
    let source = RoutingStrategy::new()
        .use_::<UseDirectoryDecl>()
        .offer::<OfferDirectoryDecl>()
        .expose::<ExposeDirectoryDecl>()
        .route(use_decl, target.clone(), allowed_sources, &mut state)
        .await?;
    Ok((source, state))
}
pub async fn route_directory ( use_decl : UseDirectoryDecl , target : & Arc < ComponentInstance > , ) -> Result < ( CapabilitySource , DirectoryState ) , RoutingError > { let mut state = DirectoryState :: new ( use_decl . rights . clone ( ) , use_decl . subdir . clone ( ) ) ; if let UseSource :: Framework = & use_decl . source { state . finalize ( * READ_RIGHTS , None ) ? ; } let allowed_sources = AllowedSourcesBuilder :: new ( ) . framework ( InternalCapability :: Directory ) . builtin ( InternalCapability :: Directory ) . namespace ( ) . component ( ) ; let source = RoutingStrategy :: new ( ) . use_ :: < UseDirectoryDecl > ( ) . offer :: < OfferDirectoryDecl > ( ) . expose :: < ExposeDirectoryDecl > ( ) . route ( use_decl , target . clone ( ) , allowed_sources , & mut state ) . await ? ; Ok ( ( source , state ) ) }
Routes a Directory capability from `target` to its source, starting from `use_decl`.
Routes a Directory capability from ` target ` to its source starting from ` use_decl ` .
use_decl
UseDirectoryDecl
target
&Arc<ComponentInstance>