pub struct LineFilter<E> { /* private fields */ }Expand description
Writes only some lines of a table, with another exporter or format: for
example a copy without group footers and the totals, or the application’s
rows alone. It wraps any clipboard format, and a grid takes it as any
exporter (LiveGridState::with_exporter); it wraps any file format, and
an export takes it as any format.
use gpui_kit_grid::{CsvFormat, ExportLine, ExportLines, LineFilter, TsvExporter};
let exporter = LineFilter::new(
TsvExporter,
ExportLines::ALL
.without(ExportLine::Footer)
.without(ExportLine::Totals),
);
assert!(!exporter.lines().contains(ExportLine::Footer));
// The application's rows alone, to a CSV file.
let format = LineFilter::new(CsvFormat::new(), ExportLines::EMPTY.with(ExportLine::Data));A table without a left-out line goes to the exporter as it is; otherwise the kept rows are copied into one list per export, in the background. A file format’s progress counts the left-out rows as written at the start.
Implementations§
Source§impl<E> LineFilter<E>
impl<E> LineFilter<E>
Sourcepub fn new(exporter: E, lines: ExportLines) -> Self
pub fn new(exporter: E, lines: ExportLines) -> Self
Writes the lines of a table with exporter.
Sourcepub fn lines(&self) -> ExportLines
pub fn lines(&self) -> ExportLines
The lines written.
Trait Implementations§
Source§impl<E: Clone> Clone for LineFilter<E>
impl<E: Clone> Clone for LineFilter<E>
Source§fn clone(&self) -> LineFilter<E>
fn clone(&self) -> LineFilter<E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<E: Debug> Debug for LineFilter<E>
impl<E: Debug> Debug for LineFilter<E>
Source§impl<E: Default> Default for LineFilter<E>
impl<E: Default> Default for LineFilter<E>
Source§fn default() -> LineFilter<E>
fn default() -> LineFilter<E>
Returns the “default value” for a type. Read more
Source§impl<R: GridRow, E: ExportFormat<R>> ExportFormat<R> for LineFilter<E>
impl<R: GridRow, E: ExportFormat<R>> ExportFormat<R> for LineFilter<E>
Source§fn export(
&self,
table: &ExportTable<'_, R>,
cells: &CellExport<R>,
out: &mut dyn Write,
control: &ExportControl,
) -> Result<(), ExportError>
fn export( &self, table: &ExportTable<'_, R>, cells: &CellExport<R>, out: &mut dyn Write, control: &ExportControl, ) -> Result<(), ExportError>
Writes
table to out; text cells with cells, as a text format
does (a spreadsheet format reads ExportCell::value instead).Source§impl<R: GridRow, E: Exporter<R>> Exporter<R> for LineFilter<E>
impl<R: GridRow, E: Exporter<R>> Exporter<R> for LineFilter<E>
Source§fn export(
&self,
table: &ExportTable<'_, R>,
cells: &CellExport<R>,
out: &mut String,
)
fn export( &self, table: &ExportTable<'_, R>, cells: &CellExport<R>, out: &mut String, )
Appends the text of
table to out, writing each cell with cells.impl<E: Copy> Copy for LineFilter<E>
Auto Trait Implementations§
impl<E> Freeze for LineFilter<E>where
E: Freeze,
impl<E> RefUnwindSafe for LineFilter<E>where
E: RefUnwindSafe,
impl<E> Send for LineFilter<E>where
E: Send,
impl<E> Sync for LineFilter<E>where
E: Sync,
impl<E> Unpin for LineFilter<E>where
E: Unpin,
impl<E> UnsafeUnpin for LineFilter<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for LineFilter<E>where
E: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().