mirror of
https://github.com/typst/typst
synced 2025-05-13 12:36:23 +08:00
More PartialEq
impls for EcoString
This commit is contained in:
parent
ec05ed7e06
commit
f72c81a757
@ -115,9 +115,7 @@ fn write_page(ctx: &mut PdfContext, page: Page) {
|
|||||||
link.subtype(AnnotationType::Link).rect(rect);
|
link.subtype(AnnotationType::Link).rect(rect);
|
||||||
match dest {
|
match dest {
|
||||||
Destination::Url(uri) => {
|
Destination::Url(uri) => {
|
||||||
link.action()
|
link.action().action_type(ActionType::Uri).uri(Str(uri.as_bytes()));
|
||||||
.action_type(ActionType::Uri)
|
|
||||||
.uri(Str(uri.as_str().as_bytes()));
|
|
||||||
}
|
}
|
||||||
Destination::Internal(loc) => {
|
Destination::Internal(loc) => {
|
||||||
let index = loc.page.get() - 1;
|
let index = loc.page.get() - 1;
|
||||||
|
@ -407,7 +407,7 @@ fn import_completions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (name, value) in module.scope().iter() {
|
for (name, value) in module.scope().iter() {
|
||||||
if existing.iter().all(|ident| ident.as_str() != name.as_str()) {
|
if existing.iter().all(|ident| ident.as_str() != name) {
|
||||||
ctx.value_completion(Some(name.clone()), value, None);
|
ctx.value_completion(Some(name.clone()), value, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ impl Content {
|
|||||||
|
|
||||||
for modifier in &self.modifiers {
|
for modifier in &self.modifiers {
|
||||||
if let Modifier::Field(other, value) = modifier {
|
if let Modifier::Field(other, value) = modifier {
|
||||||
if name == other.as_str() {
|
if name == other {
|
||||||
return Some(value.clone());
|
return Some(value.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,7 @@ impl Shorthand {
|
|||||||
|
|
||||||
/// Get the shorthanded character.
|
/// Get the shorthanded character.
|
||||||
pub fn get(&self) -> char {
|
pub fn get(&self) -> char {
|
||||||
let text = self.0.text().as_str();
|
let text = self.0.text();
|
||||||
Self::LIST
|
Self::LIST
|
||||||
.iter()
|
.iter()
|
||||||
.find(|&&(s, _)| s == text)
|
.find(|&&(s, _)| s == text)
|
||||||
|
@ -262,6 +262,18 @@ impl PartialEq<&str> for EcoString {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq<EcoString> for str {
|
||||||
|
fn eq(&self, other: &EcoString) -> bool {
|
||||||
|
self.eq(other.as_str())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialEq<EcoString> for &str {
|
||||||
|
fn eq(&self, other: &EcoString) -> bool {
|
||||||
|
(*self).eq(other.as_str())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Ord for EcoString {
|
impl Ord for EcoString {
|
||||||
fn cmp(&self, other: &Self) -> Ordering {
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
self.as_str().cmp(other.as_str())
|
self.as_str().cmp(other.as_str())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user