Trait polars::prelude::SchemaExt

source ·
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>;
}

Required Methods§

source

fn from_arrow_schema(value: &Schema<Field>) -> Self

source

fn get_field(&self, name: &str) -> Option<Field>

source

fn try_get_field(&self, name: &str) -> Result<Field, PolarsError>

source

fn to_arrow(&self, compat_level: CompatLevel) -> Schema<Field>

source

fn iter_fields(&self) -> impl ExactSizeIterator

source

fn to_supertype( &mut self, other: &Schema<DataType>, ) -> Result<bool, PolarsError>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SchemaExt for Schema<DataType>

source§

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>

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>

Convert self to ArrowSchema by cloning the fields.

source§

fn iter_fields(&self) -> impl ExactSizeIterator

Iterates the Fields in this schema, constructing them anew by cloning each (&name, &dtype) pair.

Note that this clones each name and dtype in order to form an owned Field. For a clone-free version, use [iter][Self::iter], which returns (&name, &dtype).

source§

fn to_supertype( &mut self, other: &Schema<DataType>, ) -> Result<bool, PolarsError>

Take another Schema and try to find the supertypes between them.

source§

fn from_arrow_schema(value: &Schema<Field>) -> Schema<DataType>

Implementors§