Raxol.Terminal.Emulator.Adapter (Raxol v2.0.1)
View SourceAdapter module to make EmulatorLite compatible with existing code that expects the full Emulator struct.
This module provides conversion functions and compatibility shims.
Summary
Functions
Ensures we have an Emulator struct, converting from EmulatorLite if needed.
Ensures we have an EmulatorLite struct, converting from Emulator if needed.
Converts an EmulatorLite to an Emulator struct for compatibility.
Checks if an emulator is the lite version (no GenServers).
Converts a full Emulator to EmulatorLite, discarding GenServer references.
Functions
@spec ensure_emulator(Raxol.Terminal.Emulator.t() | Raxol.Terminal.EmulatorLite.t()) :: Raxol.Terminal.Emulator.t()
Ensures we have an Emulator struct, converting from EmulatorLite if needed.
This is a compatibility function for code that expects Emulator structs.
@spec ensure_lite(Raxol.Terminal.Emulator.t() | Raxol.Terminal.EmulatorLite.t()) :: Raxol.Terminal.EmulatorLite.t()
Ensures we have an EmulatorLite struct, converting from Emulator if needed.
This is useful for performance-critical paths that don't need GenServers.
@spec from_lite(Raxol.Terminal.EmulatorLite.t()) :: Raxol.Terminal.Emulator.t()
Converts an EmulatorLite to an Emulator struct for compatibility.
Note: This creates a "hollow" Emulator with nil PIDs for GenServers. It's suitable for parsing and buffer operations but not for full terminal emulation with concurrent state management.
@spec lite?(Raxol.Terminal.Emulator.t() | Raxol.Terminal.EmulatorLite.t()) :: boolean()
Checks if an emulator is the lite version (no GenServers).
@spec to_lite(Raxol.Terminal.Emulator.t()) :: Raxol.Terminal.EmulatorLite.t()
Converts a full Emulator to EmulatorLite, discarding GenServer references.
This is useful for extracting just the state without the process overhead.