Skip to main content

regex_syntax/
either.rs

1/// A simple binary sum type.
2///
3/// This is occasionally useful in an ad hoc fashion.
4#[derive(#[automatically_derived]
impl<Left: ::core::clone::Clone, Right: ::core::clone::Clone>
    ::core::clone::Clone for Either<Left, Right> {
    #[inline]
    fn clone(&self) -> Either<Left, Right> {
        match self {
            Either::Left(__self_0) =>
                Either::Left(::core::clone::Clone::clone(__self_0)),
            Either::Right(__self_0) =>
                Either::Right(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl<Left: ::core::fmt::Debug, Right: ::core::fmt::Debug> ::core::fmt::Debug
    for Either<Left, Right> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Either::Left(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Left",
                    &__self_0),
            Either::Right(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Right",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<Left: ::core::cmp::Eq, Right: ::core::cmp::Eq> ::core::cmp::Eq for
    Either<Left, Right> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Left>;
        let _: ::core::cmp::AssertParamIsEq<Right>;
    }
}Eq, #[automatically_derived]
impl<Left: ::core::cmp::PartialEq, Right: ::core::cmp::PartialEq>
    ::core::cmp::PartialEq for Either<Left, Right> {
    #[inline]
    fn eq(&self, other: &Either<Left, Right>) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (Either::Left(__self_0), Either::Left(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Either::Right(__self_0), Either::Right(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq)]
5pub enum Either<Left, Right> {
6    Left(Left),
7    Right(Right),
8}