Skip to main content

Model

Struct Model 

Source
pub struct Model {
Show 25 fields pub lang: Lang, pub theme: Theme, pub profile: String, pub url: String, pub tab: Tab, pub size: (u16, u16), pub now: u64, pub wall_ms: i64, pub paused: bool, pub focused: bool, pub quit: bool, pub modal: Option<Modal>, pub notice: Option<Notice>, pub busy: Option<ApiCall>, pub me: Feed<Me>, pub status: Feed<ClusterStatus>, pub status_denied: Option<Fail>, pub cluster: ClusterScreen, pub tokens: TokensScreen, pub topics: TopicsScreen, pub profiles: ProfilesScreen, pub awaiting_profile: bool, pub history: History, pub next_id: u64, pub generation: u64,
}

Fields§

§lang: Lang§theme: Theme§profile: String§url: String§tab: Tab§size: (u16, u16)§now: u64

Milliseconds since the app opened, from the last tick.

§wall_ms: i64

The wall clock at the last tick (ms since the epoch, UTC).

§paused: bool§focused: bool

false while the terminal does not have the focus.

§quit: bool§modal: Option<Modal>§notice: Option<Notice>§busy: Option<ApiCall>

An action that is running (its reply has not come).

§me: Feed<Me>§status: Feed<ClusterStatus>§status_denied: Option<Fail>

GET /cluster/status answered 401/403 for this token: the screen falls back to GET /nodes.

§cluster: ClusterScreen§tokens: TokensScreen§topics: TopicsScreen§profiles: ProfilesScreen§awaiting_profile: bool

Waiting for the person to choose a profile: nothing is read until then.

§history: History§next_id: u64§generation: u64

Bumped when the screens are reset; a reply of an older generation is dropped.

Implementations§

Source§

impl Model

Source

pub fn new(options: Options) -> Model

Source

pub fn reconnect(&mut self, profile: String, url: String)

Starts over with another profile: what was read from the old server is dropped, and so is any reply still on its way (its generation is old).

Source

pub fn id(&mut self) -> u64

Source

pub fn tx(&self) -> Tx

Source

pub fn is_admin(&self) -> bool

true when this token may read the cluster’s detail and manage the tokens (root, no authentication, or the admin permission).

Source

pub fn is_root(&self) -> bool

true for the root token (or no authentication): stopping the cluster and the admin tokens are its alone.

Source

pub fn uses_status(&self) -> bool

The cluster-wide status is read with this token.

Source

pub fn is_offline(&self) -> bool

Any feed that ended in a connection failure: the server cannot be reached.

Source

pub fn health(&self) -> (Severity, String)

The worst condition for the status line: its severity and the word (a condition name, or a state key).

Source

pub fn notify(&mut self, severity: Severity, text: String)

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

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

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.