pub enum BoxEdgesValue {
Edges(BoxEdges),
Var {
name: String,
fallback: Option<Box<BoxEdgesValue>>,
},
}Expand description
A BoxEdges value or a var(--name) reference, for padding/margin.
BoxEdges itself is Copy (4× u16) and cannot carry a heap String, so
the var name lives in this wrapper enum. The cascade
(crate::cascade) resolves Var against the token table; an unresolved
Var degrades to zero edges (mirroring how an unresolved color Var
degrades to Reset).
Variants§
Edges(BoxEdges)
A concrete set of edges.
Var
A var(--name[, fallback]) reference, resolved during the cascade.
Implementations§
Source§impl BoxEdgesValue
impl BoxEdgesValue
Sourcepub fn parse(s: &str) -> Result<Self>
pub fn parse(s: &str) -> Result<Self>
Parse a CSS shorthand that may be a var(--name) reference.
If s starts with var( (case-insensitive), the name and optional
fallback are split on the first top-level comma (mirroring Length::parse
/ Color::parse_var); the fallback recurses via
BoxEdgesValue::parse. Otherwise s is parsed as a concrete
BoxEdges shorthand.
Trait Implementations§
Source§impl Clone for BoxEdgesValue
impl Clone for BoxEdgesValue
Source§fn clone(&self) -> BoxEdgesValue
fn clone(&self) -> BoxEdgesValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BoxEdgesValue
impl Debug for BoxEdgesValue
Source§impl<'de> Deserialize<'de> for BoxEdgesValue
impl<'de> Deserialize<'de> for BoxEdgesValue
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for BoxEdgesValue
impl Display for BoxEdgesValue
Source§impl From<BoxEdges> for BoxEdgesValue
impl From<BoxEdges> for BoxEdgesValue
Source§impl IntoBoxEdges for BoxEdgesValue
impl IntoBoxEdges for BoxEdgesValue
fn into_edges(self) -> BoxEdgesValue
Source§impl PartialEq for BoxEdgesValue
impl PartialEq for BoxEdgesValue
Source§fn eq(&self, other: &BoxEdgesValue) -> bool
fn eq(&self, other: &BoxEdgesValue) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for BoxEdgesValue
impl Serialize for BoxEdgesValue
impl StructuralPartialEq for BoxEdgesValue
Auto Trait Implementations§
impl Freeze for BoxEdgesValue
impl RefUnwindSafe for BoxEdgesValue
impl Send for BoxEdgesValue
impl Sync for BoxEdgesValue
impl Unpin for BoxEdgesValue
impl UnsafeUnpin for BoxEdgesValue
impl UnwindSafe for BoxEdgesValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
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 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>
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 moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more