pub enum Edges {
Uniform(LengthPercentage),
Sides {
top: LengthPercentage,
right: LengthPercentage,
bottom: LengthPercentage,
left: LengthPercentage,
},
}Expand description
Edge values for margin / padding. Either uniform or per-side.
Constat #2: CssStyle itself has deny_unknown_fields, which gives the
impression that any bad key under style is rejected — but one level
down, Sides’s four fields are all #[serde(default)] with no
deny_unknown_fields of its own. Since this is an untagged enum, a
well-meaning but unsupported shape like {"horizontal": 20} (the exact
form the LAYOUT margin-left rule teaches LLMs to reach for) fails to
match Uniform (not a scalar) and then matches Sides anyway — every
side defaults to 0, no error. deny_unknown_fields here closes that: an
object that isn’t a recognised {top,right,bottom,left} shape now fails
to match either variant, and the untagged enum reports it.
Variants§
Uniform(LengthPercentage)
Sides
Fields
§
top: LengthPercentage§
right: LengthPercentage§
bottom: LengthPercentage§
left: LengthPercentageImplementations§
Source§impl Edges
impl Edges
pub fn resolve( &self, ) -> (LengthPercentage, LengthPercentage, LengthPercentage, LengthPercentage)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Edges
impl<'de> Deserialize<'de> for Edges
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for Edges
impl JsonSchema for Edges
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreimpl StructuralPartialEq for Edges
Auto Trait Implementations§
impl Freeze for Edges
impl RefUnwindSafe for Edges
impl Send for Edges
impl Sync for Edges
impl Unpin for Edges
impl UnsafeUnpin for Edges
impl UnwindSafe for Edges
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 more