Struct AsTable

Source
pub struct AsTable<'table, Table, RowKey, Row, CellKey>(/* private fields */)
where
    RowKey: RowKey,
    Row: Cells<CellKey>,
    CellKey: CellKey + ?Sized;
Expand description

Transparent wrapper for interpreting data as a table.

AsTable provides a reference-based wrapper for table-like structures, encapsulating type information needed to interpret data as a table.

Implementations§

Source§

impl<'table, Table, RowKey, Row, CellKey> AsTable<'table, Table, RowKey, Row, CellKey>
where RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized,

Source

pub fn new(src: &'table Table) -> Self

Just a constructor.

Trait Implementations§

Source§

impl<'table, Table, RowKey, Row, CellKey> AsRef<Table> for AsTable<'table, Table, RowKey, Row, CellKey>
where RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized,

Source§

fn as_ref(&self) -> &Table

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'table, Table: Clone, RowKey, Row, CellKey> Clone for AsTable<'table, Table, RowKey, Row, CellKey>
where RowKey: RowKey + Clone, Row: Cells<CellKey> + Clone, CellKey: CellKey + ?Sized + Clone,

Source§

fn clone(&self) -> AsTable<'table, Table, RowKey, Row, CellKey>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'table, Table, RowKey, Row, CellKey> Debug for AsTable<'table, Table, RowKey, Row, CellKey>
where Table: Debug, RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'table, Table, RowKey, Row, CellKey> Deref for AsTable<'table, Table, RowKey, Row, CellKey>
where RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized,

Source§

type Target = Table

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'table, Table, RowKey, Row, CellKey> From<&'table Table> for AsTable<'table, Table, RowKey, Row, CellKey>
where RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized,

Source§

fn from(table: &'table Table) -> Self

Converts to this type from the input type.
Source§

impl<'table, Table, RowKey, Row, CellKey> IntoAsTable for AsTable<'table, Table, RowKey, Row, CellKey>
where RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized, Self: Copy,

Source§

type Table = Table

The type representing the table.
Source§

type RowKey = RowKey

The type used to identify each row.
Source§

type Row = Row

The type representing a row, must implement Cells.
Source§

type CellKey = CellKey

The type used to identify cells within a row, must implement Key and can be unsized.
Source§

fn as_table( &self, ) -> AsTable<'_, Self::Table, Self::RowKey, Self::Row, Self::CellKey>

Converts the data reference into an AsTable reference.
Source§

impl<'data, T, RowKey, Row, CellKey> TableFormatter<'data> for AsTable<'data, T, RowKey, Row, CellKey>
where Self: TableRows<CellKey = CellKey, RowKey = RowKey, Row = Row> + TableHeader<CellKey = CellKey>, RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized,

A trait for formatting tables.

Source§

fn fmt<'a>(&'data self, c: &mut Context<'a>) -> Result

Formats the table and writes the result to the provided context.
Source§

fn table_to_string(&'data self) -> String

Converts the table to a string representation. Read more
Source§

fn table_to_string_with_format<'context, Styles>( &'data self, styles: &'context Styles, ) -> String
where Styles: TableOutputFormat,

Converts the table to a string representation specifying printer. Read more
Source§

impl<T, RowKey, Row, CellKey> TableHeader for AsTable<'_, T, RowKey, Row, CellKey>
where Self: TableRows<RowKey = RowKey, Row = Row, CellKey = CellKey>, RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized,

Source§

type CellKey = CellKey

The type used to identify cells within a row, requiring implementation of the Key trait.
Source§

fn header(&self) -> Option<impl IteratorTrait<Item = (&Self::CellKey, &str)>>

Returns an iterator over all fields of the specified type within the entity.
Source§

impl<T, RowKey, Row, CellKey> TableRows for AsTable<'_, T, RowKey, Row, CellKey>
where for<'k, 'v> T: Fields<RowKey, &'k Row, Val<'v> = &'v Row> + 'k + 'v, RowKey: RowKey, Row: Cells<CellKey>, CellKey: CellKey + ?Sized,

Source§

type RowKey = RowKey

The type used to identify each row.
Source§

type Row = Row

The type representing a row, which must implement Cells for the specified CellKey and CellRepr.
Source§

type CellKey = CellKey

The type used to identify cells within a row, requiring implementation of the Key trait.
Source§

fn rows(&self) -> impl IteratorTrait<Item = &Self::Row>

Returns an iterator over all rows of the table.
Source§

impl<'table, Table: Copy, RowKey, Row, CellKey> Copy for AsTable<'table, Table, RowKey, Row, CellKey>
where RowKey: RowKey + Copy, Row: Cells<CellKey> + Copy, CellKey: CellKey + ?Sized + Copy,

Auto Trait Implementations§

§

impl<'table, Table, RowKey, Row, CellKey> Freeze for AsTable<'table, Table, RowKey, Row, CellKey>
where CellKey: ?Sized,

§

impl<'table, Table, RowKey, Row, CellKey> RefUnwindSafe for AsTable<'table, Table, RowKey, Row, CellKey>
where Table: RefUnwindSafe, CellKey: ?Sized,

§

impl<'table, Table, RowKey, Row, CellKey> Send for AsTable<'table, Table, RowKey, Row, CellKey>
where Table: Sync, CellKey: ?Sized,

§

impl<'table, Table, RowKey, Row, CellKey> Sync for AsTable<'table, Table, RowKey, Row, CellKey>
where Table: Sync, CellKey: ?Sized,

§

impl<'table, Table, RowKey, Row, CellKey> Unpin for AsTable<'table, Table, RowKey, Row, CellKey>
where CellKey: ?Sized,

§

impl<'table, Table, RowKey, Row, CellKey> UnwindSafe for AsTable<'table, Table, RowKey, Row, CellKey>
where Table: RefUnwindSafe, CellKey: ?Sized,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<C, E> EntryToVal<C> for E
where C: Collection<Entry = E>,

Source§

type Val = <C as Collection>::Val

The type of values stored in the collection. This might be distinct from Entry in complex collections. For example, in a HashMap, while Entry might be a ( key, value ) tuple, Val might only be the value part.
Source§

fn entry_to_val(self) -> <E as EntryToVal<C>>::Val

Converts an entry into a value representation specific to the type of collection. This conversion is crucial for handling operations on entries, especially when they need to be treated or accessed as individual values, such as retrieving the value part from a key-value pair in a hash map.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<'a, T> ToStringWith<WithDebug> for T
where T: Debug + ?Sized,

Source§

fn to_string_with<'s>(&'s self) -> Cow<'s, str>

Converts the type to a string using Debug formatting.

Source§

impl<'a, T> ToStringWith<WithDebugMultiline> for T
where T: Debug + ?Sized,

Source§

fn to_string_with<'s>(&'s self) -> Cow<'s, str>

Converts the type to a string using Debug formatting.

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.
Source§

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

Source§

fn type_name(&self) -> &'static str

Return name of type of variable.
Source§

impl<C, Val> ValToEntry<C> for Val
where C: CollectionValToEntry<Val>,

Source§

fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry

Invokes the val_to_entry function of the CollectionValToEntry trait to convert the value to an entry.

Source§

type Entry = <C as CollectionValToEntry<Val>>::Entry

Represents the type of entry that corresponds to the value within the collection. Type Entry is defined by the Collection trait.
Source§

impl<T> CellRepr for T
where T: Copy + 'static,

Source§

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