Skip to main content

StreamingTableFormatter

Struct StreamingTableFormatter 

Source
pub struct StreamingTableFormatter<'w> {
    columns: Vec<CqlColumn>,
    colorizer: &'w CqlColorizer,
    writer: &'w mut dyn Write,
    first_page_buffer: Vec<CqlRow>,
    page_size: usize,
    header_written: bool,
    col_widths: Vec<usize>,
    row_count: usize,
    expanded: bool,
}
Expand description

A streaming table formatter that computes column widths from the first page of results and then formats subsequent rows incrementally.

Fields§

§columns: Vec<CqlColumn>§colorizer: &'w CqlColorizer§writer: &'w mut dyn Write§first_page_buffer: Vec<CqlRow>

Buffer for first-page rows used to compute column widths

§page_size: usize

Maximum number of rows to buffer for width computation

§header_written: bool

Whether the header has been written (first page flushed)

§col_widths: Vec<usize>

Computed column widths (set after first page flush)

§row_count: usize

Total rows written

§expanded: bool

Whether we’re in expanded mode

Implementations§

Source§

impl<'w> StreamingTableFormatter<'w>

Source

pub fn new( columns: Vec<CqlColumn>, colorizer: &'w CqlColorizer, writer: &'w mut dyn Write, page_size: usize, ) -> Self

Create a new streaming formatter in tabular mode.

Source

pub fn new_expanded( columns: Vec<CqlColumn>, colorizer: &'w CqlColorizer, writer: &'w mut dyn Write, ) -> Self

Create a new streaming formatter in expanded mode.

Source

pub fn add_row(&mut self, row: CqlRow) -> Result<()>

Add a row to the formatter. Returns Err if writing fails (e.g. broken pipe).

Source

pub fn flush_writer(&mut self) -> Result<()>

Source

pub fn finish(self) -> Result<usize>

Finish the stream: flush any buffered rows and write the footer. Returns the total row count.

Source

fn flush_first_page(&mut self) -> Result<()>

Compute column widths from the first page buffer and flush everything.

Source

fn write_separator(&mut self) -> Result<()>

Source

fn write_header_row(&mut self) -> Result<()>

Source

fn write_row(&mut self, row: &CqlRow) -> Result<()>

Source

fn write_expanded_row(&mut self, row: &CqlRow) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,