#console #listen #listener #thread #input #listening #separate

console-listener

A crate for listening to console input in a separate thread

6 releases

0.2.0 Jan 23, 2021
0.1.4 Jan 21, 2021

#5 in #listening

MIT/Apache

7KB
81 lines

NOTE: Use console_listener with an underscore instead of the dash to bring this crate into scope.

console-listener

console-listener is a crate for listening to console input in a separate thread. It is very useful for listen for a stop command in an otherwise infinitely looping program. console_listener includes the Listener struct, used to listen for a specified string to be typed to the console.

How to use it

Use console_listener::listener::Listener to bring the struct to scope. Use Listener::new(key: &str) to create a new Listener instance. See whether the specified string has been heard using heard_key() Check the documentation for more info on the implementations.

Notes

This crate is still in initial development so the public API might still change drastically.


lib.rs:

console_listener includes the Listener struct, used to listen for a specified string to be typed to the console.

No runtime deps