pub struct ResourceSnapshot {
entries: BTreeMap<PathBuf, Result<ResourceData>>,
}Expand description
Captured external inputs belonging to one lowering result.
Bytes and failures are retained so consumers interpret external source spans against the same version used by the compiler. This is a per-path snapshot, not an atomic snapshot of the whole filesystem.
Fields§
§entries: BTreeMap<PathBuf, Result<ResourceData>>Implementations§
Source§impl ResourceSnapshot
impl ResourceSnapshot
Sourcepub fn text_index(&self, path: &Path) -> Option<&LineIndex>
pub fn text_index(&self, path: &Path) -> Option<&LineIndex>
Lazily index a captured UTF-8 resource. Repeated lookups reuse the index.
Returns None for absent, failed, or non-UTF-8 reads; Self::get retains
the original bytes or I/O error. Never rereads the filesystem.
Sourcepub fn get(&self, path: &Path) -> Option<Result<&[u8], &Error>>
pub fn get(&self, path: &Path) -> Option<Result<&[u8], &Error>>
Look up a captured read. None means the path was never requested.
pub(crate) fn read( &mut self, reader: &dyn ResourceReader, path: &Path, ) -> Result<&[u8], &Error>
pub(crate) fn dependencies(&self) -> Vec<ExternalDependency>
Trait Implementations§
Source§impl Debug for ResourceSnapshot
impl Debug for ResourceSnapshot
Source§impl Default for ResourceSnapshot
impl Default for ResourceSnapshot
Source§fn default() -> ResourceSnapshot
fn default() -> ResourceSnapshot
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ResourceSnapshot
impl !UnwindSafe for ResourceSnapshot
impl Freeze for ResourceSnapshot
impl Send for ResourceSnapshot
impl Sync for ResourceSnapshot
impl Unpin for ResourceSnapshot
impl UnsafeUnpin for ResourceSnapshot
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