Skip to main content

ChanInOut

Struct ChanInOut 

Source
pub struct ChanInOut<'g>(/* private fields */);
Expand description

A bidirectional SSH channel.

Used as stdin/stdout for a shell/exec/subsystem. Represents other forwarded transports.

This must be read, otherwise the SSH session will block. If input isn’t required, use split() and discard the input half.

Clone is implemented for convenience, but only one instance each should be read from or written to (this applies to split() instances too). Otherwise ordering will be arbitrary, and if competing readers or writers are in different tasks, there will be churn as they continually wake each other up. Simultaneous single-reader and single-writer is fine.

Implementations§

Source§

impl<'g> ChanInOut<'g>

Source

pub fn num(&self) -> ChanNum

Return the channel number.

Source

pub fn split(&self) -> (ChanIn<'g>, ChanOut<'g>)

Convert this into separate input and output.

Note the warning above against simultaneous use and Clone.

Source

pub async fn until_closed(&self) -> Result<()>

Wait until the channel closes.

Source

pub async fn term_window_change(&self, winch: WinChange) -> Result<()>

Send a terminal size change notification

Only applicable to client shell channels with a PTY

Trait Implementations§

Source§

impl Clone for ChanInOut<'_>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'g> Debug for ChanInOut<'g>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for ChanInOut<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl ErrorType for ChanInOut<'_>

Source§

type Error = Error

Error type of all the IO operations on this type.
Source§

impl<'g> From<ChanInOut<'g>> for ChanIn<'g>

Source§

fn from(ch: ChanInOut<'g>) -> Self

Converts to this type from the input type.
Source§

impl<'g> From<ChanInOut<'g>> for ChanOut<'g>

Source§

fn from(ch: ChanInOut<'g>) -> Self

Converts to this type from the input type.
Source§

impl Read for ChanInOut<'_>

Source§

async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>

Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl Write for ChanInOut<'_>

Source§

async fn write(&mut self, buf: &[u8]) -> Result<usize, Error>

Write a buffer into this writer, returning how many bytes were written. Read more
Source§

async fn flush(&mut self) -> Result<()>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
Source§

async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more

Auto Trait Implementations§

§

impl<'g> !RefUnwindSafe for ChanInOut<'g>

§

impl<'g> !Send for ChanInOut<'g>

§

impl<'g> !Sync for ChanInOut<'g>

§

impl<'g> !UnwindSafe for ChanInOut<'g>

§

impl<'g> Freeze for ChanInOut<'g>

§

impl<'g> Unpin for ChanInOut<'g>

§

impl<'g> UnsafeUnpin for ChanInOut<'g>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.