pub struct FieldSchema { /* private fields */ }Expand description
Which fields a subscription asks for.
The mirror of ItemGroup on the field side: LS_schema is one string
the Metadata Adapter resolves, either a schema name it knows or a
space-separated list of field names [docs/spec/03-requests.md §6.1].
The order matters: it is the order in which values arrive in every update, and the order the field indices of an update refer to.
§Examples
use lightstreamer_rs::FieldSchema;
let schema = FieldSchema::from_fields(["last_price", "time", "pct_change"])?;
assert_eq!(schema.as_str(), "last_price time pct_change");Implementations§
Source§impl FieldSchema
impl FieldSchema
Sourcepub fn try_new(schema: impl Into<String>) -> Result<Self, ConfigError>
pub fn try_new(schema: impl Into<String>) -> Result<Self, ConfigError>
Wraps a schema name the server’s Metadata Adapter will resolve.
§Errors
ConfigError::EmptyFieldSchemaif the name is empty or only whitespace.ConfigError::FieldSchemaControlCharacterif it contains an ASCII control character.
Sourcepub fn from_fields<I, S>(fields: I) -> Result<Self, ConfigError>
pub fn from_fields<I, S>(fields: I) -> Result<Self, ConfigError>
Builds the space-separated list convention from individual field names.
§Errors
ConfigError::EmptyFieldSchemaif the iterator is empty.ConfigError::FieldNameHasWhitespaceif any name contains whitespace.ConfigError::FieldSchemaControlCharacterif any name contains an ASCII control character.
Sourcepub fn names(&self) -> Vec<&str>
pub fn names(&self) -> Vec<&str>
The field names, when the caller spelled them out.
Empty for a schema name the server resolves: TLCP announces only how
many fields a subscription has, never what they are called
[docs/spec/04-notifications.md §3.1], so in that case every field is
reported by its 1-based position instead.
Trait Implementations§
Source§impl Clone for FieldSchema
impl Clone for FieldSchema
Source§fn clone(&self) -> FieldSchema
fn clone(&self) -> FieldSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more