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
impl Tab
Sourcepub fn new(key: TabKey, kind: TabKind) -> Self
pub fn new(key: TabKey, kind: TabKind) -> Self
A tab of kind opened now, waiting for its container.
Sourcepub fn blank(key: TabKey) -> Self
pub fn blank(key: TabKey) -> Self
A blank tab opened now, waiting for the person to choose what it opens.
Sourcepub fn waiting(key: TabKey, kind: TabKind) -> Self
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.
Sourcepub fn restored(
key: TabKey,
kind: TabKind,
opened: u64,
conversation: Option<String>,
) -> Self
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.
Sourcepub fn number(&self) -> u32
pub fn number(&self) -> u32
The tab’s id inside its workspace, which agents send to; 0 before it joined one.
Sourcepub fn rename(&mut self, name: Option<String>)
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.
Sourcepub fn conversation(&self) -> Option<&str>
pub fn conversation(&self) -> Option<&str>
The harness conversation the tab shows, when it is known.
Sourcepub fn session(&self) -> Option<&TerminalSession>
pub fn session(&self) -> Option<&TerminalSession>
The session drawn in the middle, while there is one.
Sourcepub fn document(&self) -> Option<&str>
pub fn document(&self) -> Option<&str>
The text of a Markdown tab’s file, once it has been read.
Sourcepub fn is_partial(&self) -> bool
pub fn is_partial(&self) -> bool
Whether the text the tab shows was cut short.
Sourcepub fn quiet(&self) -> Option<Quiet>
pub fn quiet(&self) -> Option<Quiet>
Why a sound tab shows the sound’s details rather than playing it.
Sourcepub fn keep_quiet(&mut self, why: Quiet)
pub fn keep_quiet(&mut self, why: Quiet)
Records why a sound tab shows the sound’s details.
Sourcepub fn play_through(&mut self, socket: PathBuf)
pub fn play_through(&mut self, socket: PathBuf)
Records the socket a sound tab plays through, and that it plays rather than describes.
Sourcepub fn hold(&mut self, held: bool)
pub fn hold(&mut self, held: bool)
Makes a sound tab wait to be asked before it plays, or lets it play.
Sourcepub fn sign_in(&self) -> Option<(&str, Option<Shown>)>
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.
Sourcepub fn asked_to_open(&mut self, address: String)
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.
Sourcepub fn opened_here(&mut self, address: &str, opened: Shown)
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.
Sourcepub fn back(&self) -> Option<(u16, &Back)>
pub fn back(&self) -> Option<(u16, &Back)>
The port the window’s sign-in comes back to, and where its way back stands.
Sourcepub fn listens_on(&self, port: u16) -> bool
pub fn listens_on(&self, port: u16) -> bool
Whether the tab listens for a sign-in coming back to port right now.
Sourcepub fn back_to(&mut self, port: u16, back: Back)
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.
Sourcepub fn came_back(&mut self, id: u64, ending: Ending)
pub fn came_back(&mut self, id: u64, ending: Ending)
Takes the end of the listening id, if it is still the tab’s.
Sourcepub fn stop_listening(&mut self)
pub fn stop_listening(&mut self)
Stops listening for the way back, when the tab was.
Sourcepub fn token(&self) -> &str
pub fn token(&self) -> &str
The token a harness tab is started with, by which the bridge knows it.
Sourcepub fn letters_shown(&self) -> bool
pub fn letters_shown(&self) -> bool
Whether the waiting messages are shown.
Sourcepub fn undelivered(&self) -> Option<Undelivered>
pub fn undelivered(&self) -> Option<Undelivered>
Why the waiting messages have not been typed into the harness, when something stops them.
Sourcepub fn not_delivered(&mut self, why: Undelivered)
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.
Sourcepub fn pasted(&mut self, pasted: Pasted)
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.
Sourcepub fn owed(&self) -> Option<&Pasted>
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.
Sourcepub fn returned(&mut self)
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.
Sourcepub fn put_back(&mut self, letter: Letter)
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.
Sourcepub fn person_typed(&self) -> bool
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.
Sourcepub fn delivered(&mut self)
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.
Sourcepub fn show_letters(&mut self, shown: bool)
pub fn show_letters(&mut self, shown: bool)
Shows the waiting messages, or hides them.
Sourcepub fn take_letters(&mut self) -> Vec<Letter>
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.
Sourcepub fn discard_letters(&mut self)
pub fn discard_letters(&mut self)
Throws the waiting messages away.
Sourcepub fn stopped(&self) -> Option<&str>
pub fn stopped(&self) -> Option<&str>
The other tab of the exchange the loop limit ended, while the tab still says so.
Sourcepub fn stop(&mut self, other: String)
pub fn stop(&mut self, other: String)
Records that the loop limit ended this tab’s exchange with the tab named other.
Sourcepub fn choose(&mut self, kind: TabKind, conversation: Option<String>)
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.
Sourcepub fn show_conversation(&mut self, conversation: String)
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.
Sourcepub fn restarting(&mut self)
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.
Sourcepub fn building(&mut self, task: TaskId)
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.
Sourcepub fn build_line(&mut self, text: &str, failed: bool)
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.
Sourcepub fn is_building(&self) -> bool
pub fn is_building(&self) -> bool
Whether the tab is building its profile’s image.
Sourcepub fn build_looked(&mut self, now: Instant, quiet: Duration)
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.
Sourcepub fn is_stuck(&self) -> bool
pub fn is_stuck(&self) -> bool
Whether the build has been quiet long enough to be said to be stuck.
Sourcepub fn wake(&mut self)
pub fn wake(&mut self)
Starts a tab that was waiting to be shown: it now waits for its container instead.
Sourcepub fn attached(&mut self, session: TerminalSession)
pub fn attached(&mut self, session: TerminalSession)
Attaches session and marks the tab as running.
Sourcepub fn read(&mut self, text: String, partial: bool)
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.
Sourcepub fn settled(&mut self, state: TabState)
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.
Sourcepub fn close_session(&mut self)
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§
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> 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
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