Skip to content

fix(#171): resolve is_open from a type-state trait, not type_name#320

Open
LeJamon wants to merge 1 commit into
XRPLF:mainfrom
LeJamon:fix/issue-171
Open

fix(#171): resolve is_open from a type-state trait, not type_name#320
LeJamon wants to merge 1 commit into
XRPLF:mainfrom
LeJamon:fix/issue-171

Conversation

@LeJamon

@LeJamon LeJamon commented May 30, 2026

Copy link
Copy Markdown

Closes #171.

is_open() compared core::any::type_name::<Status>() against a hardcoded string. type_name is explicitly documented as unstable across compiler releases, making the connection-state check fragile.

Introduces a sealed ConnectionStatus trait with a const IS_OPEN, implemented for WebSocketOpen/WebSocketClosed; is_open() returns Status::IS_OPEN, resolved at compile time.

Testing

  • cargo test --lib — added connection_status_is_open_resolves_from_type_state
  • cargo fmt --check; no_std feature set green

is_open compared core::any::type_name strings, which are explicitly not
stable across compiler releases. Introduce a sealed ConnectionStatus trait
with a const IS_OPEN implemented for WebSocketOpen/WebSocketClosed and have
is_open return Status::IS_OPEN, resolved at compile time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

is_open() uses core::any::type_name equality

1 participant