pub type GenericStringBuilder<O> = GenericByteBuilder<GenericStringType<O>>;
Expand description

Array builder for GenericStringArray

Values can be appended using GenericByteBuilder::append_value, and nulls with GenericByteBuilder::append_null as normal.

Additionally implements std::fmt::Write with any written data included in the next appended value. This allows use with std::fmt::Display without intermediate allocations

let mut builder = GenericStringBuilder::<i32>::new();

// Write data
write!(builder, "foo").unwrap();
write!(builder, "bar").unwrap();

// Finish value
builder.append_value("baz");

// Write second value
write!(builder, "v2").unwrap();
builder.append_value("");

let array = builder.finish();
assert_eq!(array.value(0), "foobarbaz");
assert_eq!(array.value(1), "v2");

Trait Implementations§

source§

impl<O: OffsetSizeTrait> Write for GenericStringBuilder<O>

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more