Skip to content

Commit

Permalink
Don't require Eq for FontSettings (#206)
Browse files Browse the repository at this point in the history
The code currently requires that `T` be `Eq` for `FontSettings<T>`.

This is okay when using `swash::Setting` as that unconditionally defines
`Eq` for `Setting<T>` when `T: PartialEq` and doesn't check for `Eq`.

When using `skrifa::setting::Setting`, then `Eq` is only defined for
`Setting<T>` when `T: Eq`.

We use `Setting` (and `FontSettings`) for `FontVariation` which is a
`Setting<f32>` and therefore is not `Eq` due to the `f32`.
  • Loading branch information
waywardmonkeys authored Dec 7, 2024
1 parent 050fd29 commit b5f16e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions parley/src/style/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ impl<'a> Iterator for ParseList<'a> {

/// Font settings that can be supplied as a raw source string or
/// a parsed slice.
#[derive(Clone, PartialEq, Eq, Debug)]
#[derive(Clone, PartialEq, Debug)]
pub enum FontSettings<'a, T>
where
[T]: ToOwned,
<[T] as ToOwned>::Owned: fmt::Debug + Eq + Clone,
<[T] as ToOwned>::Owned: fmt::Debug + PartialEq + Clone,
{
/// Setting source in CSS format.
Source(Cow<'a, str>),
Expand All @@ -213,7 +213,7 @@ where
impl<'a, T> From<&'a str> for FontSettings<'a, T>
where
[T]: ToOwned,
<[T] as ToOwned>::Owned: fmt::Debug + Eq + Clone,
<[T] as ToOwned>::Owned: fmt::Debug + PartialEq + Clone,
{
fn from(value: &'a str) -> Self {
Self::Source(Cow::Borrowed(value))
Expand All @@ -223,7 +223,7 @@ where
impl<'a, T> From<&'a [T]> for FontSettings<'a, T>
where
[T]: ToOwned,
<[T] as ToOwned>::Owned: fmt::Debug + Eq + Clone,
<[T] as ToOwned>::Owned: fmt::Debug + PartialEq + Clone,
{
fn from(value: &'a [T]) -> Self {
Self::List(Cow::Borrowed(value))
Expand Down

0 comments on commit b5f16e9

Please sign in to comment.