Enum style::properties::PropertyId
source · pub enum PropertyId {
NonCustom(NonCustomPropertyId),
Custom(Name),
}
Expand description
Representation of a CSS property, that is, either a longhand, a shorthand, or a custom property.
Variants§
Implementations§
source§impl PropertyId
impl PropertyId
sourcepub(super) fn parse_unchecked(
property_name: &str,
use_counters: Option<&UseCounters>,
) -> Result<Self, ()>
pub(super) fn parse_unchecked( property_name: &str, use_counters: Option<&UseCounters>, ) -> Result<Self, ()>
Returns a given property from the given name, regardless of whether it is enabled or not, or Err(()) for unknown properties.
source§impl PropertyId
impl PropertyId
sourcepub fn longhand_id(&self) -> Option<LonghandId>
pub fn longhand_id(&self) -> Option<LonghandId>
Return the longhand id that this property id represents.
sourcepub fn is_animatable(&self) -> bool
pub fn is_animatable(&self) -> bool
Returns true if this property is one of the animatable properties.
sourcepub fn parse_unchecked_for_testing(name: &str) -> Result<Self, ()>
pub fn parse_unchecked_for_testing(name: &str) -> Result<Self, ()>
Returns a given property from the given name, regardless of whether it is enabled or not, or Err(()) for unknown properties.
Do not use for non-testing purposes.
sourcepub fn parse_enabled_for_all_content(name: &str) -> Result<Self, ()>
pub fn parse_enabled_for_all_content(name: &str) -> Result<Self, ()>
Parses a property name, and returns an error if it’s unknown or isn’t enabled for all content.
sourcepub fn parse(name: &str, context: &ParserContext<'_>) -> Result<Self, ()>
pub fn parse(name: &str, context: &ParserContext<'_>) -> Result<Self, ()>
Parses a property name, and returns an error if it’s unknown or isn’t allowed in this context.
sourcepub fn parse_ignoring_rule_type(
name: &str,
context: &ParserContext<'_>,
) -> Result<Self, ()>
pub fn parse_ignoring_rule_type( name: &str, context: &ParserContext<'_>, ) -> Result<Self, ()>
Parses a property name, and returns an error if it’s unknown or isn’t allowed in this context, ignoring the rule_type checks.
This is useful for parsing stuff from CSS values, for example.
sourcepub fn is_shorthand(&self) -> bool
pub fn is_shorthand(&self) -> bool
Returns true if the property is a shorthand or shorthand alias.
sourcepub fn as_shorthand(&self) -> Result<ShorthandId, PropertyDeclarationId<'_>>
pub fn as_shorthand(&self) -> Result<ShorthandId, PropertyDeclarationId<'_>>
Given this property id, get it either as a shorthand or as a
PropertyDeclarationId
.
sourcepub fn non_custom_id(&self) -> Option<NonCustomPropertyId>
pub fn non_custom_id(&self) -> Option<NonCustomPropertyId>
Returns the NonCustomPropertyId
corresponding to this property id.
sourcefn non_custom_non_alias_id(&self) -> Option<NonCustomPropertyId>
fn non_custom_non_alias_id(&self) -> Option<NonCustomPropertyId>
Returns non-alias NonCustomPropertyId corresponding to this property id.
sourcepub fn enabled_for_all_content(&self) -> bool
pub fn enabled_for_all_content(&self) -> bool
Whether the property is enabled for all content regardless of the stylesheet it was declared on (that is, in practice only checks prefs).
fn allowed_in(&self, context: &ParserContext<'_>) -> bool
fn allowed_in_ignoring_rule_type(&self, context: &ParserContext<'_>) -> bool
sourcepub fn supports_type(&self, ty: u8) -> bool
pub fn supports_type(&self, ty: u8) -> bool
Whether the property supports the given CSS type.
ty
should a bitflags of constants in style_traits::CssType.
sourcepub fn collect_property_completion_keywords(&self, f: KeywordsCollectFn<'_>)
pub fn collect_property_completion_keywords(&self, f: KeywordsCollectFn<'_>)
Collect supported starting word of values of this property.
See style_traits::SpecifiedValueInfo::collect_completion_keywords for more details.
Trait Implementations§
source§impl Clone for PropertyId
impl Clone for PropertyId
source§fn clone(&self) -> PropertyId
fn clone(&self) -> PropertyId
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PropertyId
impl Debug for PropertyId
source§impl PartialEq for PropertyId
impl PartialEq for PropertyId
source§fn eq(&self, other: &PropertyId) -> bool
fn eq(&self, other: &PropertyId) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl ToCss for PropertyId
impl ToCss for PropertyId
impl Eq for PropertyId
impl StructuralPartialEq for PropertyId
Auto Trait Implementations§
impl Freeze for PropertyId
impl RefUnwindSafe for PropertyId
impl Send for PropertyId
impl Sync for PropertyId
impl Unpin for PropertyId
impl UnwindSafe for PropertyId
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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