Struct sway_types::span::Span
source · [−]pub struct Span { /* private fields */ }
Expand description
Represents a span of the source code in a specific file.
Implementations
sourceimpl Span
impl Span
pub fn dummy() -> Span
pub fn new(
src: Arc<str>,
start: usize,
end: usize,
path: Option<Arc<PathBuf>>
) -> Option<Span>
pub fn from_string(source: String) -> Span
pub fn src(&self) -> &Arc<str>
pub fn start(&self) -> usize
pub fn end(&self) -> usize
pub fn path(&self) -> Option<&Arc<PathBuf>>
pub fn path_str(&self) -> Option<Cow<'_, str>>
pub fn start_pos(&self) -> Position
pub fn end_pos(&self) -> Position
pub fn split(&self) -> (Position, Position)
pub fn str(self) -> String
pub fn as_str(&self) -> &str
pub fn input(&self) -> &str
pub fn trim(self) -> Span
sourcepub fn join(s1: Span, s2: Span) -> Span
pub fn join(s1: Span, s2: Span) -> Span
This panics if the spans are not from the same file. This should only be used on spans that are actually next to each other.
pub fn join_all(spans: impl IntoIterator<Item = Span>) -> Span
Trait Implementations
sourceimpl PartialOrd<Span> for Span
impl PartialOrd<Span> for Span
sourcefn partial_cmp(&self, other: &Span) -> Option<Ordering>
fn partial_cmp(&self, other: &Span) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Span
impl StructuralEq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
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