pub struct SynthUnion {
pub variants: Vec<SynthType>,
}Expand description
A structural union of types
Unlike schema unions, these are anonymous/structural and don’t have named variants.
Fields§
§variants: Vec<SynthType>The variant types in this union
Invariants:
- At least 2 elements
- No
SynthType::Unionelements (flattened) - No duplicates
Implementations§
Source§impl SynthUnion
impl SynthUnion
Sourcepub fn from_variants(variants: impl IntoIterator<Item = SynthType>) -> SynthType
pub fn from_variants(variants: impl IntoIterator<Item = SynthType>) -> SynthType
Create a union from variants, normalizing as needed
This function:
- Flattens nested unions
- Removes duplicates
- Returns single type if only one variant remains
- Returns
Neverfor empty input
Trait Implementations§
Source§impl Clone for SynthUnion
impl Clone for SynthUnion
Source§fn clone(&self) -> SynthUnion
fn clone(&self) -> SynthUnion
Returns a duplicate of the value. Read more
1.0.0 · 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 SynthUnion
impl Debug for SynthUnion
Source§impl Display for SynthUnion
impl Display for SynthUnion
Source§impl PartialEq for SynthUnion
impl PartialEq for SynthUnion
impl StructuralPartialEq for SynthUnion
Auto Trait Implementations§
impl Freeze for SynthUnion
impl RefUnwindSafe for SynthUnion
impl Send for SynthUnion
impl Sync for SynthUnion
impl Unpin for SynthUnion
impl UnwindSafe for SynthUnion
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