Struct apache_avro::schema::UnionSchema
source · pub struct UnionSchema { /* private fields */ }
Expand description
A description of a Union schema
Implementations§
source§impl UnionSchema
impl UnionSchema
sourcepub fn new(schemas: Vec<Schema>) -> AvroResult<Self>
pub fn new(schemas: Vec<Schema>) -> AvroResult<Self>
Creates a new UnionSchema from a vector of schemas.
sourcepub fn is_nullable(&self) -> bool
pub fn is_nullable(&self) -> bool
Returns true if the any of the variants of this UnionSchema
is Null
.
sourcepub fn find_schema(&self, value: &Value) -> Option<(usize, &Schema)>
👎Deprecated since 0.15.0: Please use find_schema_with_known_schemata
instead
pub fn find_schema(&self, value: &Value) -> Option<(usize, &Schema)>
find_schema_with_known_schemata
insteadOptionally returns a reference to the schema matched by this value, as well as its position within this union.
sourcepub fn find_schema_with_known_schemata<S: Borrow<Schema>>(
&self,
value: &Value,
known_schemata: Option<&HashMap<Name, S>>
) -> Option<(usize, &Schema)>
pub fn find_schema_with_known_schemata<S: Borrow<Schema>>( &self, value: &Value, known_schemata: Option<&HashMap<Name, S>> ) -> Option<(usize, &Schema)>
Optionally returns a reference to the schema matched by this value, as well as its position within this union.
Extra arguments:
known_schemata
- mapping betweenName
andSchema
- if passed, additional external schemas would be used to resolve references.
Trait Implementations§
source§impl Clone for UnionSchema
impl Clone for UnionSchema
source§fn clone(&self) -> UnionSchema
fn clone(&self) -> UnionSchema
Returns a copy 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 UnionSchema
impl Debug for UnionSchema
source§impl PartialEq<UnionSchema> for UnionSchema
impl PartialEq<UnionSchema> for UnionSchema
source§fn eq(&self, other: &UnionSchema) -> bool
fn eq(&self, other: &UnionSchema) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.Auto Trait Implementations§
impl RefUnwindSafe for UnionSchema
impl Send for UnionSchema
impl Sync for UnionSchema
impl Unpin for UnionSchema
impl UnwindSafe for UnionSchema
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