Skip to main content

Module streaming_convert

Module streaming_convert 

Source
Available on crate feature streaming only.
Expand description

Adapters from Lightstreamer ItemUpdate to presentation-layer DTOs Adapters from a Lightstreamer update to the presentation-layer DTOs.

The presentation DTOs stay transport-agnostic: they expose pure from_fields(..) constructors that take plain field maps. This module is the only place that depends on lightstreamer_rs; it reads an ItemUpdate and feeds the extracted metadata / field maps into those pure constructors.

§The seam

ItemUpdate is the streaming crate’s own type: it borrows from the subscription schema, has no public constructor, and models a field value as FieldValue rather than a string. StreamingUpdate is this crate’s owned, constructible mirror of it, and every conversion below goes through it. That keeps the DTO parsers testable without a live session, and keeps the null-versus-empty distinction explicit at exactly one place: FieldValue::Null becomes None, FieldValue::Text(s) becomes Some(s) — including Some("") for a field the server deliberately sent empty.

Both a Result-returning function (for callers that want to observe parse failures) and the From conversions (which degrade to a default on failure, preserving the previous streaming behaviour) are provided per type.

Structs§

StreamingUpdate
One Lightstreamer item update, owned and free of borrowed schema state.

Functions§

account_data_from_item_update
Converts a streaming update into an AccountData.
chart_data_from_item_update
Converts a streaming update into a ChartData.
market_data_from_item_update
Converts a streaming update into a PresentationMarketData.
price_data_from_item_update
Converts a streaming update into a PriceData.
trade_data_from_item_update
Converts a streaming update into a TradeData.