pub struct Source { /* private fields */ }Expand description
Primarily used to map spans (0 based character index ranges) to bytes.
Implementations§
Source§impl Source
impl Source
pub fn from_file(path: impl Into<PathBuf>) -> Result<Self>
pub fn path(&self) -> Option<&PathBuf>
pub fn text(&self) -> &str
pub fn span(&self) -> Span
Sourcepub fn range(&self, span: Span) -> Range<usize> ⓘ
pub fn range(&self, span: Span) -> Range<usize> ⓘ
Resolves the given span into a byte index range.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Source
impl !RefUnwindSafe for Source
impl !Sync for Source
impl Send for Source
impl Unpin for Source
impl UnsafeUnpin for Source
impl UnwindSafe for Source
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