mirror of
https://github.com/typst/typst
synced 2025-08-24 19:54:14 +08:00
refactor: move impl blocks
This commit is contained in:
parent
9c12c38a54
commit
7dc3bcd8eb
@ -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.
|
/// Create a line vector.
|
||||||
fn lines(text: &str) -> Vec<Line> {
|
fn lines(text: &str) -> Vec<Line> {
|
||||||
std::iter::once(Line { byte_idx: 0, utf16_idx: 0 })
|
std::iter::once(Line { byte_idx: 0, utf16_idx: 0 })
|
||||||
@ -393,15 +405,3 @@ mod tests {
|
|||||||
test(TEST, 0..21, "", "");
|
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user