MCPcopy Index your code
hub / github.com/endbasic/endbasic / new

Method new

sdl/src/console.rs:43–61  ·  view source on GitHub ↗

Connects a new SDL console client to an already-configured host.

(
        request_tx: SyncSender<Request>,
        response_rx: Receiver<Response>,
        on_key_rx: Receiver<Key>,
    )

Source from the content-addressed store, hash-verified

41impl SdlConsole {
42 /// Connects a new SDL console client to an already-configured host.
43 pub(crate) fn new(
44 request_tx: SyncSender<Request>,
45 response_rx: Receiver<Response>,
46 on_key_rx: Receiver<Key>,
47 ) -> io::Result<Self> {
48 // Wait for the host to be up and running. We must do this for error propagation.
49 match response_rx.recv().expect("Channel must be alive") {
50 Response::Empty(Ok(())) => Ok(Self {
51 request_tx,
52 response_rx,
53 on_key_rx,
54 fg_color: None,
55 bg_color: None,
56 alt_backup: None,
57 }),
58 Response::Empty(Err(e)) => Err(e),
59 r => panic!("Unexpected response {:?}", r),
60 }
61 }
62
63 /// Issues a synchronous call against the console host for a request that returns nothing but
64 /// an error (if any).

Callers

nothing calls this directly

Calls 4

new_console_pairFunction · 0.85
recvMethod · 0.80
build_consoleMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected