[−][src]Struct runestick::Source
A single source file.
Implementations
impl Source
[src]
pub fn new<N, S>(name: N, source: S) -> Self where
N: AsRef<str>,
S: AsRef<str>,
[src]
N: AsRef<str>,
S: AsRef<str>,
Construct a new source with the given name.
pub fn line_starts(&self) -> &[usize]ⓘ
[src]
Access all line starts in the source.
pub fn from_path(path: &Path) -> Result<Self>
[src]
Load a source from a path.
pub fn is_empty(&self) -> bool
[src]
Test if the source is empty.
pub fn len(&self) -> usize
[src]
Get the length of the source.
pub fn name(&self) -> &str
[src]
Get the name of the source.
pub fn source(&self, span: Span) -> Option<&str>
[src]
Fetch source for the given span.
pub fn get<I>(&self, i: I) -> Option<&I::Output> where
I: SliceIndex<str>,
[src]
I: SliceIndex<str>,
et the given range from the source.
pub fn end(&self) -> usize
[src]
Get the end of the source.
pub fn as_str(&self) -> &str
[src]
Access the underlying string for the source.
pub fn path(&self) -> Option<&Path>
[src]
Get the (optional) path of the source.
pub fn path_mut(&mut self) -> &mut Option<PathBuf>
[src]
Get a mutable path.
pub fn position_to_utf16cu_line_char(
&self,
offset: usize
) -> Option<(usize, usize)>
[src]
&self,
offset: usize
) -> Option<(usize, usize)>
Convert the given offset to a utf-16 line and character.
pub fn position_to_unicode_line_char(&self, offset: usize) -> (usize, usize)
[src]
Convert the given offset to a utf-16 line and character.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Source
[src]
impl Send for Source
[src]
impl Sync for Source
[src]
impl Unpin for Source
[src]
impl UnwindSafe for Source
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,