pub struct ServerPty { /* private fields */ }
Expand description
An object used for interacting with the shell.
Implementations§
Source§impl ServerPty
impl ServerPty
Sourcepub fn new() -> Result<Self, Error>
pub fn new() -> Result<Self, Error>
Creates a new instance of the Pty which must later be spawned.
Sourcepub async fn spawn(
self,
command: Option<&CStr>,
environ: Option<&[&CStr]>,
) -> Result<ShellProcess, Error>
pub async fn spawn( self, command: Option<&CStr>, environ: Option<&[&CStr]>, ) -> Result<ShellProcess, Error>
Spawns the Pty.
If no command is provided the default /boot/bin/sh will be used.
After calling this method the user must call resize to give the process a valid window size before it will respond.
The launched process will close when the Pty is dropped so you do not need to explicitly close it.
pub async fn spawn_with_argv( self, command: &CStr, argv: &[&CStr], environ: Option<&[&CStr]>, ) -> Result<ShellProcess, Error>
Sourcepub fn try_clone_fd(&self) -> Result<File, Error>
pub fn try_clone_fd(&self) -> Result<File, Error>
Attempts to clone the server side of the file descriptor.
Sourcepub async fn resize(&self, window_size: WindowSize) -> Result<(), Error>
pub async fn resize(&self, window_size: WindowSize) -> Result<(), Error>
Sends a message to the shell that the window has been resized.
Sourcepub async fn open_client(
&self,
server_end: ServerEnd<DeviceMarker>,
) -> Result<(), Error>
pub async fn open_client( &self, server_end: ServerEnd<DeviceMarker>, ) -> Result<(), Error>
Open a client Pty device. server_end
should be a handle
to one endpoint of a channel that (on success) will become an open
connection to the newly created device.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ServerPty
impl !RefUnwindSafe for ServerPty
impl Send for ServerPty
impl Sync for ServerPty
impl Unpin for ServerPty
impl !UnwindSafe for ServerPty
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)