Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-arrow/src/array/utf8/fmt.rs
6939 views
1
use std::fmt::{Debug, Formatter, Result, Write};
2
3
use super::super::fmt::write_vec;
4
use super::Utf8Array;
5
use crate::offset::Offset;
6
7
pub fn write_value<O: Offset, W: Write>(array: &Utf8Array<O>, index: usize, f: &mut W) -> Result {
8
write!(f, "{}", array.value(index))
9
}
10
11
impl<O: Offset> Debug for Utf8Array<O> {
12
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
13
let writer = |f: &mut Formatter, index| write_value(self, index, f);
14
15
let head = if O::IS_LARGE {
16
"LargeUtf8Array"
17
} else {
18
"Utf8Array"
19
};
20
write!(f, "{head}")?;
21
write_vec(f, writer, self.validity(), self.len(), "None", false)
22
}
23
}
24
25