#[non_exhaustive]pub struct FeatureState {
pub value: Value,
pub access_mode: String,
pub kind: String,
pub is_implemented: bool,
pub is_available: bool,
pub numeric: Option<NumericRange>,
pub enum_available: Option<Vec<String>>,
pub unit: Option<String>,
pub polling_ms: Option<u64>,
pub caching: Option<String>,
}Expand description
Live state of a GenICam feature at a single point in time.
Replaces NodeValueUpdate as the authoritative snapshot consumed by the
UI. Every field reflects what the device reports now, not what the XML
declares statically.
§Design notes
kindis a plain string matchingviva_genapi::Node::kind_namevalues (“Integer”, “Float”, “Enumeration”, “Boolean”, “Command”, “Category”, “SwissKnife”, “Converter”, “IntConverter”, “StringReg”, “Register”). Clients should tolerate unknown kinds.access_modeuses GenICam spelling:"RO","RW","WO","NA".is_implementedandis_availabledefault totruefor deserialization from services that do not evaluate these predicates yet.numericisSomeonly for Integer/Float nodes with a resolvable range.enum_availableisSomeonly for Enumeration nodes. When the service cannot filter by IsAvailable it SHOULD still populate this with the full entry list so the UI stops falling back to static XML.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.value: ValueCurrent feature value, typed according to kind.
null when the feature has no value to read: a Category, a Command, a
node declared WO, or the register a command writes through. Such a
feature is still reported, with its access mode, so a client can offer
the write or the execute without a value to show.
access_mode: StringLive access mode.
kind: StringGenICam node kind.
is_implemented: boolWhether the node is implemented by the device.
is_available: boolWhether the node is currently accessible (selector gating etc).
numeric: Option<NumericRange>Range for Integer/Float nodes, when resolvable.
enum_available: Option<Vec<String>>Available enum entries for Enumeration nodes.
unit: Option<String>Engineering unit copied from node metadata (e.g. "us").
polling_ms: Option<u64>How long, in milliseconds, the value may be shown before it is read
again: the <PollingTime> of the feature or of a register its value
is read through. Absent when nothing polls it.
caching: Option<String>The feature’s caching mode in GenICam spelling — "NoCache",
"WriteThrough", "WriteAround" — its own combined with that of the
registers it is read through. A NoCache feature changes on the
device with nothing to announce it. Absent from services that predate
it.
Implementations§
Source§impl FeatureState
impl FeatureState
Sourcepub fn new(
value: Value,
access_mode: impl Into<String>,
kind: impl Into<String>,
) -> Self
pub fn new( value: Value, access_mode: impl Into<String>, kind: impl Into<String>, ) -> Self
An implemented, available feature with a value, an access mode and a kind, and no range, entries or unit.
Sourcepub fn to_node_value_update(&self) -> NodeValueUpdate
pub fn to_node_value_update(&self) -> NodeValueUpdate
Project this state into the legacy NodeValueUpdate shape so callers
that still speak the old contract keep working during migration.
Trait Implementations§
Source§impl Clone for FeatureState
impl Clone for FeatureState
Source§impl Debug for FeatureState
impl Debug for FeatureState
Source§impl<'de> Deserialize<'de> for FeatureState
impl<'de> Deserialize<'de> for FeatureState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&FeatureState> for NodeValueUpdate
impl From<&FeatureState> for NodeValueUpdate
Source§fn from(s: &FeatureState) -> Self
fn from(s: &FeatureState) -> Self
Source§impl From<FeatureState> for FeatureState
Available on crate feature genapi only.The wire form of a state read through viva-genapi.
impl From<FeatureState> for FeatureState
genapi only.The wire form of a state read through viva-genapi.
Every service that holds a nodemap builds its FeatureState this way,
so the access-mode spelling, the register summary and the unreadable-value
rules cannot drift between them (backlog ST-26).
Source§fn from(state: FeatureState) -> Self
fn from(state: FeatureState) -> Self
Source§impl PartialEq for FeatureState
impl PartialEq for FeatureState
Source§impl Serialize for FeatureState
impl Serialize for FeatureState
impl StructuralPartialEq for FeatureState
Source§impl TS for FeatureState
impl TS for FeatureState
Source§type WithoutGenerics = FeatureState
type WithoutGenerics = FeatureState
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = FeatureState
type OptionInnerType = FeatureState
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all]. Read more§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export]. Read more