pub struct State {Show 17 fields
pub server: String,
pub connection: Connection,
pub listing: Listing,
pub rows: Vec<Row>,
pub next: Option<String>,
pub selected: usize,
pub view: View,
pub behind_help: View,
pub detail: Option<String>,
pub more: bool,
pub as_of: Option<OffsetDateTime>,
pub notice: Option<String>,
pub size: (u16, u16),
pub quit: bool,
pub content: Content,
pub revealed: Option<Revealed>,
pub scroll: usize,
}Expand description
Everything the UI shows. It never holds the token.
Fields§
§server: StringThe server’s address, as the client file gives it.
connection: ConnectionWhether the server has answered for the key.
listing: ListingThe state of the list.
rows: Vec<Row>The vCons read so far, newest first.
next: Option<String>The cursor of the next page, if there is one.
selected: usizeThe selected row’s index in rows.
view: ViewThe view drawn.
behind_help: ViewThe view help was opened from.
detail: Option<String>The uuid the detail view shows.
more: boolWhether a next page is in flight.
as_of: Option<OffsetDateTime>When the rows were last read from the server.
notice: Option<String>What went wrong with the last request, when the list is still shown.
size: (u16, u16)The terminal’s columns and lines.
quit: boolWhether the program should end.
content: ContentThe masked view of the vCon open.
revealed: Option<Revealed>The part of the vCon open that was revealed. It is dropped when the detail view is left, another vCon is shown, or the list is read again.
scroll: usizeThe first line of the detail view shown, for a text longer than the screen.
Implementations§
Source§impl State
impl State
Sourcepub fn new(server: &str, size: (u16, u16)) -> (Self, Vec<Effect>)
pub fn new(server: &str, size: (u16, u16)) -> (Self, Vec<Effect>)
The state at start for the server at server in a terminal of
size columns and lines, and the first request.
Sourcepub fn list_rows(lines: u16) -> u16
pub fn list_rows(lines: u16) -> u16
The rows of the list a terminal of lines lines shows: at least 1.
Sourcepub fn detail_row(&self) -> Option<&Row>
pub fn detail_row(&self) -> Option<&Row>
The row the detail view shows, if the list still holds it.
Sourcepub fn acts(&self, action: Action) -> bool
pub fn acts(&self, action: Action) -> bool
Whether a press of the key for action can do anything in this
state. The footer names only keys that act.
Sourcepub fn rows_shown(&self) -> bool
pub fn rows_shown(&self) -> bool
Whether the screen shows the rows, or the detail of one: the list is read. Otherwise a message stands in their place, and there is no selection to move or open. While a connection is being made the list is being read too, so the listing alone decides.
Sourcepub fn key_refusal(&self) -> Option<&'static str>
pub fn key_refusal(&self) -> Option<&'static str>
Why the key the server answered for may not list vCons, if it may not. The key is read once, at start, so no request changes this.
Sourcepub fn step(&mut self, event: Event, now: OffsetDateTime) -> Vec<Effect>
pub fn step(&mut self, event: Event, now: OffsetDateTime) -> Vec<Effect>
Applies event, which happened at now, and returns the requests
to make.
Sourcepub fn page_lines(lines: u16) -> usize
pub fn page_lines(lines: u16) -> usize
The lines PgUp and PgDn move the detail view by, in a terminal of
lines lines: the lines its body shows at least.
Trait Implementations§
impl Eq for State
impl StructuralPartialEq for State
Auto Trait Implementations§
impl Forget for State
impl Freeze for State
impl Move for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnsafeUnpin for State
impl UnwindSafe for State
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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