Skip to main content

Draft

Struct Draft 

Source
pub struct Draft {
Show 17 fields pub stage: Stage, pub name: String, pub renamed: bool, pub harness: HarnessKind, pub template: Template, pub parts: Vec<Extra>, pub account: AccountKind, pub providers: Vec<ProviderEntry>, pub provider_tag: Option<String>, pub provider_pick: Option<Pick>, pub model_filter: String, pub assets: MountAccess, pub network: NetworkMode, pub os: Os, pub build: Build, pub log: LogBuffer, pub login: Login, /* private fields */
}
Expand description

Everything the wizard has been told so far.

Fields§

§stage: Stage

The page being shown.

§name: String

The name as it has been typed.

§renamed: bool

Whether the name has been edited by hand; until it has, choosing a harness renames it.

§harness: HarnessKind

The chosen harness.

§template: Template

The row the template page’s picker reads: the ready-made set last chosen while the switches still read as it, and Custom once they do not (Draft::preset).

§parts: Vec<Extra>

The parts the image carries, each switched on or off on the template page.

§account: AccountKind

The chosen account type.

§providers: Vec<ProviderEntry>

The providers the person has added, as the Providers page last had them, for the account page to offer when the chosen harness can be pointed at one of its own.

§provider_tag: Option<String>

The tag of the chosen provider, while account is AccountKind::Provider.

§provider_pick: Option<Pick>

What is asked for of the chosen provider: one of its models, or one of its lineups, while account is AccountKind::Provider.

§model_filter: String

What has been typed into the model list’s filter, which is what a provider offering hundreds of models is read by.

§assets: MountAccess

How Assets/ is mounted.

§network: NetworkMode

What the container may reach.

§os: Os

The system the image is built on.

§build: Build

How far the build has got.

§log: LogBuffer

Every line the build has printed.

§login: Login

How far the login has got.

Implementations§

Source§

impl Draft

Source

pub fn new( taken: impl IntoIterator<Item = String>, providers: Vec<ProviderEntry>, ) -> Self

A new draft for a store whose profiles are called taken, offering providers on the account page for a harness that can be pointed at one.

Source

pub fn for_login(profile: &Profile) -> Self

A draft that only signs profile in: the image is already there, so the login page is the whole of it. This is how a login that was interrupted is picked up again.

Source

pub fn for_rebuild(profile: &Profile) -> Self

A draft that only builds profile’s image again: the image page is the whole of it, and the build has not started. Nothing of the profile changes but its image.

Source

pub fn for_edit(profile: &Profile, providers: Vec<ProviderEntry>) -> Self

A draft that changes profile: the whole wizard, from its first page, with everything the profile says already chosen and providers offered on the account page. The name stays as it is, because the profile’s image, its login and every workspace’s home of it are named after it.

Source

pub fn is_editing(&self) -> bool

Whether this draft changes a profile that exists.

Source

pub fn rebuilds(&self) -> bool

Whether saving the changes builds the image again: the recipe of the profile as it is now is not the recipe it was built from. The harness, the template and its parts, the system, and an account whose kind the image is kept to all change the recipe; the network, the access to Assets/ and the provider’s model do not, since they belong to the containers.

Source

pub fn signs_in_again(&self) -> bool

Whether the changes need a new sign-in: the profile signs in, and either with another kind of account or to another harness than the login it has was made for.

Source

pub fn extra_download_failed(&self) -> bool

Whether the build failed because a step of QCode extra could not download what it installs, which the step says in words of its own (recipe::EXTRA_FAILED) in the log.

Source

pub fn dev_download_failed(&self) -> bool

Whether the build failed because a step of Quvyta development could not download what it installs, which the step says in words of its own (recipe::DEV_FAILED) in the log.

Source

pub fn recommended_download_failed(&self) -> bool

Whether the build failed because a step of QCode recommended could not download what it installs, which the step says in words of its own (recipe::RECOMMENDED_FAILED) in the log.

Source

pub fn slim_download_failed(&self) -> bool

Whether the build failed because a step of oh my opencode slim could not download what it installs, which the step says in words of its own (recipe::SLIM_FAILED) in the log.

Source

pub fn custom_download_failed(&self) -> bool

