pub struct ScriptSource<'s> {
raw: &'s str,
shebang: Option<Range<usize>>,
open: Option<Range<usize>>,
info: Option<Range<usize>>,
frontmatter: Option<Range<usize>>,
close: Option<Range<usize>>,
content: Range<usize>,
}Fields§
§raw: &'s strThe full file
shebang: Option<Range<usize>>The #!/usr/bin/env cargo line, if present
open: Option<Range<usize>>The code fence opener (---)
info: Option<Range<usize>>Trailing text after ScriptSource::open that identifies the meaning of
ScriptSource::frontmatter
frontmatter: Option<Range<usize>>The lines between ScriptSource::open and ScriptSource::close
close: Option<Range<usize>>The code fence closer (---)
content: Range<usize>All content after the frontmatter and shebang
Implementations§
Source§impl<'s> ScriptSource<'s>
impl<'s> ScriptSource<'s>
pub fn parse(raw: &'s str) -> Result<Self, FrontmatterError>
pub fn shebang(&self) -> Option<&'s str>
pub fn shebang_span(&self) -> Option<Range<usize>>
pub fn open_span(&self) -> Option<Range<usize>>
pub fn info(&self) -> Option<&'s str>
pub fn info_span(&self) -> Option<Range<usize>>
pub fn frontmatter(&self) -> Option<&'s str>
pub fn frontmatter_span(&self) -> Option<Range<usize>>
pub fn close_span(&self) -> Option<Range<usize>>
pub fn content(&self) -> &'s str
pub fn content_span(&self) -> Range<usize> ⓘ
Trait Implementations§
Auto Trait Implementations§
impl<'s> Freeze for ScriptSource<'s>
impl<'s> RefUnwindSafe for ScriptSource<'s>
impl<'s> Send for ScriptSource<'s>
impl<'s> Sync for ScriptSource<'s>
impl<'s> Unpin for ScriptSource<'s>
impl<'s> UnwindSafe for ScriptSource<'s>
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