1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
pub
pub
pub
pub
pub
pub
/// Used for printing and reading from an external console.
///
/// This struct is the main interaction point to a worker process you can controll using
/// this struct's methods like [`Self::println`] or everything else documented here.
///
/// # Examples
///
/// ```rust
/// use pipedconsole::Console;
/// # fn main() -> Result<(), u32> {
/// let my_console = Console::new("My console")?;
///
/// // Prints hello world on another console window.
/// my_console.println("What is your name?");
///
/// let mut name = String::new();
/// my_console.read_to_string(&mut name)?
///
/// // Prints normally on the calling processe's console.
/// println!("Your name is: {}", name);
/// # Ok(())
/// # }
/// ```
///
/// # Cloning
///
/// You can clone this struct however you want, but note that
/// all cloned instances will controll the **same console window**.
///
/// # Threads
///
/// Currently this struct does not implement Send or Sync and there is no
/// way of connecting to an already existing console, however this will
/// be added in future versions.
///
/// **Do not try to send this struct across threads in any way.** The handle to
/// the pipe wich is owned by a [`Console`] can currently be inherited.