Skip to main content

TableEditorState

Trait TableEditorState 

Source
pub trait TableEditorState<T> {
    type Context<'a>;
    type Err;

    // Required methods
    fn create_value<'a>(
        &self,
        ctx: &'a Self::Context<'a>,
    ) -> Result<T, Self::Err>;
    fn set_value<'a>(
        &mut self,
        value: T,
        ctx: &'a Self::Context<'a>,
    ) -> Result<(), Self::Err>;
    fn value<'a>(
        &mut self,
        ctx: &'a Self::Context<'a>,
    ) -> Result<Option<T>, Self::Err>;

    // Provided methods
    fn focused_col(&self) -> Option<usize> { ... }
    fn start<'a>(
        &mut self,
        col: Option<usize>,
        ctx: &'a Self::Context<'a>,
    ) -> Result<(), Self::Err> { ... }
    fn stop<'a>(&mut self, ctx: &'a Self::Context<'a>) -> Result<(), Self::Err> { ... }
}
Expand description

Trait for the editor widget state.

Required Associated Types§

Source

type Context<'a>

Some external context.

Source

type Err

Error type.

Required Methods§

Source

fn create_value<'a>(&self, ctx: &'a Self::Context<'a>) -> Result<T, Self::Err>

Create a fresh row value with all the defaults.

Source

fn set_value<'a>( &mut self, value: T, ctx: &'a Self::Context<'a>, ) -> Result<(), Self::Err>

Set the current row value for the editor.

Source

fn value<'a>( &mut self, ctx: &'a Self::Context<'a>, ) -> Result<Option<T>, Self::Err>

Return the current row value from the editor. None results will remove the table row.

Provided Methods§

Source

fn focused_col(&self) -> Option<usize>

Returns the currently focused column. Used to scroll the column to fully visible.

Source

fn start<'a>( &mut self, col: Option<usize>, ctx: &'a Self::Context<'a>, ) -> Result<(), Self::Err>

Start editing the current value. If a specific column should be focused initially it is given as the column index.

Source

fn stop<'a>(&mut self, ctx: &'a Self::Context<'a>) -> Result<(), Self::Err>

Stop editing the current value. If necessary the editor can do some cleanup here.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§