Skip to content

Commit 07b1020

Browse files
committed
fix: update comments in builder and registry for clarity on type handling
1 parent 2aa6519 commit 07b1020

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

aimdb-websocket-connector/src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ impl WebSocketConnectorBuilder {
240240
/// Register a [`Streamable`] type for WebSocket schema resolution.
241241
///
242242
/// Each call monomorphizes closures that capture `T` for serialization,
243-
/// deserialization, and routing. The concrete type is baked into the closure
244-
/// at compile time — no `Box<dyn Any>` or downcast is needed at dispatch.
243+
/// deserialization, and routing. The serializer performs a `downcast_ref`
244+
/// on `&dyn Any` to recover the concrete type at dispatch.
245245
///
246246
/// # Example
247247
///

aimdb-websocket-connector/src/registry.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//!
33
//! Built incrementally via [`StreamableRegistry::register::<T>()`] at
44
//! connector construction time. Each entry stores monomorphized closures
5-
//! that capture the concrete type `T` — no `Box<dyn Any>` or runtime
6-
//! downcast needed.
5+
//! that capture the concrete type `T` — runtime downcasts are limited to
6+
//! a `TypeId`-guarded path inside the serializer closure.
77
88
use std::any::TypeId;
99
use std::collections::HashMap;
@@ -24,8 +24,8 @@ type DeserializeFn =
2424
/// Type-erased operations for a single [`Streamable`] type.
2525
///
2626
/// Each field is a monomorphized closure that captures `T` at compile time
27-
/// through generic instantiation. The concrete type is baked in — no
28-
/// enum dispatch or trait object downcast is needed on the hot path.
27+
/// through generic instantiation. The serializer performs a `downcast_ref`
28+
/// on `&dyn Any` to recover the concrete type.
2929
#[allow(dead_code)]
3030
pub(crate) struct StreamableOps {
3131
/// The `TypeId` of the concrete type.

0 commit comments

Comments
 (0)