Struct import_map::ImportMap
source · pub struct ImportMap { /* private fields */ }
Implementations§
source§impl ImportMap
impl ImportMap
pub fn new(base_url: Url) -> Self
pub fn base_url(&self) -> &Url
sourcepub fn lookup(&self, specifier: &Url, referrer: &Url) -> Option<String>
pub fn lookup(&self, specifier: &Url, referrer: &Url) -> Option<String>
Given a specifier and a referring specifier, determine if a value in the import map could be used as an import specifier that resolves using the import map.
sourcepub fn entries_for_referrer(
&self,
referrer: &Url
) -> impl Iterator<Item = SpecifierMapEntry<'_>>
pub fn entries_for_referrer( &self, referrer: &Url ) -> impl Iterator<Item = SpecifierMapEntry<'_>>
Iterates over the import map entries for the specified referrer in the order that should be tested for.
pub fn resolve( &self, specifier: &str, referrer: &Url ) -> Result<Url, ImportMapError>
pub fn imports(&self) -> &SpecifierMap
pub fn imports_mut(&mut self) -> &mut SpecifierMap
pub fn scopes(&self) -> impl Iterator<Item = ScopeEntry<'_>>
pub fn get_or_append_scope_mut( &mut self, key: &str ) -> Result<&mut SpecifierMap, ImportMapDiagnostic>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for ImportMap
impl Send for ImportMap
impl Sync for ImportMap
impl Unpin for ImportMap
impl UnwindSafe for ImportMap
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