pub struct UnionFields(Arc<[(i8, FieldRef)]>);
Expand description
A cheaply cloneable, owned collection of FieldRef
and their corresponding type ids
Tuple Fields§
§0: Arc<[(i8, FieldRef)]>
Implementations§
Source§impl UnionFields
impl UnionFields
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create a new UnionFields
with no fields
Sourcepub fn new<F, T>(type_ids: T, fields: F) -> Self
pub fn new<F, T>(type_ids: T, fields: F) -> Self
Create a new UnionFields
from a Fields
and array of type_ids
See https://arrow.apache.org/docs/format/Columnar.html#union-layout
use arrow_schema::{DataType, Field, UnionFields};
// Create a new UnionFields with type id mapping
// 1 -> DataType::UInt8
// 3 -> DataType::Utf8
UnionFields::new(
vec![1, 3],
vec![
Field::new("field1", DataType::UInt8, false),
Field::new("field3", DataType::Utf8, false),
],
);
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of fields in this UnionFields
Sourcepub fn iter(&self) -> impl Iterator<Item = (i8, &FieldRef)> + '_
pub fn iter(&self) -> impl Iterator<Item = (i8, &FieldRef)> + '_
Returns an iterator over the fields and type ids in this UnionFields
Sourcepub(crate) fn try_merge(&mut self, other: &Self) -> Result<(), ArrowError>
pub(crate) fn try_merge(&mut self, other: &Self) -> Result<(), ArrowError>
Merge this field into self if it is compatible.
See Field::try_merge
Trait Implementations§
Source§impl Clone for UnionFields
impl Clone for UnionFields
Source§fn clone(&self) -> UnionFields
fn clone(&self) -> UnionFields
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 UnionFields
impl Debug for UnionFields
Source§impl<'de> Deserialize<'de> for UnionFields
impl<'de> Deserialize<'de> for UnionFields
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 FromIterator<(i8, Arc<Field>)> for UnionFields
impl FromIterator<(i8, Arc<Field>)> for UnionFields
Source§impl Hash for UnionFields
impl Hash for UnionFields
Source§impl Ord for UnionFields
impl Ord for UnionFields
Source§fn cmp(&self, other: &UnionFields) -> Ordering
fn cmp(&self, other: &UnionFields) -> Ordering
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 PartialEq for UnionFields
impl PartialEq for UnionFields
Source§impl PartialOrd for UnionFields
impl PartialOrd for UnionFields
Source§impl Serialize for UnionFields
impl Serialize for UnionFields
impl Eq for UnionFields
impl StructuralPartialEq for UnionFields
Auto Trait Implementations§
impl Freeze for UnionFields
impl RefUnwindSafe for UnionFields
impl Send for UnionFields
impl Sync for UnionFields
impl Unpin for UnionFields
impl UnwindSafe for UnionFields
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