pub trait FieldExt {
// Required methods
fn into_list(self) -> Self;
fn into_fixed_size_list(self, list_size: i32) -> Self;
fn into_list_item(self) -> Self;
}Required Methods§
Sourcefn into_list(self) -> Self
fn into_list(self) -> Self
Returns a new Field representing a List of this Field’s DataType.
For example if input represents an Int32, the return value will
represent a List<Int32>.
Example:
// Int32 field
let int_field = Field::new("my_int", DataType::Int32, true);
// convert to a List field
let list_field = int_field.into_list();
// List<Int32>
// Note that the item field name has been renamed to "item"
assert_eq!(list_field.data_type(), &DataType::List(Arc::new(
Field::new("item", DataType::Int32, true)
)));Sourcefn into_fixed_size_list(self, list_size: i32) -> Self
fn into_fixed_size_list(self, list_size: i32) -> Self
Return a new Field representing this Field as the item type of a
DataType::FixedSizeList
For example if input represents an Int32, the return value will
represent a FixedSizeList<Int32, size>.
Example:
// Int32 field
let int_field = Field::new("my_int", DataType::Int32, true);
// convert to a FixedSizeList field of size 3
let fixed_size_list_field = int_field.into_fixed_size_list(3);
// FixedSizeList<Int32, 3>
// Note that the item field name has been renamed to "item"
assert_eq!(
fixed_size_list_field.data_type(),
&DataType::FixedSizeList(Arc::new(
Field::new("item", DataType::Int32, true)),
3
));Sourcefn into_list_item(self) -> Self
fn into_list_item(self) -> Self
Update the field to have the default list field name (“item”)
Lists are allowed to have an arbitrarily named field; however, a name other than ‘item’ will cause it to fail an == check against a more idiomatically created list in arrow-rs which causes issues.
For example, if input represents an Int32 field named “my_int”,
the return value will represent an Int32 field named “item”.
Example:
let my_field = Field::new("my_int", arrow::datatypes::DataType::Int32, true);
let item_field = my_field.into_list_item();
assert_eq!(item_field.name(), Field::LIST_FIELD_DEFAULT_NAME);
assert_eq!(item_field.name(), "item");Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.