Struct mock_resolver::MockResolverService
source · pub struct MockResolverService { /* private fields */ }
Expand description
Mock package resolver which returns package directories that behave roughly as if they’re being served from pkgfs: /meta can be opened as both a directory and a file.
Implementations§
source§impl MockResolverService
impl MockResolverService
pub fn new(resolve_hook: Option<Box<dyn Fn(&str) + Send + Sync>>) -> Self
sourcepub fn register_custom_package(
&self,
name_for_url: impl AsRef<str>,
meta_far_name: impl AsRef<str>,
merkle: impl AsRef<str>,
domain: &str,
) -> TestPackage
pub fn register_custom_package( &self, name_for_url: impl AsRef<str>, meta_far_name: impl AsRef<str>, merkle: impl AsRef<str>, domain: &str, ) -> TestPackage
Consider using Self::package/Self::url instead to clarify the usage of these 4 str params.
pub fn register_package( &self, name: impl AsRef<str>, merkle: impl AsRef<str>, ) -> TestPackage
pub fn mock_resolve_failure(&self, url: impl Into<String>, error: ResolveError)
sourcepub fn package(
&self,
name: impl AsRef<str>,
merkle: impl AsRef<str>,
) -> TestPackage
pub fn package( &self, name: impl AsRef<str>, merkle: impl AsRef<str>, ) -> TestPackage
Registers a package with the given name and merkle root, returning a handle to add files to the package.
This method does not register the package to be served by any fuchsia-pkg URLs. See
MockResolverService::url
sourcepub fn path(&self, path: impl AsRef<str>) -> ForUrl<'_>
pub fn path(&self, path: impl AsRef<str>) -> ForUrl<'_>
Equivalent to self.url(format!("fuchsia-pkg://fuchsia.com/{}", path))
sourcepub fn url(&self, url: impl Into<String>) -> ForUrl<'_>
pub fn url(&self, url: impl Into<String>) -> ForUrl<'_>
Returns an object to configure the handler for the given URL.
pub fn spawn_resolver_service(self: Arc<Self>) -> PackageResolverProxy
sourcepub async fn run_resolver_service(
self: Arc<Self>,
stream: PackageResolverRequestStream,
) -> Result<(), Error>
pub async fn run_resolver_service( self: Arc<Self>, stream: PackageResolverRequestStream, ) -> Result<(), Error>
Serves the fuchsia.pkg.PackageResolver protocol on the given request stream.
Auto Trait Implementations§
impl !Freeze for MockResolverService
impl !RefUnwindSafe for MockResolverService
impl Send for MockResolverService
impl Sync for MockResolverService
impl Unpin for MockResolverService
impl !UnwindSafe for MockResolverService
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more