Use SmolStr in FamilyOwned instead of String
This commit is contained in:
parent
7c25fcb7ae
commit
caa214a755
2 changed files with 5 additions and 6 deletions
|
|
@ -21,6 +21,7 @@ rangemap = "1.4.0"
|
|||
rustc-hash = { version = "1.1.0", default-features = false }
|
||||
rustybuzz = { version = "0.14", default-features = false, features = ["libm"] }
|
||||
self_cell = "1.0.1"
|
||||
smol_str = { version = "0.2.2", default-features = false }
|
||||
swash = { version = "0.1.17", optional = true }
|
||||
syntect = { version = "5.1.0", optional = true }
|
||||
sys-locale = { version = "0.3.1", optional = true }
|
||||
|
|
|
|||
10
src/attrs.rs
10
src/attrs.rs
|
|
@ -1,12 +1,10 @@
|
|||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::{
|
||||
string::{String, ToString},
|
||||
vec::Vec,
|
||||
};
|
||||
use alloc::vec::Vec;
|
||||
use core::ops::Range;
|
||||
use rangemap::RangeMap;
|
||||
use smol_str::SmolStr;
|
||||
|
||||
use crate::{CacheKeyFlags, Metrics};
|
||||
|
||||
|
|
@ -69,7 +67,7 @@ impl Color {
|
|||
/// An owned version of [`Family`]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub enum FamilyOwned {
|
||||
Name(String),
|
||||
Name(SmolStr),
|
||||
Serif,
|
||||
SansSerif,
|
||||
Cursive,
|
||||
|
|
@ -80,7 +78,7 @@ pub enum FamilyOwned {
|
|||
impl FamilyOwned {
|
||||
pub fn new(family: Family) -> Self {
|
||||
match family {
|
||||
Family::Name(name) => FamilyOwned::Name(name.to_string()),
|
||||
Family::Name(name) => FamilyOwned::Name(SmolStr::from(name)),
|
||||
Family::Serif => FamilyOwned::Serif,
|
||||
Family::SansSerif => FamilyOwned::SansSerif,
|
||||
Family::Cursive => FamilyOwned::Cursive,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue