MCPcopy Create free account
hub / github.com/davidblewett/rure-python / Input

Interface Input

regex/src/input.rs:79–112  ·  view source on GitHub ↗

An abstraction over input used in the matching engines.

Source from the content-addressed store, hash-verified

77
78/// An abstraction over input used in the matching engines.
79pub trait Input {
80 /// Return an encoding of the position at byte offset `i`.
81 fn at(&self, i: usize) -> InputAt;
82
83 /// Return the Unicode character occurring next to `at`.
84 ///
85 /// If no such character could be decoded, then `Char` is absent.
86 fn next_char(&self, at: InputAt) -> Char;
87
88 /// Return the Unicode character occurring previous to `at`.
89 ///
90 /// If no such character could be decoded, then `Char` is absent.
91 fn previous_char(&self, at: InputAt) -> Char;
92
93 /// Return true if the given empty width instruction matches at the
94 /// input position given.
95 fn is_empty_match(&self, at: InputAt, empty: &InstEmptyLook) -> bool;
96
97 /// Scan the input for a matching prefix.
98 fn prefix_at(
99 &self,
100 prefixes: &LiteralSearcher,
101 at: InputAt,
102 ) -> Option<InputAt>;
103
104 /// The number of bytes in the input.
105 fn len(&self) -> usize;
106
107 /// Whether the input is empty.
108 fn is_empty(&self) -> bool { self.len() == 0 }
109
110 /// Return the given input as a sequence of bytes.
111 fn as_bytes(&self) -> &[u8];
112}
113
114impl<'a, T: Input> Input for &'a T {
115 fn at(&self, i: usize) -> InputAt { (**self).at(i) }

Callers

nothing calls this directly

Implementers 1

input.rsregex/src/input.rs

Calls

no outgoing calls

Tested by

no test coverage detected