Skip to main content

Registry

Struct Registry 

Source
pub struct Registry { /* private fields */ }
Expand description

The registry.

Implementations§

Source§

impl Registry

Source

pub fn register( &self, name: &RawStr, cab: Cab, meter: &Arc<Meter>, ) -> Result<(), Error>

register_cab(name, cab) for a file the caller loaded, as a load of its own, charged to meter (module docs). The slot holds cab, so it is never evicted: cab is a file on a caller’s input meter (crate::budget::Reservation::Input), not one the Environment loaded as a dependency, which its load registered already, and whose reads through such a slot would charge the dependency pool outside the Environment’s retry (plan section 3.13).

Source

pub fn register_lazy( &self, name: &RawStr, bundle: Arc<BundleFile>, dir_index: usize, meter: &Arc<Meter>, ) -> Result<(), Error>

Registers entry dir_index of a bundle the caller loaded Lazy, as a load of its own, to parse on first use; charged to meter. As for Self::register, bundle is on a caller’s input meter, not a dependency’s.

Source§

impl Registry

Source

pub fn get( &self, name: &RawStr, meter: &Arc<Meter>, ) -> Result<Option<Cab>, Error>

get_cab(name), parsing a lazy slot now, or opening an evicted dependency again from its source. The key is simplify_name(name), built charged to meter (crate::pystr::simplify_name) and dropped when the lookup returns; a name already in its simplified form is looked up as it is, with no copy. The registry holds no LRU, so a pool refusal of the key’s charge, when meter is a dependency’s, is returned here as it is: Environment::get_cab is the lookup that evicts and retries (the registry’s with_room).

Source

pub fn keys(&self) -> Keys<'_> ⓘ

Keys in dict order, as an iterator that takes the read lock briefly per key (no snapshot of the registry), after the dropped lazy slots are reached (settle, module docs).

Source

pub fn len(&self) -> usize

Number of keys.

Source

pub fn is_empty(&self) -> bool

Whether it is empty.

Trait Implementations§

Source§

impl Debug for Registry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Registry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.