pub struct PkgRegistry {
pub repos: Vec<PkgRepo>,
/* private fields */
}
Expand description
An object used to store and cache all of the packages that we are working with. It queries repositories automatically when asking for a package that isn’t in the registry, and prevents having a bunch of copies of packages everywhere.
Fields§
§repos: Vec<PkgRepo>
The package repositories that the user has configured
Implementations§
Source§impl PkgRegistry
impl PkgRegistry
Sourcepub fn new(repos: Vec<PkgRepo>, caching_strategy: CachingStrategy) -> Self
pub fn new(repos: Vec<PkgRepo>, caching_strategy: CachingStrategy) -> Self
Create a new PkgRegistry with repositories and a caching strategy
Sourcepub fn has_now(&self, req: &PkgRequest) -> bool
pub fn has_now(&self, req: &PkgRequest) -> bool
Checks if a package is in the registry already
Sourcepub async fn ensure_package(
&mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<()>
pub async fn ensure_package( &mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<()>
Ensure that a package is in the registry
Sourcepub async fn get_metadata<'a>(
&'a mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<&'a PackageMetadata>
pub async fn get_metadata<'a>( &'a mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<&'a PackageMetadata>
Get the metadata of a package
Sourcepub async fn get_properties<'a>(
&'a mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<&'a PackageProperties>
pub async fn get_properties<'a>( &'a mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<&'a PackageProperties>
Get the properties of a package
Sourcepub async fn get_content_type<'a>(
&'a mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<PackageContentType>
pub async fn get_content_type<'a>( &'a mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<PackageContentType>
Get the content type of a package
Sourcepub async fn load(
&mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<String>
pub async fn load( &mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<String>
Load the contents of a package
Sourcepub async fn parse_and_validate(
&mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<()>
pub async fn parse_and_validate( &mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<()>
Parse and validate a package
Sourcepub async fn parse<'a>(
&'a mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<&'a PkgContents>
pub async fn parse<'a>( &'a mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<&'a PkgContents>
Parse a package and get the contents
Sourcepub async fn eval<'a>(
&mut self,
req: &ArcPkgReq,
paths: &'a Paths,
routine: Routine,
input: EvalInput<'a>,
client: &Client,
plugins: &'a PluginManager,
o: &mut impl MCVMOutput,
) -> Result<EvalData<'a>>
pub async fn eval<'a>( &mut self, req: &ArcPkgReq, paths: &'a Paths, routine: Routine, input: EvalInput<'a>, client: &Client, plugins: &'a PluginManager, o: &mut impl MCVMOutput, ) -> Result<EvalData<'a>>
Evaluate a package
Sourcepub async fn content_type<'a>(
&mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<PackageContentType>
pub async fn content_type<'a>( &mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<PackageContentType>
Get the content type of a package
Sourcepub async fn flags<'a>(
&'a mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<&'a HashSet<PackageFlag>>
pub async fn flags<'a>( &'a mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<&'a HashSet<PackageFlag>>
Get the flags of a package
Sourcepub async fn remove_cached(
&mut self,
req: &ArcPkgReq,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<()>
pub async fn remove_cached( &mut self, req: &ArcPkgReq, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<()>
Remove a cached package
Sourcepub fn iter_requests(&self) -> impl Iterator<Item = &ArcPkgReq>
pub fn iter_requests(&self) -> impl Iterator<Item = &ArcPkgReq>
Iterator over all package requests in the registry
Sourcepub fn get_all_packages(&self) -> Vec<ArcPkgReq> ⓘ
pub fn get_all_packages(&self) -> Vec<ArcPkgReq> ⓘ
Get all of the package requests in the registry in an owned manner
Sourcepub async fn get_all_available_packages(
&mut self,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<Vec<ArcPkgReq>>
pub async fn get_all_available_packages( &mut self, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<Vec<ArcPkgReq>>
Get all of the available package requests from the repos
Sourcepub async fn update_cached_packages(
&mut self,
paths: &Paths,
client: &Client,
o: &mut impl MCVMOutput,
) -> Result<()>
pub async fn update_cached_packages( &mut self, paths: &Paths, client: &Client, o: &mut impl MCVMOutput, ) -> Result<()>
Update cached package scripts based on the caching strategy
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PkgRegistry
impl RefUnwindSafe for PkgRegistry
impl Send for PkgRegistry
impl Sync for PkgRegistry
impl Unpin for PkgRegistry
impl UnwindSafe for PkgRegistry
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
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>
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>
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