pub struct SyntaxLocation { /* private fields */ }Expand description
Where a read failed: the byte offset, its line and column and a quote of the offending line.
The quote is the whole line when it fits in 120 characters.
A longer line is cut to a window of 120 characters around the
offset, with … on each cut end. Line breaks and tabs are spaces.
Implementations§
Source§impl SyntaxLocation
impl SyntaxLocation
Sourcepub fn at(input: &[u8], offset: usize) -> Self
pub fn at(input: &[u8], offset: usize) -> Self
The location of byte offset in input, clamped to its length.
Sourcepub fn locate(input: &[u8], error: &ModelError) -> Option<Self>
pub fn locate(input: &[u8], error: &ModelError) -> Option<Self>
The location of a syntax error in input; None for any other
error.
Sourcepub fn of_step_error(input: &[u8], error: &StepError) -> Option<Self>
pub fn of_step_error(input: &[u8], error: &StepError) -> Option<Self>
The location of a STEP error that names a byte offset
(StepError::Syntax, StepError::MissingEntityId,
StepError::RealWithoutDecimalPoint, StepError::DuplicateId);
None for any other.
Sourcepub const fn position(&self) -> SourcePosition
pub const fn position(&self) -> SourcePosition
Line and column of the offset.
Sourcepub const fn excerpt_column(&self) -> usize
pub const fn excerpt_column(&self) -> usize
1-based column of the offset within SyntaxLocation::excerpt,
counted in characters, a leading … included.
Trait Implementations§
Source§impl Clone for SyntaxLocation
impl Clone for SyntaxLocation
Source§fn clone(&self) -> SyntaxLocation
fn clone(&self) -> SyntaxLocation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SyntaxLocation
impl Debug for SyntaxLocation
Source§impl Display for SyntaxLocation
impl Display for SyntaxLocation
impl Eq for SyntaxLocation
Source§impl PartialEq for SyntaxLocation
impl PartialEq for SyntaxLocation
impl StructuralPartialEq for SyntaxLocation
Auto Trait Implementations§
impl Freeze for SyntaxLocation
impl RefUnwindSafe for SyntaxLocation
impl Send for SyntaxLocation
impl Sync for SyntaxLocation
impl Unpin for SyntaxLocation
impl UnsafeUnpin for SyntaxLocation
impl UnwindSafe for SyntaxLocation
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