Whether the build failed because a step of a profile whose parts are its own could not download what it installs, which the step says in words of its own (recipe::CUSTOM_FAILED) in the log.

Source

pub fn is_only_login(&self) -> bool

Whether this draft is only a login for a profile that already exists.

Source

pub fn is_only_rebuild(&self) -> bool

Whether this draft only builds the image of a profile that already exists again.

Source

pub fn choose_harness(&mut self, harness: HarnessKind)

Chooses a harness. While the name has not been touched it follows the harness, and a different harness brings its own first account type: the account page comes after this one, and each harness offers its own list, headed by the one most people start with.

The parts follow the harness too. A ready-made set stays that set and gives what it gives for the new harness, or QCode recommended where the set is not offered. A set of the person’s own keeps the parts this harness can have, so moving from Claude Code to opencode does not take graphify away.

Source

pub fn provider_models(&self) -> &[Model]

The models of the chosen provider, or none while no provider is chosen or it offers none yet: a provider the person has not asked to list is added with an empty list, and its own page is where that is fixed.

Source

pub fn provider_lineups(&self) -> &[Lineup]

The lineups of the chosen provider, or none while no provider is chosen. A lineup is the person’s own order of that provider’s models, written on the Providers page; a provider that has none is a provider that is simply not given one.

Source

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

The model the account page has chosen, when what it has chosen is a model rather than a lineup. The list’s rows are models as well as lineups, so this is only what a caller that asks about the model has an answer for.

Source

pub fn pick_rows(&self) -> Vec<PickRow<'_>>

The rows of the account page’s list: the chosen provider’s lineups first and under a heading of their own, then its models under a heading of their own, with a gap between them. A provider with no lineup of its own is not given a heading for one, so its list is the models alone as it was.

One filter leaves both, because one box on the page filters both: a person who has heard of qwen3-coder and of the lineup coder is looking for either, and a box that found only one of them would read as the other not being there. What the filter leaves out is not unchosen: the chosen pick is a name, and it stays what it is until another row is pressed.

Nothing at all when the filter leaves neither, so the list says so in its own words rather than showing a heading over nothing.

Source

pub fn chosen_row(&self) -> Option<usize>

The row of the list the page stands on: the one the chosen pick is on, while the filter leaves it there. A pick the filter hides is on no row, which is not a row selected.

Source

pub fn pick_at(&self, index: usize) -> Option<Pick>

The pick the row at index stands for, and None for a heading, a gap, or a row that is not there: none of those is something to choose, and a person clicking past the end of a list expects nothing to change.

Source

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

The steps a request on the chosen pick would spend money on if it landed on one: a lineup’s own paid steps, or the one model itself when it is a paid one. Empty for a pick nobody has made yet, and for a step whose price nobody published, which is not the same as a free one.

Source

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

The steps of the chosen pick whose window nobody has measured, so a harness told nothing works to a figure of its own and may lose the front of a long prompt without a word. The one model of a single-model pick, or the steps of a lineup no step of which is known.

Source

pub fn matching_models(&self) -> Vec<&Model>

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

A service such as OpenRouter offers hundreds of models and a page holds a handful, so the list shows what is asked for. What the filter hides is not unchosen: the chosen model is a name, and it stays what it is until another one is chosen.

Source

pub fn choose_provider(&mut self, tag: &str)

Chooses the provider tagged tag, and with it the first lineup it is known to offer, or the first model it offers when it has no lineup, so that picking a provider that already has something to run on chose it for the person rather than leaving a second, empty choice behind it. What was asked for in the provider left behind is of no use here, and a filter matching none of this provider’s models would show an empty list.

Source

pub fn offer_providers(&mut self, providers: Vec<ProviderEntry>)

Offers providers from now on, as the file has them after the person was away on the Providers page. A provider account keeps the provider and what it runs on where they are still there, and otherwise takes the first of what is offered now, the way picking the account does: the page told the person to add one and come back, so the one they added is the one they meant.

Source

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

Chooses the model id of the provider already chosen.

Source

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

Chooses what the row at index of the account page’s list stands for: one of the chosen provider’s lineups, or one of its models. A row that is not there, a heading and a gap choose nothing, as a person clicking past the end of a list expects.

