pub struct Field { /* private fields */ }
Expand description
Characterizes the name and the DataType
of a column.
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 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<T> Pointable for T
impl<T> Pointable for T
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)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more