pub trait SchemaExt {
// Required methods
fn from_arrow_schema(value: &Schema<Field>) -> Self;
fn get_field(&self, name: &str) -> Option<Field>;
fn try_get_field(&self, name: &str) -> Result<Field, PolarsError>;
fn to_arrow(&self, compat_level: CompatLevel) -> Schema<Field>;
fn iter_fields(&self) -> impl ExactSizeIterator;
fn to_supertype(
&mut self,
other: &Schema<DataType>,
) -> Result<bool, PolarsError>;
fn materialize_unknown_dtypes(
&self,
) -> Result<Schema<DataType>, PolarsError>;
}
Required Methods§
fn from_arrow_schema(value: &Schema<Field>) -> Self
fn get_field(&self, name: &str) -> Option<Field>
fn try_get_field(&self, name: &str) -> Result<Field, PolarsError>
fn to_arrow(&self, compat_level: CompatLevel) -> Schema<Field>
fn iter_fields(&self) -> impl ExactSizeIterator
fn to_supertype( &mut self, other: &Schema<DataType>, ) -> Result<bool, PolarsError>
fn materialize_unknown_dtypes(&self) -> Result<Schema<DataType>, PolarsError>
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.
Implementations on Foreign Types§
Source§impl SchemaExt for Schema<DataType>
impl SchemaExt for Schema<DataType>
Source§fn get_field(&self, name: &str) -> Option<Field>
fn get_field(&self, name: &str) -> Option<Field>
Look up the name in the schema and return an owned Field
by cloning the data.
Returns None
if the field does not exist.
This method constructs the Field
by cloning the name and dtype. For a version that returns references, see
[get
][Self::get] or [get_full
][Self::get_full].
Source§fn try_get_field(&self, name: &str) -> Result<Field, PolarsError>
fn try_get_field(&self, name: &str) -> Result<Field, PolarsError>
Look up the name in the schema and return an owned Field
by cloning the data.
Returns Err(PolarsErr)
if the field does not exist.
This method constructs the Field
by cloning the name and dtype. For a version that returns references, see
[get
][Self::get] or [get_full
][Self::get_full].
Source§fn to_arrow(&self, compat_level: CompatLevel) -> Schema<Field>
fn to_arrow(&self, compat_level: CompatLevel) -> Schema<Field>
Convert self to ArrowSchema
by cloning the fields.
Source§fn iter_fields(&self) -> impl ExactSizeIterator
fn iter_fields(&self) -> impl ExactSizeIterator
Source§fn to_supertype(
&mut self,
other: &Schema<DataType>,
) -> Result<bool, PolarsError>
fn to_supertype( &mut self, other: &Schema<DataType>, ) -> Result<bool, PolarsError>
Take another Schema
and try to find the supertypes between them.
Source§fn materialize_unknown_dtypes(&self) -> Result<Schema<DataType>, PolarsError>
fn materialize_unknown_dtypes(&self) -> Result<Schema<DataType>, PolarsError>
Materialize all unknown dtypes in this schema.