pub enum DeclarationOrBad<'a, D, M>where
D: DeclarationValue<'a, M>,
M: NodeMetadata,{
Declaration(Declaration<'a, D, M>),
Bad(BadDeclaration<'a>),
}Expand description
Either a valid declaration or a bad declaration consumed for error recovery.
Per the CSS spec, when parsing fails for both a declaration and a rule, we consume the remnants as a bad declaration to maintain error recovery.
Variants§
Declaration(Declaration<'a, D, M>)
Bad(BadDeclaration<'a>)
Trait Implementations§
Source§impl<'a, D, M> Clone for DeclarationOrBad<'a, D, M>
impl<'a, D, M> Clone for DeclarationOrBad<'a, D, M>
Source§fn clone(&self) -> DeclarationOrBad<'a, D, M>
fn clone(&self) -> DeclarationOrBad<'a, D, M>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a, D, M> Debug for DeclarationOrBad<'a, D, M>
impl<'a, D, M> Debug for DeclarationOrBad<'a, D, M>
Source§impl<'a, D, M> Hash for DeclarationOrBad<'a, D, M>
impl<'a, D, M> Hash for DeclarationOrBad<'a, D, M>
Source§impl<'a, D, M> NodeWithMetadata<M> for DeclarationOrBad<'a, D, M>where
D: DeclarationValue<'a, M>,
M: NodeMetadata,
impl<'a, D, M> NodeWithMetadata<M> for DeclarationOrBad<'a, D, M>where
D: DeclarationValue<'a, M>,
M: NodeMetadata,
Source§fn metadata(&self) -> M
fn metadata(&self) -> M
Returns the complete aggregated metadata for this node (self + children).
Default implementation merges children’s metadata with self_metadata().
Source§fn self_metadata(&self) -> M
fn self_metadata(&self) -> M
Returns the metadata contributed by this node itself, not including children.
Most nodes don’t contribute metadata, so can simply return
M::default().
Nodes like StyleRule or AtRules should return their own node kind flags here.Source§impl<'a, D, M> Ord for DeclarationOrBad<'a, D, M>
impl<'a, D, M> Ord for DeclarationOrBad<'a, D, M>
Source§fn cmp(&self, other: &DeclarationOrBad<'a, D, M>) -> Ordering
fn cmp(&self, other: &DeclarationOrBad<'a, D, M>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a, D, M> PartialEq for DeclarationOrBad<'a, D, M>
impl<'a, D, M> PartialEq for DeclarationOrBad<'a, D, M>
Source§impl<'a, D, M> PartialOrd for DeclarationOrBad<'a, D, M>
impl<'a, D, M> PartialOrd for DeclarationOrBad<'a, D, M>
Source§impl<'a, D, M> SemanticEq for DeclarationOrBad<'a, D, M>where
D: DeclarationValue<'a, M>,
M: NodeMetadata,
impl<'a, D, M> SemanticEq for DeclarationOrBad<'a, D, M>where
D: DeclarationValue<'a, M>,
M: NodeMetadata,
Source§fn semantic_eq(&self, other: &Self) -> bool
fn semantic_eq(&self, other: &Self) -> bool
Returns
true if self and other are semantically equal.Source§impl<'a, D, M> ToCursors for DeclarationOrBad<'a, D, M>
impl<'a, D, M> ToCursors for DeclarationOrBad<'a, D, M>
fn to_cursors(&self, s: &mut impl CursorSink)
Source§impl<'a, D, M> ToSpan for DeclarationOrBad<'a, D, M>
impl<'a, D, M> ToSpan for DeclarationOrBad<'a, D, M>
impl<'a, D, M> Eq for DeclarationOrBad<'a, D, M>
impl<'a, D, M> StructuralPartialEq for DeclarationOrBad<'a, D, M>where
D: DeclarationValue<'a, M>,
M: NodeMetadata,
Auto Trait Implementations§
impl<'a, D, M> Freeze for DeclarationOrBad<'a, D, M>where
D: Freeze,
impl<'a, D, M> !RefUnwindSafe for DeclarationOrBad<'a, D, M>
impl<'a, D, M> !Send for DeclarationOrBad<'a, D, M>
impl<'a, D, M> !Sync for DeclarationOrBad<'a, D, M>
impl<'a, D, M> Unpin for DeclarationOrBad<'a, D, M>where
D: Unpin,
impl<'a, D, M> !UnwindSafe for DeclarationOrBad<'a, D, M>
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
Mutably borrows from an owned value. Read more