pub enum Either<L: Clone, R: Clone> {
Left(L),
Right(R),
}
Variants§
Implementations§
source§impl<L: Clone, R: Clone> Either<L, R>
impl<L: Clone, R: Clone> Either<L, R>
pub fn left(self) -> Option<L>
pub fn right(self) -> Option<R>
pub fn is_left(&self) -> bool
pub fn is_right(&self) -> bool
pub fn map_to_right<F>(self, map: F) -> Rwhere
F: FnOnce(L) -> R,
pub fn map_to_left<F>(self, map: F) -> Lwhere
F: FnOnce(R) -> L,
pub fn right_or(self, or: Either<L, R>) -> Either<L, R>
pub fn map_ref_to_right<F>(&self, map: F) -> R
pub fn map_ref_to_left<F>(&self, map: F) -> L
pub const fn as_ref(&self) -> Either<&L, &R>
Trait Implementations§
source§impl<'de, L, R> Deserialize<'de> for Either<L, R>
impl<'de, L, R> Deserialize<'de> for Either<L, R>
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<L: Clone + JsonSchema, R: Clone + JsonSchema> JsonSchema for Either<L, R>
impl<L: Clone + JsonSchema, R: Clone + JsonSchema> JsonSchema for Either<L, R>
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(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &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 moresource§impl<L: Ord + Clone, R: Ord + Clone> Ord for Either<L, R>
impl<L: Ord + Clone, R: Ord + Clone> Ord for Either<L, R>
1.21.0 · 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<L: PartialOrd + Clone, R: PartialOrd + Clone> PartialOrd for Either<L, R>
impl<L: PartialOrd + Clone, R: PartialOrd + Clone> PartialOrd for Either<L, R>
impl<L: Eq + Clone, R: Eq + Clone> Eq for Either<L, R>
impl<L: Clone, R: Clone> StructuralPartialEq for Either<L, R>
Auto Trait Implementations§
impl<L, R> Freeze for Either<L, R>
impl<L, R> RefUnwindSafe for Either<L, R>where
L: RefUnwindSafe,
R: RefUnwindSafe,
impl<L, R> Send for Either<L, R>
impl<L, R> Sync for Either<L, R>
impl<L, R> Unpin for Either<L, R>
impl<L, R> UnwindSafe for Either<L, R>where
L: UnwindSafe,
R: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.