-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4055 from wasmerio/default-package-loader
Use a no-op package loader by default in PluggableRuntime
- Loading branch information
Showing
5 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
mod builtin_loader; | ||
mod load_package_tree; | ||
mod types; | ||
mod unsupported; | ||
|
||
pub use self::{ | ||
builtin_loader::BuiltinPackageLoader, load_package_tree::load_package_tree, | ||
types::PackageLoader, | ||
types::PackageLoader, unsupported::UnsupportedPackageLoader, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use anyhow::Error; | ||
use webc::compat::Container; | ||
|
||
use crate::{ | ||
bin_factory::BinaryPackage, | ||
runtime::{ | ||
package_loader::PackageLoader, | ||
resolver::{PackageSummary, Resolution}, | ||
}, | ||
}; | ||
|
||
/// A [`PackageLoader`] implementation which will always error out. | ||
#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)] | ||
pub struct UnsupportedPackageLoader; | ||
|
||
#[async_trait::async_trait] | ||
impl PackageLoader for UnsupportedPackageLoader { | ||
async fn load(&self, _summary: &PackageSummary) -> Result<Container, Error> { | ||
Err(Error::new(Unsupported)) | ||
} | ||
|
||
async fn load_package_tree( | ||
&self, | ||
_root: &Container, | ||
_resolution: &Resolution, | ||
) -> Result<BinaryPackage, Error> { | ||
Err(Error::new(Unsupported)) | ||
} | ||
} | ||
|
||
#[derive(Debug, Copy, Clone, thiserror::Error)] | ||
#[error("Loading of packages is not supported in this runtime (no PackageLoader configured)")] | ||
struct Unsupported; |