Expand description
Characterizes the name and the DataType
of a column.
Fields
name: String
dtype: DataType
Implementations
sourceimpl Field
impl Field
sourcepub fn new(name: &str, dtype: DataType) -> Field
pub fn new(name: &str, dtype: DataType) -> Field
Creates a new Field
.
Example
let f1 = Field::new("Fruit name", DataType::Utf8);
let f2 = Field::new("Lawful", DataType::Boolean);
let f2 = Field::new("Departure", DataType::Time);
pub fn from_owned(name: String, dtype: DataType) -> Field
sourcepub fn name(&self) -> &String
pub fn name(&self) -> &String
Returns a reference to the Field
name.
Example
let f = Field::new("Year", DataType::Int32);
assert_eq!(f.name(), "Year");
sourcepub fn data_type(&self) -> &DataType
pub fn data_type(&self) -> &DataType
Returns a reference to the Field
datatype.
Example
let f = Field::new("Birthday", DataType::Date);
assert_eq!(f.data_type(), &DataType::Date);
sourcepub fn coerce(&mut self, dtype: DataType)
pub fn coerce(&mut self, dtype: DataType)
Sets the Field
datatype.
Example
let mut f = Field::new("Temperature", DataType::Int32);
f.coerce(DataType::Float32);
assert_eq!(f, Field::new("Temperature", DataType::Float32));
Trait Implementations
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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 Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
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.