mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Some impls for Either<A, B>
This commit is contained in:
parent
72e4c6dc21
commit
dc7c1c6270
1 changed files with 7 additions and 7 deletions
|
@ -343,6 +343,13 @@ impl Parse for Length {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Either<Length, T> {
|
||||
#[inline]
|
||||
pub fn parse_non_negative_length(input: &mut Parser) -> Result<Either<Length, T>, ()> {
|
||||
Length::parse_internal(input, AllowedNumericType::NonNegative).map(Either::First)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CalcSumNode {
|
||||
pub products: Vec<CalcProductNode>,
|
||||
|
@ -946,13 +953,6 @@ impl Parse for LengthOrPercentageOrNone {
|
|||
|
||||
pub type LengthOrNone = Either<Length, None_>;
|
||||
|
||||
impl LengthOrNone {
|
||||
#[inline]
|
||||
pub fn parse_non_negative(input: &mut Parser) -> Result<LengthOrNone, ()> {
|
||||
Length::parse_internal(input, AllowedNumericType::NonNegative).map(Either::First)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Copy, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum LengthOrPercentageOrAutoOrContent {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue