pub struct PtyAttachment {
pub initial_backlog: Vec<u8>,
pub bytes_missed: u64,
/* private fields */
}Expand description
Active attachment to a daemon-owned PTY session.
Owns the socket; the connection is in streaming mode and cannot be used for unrelated RPCs.
Fields§
§initial_backlog: Vec<u8>Bytes received in the initial AttachPtySessionResponse (output the client missed before attach succeeded).
bytes_missed: u64Cumulative bytes dropped from the daemon’s ring buffer before this attach. Zero if the buffer never overflowed.
Implementations§
Source§impl PtyAttachment
impl PtyAttachment
Sourcepub fn attach(
scope_hash: Option<&str>,
session_id: &str,
rows: u16,
cols: u16,
steal: bool,
) -> Result<Self, AttachError>
pub fn attach( scope_hash: Option<&str>, session_id: &str, rows: u16, cols: u16, steal: bool, ) -> Result<Self, AttachError>
Open a fresh socket to the daemon and attach to session_id.
Sourcepub fn attach_to(
socket_path: &str,
session_id: &str,
rows: u16,
cols: u16,
steal: bool,
) -> Result<Self, AttachError>
pub fn attach_to( socket_path: &str, session_id: &str, rows: u16, cols: u16, steal: bool, ) -> Result<Self, AttachError>
Open a fresh socket at socket_path and attach to session_id.
Sourcepub fn recv_frame(&mut self) -> Result<PtyStreamFrame, AttachError>
pub fn recv_frame(&mut self) -> Result<PtyStreamFrame, AttachError>
Block until the next stream frame arrives.
Sourcepub fn recv_frame_with_timeout(
&mut self,
timeout: Duration,
) -> Result<Option<PtyStreamFrame>, AttachError>
pub fn recv_frame_with_timeout( &mut self, timeout: Duration, ) -> Result<Option<PtyStreamFrame>, AttachError>
Block until the next stream frame arrives, or until timeout
elapses (returns Ok(None)). The underlying socket is put into
nonblocking mode for the duration of the wait; callers should not
interleave this with recv_frame.
Sourcepub fn send_input(&mut self, bytes: &[u8]) -> Result<(), AttachError>
pub fn send_input(&mut self, bytes: &[u8]) -> Result<(), AttachError>
Send raw input bytes to the PTY.
Sourcepub fn send_interrupt(&mut self) -> Result<(), AttachError>
pub fn send_interrupt(&mut self) -> Result<(), AttachError>
Send an interrupt (Ctrl+C / SIGINT) to the child process group.
Sourcepub fn detach(self) -> Result<(), AttachError>
pub fn detach(self) -> Result<(), AttachError>
Cleanly detach this attachment; the session keeps running.
Auto Trait Implementations§
impl Freeze for PtyAttachment
impl RefUnwindSafe for PtyAttachment
impl Send for PtyAttachment
impl Sync for PtyAttachment
impl Unpin for PtyAttachment
impl UnsafeUnpin for PtyAttachment
impl UnwindSafe for PtyAttachment
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