pub async fn route_and_open_storage_capability<'a>(
    model: &'a Model,
    use_decl: &'a UseStorageDecl,
    open_mode: u32,
    use_abs_moniker: AbsoluteMoniker,
    server_chan: zx::Channel,
) -> Result<(), ModelError> {
    let (dir_source_moniker, dir_source_path, relative_moniker) =
        route_storage_capability(model, use_decl, use_abs_moniker).await?;
    let storage_dir_proxy = storage::open_isolated_storage(
        &model,
        dir_source_moniker,
        &dir_source_path,
        use_decl.type_(),
        &relative_moniker,
        open_mode,
    )
    .await
    .map_err(|e| ModelError::from(e))?;

    // clone the final connection to connect the channel we're routing to its destination
    storage_dir_proxy
        .clone(fio::CLONE_FLAG_SAME_RIGHTS, ServerEnd::new(server_chan))
        .map_err(|e| ModelError::capability_discovery_error(format_err!("failed clone {}", e)))?;
    Ok(())
}
/// Routes a `UseDecl::Storage` to the component instance providing the backing directory and
/// opens its isolated storage with `server_chan`.
Routes a `UseDecl::Storage` to the component instance providing the backing directory and
opens its isolated storage with `server_chan`.
Routes a ` UseDecl :: Storage ` to the component instance providing the backing directory and opens its isolated storage with ` server_chan ` .
pub async fn route_and_open_storage_capability<'a>(
    model: &'a Model,
    use_decl: &'a UseStorageDecl,
    open_mode: u32,
    use_abs_moniker: AbsoluteMoniker,
    server_chan: zx::Channel,
) -> Result<(), ModelError> {
    let (dir_source_moniker, dir_source_path, relative_moniker) =
        route_storage_capability(model, use_decl, use_abs_moniker).await?;
    let storage_dir_proxy = storage::open_isolated_storage(
        &model,
        dir_source_moniker,
        &dir_source_path,
        use_decl.type_(),
        &relative_moniker,
        open_mode,
    )
    .await
    .map_err(|e| ModelError::from(e))?;
    // clone the final connection to connect the channel we're routing to its destination
    storage_dir_proxy
        .clone(fio::CLONE_FLAG_SAME_RIGHTS, ServerEnd::new(server_chan))
        .map_err(|e| ModelError::capability_discovery_error(format_err!("failed clone {}", e)))?;
    Ok(())
}
pub async fn route_and_open_storage_capability < ' a > ( model : & ' a Model , use_decl : & ' a UseStorageDecl , open_mode : u32 , use_abs_moniker : AbsoluteMoniker , server_chan : zx :: Channel , ) -> Result < ( ) , ModelError > { let ( dir_source_moniker , dir_source_path , relative_moniker ) = route_storage_capability ( model , use_decl , use_abs_moniker ) . await ? ; let storage_dir_proxy = storage :: open_isolated_storage ( & model , dir_source_moniker , & dir_source_path , use_decl . type_ ( ) , & relative_moniker , open_mode , ) . await . map_err ( | e | ModelError :: from ( e ) ) ? ; // clone the final connection to connect the channel we're routing to its destination storage_dir_proxy . clone ( fio :: CLONE_FLAG_SAME_RIGHTS , ServerEnd :: new ( server_chan ) ) . map_err ( | e | ModelError :: capability_discovery_error ( format_err ! ( " " e ) ) ) ? ; Ok ( ( ) ) }
Routes a `UseDecl::Storage` to the component instance providing the backing directory and
opens its isolated storage with `server_chan`.
Routes a ` UseDecl :: Storage ` to the component instance providing the backing directory and opens its isolated storage with ` server_chan ` .
model
&'a Model
use_decl
&'a UseStorageDecl
open_mode
u32
use_abs_moniker
AbsoluteMoniker
server_chan
zx::Channel