pub struct ArrowField { /* private fields */ }Expand description
Implementations§
Source§impl Field
impl Field
Sourcepub fn new(
name: impl Into<String>,
data_type: DataType,
nullable: bool,
) -> Field
pub fn new( name: impl Into<String>, data_type: DataType, nullable: bool, ) -> Field
Creates a new field with the given name, type, and nullability
Sourcepub fn new_list_field(data_type: DataType, nullable: bool) -> Field
pub fn new_list_field(data_type: DataType, nullable: bool) -> Field
Creates a new Field suitable for DataType::List and
DataType::LargeList
While not required, this method follows the convention of naming the
Field "item".
§Example
assert_eq!(
Field::new("item", DataType::Int32, true),
Field::new_list_field(DataType::Int32, true)
);Sourcepub fn new_dict(
name: impl Into<String>,
data_type: DataType,
nullable: bool,
dict_id: i64,
dict_is_ordered: bool,
) -> Field
pub fn new_dict( name: impl Into<String>, data_type: DataType, nullable: bool, dict_id: i64, dict_is_ordered: bool, ) -> Field
Creates a new field that has additional dictionary information
Sourcepub fn new_dictionary(
name: impl Into<String>,
key: DataType,
value: DataType,
nullable: bool,
) -> Field
pub fn new_dictionary( name: impl Into<String>, key: DataType, value: DataType, nullable: bool, ) -> Field
Create a new Field with DataType::Dictionary
Use Self::new_dict for more advanced dictionary options
§Panics
Panics if !key.is_dictionary_key_type
Sourcepub fn new_struct(
name: impl Into<String>,
fields: impl Into<Fields>,
nullable: bool,
) -> Field
pub fn new_struct( name: impl Into<String>, fields: impl Into<Fields>, nullable: bool, ) -> Field
Create a new Field with DataType::Struct
name: the name of theDataType::Structfieldfields: the description of each struct elementnullable: if theDataType::Structarray is nullable
Sourcepub fn new_list(
name: impl Into<String>,
value: impl Into<Arc<Field>>,
nullable: bool,
) -> Field
pub fn new_list( name: impl Into<String>, value: impl Into<Arc<Field>>, nullable: bool, ) -> Field
Create a new Field with DataType::List
name: the name of theDataType::Listfieldvalue: the description of each list elementnullable: if theDataType::Listarray is nullable
Sourcepub fn new_large_list(
name: impl Into<String>,
value: impl Into<Arc<Field>>,
nullable: bool,
) -> Field
pub fn new_large_list( name: impl Into<String>, value: impl Into<Arc<Field>>, nullable: bool, ) -> Field
Create a new Field with DataType::LargeList
name: the name of theDataType::LargeListfieldvalue: the description of each list elementnullable: if theDataType::LargeListarray is nullable
Sourcepub fn new_fixed_size_list(
name: impl Into<String>,
value: impl Into<Arc<Field>>,
size: i32,
nullable: bool,
) -> Field
pub fn new_fixed_size_list( name: impl Into<String>, value: impl Into<Arc<Field>>, size: i32, nullable: bool, ) -> Field
Create a new Field with DataType::FixedSizeList
name: the name of theDataType::FixedSizeListfieldvalue: the description of each list elementsize: the size of the fixed size listnullable: if theDataType::FixedSizeListarray is nullable
Sourcepub fn new_map(
name: impl Into<String>,
entries: impl Into<String>,
keys: impl Into<Arc<Field>>,
values: impl Into<Arc<Field>>,
sorted: bool,
nullable: bool,
) -> Field
pub fn new_map( name: impl Into<String>, entries: impl Into<String>, keys: impl Into<Arc<Field>>, values: impl Into<Arc<Field>>, sorted: bool, nullable: bool, ) -> Field
Create a new Field with DataType::Map
name: the name of theDataType::Mapfieldentries: the name of the innerDataType::Structfieldkeys: the map keysvalues: the map valuessorted: if theDataType::Maparray is sortednullable: if theDataType::Maparray is nullable
Sourcepub fn new_union<S, F, T>(
name: S,
type_ids: T,
fields: F,
mode: UnionMode,
) -> Fieldwhere
S: Into<String>,
F: IntoIterator,
<F as IntoIterator>::Item: Into<Arc<Field>>,
T: IntoIterator<Item = i8>,
pub fn new_union<S, F, T>(
name: S,
type_ids: T,
fields: F,
mode: UnionMode,
) -> Fieldwhere
S: Into<String>,
F: IntoIterator,
<F as IntoIterator>::Item: Into<Arc<Field>>,
T: IntoIterator<Item = i8>,
Create a new Field with DataType::Union
name: the name of theDataType::Unionfieldtype_ids: the union type idsfields: the union fieldsmode: the union mode
Sourcepub fn set_metadata(&mut self, metadata: HashMap<String, String>)
pub fn set_metadata(&mut self, metadata: HashMap<String, String>)
Sets the Field’s optional custom metadata.
Sourcepub fn with_metadata(self, metadata: HashMap<String, String>) -> Field
pub fn with_metadata(self, metadata: HashMap<String, String>) -> Field
Sets the metadata of this Field to be metadata and returns self
Sourcepub const fn metadata(&self) -> &HashMap<String, String>
pub const fn metadata(&self) -> &HashMap<String, String>
Returns the immutable reference to the Field’s optional custom metadata.
Sourcepub fn with_name(self, name: impl Into<String>) -> Field
pub fn with_name(self, name: impl Into<String>) -> Field
Set the name of the Field and returns self.
let field = Field::new("c1", DataType::Int64, false)
.with_name("c2");
assert_eq!(field.name(), "c2");Sourcepub fn with_data_type(self, data_type: DataType) -> Field
pub fn with_data_type(self, data_type: DataType) -> Field
Sourcepub const fn is_nullable(&self) -> bool
pub const fn is_nullable(&self) -> bool
Indicates whether this Field supports null values.
Sourcepub fn with_nullable(self, nullable: bool) -> Field
pub fn with_nullable(self, nullable: bool) -> Field
Set nullable of the Field and returns self.
let field = Field::new("c1", DataType::Int64, false)
.with_nullable(true);
assert_eq!(field.is_nullable(), true);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<(), ArrowError>
pub fn try_merge(&mut self, from: &Field) -> Result<(), ArrowError>
Merge this field into self if it is compatible.
Struct fields are merged recursively.
NOTE: self may be updated to a partial / unexpected state in case of merge failure.
Example:
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§
Source§impl Ord for Field
impl Ord for Field
Source§impl PartialOrd for Field
impl PartialOrd for Field
impl Eq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);