Raxol.Terminal.Output.Manager (Raxol v2.0.1)
View SourceManages terminal output buffering, event processing, styling, and formatting. This module handles output events, applies styles and formatting rules, and tracks metrics.
Summary
Functions
Adds a custom formatting rule. Returns the updated manager.
Adds a custom style to the style map. Returns the updated manager.
Flushes the output buffer. Returns the updated manager with an empty buffer.
Gets the current metrics.
Creates a new output manager instance.
Processes a batch of output events. Returns {:ok, updated_manager} or {:error, :invalid_event}.
Processes a single output event. Returns {:ok, updated_manager} or {:error, :invalid_event}.
Types
@type buffer() :: %{events: [event()], max_size: non_neg_integer()}
@type metrics() :: %{ processed_events: non_neg_integer(), batch_count: non_neg_integer(), format_applications: non_neg_integer(), style_applications: non_neg_integer() }
@type t() :: %Raxol.Terminal.Output.Manager{ batch_size: pos_integer(), buffer: buffer(), format_rules: [format_rule()], metrics: metrics(), style_map: %{required(String.t()) => style()} }
Functions
@spec add_format_rule(t(), format_rule()) :: t()
Adds a custom formatting rule. Returns the updated manager.
Adds a custom style to the style map. Returns the updated manager.
Flushes the output buffer. Returns the updated manager with an empty buffer.
Gets the current metrics.
Creates a new output manager instance.
Processes a batch of output events. Returns {:ok, updated_manager} or {:error, :invalid_event}.
Processes a single output event. Returns {:ok, updated_manager} or {:error, :invalid_event}.