messages: sort module — promote user-facing types; hide wire internals (#577)
* messages: sort module — promote user-facing types to crate root; hide wire internals
pub mod messages → pub(crate) mod messages (src/lib.rs:110).
User-facing types re-exported from crate root (added via doc(inline)):
- Notice, NoticeCategory
- IncomingMessages, OutgoingMessages, ResponseMessage
- WARNING_CODE_RANGE, SYSTEM_MESSAGE_CODES,
ORDER_REJECTION_CODE_RANGE, ORDER_CANCELLED_CODE
Notice + NoticeCategory added to the prelude.
ResponseMessage stays pub: forced by StartupMessage::Other(ResponseMessage)
in src/connection/common.rs:40. Future PR can re-shape that variant
payload to retire the leak.
Wire internals demoted to pub(crate): RequestMessage, PROTOBUF_MSG_ID,
encode_length, encode_protobuf_message, encode_raw_length, order_id_index,
request_id_index. RequestMessage::{encode,encode_simple,from,from_simple}
narrowed to pub(crate) and given an impl-block #[allow(dead_code)] (cross-
feature dead-code; matches the existing pattern on encode_simple.
Narrowing surfaced dead code:
- encode_request_binary_from_text — deleted (no callers).
parser_registry reachable via #[doc(hidden)] pub use crate::messages::parser_registry
at the crate root for examples/record_interactions.rs (updated to new paths).
Doc-comment cleanup:
- Notice + NoticeCategory examples now use ibapi::{Notice, NoticeCategory}.
- ResponseMessage::request_id rustdoc link to private request_id_index
removed; description kept inline.
Migration guide §17 added.
PR 3 of plans/hide-internal-types.md.
EOF
)
* messages: /simplify fixups — cfg-gate RequestMessage helpers; split re-exports
(a) impl RequestMessage block: replaced #[allow(dead_code)] with
#[cfg(all(test, feature = "sync"))]. All four helpers (encode,
encode_simple, from, from_simple) have their only callers in
src/transport/sync/tests.rs — the cfg is more honest than blanket
dead_code, and matches the per-fn / per-block convention used
elsewhere in the crate.
(b) src/lib.rs: split the bulk messages re-export into two
#[doc(inline)] pub use blocks — types first, code-range constants
second. Communicates intent without fighting rustfmt brace-group
sort, and matches the section-banner style used in prelude.rs. W
Wil Boayue committed
e1c0135d5b7c6cab034e4dfbf352ffd6f92a2124
Parent: 0413f1c
Committed by GitHub <noreply@github.com>
on 5/17/2026, 7:08:51 PM