Skip to main content

Lineups

Struct Lineups 

Source
pub struct Lineups {
    pub editor: Option<Editor>,
    pub chosen: Option<String>,
}
Expand description

The lineups dialog, while it is open.

Fields§

§editor: Option<Editor>

The lineup being written, or nothing while the list of them stands in its place.

§chosen: Option<String>

The lineup the person is looking at, named rather than numbered: a lineup saved or deleted under the person must not move the list out from under their hand.

Implementations§

Source§

impl Lineups

Source

pub fn new() -> Self

The dialog as it opens: the list, with nothing chosen and nothing being written.

Source

pub fn editing(&self, name: &str) -> bool

Whether a lineup called name is the one being written, which is what decides whether the name is free.

Source

pub fn filter(&self) -> &str

What has been written above the list of the provider’s models.

Source

pub fn steps(&self) -> &[String]

The steps of the lineup being written, in the order they are tried.

Source

pub fn step(&self) -> usize

The step the person is looking at, while a lineup is being written.

Source

pub fn refusal(&self) -> Option<&Refusal>

What stopped the lineup being saved last time, as the view turns it into words.

Source

pub fn shown<'a>(&self, entry: &'a ProviderEntry) -> Vec<&'a Model>

The provider’s models the filter keeps, in the provider’s own order.

A service such as OpenRouter offers hundreds of models and a dialog holds a handful, so the list shows what is asked for. What the filter hides is not thrown away: a step already in the lineup stays in it, and the line under the name says so.

Source

pub fn paid<'a>(&self, entry: &'a ProviderEntry) -> Vec<&'a str>

The steps that cost money, said as Lineup::paid would say it for a saved one: the person hears it while they are choosing the order rather than from a bill afterwards. There is no lineup yet to ask, so the steps are read off the editor.

Source

pub fn open(&mut self, entry: &ProviderEntry)

The first lineup of entry, so that Edit and Delete act on something the moment the dialog opens rather than waiting for a row to be pointed at.

Source

pub fn kept(&mut self, names: &[String])

Puts the choice on a lineup that is still there after the one under the hand is gone, and on the first of what is left when the one under the hand is the one that went. The names are the list as it is now, read after the deletion rather than before it.

Source

pub fn choose(&mut self, name: &str)

The lineup called name is the one the person is looking at.

Source

pub fn new_lineup(&mut self)

Starts a lineup that is not there yet. Nothing of another is carried into it: its steps are its own.

Source

pub fn edit(&mut self, lineup: &Lineup)

Starts the lineup lineup for changing, with its own name and steps in the fields.

Source

pub fn name(&mut self, text: String)

The name as it has been typed. A form does not complain about a field nobody has finished, so what was said before is taken back as soon as it is written in.

Source

pub fn filter_for(&mut self, text: String)

What has been written above the list of the provider’s models.

Source

pub fn look_at(&mut self, id: &str)

The model the person is looking at in the list of the provider’s models.

Source

pub fn add(&mut self, id: &str)

Puts the model id at the end of the lineup.

The same model twice would send the same request to it twice and fall back to it twice, so a step already in the lineup is not put in again: the list of steps, right under the one that was pressed, is where that is visible.

Source

pub fn pick_step(&mut self, index: usize)

The step the person is looking at in the lineup.

Source

pub fn up(&mut self)

Moves the chosen step one place earlier. The first step has nowhere earlier to go, and a request that failed on it is what the order is for.

Source

pub fn down(&mut self)

Moves the chosen step one place later. The last step has nowhere later to go.

Source

pub fn remove(&mut self)

Takes the chosen step out of the lineup.

Source

pub fn build(&self, taken: impl Fn(&str) -> bool) -> Result<Lineup, Refusal>

The lineup the editor describes, or the first reason it is not one.

taken says whether a lineup of this name is already there, which only the file knows.

§Errors

Refusal says what stopped it, in the words the view shows beside the name field.

Source

pub fn saved(&mut self, name: &str)

Puts the saved lineup back on the list and leaves the editor, which is what a save means everywhere else on this page: what was asked to be kept is now what is shown.

Source

pub fn cancelled(&mut self)

Leaves the lineup being written, keeping nothing of it. A lineup reaches the file when it is saved, so one left half-made is not left behind in the file either.

Trait Implementations§

Source§

impl Clone for Lineups

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Lineups

Source§

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

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

impl Default for Lineups

Source§

fn default() -> Self

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

impl Eq for Lineups

Source§

impl PartialEq for Lineups

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Lineups

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> 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<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> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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<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<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.