Skip to main content

Tab

Struct Tab 

Source
pub struct Tab { /* private fields */ }
Expand description

One tab: a container to enter, the state it is in and the session it draws while it runs.

Implementations§

Source§

impl Tab

Source

pub fn new(key: TabKey, kind: TabKind) -> Self

A tab of kind opened now, waiting for its container.

Source

pub fn blank(key: TabKey) -> Self

A blank tab opened now, waiting for the person to choose what it opens.

Source

pub fn waiting(key: TabKey, kind: TabKind) -> Self

A tab of kind opened now that waits to be started, which the screen does as soon as it is shown. A tab of one of the workspace’s files is opened this way, so it starts exactly the way a tab brought back from the last session does.

Source

pub fn restored( key: TabKey, kind: TabKind, opened: u64, conversation: Option<String>, ) -> Self

A tab of kind brought back from the last session, as it was recorded: opened at opened and showing conversation. It waits to be shown before it starts anything.

Source

pub fn key(&self) -> TabKey

The tab’s identity.

Source

pub fn number(&self) -> u32

The tab’s id inside its workspace, which agents send to; 0 before it joined one.

Source

pub fn name(&self) -> Option<&str>

The name the person gave the tab, when they gave it one.

Source

pub fn rename(&mut self, name: Option<String>)

Gives the tab the person’s name, or with None takes it away, after which the tab reads its automatic name again.

Source

pub fn kind(&self) -> &TabKind

What the tab opens.

Source

pub fn state(&self) -> &TabState

Where the tab stands.

Source

pub fn opened(&self) -> u64

When the tab was opened, in seconds since the Unix epoch.

Source

pub fn conversation(&self) -> Option<&str>

The harness conversation the tab shows, when it is known.

Source

pub fn session(&self) -> Option<&TerminalSession>

The session drawn in the middle, while there is one.

Source

pub fn document(&self) -> Option<&str>

The text of a Markdown tab’s file, once it has been read.

Source

pub fn is_partial(&self) -> bool

Whether the text the tab shows was cut short.

Source

pub fn pages(&self) -> Pages

Where a PDF tab stands among its pages.

Source

pub fn turn(&mut self, pages: Pages)

Moves a PDF tab to pages.

Source

pub fn quiet(&self) -> Option<Quiet>

Why a sound tab shows the sound’s details rather than playing it.

Source

pub fn keep_quiet(&mut self, why: Quiet)

Records why a sound tab shows the sound’s details.

Source

pub fn socket(&self) -> Option<&Path>

The sound server’s socket a sound tab plays through.

Source

pub fn play_through(&mut self, socket: PathBuf)

Records the socket a sound tab plays through, and that it plays rather than describes.

Source

pub fn is_held(&self) -> bool

Whether a sound tab waits to be asked before it plays.

Source

pub fn hold(&mut self, held: bool)

Makes a sound tab wait to be asked before it plays, or lets it play.

Source

pub fn sign_in(&self) -> Option<(&str, Option<Shown>)>

The web address the window asked to have opened, with where it was shown; that is None until the opening answers.

Source

pub fn asked_to_open(&mut self, address: String)

Records the address the window asked to have opened. The address is shown at once, before anything is known about the browser, because reading it is what the person needs most.

Source

pub fn opened_here(&mut self, address: &str, opened: Shown)

Records how the opening of that address went, if it is still the address being opened.

Source

pub fn back(&self) -> Option<(u16, &Back)>

The port the window’s sign-in comes back to, and where its way back stands.

Source

pub fn listens_on(&self, port: u16) -> bool

Whether the tab listens for a sign-in coming back to port right now.

Source

pub fn back_to(&mut self, port: u16, back: Back)

Records where the way back to port stands; a listening that was going on is stopped by being replaced.

Source

pub fn came_back(&mut self, id: u64, ending: Ending)

Takes the end of the listening id, if it is still the tab’s.

Source

pub fn stop_listening(&mut self)

Stops listening for the way back, when the tab was.

Source

pub fn run(&self) -> u64

Which session of this tab is the current one.

Source

pub fn token(&self) -> &str

The token a harness tab is started with, by which the bridge knows it.

Source

pub fn letters(&self) -> &[Letter]

The messages that wait in this tab, oldest first.

Source

pub fn letters_shown(&self) -> bool

Whether the waiting messages are shown.

Source

pub fn receive(&mut self, letter: Letter)

Leaves letter waiting in the tab.

Source

pub fn undelivered(&self) -> Option<Undelivered>

