File tree Expand file tree Collapse file tree
aimdb-websocket-connector/src Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ///
Original file line number Diff line number Diff line change 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
88use std:: any:: TypeId ;
99use 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) ]
3030pub ( crate ) struct StreamableOps {
3131 /// The `TypeId` of the concrete type.
You can’t perform that action at this time.
0 commit comments