9 releases

0.3.6 May 18, 2020
0.3.5 Apr 28, 2019
0.3.1 Mar 7, 2019
0.3.0 Jan 25, 2019
0.1.0 Jan 14, 2019

#870 in Command-line interface

31 downloads per month

MIT/Apache

135KB
3.5K SLoC

Interact is a framework for friendly online introspection of the running program state in an intuitive command-line interactive way.

Please go to the homepage for more details.


lib.rs:

Interact Prompt

In high-level, to use Interact Prompt you need:

  1. Deriving of Interact over types.
  2. Registration of state
  3. Spawning or invoking the Interact prompt.

In pseudo code:

extern crate interact;

use interact::Interact;
use interact_prompt::{LocalRegistry, SendRegistry, Settings};

#[derive(Interact)]
struct YourType {
    // ...
}

// ...

fn in_each_thread(rc: Rc<SomeState>) {
    // ... You would have some code to register your 'Rc's.
    LocalRegistry::insert("rc_state", Box::new(rc));
    // ...
}

fn spawn_interact(arc: Arc<SomeOtherState>) {
    // On the global context you can register any object that is `Send`
    // and implements `Access` via #[derive(Interact)], this means `Arc` types,
    SendRegistry::insert("arc_state", Box::new(arc));

    interact_prompt::spawn(Settings::default(), ());
}

NOTE: Currently only the SendRegistry is supported for the background spawn variant of Interact. Supporting LocalRegistry is planned for the future.

Dependencies

~7MB
~138K SLoC