Struct source_map::SourceId
source · pub struct SourceId(_);
Implementations
sourceimpl 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
Trait Implementations
impl Copy for SourceId
impl Eq for SourceId
impl StructuralEq for SourceId
impl StructuralPartialEq for SourceId
Auto Trait Implementations
impl RefUnwindSafe for SourceId
impl Send for SourceId
impl Sync for SourceId
impl Unpin for SourceId
impl UnwindSafe for SourceId
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more