Expand description
Interact
Interact is a framework for friendly online introspection of the running program state in an intuitive command-line interactive way.
While dynamically-typed interpreted languages offer the advantage of allowing to look at a running program state using a prompt, compiled languages often do not provide that feature. Being hard as it is to introduce interpreters into compiled languages, the Interact project aimes to provide a midway solution using stable Rust.
§Usage
NOTE: Unless you are manually extending types for use under Interact, you probably don’t need
most of the items that are exported in this crate. Instead, look for the interact_prompt
crate.
§Design
Interact introduces a series of traits, the main ones are Access
and Deser
trait. Those
crates can be custom-derived using #[derive(Interact)]
, or be derived manually.
The Access
provides two methods that return special accessor trait object types. Please
read the documentation for the access
part of Interact.
The Deser
trait is a special deserializer that allows for online interactive hints at
non-ambiguous parse points.
Further relevent bits that comprise Interact are:
reflector
, when provided at type it will generate a representation of it, while handling reference cycles, imposed output limitations, mutexs, and customized in-process indirections.climber
, which when given a Rust-like expression of an inner value, knows how to go from an Interact root down to a field.
Modules§
Structs§
- Assist
- Given a list of items, this provides assistance for completing them.
- Climber
- Climber represents the full state of evaluation of Interact expressions. It is used within the
impls of the
Access
trait, and most likely does not require direct references from Interact’s crate users, unless manually providing impls ofAccess
not via the#[derive(Interact)]
. - Immut
Access - ImmutAccess adds function call information over
Reflect
. - MutAccess
- MutAccess adds function call information over
ReflectMut
. - Node
Tree - NodeTree represent a reflection of an Interact type that implemented the
Access
trait. It may be a partial reflection due to limits and indirections (seeReflector
). - Reflector
Reflector
operates on types implementingAccess
. Some of its methods are being called automatically from#[derive(Interact)]
impls. It provides a thread-safe context, because on the extreme case, where it is possible that reflection is done via indirection using multiple process threads (seeReflectIndirect
).- Root
- A temporary binder of
RootSend
andRootLocal
dictionaries, used for providing a unified dictionary to the user. - Root
Local - Holds a root dictionary of trait objects that implement
Access
and are therefore Interact-able. These are most likely objects that are held locally behind anRc
. - Root
Send - Holds a root dictionary of
Send
-able trait objects that implementAccess
and are therefore Interact-able. These are most likely objects that are held globally behind anArc
. - Token
- Represents a single meaningful substring part in an Interact string expression.
- Token
Vec - Wrapper for the traversal of a borrowed list of tokens.
Enums§
- Assign
Error - Call
Error - Climb
Error - Next
Options - Node
Info - Reflect
- An arbitrar between the two possible way to climb into an immutable value.
- Reflect
Mut - An arbitrar between the two possible way to climb into a mutable value.
- Token
Kind
Traits§
- Access
- The
Access
trait, meant to be used as a trait object, provides methods that dynamically expose read&write access to the underlying objects. - Deser
- Reflect
Direct - The direct Reflect allows direct climber or reflector access, and meant to be used as a trait object for that purpose.
- Reflect
Indirect - The indirect Reflect allows indirect climber or reflector access, and meant to be used as a trait object for that purpose.
Functions§
- deser_
assign - A helper for the specific implementations of
Access
to use withmut_assign
methods
Type Aliases§
Derive Macros§
- Interact
- Attributes that Interact derive macro supports