Struct CSSFeature

Source
pub struct CSSFeature {
    pub id: &'static str,
    pub name: &'static str,
    pub description: &'static str,
    pub spec: &'static str,
    pub groups: &'static [&'static str],
    pub caniuse: &'static [&'static str],
    pub baseline_status: BaselineStatus,
    pub browser_support: BrowserSupport,
    pub popularity: f32,
}

Fields§

§id: &'static str

The ID of the feature.

§name: &'static str

A friendly, human-readable name of the feature.

§description: &'static str

A description for this feature.

§spec: &'static str

A URL to the CSS specification that includes this feature.

§groups: &'static [&'static str]

The groups this feature is part of.

§caniuse: &'static [&'static str]

The CanIUse URLs available for this feature.

§baseline_status: BaselineStatus

The current BaselineStatus of this feature

§browser_support: BrowserSupport

The browsers that support this feature.

§popularity: f32

The percentage of web pages which use this feature, as reported by Chrome usage data.

Implementations§

Source§

impl CSSFeature

Source

pub fn by_feature_name(name: &str) -> Option<&'static CSSFeature>

Source

pub fn by_property_name(name: &str) -> Option<&'static CSSFeature>

Source

pub fn has_baseline_support(&self) -> bool

Check if a feature has Baseline support.

use css_feature_data::CSSFeature;
assert_eq!(CSSFeature::by_property_name("word-break").is_some_and(|f| f.has_baseline_support()), true)
Source

pub fn baseline_supported_since(&self) -> Option<NaiveDate>

Check the earliest date this feature was supported as Baseline.

If BaselineStatus::Low, then that date will be returned. If BaselineStatus::High, then the low date will be returned.

use css_feature_data::CSSFeature;
use chrono::NaiveDate;
assert_eq!(CSSFeature::by_property_name("word-break").map(|f| f.baseline_supported_since()), Some(NaiveDate::from_ymd_opt(2015,07,29)));
Source

pub fn group_siblings(&self) -> impl Iterator<Item = &'static CSSFeature>

Get all CSS properties in the same groups as this one

Source

pub fn spec_siblings(&self) -> impl Iterator<Item = &'static CSSFeature>

Get all CSS properties in the same specification as this one

Source

pub fn supports_browserslist( &self, browserslist_query: &[&str], opts: &Opts, ) -> Result<CompatibilityResult, Error>

Check if a CSS property is supported across browsers specified by a browserslist query

Source

pub fn supports(&self, browser: NamedBrowserVersion) -> bool

Trait Implementations§

Source§

impl Clone for CSSFeature

Source§

fn clone(&self) -> CSSFeature

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CSSFeature

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CSSFeature

Source§

fn eq(&self, other: &CSSFeature) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for CSSFeature

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.