serde 1.0.221 introduced serde_core into the build graph, which should render explicitly depending on serde_derive for faster build times an obsolote method. Besides, I'm not even sure if that worked for us. My hunch is that at least one of our deps would have `serde` with derive feature enabled.. and then, most of the crates using `serde_derive` explicitly were also depending on gpui, which depended on `serde`.. thus, we wouldn't have gained anything from explicit dep on `serde_derive` Release Notes: - N/A
22 lines
635 B
Rust
22 lines
635 B
Rust
use std::sync::Arc;
|
|
|
|
use schemars::JsonSchema;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// The fallback fonts that can be configured for a given font.
|
|
/// Fallback fonts family names are stored here.
|
|
#[derive(Default, Clone, Eq, PartialEq, Hash, Debug, Deserialize, Serialize, JsonSchema)]
|
|
pub struct FontFallbacks(pub Arc<Vec<String>>);
|
|
|
|
impl FontFallbacks {
|
|
/// Get the fallback fonts family names
|
|
pub fn fallback_list(&self) -> &[String] {
|
|
self.0.as_slice()
|
|
}
|
|
|
|
/// Create a font fallback from a list of strings
|
|
pub fn from_fonts(fonts: Vec<String>) -> Self {
|
|
FontFallbacks(Arc::new(fonts))
|
|
}
|
|
}
|