pub enum DiscriminatorRule {
Prefix(String),
Suffix(String),
Contains(String),
Regex(String),
FieldEquals(FieldDiscriminator),
FieldAbsent(String),
}Expand description
How the decoder identifies that a value belongs to a given union branch.
Variants§
Prefix(String)
String value starts with this prefix (e.g. "ssh://").
Suffix(String)
String value ends with this suffix (e.g. ".tar.gz").
Contains(String)
String value contains this substring.
Regex(String)
String value has a match for this regex in the implementation’s regex dialect. The pattern must include anchors when whole-string matching is required.
FieldEquals(FieldDiscriminator)
Record-shaped value where the named field is present, and — if
literal is set — has the given literal string value. The common
JSON-discriminated-object case ({"kind":"circle",…}) is
field-equals { field-name: "kind", literal: some("circle") }.
FieldAbsent(String)
Record-shaped value where the named field is absent.
Trait Implementations§
Source§impl Clone for DiscriminatorRule
impl Clone for DiscriminatorRule
Source§fn clone(&self) -> DiscriminatorRule
fn clone(&self) -> DiscriminatorRule
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DiscriminatorRule
impl RefUnwindSafe for DiscriminatorRule
impl Send for DiscriminatorRule
impl Sync for DiscriminatorRule
impl Unpin for DiscriminatorRule
impl UnsafeUnpin for DiscriminatorRule
impl UnwindSafe for DiscriminatorRule
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