Source

pub fn stages(&self) -> &'static [Stage]

The pages this draft goes through. A profile that signs in to nothing has no sign-in page: a step that could only say “nothing to do” would still have to be walked through.

A profile being changed has one only when the changes need a new sign-in: the login it has is kept otherwise, and asking for it again would only make the person do it twice.

Source

pub fn profile(&self) -> Option<Profile>

The profile the draft describes, if the name is usable and, for a provider account, both a provider and a model have been chosen.

A ready-made set the picker reads is written as itself. The switches of a set of the person’s own are written in the terms an older QCode builds the same way where there are such terms (Template::written_as), and as Custom only where there are not.

Source

pub fn preset(&self) -> Template

The row the picker reads.

Source

pub fn offered(&self) -> Vec<Extra>

Every part this profile can have, whatever the picker reads: the list the page shows.

Source

pub fn has(&self, extra: Extra) -> bool

Whether extra is switched on.

Source

pub fn adds_anything(&self) -> bool

Whether anything is downloaded into the image beside the harness: the recommended settings are written, not downloaded.

Source

pub fn switch(&mut self, extra: Extra, on: bool)

Switches extra on or off, and the picker reads Custom unless the switches are now exactly a ready-made set. The two teams of agents opencode has exclude each other: each one switched on switches the other off, since a container runs one of them, not both. A part the chosen system has none of stays off; its switch is disabled.

Source

pub fn choose(&mut self, template: Template)

Chooses the picker’s row template: a ready-made set switches on every part it gives and every other part off. Custom switches every part off, which is the harness as it comes, the start of a set of the person’s own.

Source

pub fn choose_os(&mut self, os: Os)

Chooses the system the image is built on. A part the new system has none of is switched off: no image can carry it there.

Source

pub fn chromium_refused(&self) -> bool

Whether the chosen system has no Chromium that runs in a container, which the page says beside the switch it cannot move.

Source

pub fn safe_name(&self) -> Option<SafeName>

The name as it will be written, which is not always the name as it was typed.

Source

pub fn blocked(&self) -> Option<Blocked>

Why the current page cannot be left, if it cannot.

Source

pub fn harnesses(&self) -> Vec<HarnessKind>

The harnesses the first page offers: all of them, less the ones that mean nothing in a container with no network while that is what the profile’s containers are to get.

Source

pub fn networks(&self) -> Vec<NetworkMode>

The network modes the permissions page offers: both, less no network at all for a harness that means nothing without it.

Source

pub fn is_busy(&self) -> bool

Whether the wizard should show its buttons as working and ignore them.

Source

pub fn building(&mut self, task: TaskId)

The build has started in task, so the silence the page warns about begins now: a build that has only just begun has said nothing, and nothing yet.

Source

pub fn is_building(&self) -> bool

Whether the image build is running.

Source

pub fn build_looked(&mut self, now: Instant, quiet: Duration)

Whether the build has said nothing for longer than quiet as of now, which is what the page says under its own words about the build. A draft that is not building says no whatever its silence is: there is no build to be stuck.

Source

pub fn is_stuck(&self) -> bool

Whether the build has been quiet long enough to be said to be stuck, which is never said of a build that has ended.

Source

pub fn build_said(&mut self)

Notes that the build has said something, so that the silence is counted from this moment and the warning under the page’s own words goes away.

Source

pub fn build_ended(&mut self)

The build has ended, so there is no build left to be stuck: the warning goes with it here rather than standing until the next look noticed, since the page stays up to say how the build ended.

Source

pub fn advance(&mut self) -> Option<Blocked>

Moves to the next page, unless the current one is blocked or something is running.

Source

pub fn back(&mut self)

Moves back a page.

Source

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

Goes back to a page that has been finished. Pages ahead of the current one are not reachable this way, and neither is any page while work is running.

Trait Implementations§

Source§

impl Debug for Draft

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Draft

§

impl RefUnwindSafe for Draft

§

impl Send for Draft

§

impl Sync for Draft

§

impl Unpin for Draft

§

impl UnsafeUnpin for Draft

§

impl UnwindSafe for Draft

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