#[non_exhaustive]pub enum MonitorMode {
None,
Active {
port: u16,
echo: Option<u16>,
},
}Expand description
Monitor-port mode resolved from the -M flag or AUTOSSH_PORT env var.
MonitorMode::None(-M 0) — no TCP listeners; respawn ssh only on non-zero exit.MonitorMode::Active(-M <port>or-M <port>:<echo>) — bind a monitor-porttokio::net::TcpListenerpair (or single listener whenechois supplied) and probe round-trip everyAUTOSSH_POLLseconds.
§Example
use rusty_autossh::MonitorMode;
// -M 0: exit-only supervision, no TCP listeners.
let none = MonitorMode::None;
assert_eq!(none, MonitorMode::default());
// -M 20000:22 single-listener mode.
let active = MonitorMode::Active { port: 20000, echo: Some(22) };
match active {
MonitorMode::Active { port, echo } => {
assert_eq!(port, 20000);
assert_eq!(echo, Some(22));
}
_ => unreachable!(),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
None
-M 0: no monitor-port listeners; supervisor only watches child
exit status.
Active
-M <port> (echo None) or -M <port>:<echo> (echo Some).
Trait Implementations§
Source§impl Clone for MonitorMode
impl Clone for MonitorMode
Source§fn clone(&self) -> MonitorMode
fn clone(&self) -> MonitorMode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MonitorMode
impl Debug for MonitorMode
Source§impl Default for MonitorMode
impl Default for MonitorMode
Source§fn default() -> MonitorMode
fn default() -> MonitorMode
Returns the “default value” for a type. Read more
Source§impl Hash for MonitorMode
impl Hash for MonitorMode
Source§impl PartialEq for MonitorMode
impl PartialEq for MonitorMode
Source§fn eq(&self, other: &MonitorMode) -> bool
fn eq(&self, other: &MonitorMode) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for MonitorMode
impl StructuralPartialEq for MonitorMode
Auto Trait Implementations§
impl Freeze for MonitorMode
impl RefUnwindSafe for MonitorMode
impl Send for MonitorMode
impl Sync for MonitorMode
impl Unpin for MonitorMode
impl UnsafeUnpin for MonitorMode
impl UnwindSafe for MonitorMode
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