Skip to main content

Crate ez_tui

Crate ez_tui 

Source
Expand description

ez-tui is a library for building terminal user interfaces (TUIs) in Rust written by a beginner for his own needs.

You probably should not use this

Structs§

AppArguments
Wraps the library and your business logic command line arguments.
AppStateCpt
A component to display the application state at runtime
Application
Application is the struct that will hold all the parts of your TUI application.
BorderTheme
Wraps all the defining attributes of a border
CheckboxInputCpt
A component drawing a FormField of type FormFieldType::CheckBox.
CommonArg
Holds the command line arguments to change this lib behavior.
CustomLayout
A layout wrapper that makes it easy to create nested layouts.
DateTimeInputCpt
A component drawing a FormField of type FormFieldType::DateTime, FormFieldType::Date, or FormFieldType::Time.
DebugWidgetMock
A mock component display some value at runtime
FieldResult
A type wrapping a form field and its value.
Form
Describes a whole form, which can contain multiple fields and sub-forms. As a form has a fixed layout direction, sub forms can be used to change the direction.
FormCpt
A component responsible for rendering a form.
FormField
Describe one field inside a form.
FormResult
A type wrapping all the FieldResults of a form into a Vec.
GlobalHotKeys
A struct representing global hotkeys for the application.
HotKey
A struct representing a hotkey combination.
IndicatorMock
A mock component to display a colored indicator inside the TUI. The indicator is a simple box alternating its style from a given set of Style when Self::cycle is called.
InputBuilder
A builder for creating input components based on a given form field. TODO: bad design
Legend
A struct representing a legend for hotkeys
LegendMock
A mock component to display a colored indicator inside the TUI. The indicator is a simple box alternating its style from a given set of Style when [Self::cycle] is called.
Legends
A component to display a colored indicator alternating colors based on the frame rate of the terminal.
LogSwitcher
A struct to allow togling on or off the stdout logging so we have it during args parsing and app exit but not during TUI execution.
LogsMock
A generic mock component to display logs inside the TUI
LogsViewer
An implementation of Component for the LogsMock component. This component initializes tui_logger and so it should be instantiated only once.
Matcher
A struct associating some HotKeys with an action
MouseEventClause
Struct to be more specific on the mouse event clause. Allow checking the range of the event and any modifiers.
NoClientArgs
Dummy struct to use when you don’t need any client arguments.
NoClientCptId
A dummy type to be used when you don’t have any component ids
NoClientError
Dummy type to use if your application does not handle any specific errors.
NoClientMsg
A dummy type to be used when you don’t have any messages
NoClientShipId
A dummy type to be used when you don’t have any ship ids
NoClientState
A dummy type to be used when you don’t have any state
NumberInputCpt
A component drawing a FormField of type FormFieldType::Number.
Port
The port is the struct that holds all your ships. Like the [View], you’ll only have one port in your app but as many ships as you want. Again like the [View], the port is the orchestrator of your ships. It will send the forward to/from the ships and your app.
Props
RangeInputCpt
A component drawing a FormField of type FormFieldType::Range.
Receiver
A wrapper around mpsc::UnboundedReceiver to work explicitly with this crates Error and Result
RenderIndicatorCpt
A component to display a colored indicator alternating colors based on the frame rate of the terminal.
SelectInputCpt
A component drawing a FormField of type FormFieldType::Select.
Sender
A wrapper around mpsc::UnboundedSender to work explicitly with this crates Error and Result
State
The state of the application. It includes some generic state needed by the library as well as your sustom state if you have some;
Subscription
A subscription describe if a target should be forwarded an event and under which conditions. The target is described by a SubId so it can be either a [Component] or a [Ship]. The event is forwarded only if
TextInputCpt
A component drawing a FormField of type FormFieldType::Text or FormFieldType::Password.
Theme
Holds some commonly used style across your application
TickIndicatorCpt
A component to display a colored indicator alternating colors based on the tick rate of the terminal.
View
The view is the struct that holds all your components. You’ll only have one view in your app but as many components as you want. Those components will be orchestrated by the view. This includes handling their layout, the focused one and forward event to them if needed.

Enums§

AttrValue
Attribute
DateTimeConfig
The type of date and time configuration for a form field.
Error
Error type for the library
EventClause
EventClause can be seen as categories of events. When you want a target to listen for events, you don’t subscribe to this event explicitly but to its category.
EzCptId
Wrapper around the client’s component ids enum
EzEvent
All the events that can be sent across the application. Your custom events will be wrapped inside EzEvent::Client.
EzShipId
Wrapper around the client’s ship ids enum. Useless for now.
FormFieldType
All the possible form field type with their configs if needed.
FormFieldValue
All possible values types for a form field.
FormNode
A form node is either a field or whole sub-form.
IoContext
Some context associated with any IO error that may occur.
LayoutItem
An item of a layout. It can be either a nested CustomLayout or a component id.
PortError
The errors that could happen when using the Port
SubClause
SubClause defines unde what conditions the event should be forwarded to the target based on its state.
SubId
Every subscription target is either for a [Component] or a [Ship]. We wrap the id of that target inside this enum to know if it refers to a component or a ship.
ViewError
The errors that could happen when using the View

Traits§

Component
A type to describe a concrete component. In your app, every component should have it’s own struct implementing this trait.
EzArgs
Trait to be defined on your client’s clap arguments enum.
EzCptIds
Trait to be defined on your client’s component idq enum.
EzMsg
Trait to be defined on your client’s messages enum
EzShipIds
Trait to be defined on your client’s ship ids enum.
EzState
Trait to be defined on your client’s state
FocusChain
A trait to define to describe a chain of focusable items.
InputCpt
A trait to be implemented by all input components in the form system.
MockComponent
A type to describe a “reusable” component.
MockProps
Similar to MockComponent, but for the component’s attributes.
Ship
A ship is a struct that can be subscribed to some events; execute some - probably async - code; and emit events. It is used if your app is dependent on some api calls, or other IO operations, they’ll certainly have to be done done via a Ship.

Type Aliases§

BoxedComponent
A type alias for a Component inside a Box.
BoxedShip
A type alias for a Ship inside a Box.
Result
A std::result::Result wrapper using this crate’s Error as the error type.