pub struct Registry(/* private fields */);Expand description
Shared registry of live connections and recent events, read by the TUI and, when a log file is configured, mirrored to disk as JSON lines for headless use.
Implementations§
Source§impl Registry
impl Registry
pub fn new() -> Self
Sourcepub fn subscribe(&self) -> Receiver<Event>
pub fn subscribe(&self) -> Receiver<Event>
Subscribes to every event from now on, as structured values rather than
the formatted lines of Registry::recent_log. A subscriber that falls
more than a few hundred events behind gets RecvError::Lagged and
skips ahead.
pub fn set_log_file(&self, path: PathBuf) -> Result<()>
Sourcepub fn open(
&self,
label: impl Into<String>,
protocol: Protocol,
source: impl Into<String>,
destination: impl Into<String>,
) -> ConnectionInfo
pub fn open( &self, label: impl Into<String>, protocol: Protocol, source: impl Into<String>, destination: impl Into<String>, ) -> ConnectionInfo
Register a new connection and emit its ConnectionOpened event. Returns a
handle whose bytes_in/bytes_out counters the caller should update live.
pub fn close(&self, info: &ConnectionInfo)
pub fn info(&self, message: impl Into<String>)
pub fn error(&self, message: impl Into<String>)
pub fn live_connections(&self) -> Vec<ConnectionInfo>
pub fn recent_log(&self) -> Vec<String>
pub fn totals(&self) -> Totals
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Registry
impl !UnwindSafe for Registry
impl Freeze for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
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