Struct opcua_core::prelude::DataValue
source · [−]pub struct DataValue {
pub value: Option<Variant>,
pub status: Option<StatusCode>,
pub source_timestamp: Option<DateTime>,
pub source_picoseconds: Option<i16>,
pub server_timestamp: Option<DateTime>,
pub server_picoseconds: Option<i16>,
}
Expand description
A data value is a value of a variable in the OPC UA server and contains information about its value, status and change timestamps.
Fields
value: Option<Variant>
The value. BaseDataType Not present if the Value bit in the EncodingMask is False.
status: Option<StatusCode>
The status associated with the value. Not present if the StatusCode bit in the EncodingMask is False
source_timestamp: Option<DateTime>
The source timestamp associated with the value. Not present if the SourceTimestamp bit in the EncodingMask is False.
source_picoseconds: Option<i16>
The number of 10 picosecond intervals for the SourceTimestamp. Not present if the SourcePicoSeconds bit in the EncodingMask is False. If the source timestamp is missing the picoseconds are ignored.
server_timestamp: Option<DateTime>
The Server timestamp associated with the value. Not present if the ServerTimestamp bit in the EncodingMask is False.
server_picoseconds: Option<i16>
The number of 10 picosecond intervals for the ServerTimestamp. Not present if the ServerPicoSeconds bit in the EncodingMask is False. If the Server timestamp is missing the picoseconds are ignored.
Implementations
sourceimpl DataValue
impl DataValue
sourcepub fn value_only<V>(value: V) -> DataValue where
V: Into<Variant>,
pub fn value_only<V>(value: V) -> DataValue where
V: Into<Variant>,
Creates a DataValue
from the supplied value with nothing else.
sourcepub fn new_now<V>(value: V) -> DataValue where
V: Into<Variant>,
pub fn new_now<V>(value: V) -> DataValue where
V: Into<Variant>,
Creates a DataValue
from the supplied value AND a timestamp for now. If you are passing a value to the Attribute::Write service
on a server from a server, you may consider this from the specification:
If the SourceTimestamp or the ServerTimestamp is specified, the Server shall use these values. The Server returns a Bad_WriteNotSupported error if it does not support writing of timestamps
In which case, use the value_only()
constructor, or make explicit which fields you pass.
sourcepub fn set_value<V>(
&mut self,
value: V,
source_timestamp: &DateTime,
server_timestamp: &DateTime
) where
V: Into<Variant>,
pub fn set_value<V>(
&mut self,
value: V,
source_timestamp: &DateTime,
server_timestamp: &DateTime
) where
V: Into<Variant>,
Sets the value of the data value, updating the timestamps at the same point
sourcepub fn set_timestamps(
&mut self,
timestamps_to_return: TimestampsToReturn,
source_timestamp: DateTime,
server_timestamp: DateTime
)
pub fn set_timestamps(
&mut self,
timestamps_to_return: TimestampsToReturn,
source_timestamp: DateTime,
server_timestamp: DateTime
)
Sets the timestamps of the data value based on supplied timestamps to return
sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Returns the status code or Good if there is no code on the value
Trait Implementations
sourceimpl BinaryEncoder<DataValue> for DataValue
impl BinaryEncoder<DataValue> for DataValue
sourcefn byte_len(&self) -> usize
fn byte_len(&self) -> usize
Returns the exact byte length of the structure as it would be if encode
were called.
This may be called prior to writing to ensure the correct amount of space is available. Read more
sourcefn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode> where
S: Write,
fn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode> where
S: Write,
Encodes the instance to the write stream.
sourcefn decode<S>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> Result<DataValue, StatusCode> where
S: Read,
fn decode<S>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> Result<DataValue, StatusCode> where
S: Read,
Decodes an instance from the read stream. The decoding options contains restrictions set by
the server / client on the length of strings, arrays etc. If these limits are exceeded the
implementation should return with a BadDecodingError
as soon as possible. Read more
fn encode_to_vec(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
sourceimpl<'de> Deserialize<'de> for DataValue
impl<'de> Deserialize<'de> for DataValue
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<DataValue, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<DataValue, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<ByteString> for DataValue
impl From<ByteString> for DataValue
sourcefn from(v: ByteString) -> DataValue
fn from(v: ByteString) -> DataValue
Converts to this type from the input type.
sourceimpl From<LocalizedText> for DataValue
impl From<LocalizedText> for DataValue
sourcefn from(v: LocalizedText) -> DataValue
fn from(v: LocalizedText) -> DataValue
Converts to this type from the input type.
sourceimpl From<QualifiedName> for DataValue
impl From<QualifiedName> for DataValue
sourcefn from(v: QualifiedName) -> DataValue
fn from(v: QualifiedName) -> DataValue
Converts to this type from the input type.
sourceimpl From<StatusCode> for DataValue
impl From<StatusCode> for DataValue
sourcefn from(v: StatusCode) -> DataValue
fn from(v: StatusCode) -> DataValue
Converts to this type from the input type.
sourceimpl Serialize for DataValue
impl Serialize for DataValue
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DataValue
Auto Trait Implementations
impl RefUnwindSafe for DataValue
impl Send for DataValue
impl Sync for DataValue
impl Unpin for DataValue
impl UnwindSafe for DataValue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more