pub struct Resolver { /* private fields */ }Expand description
The NAP resolver — resolves URIs to manifests or subtrees.
Implementations§
Source§impl Resolver
impl Resolver
Sourcepub fn new(base_path: &Path) -> Self
pub fn new(base_path: &Path) -> Self
Create a resolver that looks for universe repos under base_path.
§Example layout
base_path/
├── starwars/ ← universe repo
├── toystory/ ← universe repo
└── marvel/ ← universe repoSourcepub fn with_vcs_factory(
base_path: &Path,
factory: fn() -> Box<dyn VcsBackend>,
) -> Self
pub fn with_vcs_factory( base_path: &Path, factory: fn() -> Box<dyn VcsBackend>, ) -> Self
Create a resolver with a custom VCS backend factory.
Sourcepub fn resolve(
&self,
uri_str: &str,
options: &ResolveOptions,
) -> Result<ResolveResult, NapError>
pub fn resolve( &self, uri_str: &str, options: &ResolveOptions, ) -> Result<ResolveResult, NapError>
Resolve a NAP URI string with options.
§Examples
// Full manifest
resolver.resolve("nap://starwars/character/lukeskywalker", &Default::default())
// With branch
resolver.resolve("nap://starwars/character/lukeskywalker", &ResolveOptions {
branch: Some("canon".to_string()),
..Default::default()
})
// With fragment query (via URI)
resolver.resolve("nap://starwars/character/lukeskywalker#references.appears_in", &Default::default())Sourcepub fn resolve_uri(
&self,
uri: &NapUri,
options: &ResolveOptions,
) -> Result<ResolveResult, NapError>
pub fn resolve_uri( &self, uri: &NapUri, options: &ResolveOptions, ) -> Result<ResolveResult, NapError>
Resolve a parsed NAP URI with options.
Auto Trait Implementations§
impl Freeze for Resolver
impl RefUnwindSafe for Resolver
impl Send for Resolver
impl Sync for Resolver
impl Unpin for Resolver
impl UnsafeUnpin for Resolver
impl UnwindSafe for Resolver
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more