polars_core/datatypes/
schema.rs1use super::*;
2
3pub trait SchemaExtPl {
4 fn matches_schema(&self, other: &Schema) -> PolarsResult<bool>;
11}
12
13impl SchemaExtPl for Schema {
14 fn matches_schema(&self, other: &Schema) -> PolarsResult<bool> {
15 polars_ensure!(self.len() == other.len(), SchemaMismatch: "found different number of fields in schema's\n\nLeft schema: {} fields, right schema: {} fields.", self.len(), other.len());
16 let mut cast = false;
17 for (a, b) in self.iter_values().zip(other.iter_values()) {
18 cast |= a.matches_schema_type(b)?;
19 }
20 Ok(cast)
21 }
22}