Skip to main content

PivotMeltModal

Struct PivotMeltModal 

Source
pub struct PivotMeltModal {
Show 19 fields pub active: bool, pub preview: ReshapePreview, pub active_tab: PivotMeltTab, pub focus: PivotMeltFocus, pub available_columns: Vec<String>, pub column_dtypes: HashMap<String, DataType>, pub picker: Option<PickerState>, pub attention: bool, pub index_columns: Vec<String>, pub pivot_column: Option<String>, pub value_column: Option<String>, pub aggregation: PivotAggregation, pub melt_index_columns: Vec<String>, pub melt_value_strategy: MeltValueStrategy, pub melt_pattern_input: TextInput, pub melt_type_filter: MeltTypeFilter, pub melt_explicit_list: Vec<String>, pub melt_variable_input: TextInput, pub melt_value_input: TextInput, /* private fields */
}

Fields§

§active: bool§preview: ReshapePreview

The live preview of the staged spec.

§active_tab: PivotMeltTab§focus: PivotMeltFocus§available_columns: Vec<String>

Column names from current schema. Set when opening modal.

§column_dtypes: HashMap<String, DataType>

Column name -> DataType. Set when opening.

§picker: Option<PickerState>

The one Picker, open for the focused row; None while the form has the keys.

§attention: bool

Set when Enter was pressed on an incomplete form: the spec line that names the gap re-accents instead of a modal repeating it. Any other key clears it.

§index_columns: Vec<String>§pivot_column: Option<String>§value_column: Option<String>§aggregation: PivotAggregation§melt_index_columns: Vec<String>§melt_value_strategy: MeltValueStrategy§melt_pattern_input: TextInput§melt_type_filter: MeltTypeFilter§melt_explicit_list: Vec<String>§melt_variable_input: TextInput§melt_value_input: TextInput

Implementations§

Source§

impl PivotMeltModal

Source

pub fn new() -> Self

Source

pub fn open(&mut self, history_limit: usize, theme: &Theme)

Source

pub fn close(&mut self)

Source

pub fn reset_form(&mut self)

Source

pub fn row_order(&self) -> &'static [PivotMeltFocus]

The active tab’s rows, in Tab order. Melt’s value rows follow its strategy.

Source

pub fn switch_tab(&mut self)

Source

pub fn is_text_row(&self, focus: PivotMeltFocus) -> bool

Rows whose value is a text field rather than a picked choice.

Source

pub fn is_choice_row(&self, focus: PivotMeltFocus) -> bool

Rows whose value steps through a short list: the aggregation, the melt strategy and its type.

Source

pub fn is_picker_row(&self, focus: PivotMeltFocus) -> bool

Rows edited through the Picker: the column rows.

Source

pub fn step_choice(&mut self, delta: i8)

←/→ (and Space) on a choice row: the next or previous value, wrapping. A new strategy changes which melt rows follow it.

Source

pub fn step_picker_row(&mut self, delta: i8)

←/→ on a pick-one column row: the next or previous column, chosen at once. A row with nothing chosen yet starts at the first (→) or the last (←).

Source

pub fn is_multi_row(&self, focus: PivotMeltFocus) -> bool

Rows where the Picker toggles several choices rather than picking one.

Source

pub fn focused_text_input_mut(&mut self) -> Option<&mut TextInput>

The focused row’s text field, when it has one.

Source

pub fn picker_items(&self) -> Vec<String>

What the focused row’s Picker offers: each row sees only its own pool, so narrowing one list can never silently empty another.

Source

pub fn open_picker(&mut self)

Open the Picker for the focused row, cursor on the current choice.

Source

pub fn picker_cancel(&mut self)

Esc in the Picker: it closes, and the toggles made since it opened go with it (a pick-one row changed nothing yet).

Source

pub fn picker_choose(&mut self)

Enter in the Picker: a pick-one row takes the cursor’s item; a toggle row’s choices are already staged. Either way the Picker closes.

Source

pub fn picker_toggle(&mut self)

Space in a toggle row’s Picker: flip the cursor’s column in or out.

Source

pub fn is_marked(&self, item: &str) -> bool

Whether an item in the focused row’s Picker is currently chosen.

Source

pub fn pivot_spec_line(&self, g: &Glyphs) -> Result<String, String>

The staged pivot as one line — index × columns → agg(values) — or what is still missing from it.

Source

pub fn melt_spec_line(&self) -> Result<String, String>

The staged melt as one line, or what is still missing from it.

Source

pub fn pivot_validation_error(&self) -> Option<String>

Source

pub fn build_pivot_spec(&self) -> Option<PivotSpec>

Source

pub fn melt_value_pool(&self) -> Vec<String>

Source

pub fn melt_resolve_value_columns(&self) -> Result<Vec<String>, String>

Source

pub fn melt_validation_error(&self) -> Option<String>

Source

pub fn build_melt_spec(&self) -> Option<MeltSpec>

Source

pub fn staged_spec(&self) -> Option<PreviewSpec>

The spec Enter would apply on the active tab, if it is complete.

Trait Implementations§

Source§

impl Default for PivotMeltModal

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Form for PivotMeltModal

Source§

fn fields(&self) -> Vec<(PivotMeltFocus, FieldKind)>

The tab bar, then the active tab’s rows. Melt’s value rows follow its strategy.

Source§

type Field = PivotMeltFocus

The modal’s name for a field.
Source§

fn focused(&self) -> PivotMeltFocus

Source§

fn set_focused(&mut self, field: PivotMeltFocus)

Put focus on field. Called only with a field of Form::fields; a modal that shows a text cursor in the focused field syncs it here.
Source§

fn text_edge(&self, _field: Self::Field) -> (bool, bool)

For a multiline field: whether its cursor is on the first line, and on the last, where ↑ and ↓ leave it.
Source§

fn list_row(&self, _field: Self::Field) -> bool

Whether field is a row of a list (a sort, a filter, a column) rather than a setting. A click on a list row only focuses it, so it can be picked to move or remove without changing it; a click on it once focused acts. A setting (a checkbox, a choice, a button) acts on the first click.
Source§

fn focused_kind(&self) -> Option<FieldKind>

The focused field’s kind; None when focus is on a field not shown.
Source§

fn focus(&mut self, field: Self::Field) -> bool

Focus field if the form shows it: a click on a row, or a modal moving focus itself. Returns whether it did.
Source§

fn move_focus(&mut self, delta: isize)

Move focus delta fields along, wrapping. A focus the form no longer shows counts from the top.
Source§

fn focus_next(&mut self)

Source§

fn focus_prev(&mut self)

Source§

fn settle_focus(&mut self)

After a change that hides fields: when the focused one went, focus the first field instead, so it never points at nothing.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> Downcast for T
where T: Any,

Source§

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

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

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> PlanCallbackArgs for T

Source§

impl<T> PlanCallbackOut for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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