Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-arrow/src/array/union/fmt.rs
6939 views
1
use std::fmt::{Debug, Formatter, Result, Write};
2
3
use super::super::fmt::{get_display, write_vec};
4
use super::UnionArray;
5
6
pub fn write_value<W: Write>(
7
array: &UnionArray,
8
index: usize,
9
null: &'static str,
10
f: &mut W,
11
) -> Result {
12
let (field, index) = array.index(index);
13
14
get_display(array.fields()[field].as_ref(), null)(f, index)
15
}
16
17
impl Debug for UnionArray {
18
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
19
let writer = |f: &mut Formatter, index| write_value(self, index, "None", f);
20
21
write!(f, "UnionArray")?;
22
write_vec(f, writer, None, self.len(), "None", false)
23
}
24
}
25
26