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§
source§impl 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§
source§impl Ord for Span
impl Ord for Span
source§impl PartialEq<Span> for Span
impl PartialEq<Span> for Span
source§impl PartialOrd<Span> for Span
impl PartialOrd<Span> for Span
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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§
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more