Why the waiting messages have not been typed into the harness, when something stops them.

Source

pub fn not_delivered(&mut self, why: Undelivered)

Records that the oldest waiting message could not be typed in, and why. The message stays where it is: dropping it would let the sender believe its work was handed over.

Source

pub fn pasted(&mut self, pasted: Pasted)

Records that pasted went into this tab’s prompt and that the tab owes its Return until Tab::returned says it has gone. A tab takes no further message in the meantime: two messages in one prompt line are one message to the harness.

Source

pub fn owed(&self) -> Option<&Pasted>

The message whose Return this tab still owes, when it owes one: the paste that went in, the harness’s last output before it, and when it went, which is what the Return’s own wait is counted from.

Source

pub fn returned(&mut self)

Records that the Return this tab owed has been written, and that the newest thing in the terminal is QCode’s own: what the person types after it is theirs, as before.

Source

pub fn put_back(&mut self, letter: Letter)

Puts letter back at the head of the waiting messages, as the oldest of them, and says why it is waiting again: its Return could not be written, so the harness that would have read it is gone and the message waits for the tab’s own next start rather than being lost.

Source

pub fn person_typed(&self) -> bool

Whether the person has typed into the session since it started and since QCode last wrote into it: a message pasted in is QCode’s own, and so is the Return that sends it, so neither counts as the person typing while the Return is still owed.

Source

pub fn delivered(&mut self)

Takes the oldest waiting message away, once it has been typed into the harness. The session’s own last input is left to the Return that sends it, which is written later than this paste.

Source

pub fn show_letters(&mut self, shown: bool)

Shows the waiting messages, or hides them.

Source

pub fn take_letters(&mut self) -> Vec<Letter>

Takes every waiting message out of the tab, oldest first, because its agent asked for them from its inbox: they are delivered by being handed over, and none of them is typed in.

Source

pub fn discard_letters(&mut self)

Throws the waiting messages away.

Source

pub fn stopped(&self) -> Option<&str>

The other tab of the exchange the loop limit ended, while the tab still says so.

Source

pub fn stop(&mut self, other: String)

Records that the loop limit ended this tab’s exchange with the tab named other.

Source

pub fn unstop(&mut self)

Stops saying that an exchange was ended, once the person has read it.

Source

pub fn choose(&mut self, kind: TabKind, conversation: Option<String>)

Turns a blank tab into a tab of kind showing conversation, opened now and waiting for its container. The key stays, so the tab keeps its place in the strip.

Source

pub fn show_conversation(&mut self, conversation: String)

Records that the tab shows conversation, once that is known, so the session file keeps it and the tab opens it again next time.

Source

pub fn restarting(&mut self)

Puts the tab back to waiting for its container and gives up the session it had, which ends the program still attached to it.

Source

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

The tab builds its profile’s image in task; the log starts empty and the silence starts now, since a build that has just begun has said something.

Source

pub fn build_line(&mut self, text: &str, failed: bool)

Adds a line the image build said to the tab’s log, which is also what ends the silence: a build that is saying things is not one to warn about.

Source

pub fn build_log(&self) -> &LogBuffer

What the image build said so far.

Source

pub fn is_building(&self) -> bool

Whether the tab is building its profile’s image.

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 beside it. A tab 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.

Source

pub fn wake(&mut self)

Starts a tab that was waiting to be shown: it now waits for its container instead.

Source

pub fn attached(&mut self, session: TerminalSession)

Attaches session and marks the tab as running.

Source

pub fn read(&mut self, text: String, partial: bool)

Takes the text of a Markdown tab’s file, or of a PDF, and shows it; partial says it was cut short.

Source

pub fn settled(&mut self, state: TabState)

Moves the tab to state, keeping the session so its last screen stays readable: a tab that says the container stopped still shows what the harness printed before it did.

Source

pub fn close_session(&mut self)

Ends the tab’s session, which is what closing a tab or restarting it does. The container itself is left alone: other tabs and other workspaces may be using it.

A Return owed to the program that is ending is given up with it: what is left in a prompt nobody will read is not a message the tab still holds, so a message whose Return could not be written is the only one that comes back, and it has come back by then.

Trait Implementations§

Source§

impl Debug for Tab

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Tab

§

impl RefUnwindSafe for Tab

§

impl Send for Tab

§

impl Sync for Tab

§

impl Unpin for Tab

§

impl UnsafeUnpin for Tab

§

impl UnwindSafe for Tab

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.