Rename library to nomo
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
d691fb9198
commit
d2e0405033
28 changed files with 92 additions and 92 deletions
50
src/input.rs
50
src/input.rs
|
|
@ -9,14 +9,14 @@ use winnow::stream::Stream;
|
|||
use winnow::stream::StreamIsPartial;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct TempleInput {
|
||||
pub struct NomoInput {
|
||||
backing: Arc<str>,
|
||||
range: Range<usize>,
|
||||
}
|
||||
|
||||
impl TempleInput {
|
||||
pub fn from_parts(backing: Arc<str>, range: Range<usize>) -> TempleInput {
|
||||
TempleInput { backing, range }
|
||||
impl NomoInput {
|
||||
pub fn from_parts(backing: Arc<str>, range: Range<usize>) -> NomoInput {
|
||||
NomoInput { backing, range }
|
||||
}
|
||||
|
||||
pub fn into_parts(self) -> (Arc<str>, Range<usize>) {
|
||||
|
|
@ -24,43 +24,43 @@ impl TempleInput {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for TempleInput {
|
||||
impl std::fmt::Debug for NomoInput {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "\"{}\"", self.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for TempleInput {
|
||||
impl From<String> for NomoInput {
|
||||
fn from(value: String) -> Self {
|
||||
let range = 0..value.len();
|
||||
let backing = Arc::from(value);
|
||||
|
||||
TempleInput { backing, range }
|
||||
NomoInput { backing, range }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for TempleInput {
|
||||
impl From<&str> for NomoInput {
|
||||
fn from(value: &str) -> Self {
|
||||
let backing = Arc::from(value.to_string());
|
||||
let range = 0..value.len();
|
||||
|
||||
TempleInput { backing, range }
|
||||
NomoInput { backing, range }
|
||||
}
|
||||
}
|
||||
|
||||
impl FindSlice<&str> for TempleInput {
|
||||
impl FindSlice<&str> for NomoInput {
|
||||
fn find_slice(&self, substr: &str) -> Option<core::ops::Range<usize>> {
|
||||
self.as_str().find_slice(substr)
|
||||
}
|
||||
}
|
||||
|
||||
impl Compare<&str> for TempleInput {
|
||||
impl Compare<&str> for NomoInput {
|
||||
fn compare(&self, t: &str) -> winnow::stream::CompareResult {
|
||||
self.as_str().compare(t)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for TempleInput {
|
||||
impl Deref for NomoInput {
|
||||
type Target = str;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
|
@ -68,24 +68,24 @@ impl Deref for TempleInput {
|
|||
}
|
||||
}
|
||||
|
||||
impl TempleInput {
|
||||
impl NomoInput {
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.deref()
|
||||
}
|
||||
}
|
||||
|
||||
impl Offset for TempleInput {
|
||||
impl Offset for NomoInput {
|
||||
fn offset_from(&self, start: &Self) -> usize {
|
||||
self.as_str().offset_from(&start.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TempleInputIter {
|
||||
pub struct NomoInputIter {
|
||||
idx: usize,
|
||||
input: TempleInput,
|
||||
input: NomoInput,
|
||||
}
|
||||
|
||||
impl Iterator for TempleInputIter {
|
||||
impl Iterator for NomoInputIter {
|
||||
type Item = (usize, char);
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
|
@ -95,7 +95,7 @@ impl Iterator for TempleInputIter {
|
|||
}
|
||||
}
|
||||
|
||||
impl StreamIsPartial for TempleInput {
|
||||
impl StreamIsPartial for NomoInput {
|
||||
type PartialState = ();
|
||||
|
||||
fn complete(&mut self) -> Self::PartialState {
|
||||
|
|
@ -109,17 +109,17 @@ impl StreamIsPartial for TempleInput {
|
|||
}
|
||||
}
|
||||
|
||||
impl Stream for TempleInput {
|
||||
impl Stream for NomoInput {
|
||||
type Token = char;
|
||||
|
||||
type Slice = TempleInput;
|
||||
type Slice = NomoInput;
|
||||
|
||||
type IterOffsets = TempleInputIter;
|
||||
type IterOffsets = NomoInputIter;
|
||||
|
||||
type Checkpoint = TempleInput;
|
||||
type Checkpoint = NomoInput;
|
||||
|
||||
fn iter_offsets(&self) -> Self::IterOffsets {
|
||||
TempleInputIter {
|
||||
NomoInputIter {
|
||||
idx: 0,
|
||||
input: self.clone(),
|
||||
}
|
||||
|
|
@ -187,11 +187,11 @@ impl Stream for TempleInput {
|
|||
mod tests {
|
||||
use winnow::stream::Stream;
|
||||
|
||||
use crate::input::TempleInput;
|
||||
use crate::input::NomoInput;
|
||||
|
||||
#[test]
|
||||
fn check_stream_impl() {
|
||||
let mut stream = TempleInput::from("checking");
|
||||
let mut stream = NomoInput::from("checking");
|
||||
|
||||
let checkpoint = stream.checkpoint();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue