pub struct Source<'i> { /* private fields */ }Expand description
Data encoded as TOML
Implementations§
Source§impl<'i> Source<'i>
impl<'i> Source<'i>
pub fn new(input: &'i str) -> Self
Sourcepub fn get(&self, span: impl SourceIndex) -> Option<Raw<'i>>
pub fn get(&self, span: impl SourceIndex) -> Option<Raw<'i>>
Return a subslice of the input
Sourcepub unsafe fn get_unchecked(&self, span: impl SourceIndex) -> Raw<'i>
Available on crate feature unsafe only.
pub unsafe fn get_unchecked(&self, span: impl SourceIndex) -> Raw<'i>
unsafe only.Return an unchecked subslice of the input
§Safety
Callers of this function are responsible that these preconditions are satisfied:
- The starting index must not exceed the ending index;
- Indexes must be within bounds of the original slice;
- Indexes must lie on UTF-8 sequence boundaries.
Or one of:
spancame fromSource::lex
Failing any of those, the returned string slice may reference invalid memory or violate the invariants communicated by str type.
Trait Implementations§
impl<'i> Copy for Source<'i>
impl<'i> Eq for Source<'i>
impl<'i> StructuralPartialEq for Source<'i>
Auto Trait Implementations§
impl<'i> Freeze for Source<'i>
impl<'i> RefUnwindSafe for Source<'i>
impl<'i> Send for Source<'i>
impl<'i> Sync for Source<'i>
impl<'i> Unpin for Source<'i>
impl<'i> UnwindSafe for Source<'i>
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