#[non_exhaustive]pub struct ScanItem<'a> {
pub raw: &'a str,
pub span: Range<usize>,
pub kind: ScanKind,
}Expand description
A single item produced by the scanner, carrying its raw source slice and a structural classification.
Concatenating all raw slices from a scan reconstructs the original
input exactly.
§Examples
use evfmt::{ScanKind, scan};
let item = scan("\u{00A9}").next().unwrap();
assert_eq!(item.raw, "\u{00A9}");
assert_eq!(item.span, 0.."\u{00A9}".len());
assert!(matches!(item.kind, ScanKind::EmojiSequence(_)));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.raw: &'a strThe raw source text for this item.
span: Range<usize>Byte range of this item in the original input.
kind: ScanKindStructural classification of this item.
Trait Implementations§
impl<'a> Eq for ScanItem<'a>
impl<'a> StructuralPartialEq for ScanItem<'a>
Auto Trait Implementations§
impl<'a> Freeze for ScanItem<'a>
impl<'a> RefUnwindSafe for ScanItem<'a>
impl<'a> Send for ScanItem<'a>
impl<'a> Sync for ScanItem<'a>
impl<'a> Unpin for ScanItem<'a>
impl<'a> UnsafeUnpin for ScanItem<'a>
impl<'a> UnwindSafe for ScanItem<'a>
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