Setup a testing bench

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2026-03-06 13:56:39 +01:00
parent 4470af3926
commit d3e6410ec0
16 changed files with 336 additions and 4 deletions

View file

@ -14,12 +14,31 @@ pub struct TempleInput {
range: Range<usize>,
}
impl TempleInput {
pub fn from_parts(backing: Arc<str>, range: Range<usize>) -> TempleInput {
TempleInput { backing, range }
}
pub fn into_parts(self) -> (Arc<str>, Range<usize>) {
(self.backing, self.range)
}
}
impl std::fmt::Debug for TempleInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "\"{}\"", self.as_str())
}
}
impl From<String> for TempleInput {
fn from(value: String) -> Self {
let range = 0..value.len();
let backing = Arc::from(value);
TempleInput { backing, range }
}
}
impl From<&str> for TempleInput {
fn from(value: &str) -> Self {
let backing = Arc::from(value.to_string());