Skip to main content

Session

Struct Session 

Source
pub struct Session {
    pub connected: bool,
    parser: Parser,
    sb: Vec<u8>,
    csi: Vec<u8>,
    line: Vec<u8>,
    pos: usize,
    history: Vec<Vec<u8>>,
    hist_idx: usize,
    saved_line: Vec<u8>,
    pub term: Term,
    pub cwd: String,
    pub color_forced: bool,
}

Fields§

§connected: bool§parser: Parser§sb: Vec<u8>§csi: Vec<u8>§line: Vec<u8>§pos: usize§history: Vec<Vec<u8>>§hist_idx: usize§saved_line: Vec<u8>§term: Term§cwd: String§color_forced: bool

True when the user forced a color mode with the color command.

Implementations§

Source§

impl Session

Source

pub fn new() -> Self

Source

pub fn reset(&mut self)

Reset everything tied to one connection (including history and cwd).

Source

pub fn history(&self) -> impl Iterator<Item = &[u8]>

Source

pub fn send_negotiation(&self, out: &mut Out)

Option negotiation (used when the client spoke before the probe won).

Source

pub fn send_banner(&mut self, out: &mut Out)

Source

fn draw_prompt(&self, out: &mut Out)

Source

fn redraw(&self, out: &mut Out)

Redraw prompt + line and put the cursor back at pos.

Source

fn new_prompt(&mut self, out: &mut Out)

Source

pub fn feed(&mut self, out: &mut Out, bytes: &[u8]) -> bool

Feed bytes received from the client. Returns false to disconnect.

Source

fn feed_byte(&mut self, out: &mut Out, b: u8) -> bool

Source

fn negotiate(&mut self, out: &mut Out, cmd: u8, opt: u8)

Source

fn subnegotiation(&mut self)

Source

pub fn apply_color(&self, out: &mut Out)

Color mode currently in effect for command output and the prompt.

Source

fn insert(&mut self, out: &mut Out, b: u8)

Source

fn backspace(&mut self, out: &mut Out)

Source

fn delete(&mut self, out: &mut Out)

Source

fn kill_word(&mut self, out: &mut Out)

Source

fn move_left(&mut self, out: &mut Out)

Source

fn move_right(&mut self, out: &mut Out)

Source

fn set_line(&mut self, out: &mut Out, new: Vec<u8>)

Source

fn csi_key(&mut self, out: &mut Out, fin: u8)

Source

fn tab(&mut self, out: &mut Out)

Source

fn replace_tail(&mut self, out: &mut Out, start: usize, text: Vec<u8>)

Source

fn submit(&mut self, out: &mut Out) -> bool

Auto Trait Implementations§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.