Trait opcua_types::encoding::BinaryEncoder
source · [−]pub trait BinaryEncoder<T> {
fn byte_len(&self) -> usize;
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>;
fn decode<S: Read>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> EncodingResult<T>;
fn encode_to_vec(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
{ ... }
}
Expand description
OPC UA Binary Encoding interface. Anything that encodes to binary must implement this. It provides functions to calculate the size in bytes of the struct (for allocating memory), encoding to a stream and decoding from a stream.
Required methods
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.
Encodes the instance to the write stream.
fn decode<S: Read>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> EncodingResult<T>
fn decode<S: Read>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> EncodingResult<T>
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.
Provided methods
Implementations on Foreign Types
sourceimpl BinaryEncoder<bool> for bool
impl BinaryEncoder<bool> for bool
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<i8> for i8
impl BinaryEncoder<i8> for i8
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<u8> for u8
impl BinaryEncoder<u8> for u8
An unsigned byt integer value between 0 and 255.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<i16> for i16
impl BinaryEncoder<i16> for i16
A signed integer value between −32768 and 32767.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<u16> for u16
impl BinaryEncoder<u16> for u16
An unsigned integer value between 0 and 65535.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<i32> for i32
impl BinaryEncoder<i32> for i32
A signed integer value between −2147483648 and 2147483647.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<u32> for u32
impl BinaryEncoder<u32> for u32
An unsigned integer value between 0 and 4294967295.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<i64> for i64
impl BinaryEncoder<i64> for i64
A signed integer value between −9223372036854775808 and 9223372036854775807.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<u64> for u64
impl BinaryEncoder<u64> for u64
An unsigned integer value between 0 and 18446744073709551615.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<f32> for f32
impl BinaryEncoder<f32> for f32
An IEEE single precision (32 bit) floating point value.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
sourceimpl BinaryEncoder<f64> for f64
impl BinaryEncoder<f64> for f64
An IEEE double precision (64 bit) floating point value.
fn byte_len(&self) -> usize
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn decode<S: Read>(stream: &mut S, _: &DecodingOptions) -> EncodingResult<Self>
Implementors
impl BinaryEncoder<ApplicationType> for ApplicationType
impl BinaryEncoder<AxisScaleEnumeration> for AxisScaleEnumeration
impl BinaryEncoder<BrokerTransportQualityOfService> for BrokerTransportQualityOfService
impl BinaryEncoder<BrowseDirection> for BrowseDirection
impl BinaryEncoder<BrowseResultMask> for BrowseResultMask
impl BinaryEncoder<DataChangeTrigger> for DataChangeTrigger
impl BinaryEncoder<DataSetOrderingType> for DataSetOrderingType
impl BinaryEncoder<DeadbandType> for DeadbandType
impl BinaryEncoder<DiagnosticsLevel> for DiagnosticsLevel
impl BinaryEncoder<ExceptionDeviationFormat> for ExceptionDeviationFormat
impl BinaryEncoder<FilterOperator> for FilterOperator
impl BinaryEncoder<HistoryUpdateType> for HistoryUpdateType
impl BinaryEncoder<IdType> for IdType
impl BinaryEncoder<IdentityCriteriaType> for IdentityCriteriaType
impl BinaryEncoder<MessageSecurityMode> for MessageSecurityMode
impl BinaryEncoder<ModelChangeStructureVerbMask> for ModelChangeStructureVerbMask
impl BinaryEncoder<MonitoringMode> for MonitoringMode
impl BinaryEncoder<NamingRuleType> for NamingRuleType
impl BinaryEncoder<NodeAttributesMask> for NodeAttributesMask
impl BinaryEncoder<NodeClass> for NodeClass
impl BinaryEncoder<NodeIdType> for NodeIdType
impl BinaryEncoder<OpenFileMode> for OpenFileMode
impl BinaryEncoder<OverrideValueHandling> for OverrideValueHandling
impl BinaryEncoder<PerformUpdateType> for PerformUpdateType
impl BinaryEncoder<PubSubDiagnosticsCounterClassification> for PubSubDiagnosticsCounterClassification
impl BinaryEncoder<PubSubState> for PubSubState
impl BinaryEncoder<RedundancySupport> for RedundancySupport
impl BinaryEncoder<SecurityTokenRequestType> for SecurityTokenRequestType
impl BinaryEncoder<ServerState> for ServerState
impl BinaryEncoder<StructureType> for StructureType
impl BinaryEncoder<TimestampsToReturn> for TimestampsToReturn
impl BinaryEncoder<TrustListMasks> for TrustListMasks
impl BinaryEncoder<UserTokenType> for UserTokenType
impl BinaryEncoder<Variant> for Variant
impl BinaryEncoder<Argument> for opcua_types::argument::Argument
impl BinaryEncoder<ByteString> for ByteString
impl BinaryEncoder<DataValue> for DataValue
impl BinaryEncoder<DateTime> for DateTime
DateTime encoded as 64-bit signed int