Skip to main content

App

Struct App 

Source
pub struct App {
Show 14 fields pub title: String, pub mode: Mode, pub budget: Budget, pub cx: Context, pub powers: Powers, pub slots: Vec<Slot>, pub selected: usize, pub status: String, pub config_path: String, pub balanced: bool, pub bg: Background, pub used: BackgroundUsed, pub headline: [Option<Delivered>; 4], pub other_budget: Budget,
}
Expand description

The planner’s state.

Fields§

§title: String

Title line.

§mode: Mode

Which paper.

§budget: Budget

Resource budget.

§cx: Context

Workload.

§powers: Powers

Side powers.

§slots: Vec<Slot>

Components.

§selected: usize

Selected control.

§status: String

Status line.

§config_path: String

Where W writes the build flags.

§balanced: bool

The powers are the balanced split for the current settings.

§bg: Background

The DSig paper’s background setting (auto or manual).

§used: BackgroundUsed

The background in use, with what the planner would choose.

§headline: [Option<Delivered>; 4]

Each mode’s delivered rates as last planned (Mode::ALL order), for the headline that shows every paper.

§other_budget: Budget

The budget of the modes on the other side of the uBFT line: the papers plan an engine budget, the uBFT modes the whole device (Budget::whole_device). Switching across swaps them.

Implementations§

Source§

impl App

Controls, key handling and planning for the TUI.

Source

pub fn new(title: &str, mode: Mode, slots: Vec<Slot>) -> App

A planner for slots, balanced for the default settings.

Source

pub fn has_paper(&self, mode: Mode) -> bool

Whether this chip has the modules of mode’s paper: a paper’s signing module decides it (Ed25519 signing for the Ed25519 paper, DSig signing for the DSig paper; a uBFT module of that role for a uBFT mode).

Source

pub fn papers(&self) -> Vec<Mode>

The papers this chip can plan, in display order (Mode::ALL).

Source

pub fn controls(&self) -> Vec<Control>

Every control, in display order.

Source

pub fn sha_lut_knob(&self) -> Option<(usize, usize)>

The SHA-512 line’s LUT allowance knob: (slot, knob index).

Source

pub fn sha_auto(&self) -> bool

Whether the SHA-512 line sizes itself to demand (its “size” knob on auto).

Source

pub fn lut_split(&self) -> (f64, f64, f64)

The LUT split in % of the LUT budget: (SHA line, DSig foreground, Ed25519). The Ed25519 paper has no DSig part. Sums to 100.

Source

pub fn adjust(&mut self, steps: f64)

Move the selected control by steps.

Source

pub fn switch_paper(&mut self)

Switch to the next paper this build has (papers, wrapping around) and balance it.

Source

pub fn balance(&mut self)

Choose the side powers for the mix (what “100 %” means).

Source

pub fn write_config(&mut self)

Write the build flags of the current plan.

Source

pub fn key(&mut self, code: KeyCode, shift: bool) -> bool

Handle one key; false to quit.

Source

pub fn plan(&self) -> ChipPlan

The current plan.

Auto Trait Implementations§

§

impl Freeze for App

§

impl !RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

§

impl !UnwindSafe for App

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