pub struct NonEmpty<T>(pub T);Expand description
A non-empty collection wrapper.
Wraps any collection type that derefs to a slice (Deref<Target = [_]>)
and validates at parse time that the collection contains at least one item.
Works with bumpalo::collections::Vec and any other slice-backed type.
Tuple Fields§
§0: TImplementations§
Trait Implementations§
impl<T: Eq> Eq for NonEmpty<T>
Source§impl<T: NodeWithMetadata<CssMetadata>> NodeWithMetadata<CssMetadata> for NonEmpty<T>
impl<T: NodeWithMetadata<CssMetadata>> NodeWithMetadata<CssMetadata> for NonEmpty<T>
Source§fn self_metadata(&self) -> CssMetadata
fn self_metadata(&self) -> CssMetadata
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§fn metadata(&self) -> CssMetadata
fn metadata(&self) -> CssMetadata
Returns the complete aggregated metadata for this node (self + children).
Default implementation merges children’s metadata with self_metadata().
Source§impl<T: Ord> Ord for NonEmpty<T>
impl<T: Ord> Ord for NonEmpty<T>
1.21.0 (const: unstable) · 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<T: PartialEq> PartialEq for NonEmpty<T>
impl<T: PartialEq> PartialEq for NonEmpty<T>
Source§impl<T: PartialOrd> PartialOrd for NonEmpty<T>
impl<T: PartialOrd> PartialOrd for NonEmpty<T>
Source§impl<T> SemanticEq for NonEmpty<T>where
T: SemanticEq,
impl<T> SemanticEq for NonEmpty<T>where
T: SemanticEq,
Source§fn semantic_eq(&self, other: &Self) -> bool
fn semantic_eq(&self, other: &Self) -> bool
Returns
true if self and other are semantically equal.impl<T> StructuralPartialEq for NonEmpty<T>
Source§impl<T> ToCursors for NonEmpty<T>where
T: ToCursors,
impl<T> ToCursors for NonEmpty<T>where
T: ToCursors,
fn to_cursors(&self, s: &mut impl CursorSink)
Auto Trait Implementations§
impl<T> Freeze for NonEmpty<T>where
T: Freeze,
impl<T> RefUnwindSafe for NonEmpty<T>where
T: RefUnwindSafe,
impl<T> Send for NonEmpty<T>where
T: Send,
impl<T> Sync for NonEmpty<T>where
T: Sync,
impl<T> Unpin for NonEmpty<T>where
T: Unpin,
impl<T> UnsafeUnpin for NonEmpty<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for NonEmpty<T>where
T: UnwindSafe,
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