Crate interact

Source
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§

access
climber
deser
root

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 of Access not via the #[derive(Interact)].
ImmutAccess
ImmutAccess adds function call information over Reflect.
MutAccess
MutAccess adds function call information over ReflectMut.
NodeTree
NodeTree represent a reflection of an Interact type that implemented the Access trait. It may be a partial reflection due to limits and indirections (see Reflector).
Reflector
Reflector operates on types implementing Access. 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 (see ReflectIndirect).
Root
A temporary binder of RootSend and RootLocal dictionaries, used for providing a unified dictionary to the user.
RootLocal
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 an Rc.
RootSend
Holds a root dictionary of Send-able trait objects that implement Access and are therefore Interact-able. These are most likely objects that are held globally behind an Arc.
Token
Represents a single meaningful substring part in an Interact string expression.
TokenVec
Wrapper for the traversal of a borrowed list of tokens.

Enums§

AssignError
CallError
ClimbError
NextOptions
NodeInfo
Reflect
An arbitrar between the two possible way to climb into an immutable value.
ReflectMut
An arbitrar between the two possible way to climb into a mutable value.
TokenKind

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
ReflectDirect
The direct Reflect allows direct climber or reflector access, and meant to be used as a trait object for that purpose.
ReflectIndirect
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 with mut_assign methods

Type Aliases§

RetValCallback

Derive Macros§

Interact
Attributes that Interact derive macro supports