change visibility can change pub to pub(crate)

This commit is contained in:
Aleksey Kladov
2019-01-05 15:28:07 +03:00
parent 9b5b13dfcf
commit 79fd6b5c88
2 changed files with 48 additions and 2 deletions

View File

@@ -125,3 +125,21 @@ impl From<SyntaxText<'_>> for String {
text.to_string()
}
}
impl PartialEq<str> for SyntaxText<'_> {
fn eq(&self, mut rhs: &str) -> bool {
for chunk in self.chunks() {
if !rhs.starts_with(chunk) {
return false;
}
rhs = &rhs[chunk.len()..];
}
rhs.is_empty()
}
}
impl PartialEq<&'_ str> for SyntaxText<'_> {
fn eq(&self, rhs: &&str) -> bool {
self == *rhs
}
}