Skip to main content

NamespaceRegistry

Struct NamespaceRegistry 

Source
pub struct NamespaceRegistry<V> { /* private fields */ }

Implementations§

Source§

impl<V: Clone> NamespaceRegistry<V>

Source

pub fn new(initial: impl AsRef<str>) -> Self

Source

pub fn current(&self) -> Namespace<V>

Source

pub fn find(&self, name: impl AsRef<str>) -> Option<Namespace<V>>

Source

pub fn find_or_create(&self, name: impl AsRef<str>) -> Namespace<V>

Source

pub fn set_current(&self, name: impl AsRef<str>) -> Namespace<V>

Source

pub fn all(&self) -> Vec<Namespace<V>>

Source

pub fn known_names(&self) -> Vec<Symbol>

Returns every namespace known either as a materialized namespace or as a discoverable module with load state. Catalog-backed modules can therefore be inspected before a Namespace value exists.

Source

pub fn load_state(&self, name: impl AsRef<str>) -> Option<NamespaceLoadState>

Source

pub fn set_load_state(&self, name: impl AsRef<str>, state: NamespaceLoadState)

Source

pub fn clear_load_state(&self, name: impl AsRef<str>)

Source

pub fn load_failure(&self, name: impl AsRef<str>) -> Option<String>

Source

pub fn set_load_failure(&self, name: impl AsRef<str>, detail: impl Into<String>)

Source

pub fn clear_load_failure(&self, name: impl AsRef<str>)

Source

pub fn register_global_alias( &self, alias: impl AsRef<str>, namespace: impl AsRef<str>, ) -> Result<(), String>

Source

pub fn global_aliases(&self) -> Vec<(Symbol, Symbol)>

Source

pub fn register_global_import( &self, shorthand: impl AsRef<str>, canonical: impl AsRef<str>, ) -> Result<(), String>

Source

pub fn global_imports(&self) -> Vec<(Symbol, Symbol)>

Source

pub fn module_revision(&self, name: impl AsRef<str>) -> u64

Source

pub fn commit_module_revision(&self, name: impl AsRef<str>) -> u64

Source

pub fn module_dependencies(&self, name: impl AsRef<str>) -> Vec<Symbol>

Source

pub fn clear_module_dependencies(&self, name: impl AsRef<str>)

Source

pub fn record_module_dependency( &self, module: impl AsRef<str>, dependency: impl AsRef<str>, )

Source

pub fn snapshot(&self) -> NamespaceRegistrySnapshot<V>
where V: 'static,

Source

pub fn transaction_snapshot<'a>( &self, names: impl IntoIterator<Item = &'a str>, ) -> NamespaceTransactionSnapshot<V>
where V: 'static,

Source

pub fn restore(&self, snapshot: NamespaceRegistrySnapshot<V>)
where V: 'static,

Source

pub fn restore_transaction(&self, snapshot: NamespaceTransactionSnapshot<V>)
where V: 'static,

Source

pub fn remove(&self, name: impl AsRef<str>) -> Option<Namespace<V>>

Source

pub fn resolve(&self, symbol: &Symbol) -> Option<Var<V>>
where V: Clone,

Source

pub fn set_var(&self, symbol: Symbol, var: Var<V>) -> Result<Var<V>, String>
where V: Clone,

Source

pub fn visible_symbol_names(&self) -> Vec<String>

Trait Implementations§

Source§

impl<V: Clone> Clone for NamespaceRegistry<V>

Source§

fn clone(&self) -> NamespaceRegistry<V>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug> Debug for NamespaceRegistry<V>

Source§

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

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

impl<V: Clone> Default for NamespaceRegistry<V>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, <T as TryFrom<U>>::Error>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more