/// Creates and sets up a model with standard parameters. This is easier than setting up the
/// model manually with `Model::new()`.
Creates and sets up a model with standard parameters. This is easier than setting up the
model manually with `Model::new()`.
Creates and sets up a model with standard parameters . This is easier than setting up the model manually with ` Model :: new () ` .
pub async fn model_setup(args: &Arguments) -> Result<Arc<Model>, Error> {
    // The model needs the resolver registry to be created, but the resolver registry needs the
    // model to be created so that the fuchsia_pkg resolver can route the pkgfs handle. Thus we
    // create an empty Arc<Mutex<<Option<Model>>>, give it to the resolvers, create the model with
    // the resolvers, and then lock this mutex and set it to a clone of the model we just created.
    let model_for_resolver = Arc::new(Mutex::new(None));
    let resolver_registry = available_resolvers(model_for_resolver.clone())?;
    let params = ModelParams {
        root_component_url: args.root_component_url.clone(),
        root_resolver_registry: resolver_registry,
    };
    let model = Arc::new(Model::new(params));
    *model_for_resolver.lock().await = Some(Arc::downgrade(&model));
    Ok(model)
}
pub async fn model_setup ( args : & Arguments ) -> Result < Arc < Model > , Error > { // The model needs the resolver registry to be created, but the resolver registry needs the // model to be created so that the fuchsia_pkg resolver can route the pkgfs handle. Thus we // create an empty Arc<Mutex<<Option<Model>>>, give it to the resolvers, create the model with // the resolvers, and then lock this mutex and set it to a clone of the model we just created. let model_for_resolver = Arc :: new ( Mutex :: new ( None ) ) ; let resolver_registry = available_resolvers ( model_for_resolver . clone ( ) ) ? ; let params = ModelParams { root_component_url : args . root_component_url . clone ( ) , root_resolver_registry : resolver_registry , } ; let model = Arc :: new ( Model :: new ( params ) ) ; * model_for_resolver . lock ( ) . await = Some ( Arc :: downgrade ( & model ) ) ; Ok ( model ) }
Creates and sets up a model with standard parameters.
Creates and sets up a model with standard parameters .
args
&Arguments