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> + Debug>(
&self,
value: &Value,
known_schemata: Option<&HashMap<Name, S>>,
enclosing_namespace: &Namespace,
) -> Option<(usize, &Schema)>
pub fn find_schema_with_known_schemata<S: Borrow<Schema> + Debug>( &self, value: &Value, known_schemata: Option<&HashMap<Name, S>>, enclosing_namespace: &Namespace, ) -> 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 for UnionSchema
impl PartialEq for UnionSchema
Auto Trait Implementations§
impl Freeze for UnionSchema
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)