pub struct GenericStreamEncoder<W: Write> { /* private fields */ }Expand description
GenericStreamEncoder writes GCF tabular output incrementally as rows arrive. Zero buffering: each row is written immediately. A trailer summary is emitted on close() with the final counts.
Thread-safe via internal Mutex.
§Example
use gcf::GenericStreamEncoder;
use gcf::stream_generic::GcfValue;
let buf = Vec::new();
let enc = GenericStreamEncoder::new(buf);
enc.begin_array("employees", &["id", "name", "department", "salary"]);
enc.write_row(&[1.into(), "Alice".into(), "Engineering".into(), 95000.into()]);
enc.end_array();
enc.close().unwrap();Implementations§
Source§impl<W: Write> GenericStreamEncoder<W>
impl<W: Write> GenericStreamEncoder<W>
Sourcepub fn begin_array(&self, name: &str, fields: &[&str])
pub fn begin_array(&self, name: &str, fields: &[&str])
Start a tabular array section with deferred count [?].
Sourcepub fn write_section(&self, name: &str)
pub fn write_section(&self, name: &str)
Start a nested object section (## key).
Sourcepub fn write_inline_array(&self, name: &str, values: &[GcfValue])
pub fn write_inline_array(&self, name: &str, values: &[GcfValue])
Emit a primitive array inline: name[N]: val1,val2,val3
Auto Trait Implementations§
impl<W> !Freeze for GenericStreamEncoder<W>
impl<W> RefUnwindSafe for GenericStreamEncoder<W>
impl<W> Send for GenericStreamEncoder<W>where
W: Send,
impl<W> Sync for GenericStreamEncoder<W>where
W: Send,
impl<W> Unpin for GenericStreamEncoder<W>where
W: Unpin,
impl<W> UnsafeUnpin for GenericStreamEncoder<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for GenericStreamEncoder<W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more