pub struct ProxyRegistryExt { /* private fields */ }Expand description
In-memory registry of ProxyRecords indexed by source path.
Implementations§
Source§impl ProxyRegistryExt
impl ProxyRegistryExt
Sourcepub fn insert(&mut self, record: ProxyRecord)
pub fn insert(&mut self, record: ProxyRecord)
Register or replace the record for source_path.
Sourcepub fn add_variant(
&mut self,
source_path: impl Into<PathBuf>,
variant: ProxyVariantRecord,
)
pub fn add_variant( &mut self, source_path: impl Into<PathBuf>, variant: ProxyVariantRecord, )
Add a single proxy variant for source_path.
Creates a new ProxyRecord if one does not already exist.
Sourcepub fn get(&self, source_path: &Path) -> Option<&ProxyRecord>
pub fn get(&self, source_path: &Path) -> Option<&ProxyRecord>
Return the record for source_path, if present.
Sourcepub fn remove(&mut self, source_path: &Path) -> Option<ProxyRecord>
pub fn remove(&mut self, source_path: &Path) -> Option<ProxyRecord>
Remove the record for source_path, returning it if it existed.
Sourcepub fn find_best_proxy(
&self,
source_path: &Path,
target_resolution: Resolution,
) -> Option<&ProxyVariantRecord>
pub fn find_best_proxy( &self, source_path: &Path, target_resolution: Resolution, ) -> Option<&ProxyVariantRecord>
Find the best proxy variant for source_path at target_resolution.
Returns None if the source is not registered or has no variants.
Sourcepub fn sources_with_proxies(&self) -> Vec<&Path>
pub fn sources_with_proxies(&self) -> Vec<&Path>
Return all source paths that have at least one proxy registered.
Sourcepub fn total_variants(&self) -> usize
pub fn total_variants(&self) -> usize
Total number of proxy variants across all records.
Trait Implementations§
Source§impl Debug for ProxyRegistryExt
impl Debug for ProxyRegistryExt
Source§impl Default for ProxyRegistryExt
impl Default for ProxyRegistryExt
Source§fn default() -> ProxyRegistryExt
fn default() -> ProxyRegistryExt
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProxyRegistryExt
impl RefUnwindSafe for ProxyRegistryExt
impl Send for ProxyRegistryExt
impl Sync for ProxyRegistryExt
impl Unpin for ProxyRegistryExt
impl UnsafeUnpin for ProxyRegistryExt
impl UnwindSafe for ProxyRegistryExt
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
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