Struct source_cache::SourceCache
source · pub struct SourceCache { /* private fields */ }
Expand description
A [Cache
] that fetches SourceText
s from the filesystem.
Implementations§
source§impl SourceCache
impl SourceCache
sourcepub fn load_local<P>(&mut self, path: P) -> Result<SourceID, Error>
pub fn load_local<P>(&mut self, path: P) -> Result<SourceID, Error>
Create a new SourceCache
.
sourcepub fn load_remote(&mut self, url: Url) -> Result<SourceID, Error>
pub fn load_remote(&mut self, url: Url) -> Result<SourceID, Error>
Create a new SourceCache
.
sourcepub fn load_text<T, N>(&mut self, text: T, name: N) -> SourceID
pub fn load_text<T, N>(&mut self, text: T, name: N) -> SourceID
Create a new SourceCache
.
sourcepub unsafe fn set_source<N>(&mut self, file: SourceID, source: N) -> bool
pub unsafe fn set_source<N>(&mut self, file: SourceID, source: N) -> bool
Set the file identifier buy not update the context
sourcepub fn fetch(&self, file: &SourceID) -> Result<&SourceText, Error>
pub fn fetch(&self, file: &SourceID) -> Result<&SourceText, Error>
Create a new SourceCache
.
sourcepub fn source_path(&self, file: &SourceID) -> Option<&SourcePath>
pub fn source_path(&self, file: &SourceID) -> Option<&SourcePath>
Create a new SourceCache
.
Trait Implementations§
source§impl Clone for SourceCache
impl Clone for SourceCache
source§fn clone(&self) -> SourceCache
fn clone(&self) -> SourceCache
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SourceCache
impl Debug for SourceCache
source§impl Default for SourceCache
impl Default for SourceCache
source§fn default() -> SourceCache
fn default() -> SourceCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for SourceCache
impl Send for SourceCache
impl Sync for SourceCache
impl Unpin for SourceCache
impl UnwindSafe for SourceCache
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