Raxol.Terminal.Session.Serializer (Raxol v2.0.1)

View Source

Handles serialization and deserialization of terminal session state.

Refactored version with pure functional error handling patterns. All try/catch blocks have been replaced with with statements and proper error tuples.

Summary

Functions

Deserializes a session state from a map.

Serializes a session state to a map that can be stored and later restored.

Serializes a session state to a map, returning the map directly for backward compatibility. Falls back to empty session data on error.

Functions

deserialize(invalid_data)

@spec deserialize(map()) :: {:ok, Raxol.Terminal.Session.t()} | {:error, term()}

Deserializes a session state from a map.

serialize(session)

@spec serialize(Raxol.Terminal.Session.t()) :: {:ok, map()} | {:error, term()}

Serializes a session state to a map that can be stored and later restored.

serialize!(session)

@spec serialize!(Raxol.Terminal.Session.t()) :: map()

Serializes a session state to a map, returning the map directly for backward compatibility. Falls back to empty session data on error.