Struct source_map::SourceId
source · pub struct SourceId(_);
Implementations§
source§impl SourceId
impl SourceId
sourcepub fn new(path: PathBuf, content: String) -> Self
pub fn new(path: PathBuf, content: String) -> Self
Returns a SourceId handle that references a file and its content
pub const fn is_null(&self) -> bool
sourcepub fn get_file(&self) -> Option<(PathBuf, String)>
pub fn get_file(&self) -> Option<(PathBuf, String)>
Note that this does clone the result
use SourceId::get_file_slice for a section of the source
sourcepub fn get_file_slice<I: SliceIndex<str>>(
&self,
slice: I
) -> Option<(PathBuf, <I::Output as ToOwned>::Owned)>where
I::Output: Sized + ToOwned,
pub fn get_file_slice<I: SliceIndex<str>>(
&self,
slice: I
) -> Option<(PathBuf, <I::Output as ToOwned>::Owned)>where
I::Output: Sized + ToOwned,
Note that this does clone the result
sourcepub fn drop_handle(self)
pub fn drop_handle(self)
Remove the filename and content mapping behind the handle make sure that this is the only SourceId