Skip to content

with_preamble method silently drops previously-set callback handlers #32

@coderabbitai

Description

@coderabbitai

Problem

The with_preamble method currently resets callback handlers to None when called, which can surprise users who have already registered success/failure callbacks.

Location

Lines 90-92 in src/server.rs

Current Behaviour

When a user calls with_preamble after setting callback handlers via on_preamble_decode_success or on_preamble_decode_failure, the previously-set handlers are silently dropped and reset to None.

Suggested Solutions

Either:

  1. Document the required call order prominently in the API documentation
  2. Carry the existing Arc<...> callback values across to the new instance to preserve user-set handlers

Context

This issue affects the user experience of the preamble callback API and could lead to unexpected behaviour where callbacks appear to be ignored.

References

Reported by: @leynos

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions