WriteContext

Struct WriteContext 

Source
pub struct WriteContext(/* private fields */);
Expand description

Extra contextual info for accurating recreating read tables when writing

This entirely exists to handle the edge case where you read a table, remove all of its rows, and then try to write it. If there are optional rowed values, there is no clear way to know if a column should be written as zero or rowed.

This is used by the utf_table macro. When a table is read, a context is created with the state of the columns. When a table is created, a context is created and configured based on the schema provided to the macro.

It is untested whether or not this approach holds, so this type is subject to removal.

Implementations§

Source§

impl WriteContext

Source

pub fn new() -> Self

Creates a new write context

Source

pub fn is_included(&self, column_name: &str) -> bool

Returns true if the given column should be included (rowed), or false if it should be excluded (zero)

Source

pub fn set_inclusion_state(&mut self, column_name: &'static str, included: bool)

Sets the inclusion state of a column. true denotes rowed, false denotes zero

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.

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, 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.