pub struct Bridge { /* private fields */ }
Expand description
Bridge
is a complement for Screen
. It allows you to print new lines in windows from different threads.
You initiate a Bridge
by passing a pre-created Screen
. The only disadvantage of using
Bridge
is that you can’t create new children once you have created the Bridge
. Run Bridge::clone(&self)
to
access bridge from multiple threads. Ideally, run Bridge::kill(&self)
before ending program to kill the screening process. However, it is not neccessary.
Implementations§
Source§impl Bridge
impl Bridge
Sourcepub fn new(screen: Screen) -> Self
pub fn new(screen: Screen) -> Self
Create a Bridge
by passing an already created Screen
. You won’t be able to append children
to Screen
once passed.
Sourcepub fn println(&self, id: usize, msg: &str) -> Result<(), ErrorKind>
pub fn println(&self, id: usize, msg: &str) -> Result<(), ErrorKind>
Print a new line
in window with id
. Returns ()
if successful, Err(std::io::ErrorKind)
if not.
Sourcepub fn print(&self, id: usize, msg: &str) -> Result<(), ErrorKind>
pub fn print(&self, id: usize, msg: &str) -> Result<(), ErrorKind>
Print line
in window with id
, but do not flush. Returns ()
if successful, Err(std::io::ErrorKind)
if not.