MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / format_array

Function format_array

src/repr/src/strconv.rs:1603–1622  ·  view source on GitHub ↗
(
    buf: &mut F,
    dims: &[ArrayDimension],
    elems: impl IntoIterator<Item = T>,
    mut format_elem: impl FnMut(ListElementWriter<F>, T) -> Result<Nestable, E>,
)

Source from the content-addressed store, hash-verified

1601}
1602
1603pub fn format_array<F, T, E>(
1604 buf: &mut F,
1605 dims: &[ArrayDimension],
1606 elems: impl IntoIterator<Item = T>,
1607 mut format_elem: impl FnMut(ListElementWriter<F>, T) -> Result<Nestable, E>,
1608) -> Result<Nestable, E>
1609where
1610 F: FormatBuffer,
1611{
1612 if dims.iter().any(|dim| dim.lower_bound != 1) {
1613 for d in dims.iter() {
1614 let (lower, upper) = d.dimension_bounds();
1615 write!(buf, "[{}:{}]", lower, upper);
1616 }
1617 buf.write_char('=');
1618 }
1619
1620 format_array_inner(buf, dims, &mut elems.into_iter(), &mut format_elem)?;
1621 Ok(Nestable::Yes)
1622}
1623
1624pub fn format_array_inner<F, T, E>(
1625 buf: &mut F,

Callers 2

stringify_datumFunction · 0.85
encode_textMethod · 0.85

Calls 6

format_array_innerFunction · 0.85
anyMethod · 0.80
dimension_boundsMethod · 0.80
write_charMethod · 0.80
iterMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected