pub struct Field { /* private fields */ }
Expand description
Contains the meta-data for a single relative type.
The Schema
object is an ordered collection of Field
objects.
Implementations
sourceimpl Field
impl Field
sourcepub fn new_dict(
name: &str,
data_type: DataType,
nullable: bool,
dict_id: i64,
dict_is_ordered: bool
) -> Self
pub fn new_dict(
name: &str,
data_type: DataType,
nullable: bool,
dict_id: i64,
dict_is_ordered: bool
) -> Self
Creates a new field
sourcepub fn set_metadata(&mut self, metadata: Option<BTreeMap<String, String>>)
pub fn set_metadata(&mut self, metadata: Option<BTreeMap<String, String>>)
Sets the Field
’s optional custom metadata.
The metadata is set as None
for empty map.
sourcepub fn with_metadata(self, metadata: Option<BTreeMap<String, String>>) -> Self
pub fn with_metadata(self, metadata: Option<BTreeMap<String, String>>) -> Self
Sets the metadata of this Field
to be metadata
and returns self
sourcepub const fn metadata(&self) -> Option<&BTreeMap<String, String>>
pub const fn metadata(&self) -> Option<&BTreeMap<String, String>>
Returns the immutable reference to the Field
’s optional custom metadata.
sourcepub const fn data_type(&self) -> &DataType
pub const fn data_type(&self) -> &DataType
Returns an immutable reference to the Field
’s data-type.
sourcepub const fn is_nullable(&self) -> bool
pub const fn is_nullable(&self) -> bool
Indicates whether this Field
supports null values.
sourcepub const fn dict_id(&self) -> Option<i64>
pub const fn dict_id(&self) -> Option<i64>
Returns the dictionary ID, if this is a dictionary type.
sourcepub const fn dict_is_ordered(&self) -> Option<bool>
pub const fn dict_is_ordered(&self) -> Option<bool>
Returns whether this Field
’s dictionary is ordered, if this is a dictionary type.
sourcepub fn try_merge(&mut self, from: &Field) -> Result<()>
pub fn try_merge(&mut self, from: &Field) -> Result<()>
Merge field into self if it is compatible. Struct will be merged recursively.
NOTE: self
may be updated to unexpected state in case of merge failure.
Example:
use arrow::datatypes::*;
let mut field = Field::new("c1", DataType::Int64, false);
assert!(field.try_merge(&Field::new("c1", DataType::Int64, true)).is_ok());
assert!(field.is_nullable());
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Field
impl<'de> Deserialize<'de> for Field
sourcefn 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
sourceimpl From<&'_ Field> for ArrowJsonField
impl From<&'_ Field> for ArrowJsonField
sourceimpl Ord for Field
impl Ord for Field
sourceimpl PartialOrd<Field> for Field
impl PartialOrd<Field> for Field
sourcefn partial_cmp(&self, other: &Field) -> Option<Ordering>
fn partial_cmp(&self, other: &Field) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl TryFrom<&'_ FFI_ArrowSchema> for Field
impl TryFrom<&'_ FFI_ArrowSchema> for Field
type Error = ArrowError
type Error = ArrowError
The type returned in the event of a conversion error.
sourcefn try_from(c_schema: &FFI_ArrowSchema) -> Result<Self>
fn try_from(c_schema: &FFI_ArrowSchema) -> Result<Self>
Performs the conversion.
sourceimpl TryFrom<&'_ Field> for FFI_ArrowSchema
impl TryFrom<&'_ Field> for FFI_ArrowSchema
sourceimpl TryFrom<Field> for FFI_ArrowSchema
impl TryFrom<Field> for FFI_ArrowSchema
impl Eq for Field
impl StructuralEq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more