Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-arrow/src/array/map/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::MapArray;
5
6
pub fn write_value<W: Write>(
7
array: &MapArray,
8
index: usize,
9
null: &'static str,
10
f: &mut W,
11
) -> Result {
12
let values = array.value(index);
13
let writer = |f: &mut W, index| get_display(values.as_ref(), null)(f, index);
14
write_vec(f, writer, None, values.len(), null, false)
15
}
16
17
impl Debug for MapArray {
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, "MapArray")?;
22
write_vec(f, writer, self.validity.as_ref(), self.len(), "None", false)
23
}
24
}
25
26