async fn load_module(&self, store: &Store, cache: PathBuf) -> anyhow::Result<wasmtime::Module> {
        log::trace!(
            "Module::load_module: loading from source: module={}",
            &self.module
        );
        match Url::parse(self.module.as_str()) {
            Err(e) => {
                log::debug!(
                    "Error parsing module URI {}. Assuming this is a local file.",
                    e
                );
                wasmtime::Module::from_file(store.engine(), self.module.as_str())
            }
            Ok(uri) => match uri.scheme() {
                "file" => {
                    match uri.to_file_path() {
                        Ok(p) => return wasmtime::Module::from_file(store.engine(), p),
                        Err(e) => anyhow::bail!("Cannot get path to file: {:#?}", e),
                    };
                }
                "bindle" => self.load_bindle(&uri, store.engine(), cache).await,
                "parcel" => self.load_parcel(&uri, store.engine(), cache).await,
                "oci" => self.load_oci(&uri, store.engine(), cache).await,
                s => anyhow::bail!("Unknown scheme {}", s),
            },
        }
    }
/// Determine the source of the module, and read it from that source.
///
/// Modules can be stored locally, or they can be stored in external sources like
/// Bindle. WAGI determines the source by looking at the URI of the module.
///
/// - If `file:` is specified, or no schema is specified, this loads from the local filesystem
/// - If `bindle:` is specified, this will retrieve the module from the configured Bindle server
/// - If `oci:` is specified, this will retrieve the module from an OCI Distribution registry
///
/// While `file` is a little lenient in its adherence to the URL spec, `bindle` and `oci` are not.
/// For example, an `oci` URL that references `alpine:latest` should be `oci:alpine:latest`.
/// It should NOT be `oci://alpine:latest` because `alpine` is not a host name.
Determine the source of the module, and read it from that source.
Modules can be stored locally, or they can be stored in external sources like
Bindle. WAGI determines the source by looking at the URI of the module.




Determine the source of the module and read it from that source . Modules can be stored locally or they can be stored in external sources like Bindle . WAGI determines the source by looking at the URI of the module .
async fn load_module(&self, store: &Store, cache: PathBuf) -> anyhow::Result<wasmtime::Module> {
        log::trace!(
            "Module::load_module: loading from source: module={}",
            &self.module
        );
        match Url::parse(self.module.as_str()) {
            Err(e) => {
                log::debug!(
                    "Error parsing module URI {}. Assuming this is a local file.",
                    e
                );
                wasmtime::Module::from_file(store.engine(), self.module.as_str())
            }
            Ok(uri) => match uri.scheme() {
                "file" => {
                    match uri.to_file_path() {
                        Ok(p) => return wasmtime::Module::from_file(store.engine(), p),
                        Err(e) => anyhow::bail!("Cannot get path to file: {:#?}", e),
                    };
                }
                "bindle" => self.load_bindle(&uri, store.engine(), cache).await,
                "parcel" => self.load_parcel(&uri, store.engine(), cache).await,
                "oci" => self.load_oci(&uri, store.engine(), cache).await,
                s => anyhow::bail!("Unknown scheme {}", s),
            },
        }
    }
async fn load_module ( & self , store : & Store , cache : PathBuf ) -> anyhow :: Result < wasmtime :: Module > { log :: trace ! ( " " self module ) ; match Url :: parse ( self . module . as_str ( ) ) { Err ( e ) => { log :: debug ! ( " " e ) ; wasmtime :: Module :: from_file ( store . engine ( ) , self . module . as_str ( ) ) } Ok ( uri ) => match uri . scheme ( ) { " " => { match uri . to_file_path ( ) { Ok ( p ) => return wasmtime :: Module :: from_file ( store . engine ( ) , p ) , Err ( e ) => anyhow :: bail ! ( " " e ) , } ; } " " => self . load_bindle ( & uri , store . engine ( ) , cache ) . await , " " => self . load_parcel ( & uri , store . engine ( ) , cache ) . await , " " => self . load_oci ( & uri , store . engine ( ) , cache ) . await , s => anyhow :: bail ! ( " " s ) , } , } }
Determine the source of the module, and read it from that source.
Determine the source of the module and read it from that source .
&self
store
&Store
cache
PathBuf