refactor: move impl blocks

This commit is contained in:
Tobias Schmitz 2025-05-20 15:16:05 +02:00
parent 9c12c38a54
commit 7dc3bcd8eb
No known key found for this signature in database

View File

@ -230,6 +230,18 @@ impl Lines<String> {
}
}
impl<S: Hash> Hash for Lines<S> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.str.hash(state);
}
}
impl<S: AsRef<str>> AsRef<str> for Lines<S> {
fn as_ref(&self) -> &str {
self.0.str.as_ref()
}
}
/// Create a line vector.
fn lines(text: &str) -> Vec<Line> {
std::iter::once(Line { byte_idx: 0, utf16_idx: 0 })
@ -393,15 +405,3 @@ mod tests {
test(TEST, 0..21, "", "");
}
}
impl<S: Hash> Hash for Lines<S> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.str.hash(state);
}
}
impl<S: AsRef<str>> AsRef<str> for Lines<S> {
fn as_ref(&self) -> &str {
self.0.str.as_ref()
}
}