lewp_css/domain/properties/has_importance.rs
1// This file is part of css. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2017 The developers of css. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css/master/COPYRIGHT.
3
4use {
5 super::Importance,
6 crate::CustomParseError,
7 cssparser::{ParseError, ToCss},
8 std::{fmt::Debug, hash::Hash},
9};
10
11/// A trait representing that !important can or can not be present in a property declaration
12pub trait HasImportance:
13 ToCss + Sized + Debug + Copy + Clone + Ord + PartialOrd + Eq + PartialEq + Hash
14{
15 /// Validate and convert importance, if permitted
16 fn validateParsedImportance<'i>(
17 importance: Importance,
18 ) -> Result<Self, ParseError<'i, CustomParseError<'i>>>;
19
20 /// Return whether this is an important declaration.
21 fn isImportant(&self) -> bool;
22}