pub trait BinaryEncoder<T> {
// Required methods
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>;
// Provided method
fn encode_to_vec(&self) -> Vec<u8> ⓘ { ... }
}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§
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.
Sourcefn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize>
Encodes the instance to the write stream.
Sourcefn 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§
fn encode_to_vec(&self) -> Vec<u8> ⓘ
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl BinaryEncoder<bool> for bool
impl BinaryEncoder<bool> for bool
Source§impl BinaryEncoder<f32> for f32
An IEEE single precision (32 bit) floating point value.
impl BinaryEncoder<f32> for f32
An IEEE single precision (32 bit) floating point value.
Source§impl BinaryEncoder<f64> for f64
An IEEE double precision (64 bit) floating point value.
impl BinaryEncoder<f64> for f64
An IEEE double precision (64 bit) floating point value.
Source§impl BinaryEncoder<i8> for i8
impl BinaryEncoder<i8> for i8
Source§impl BinaryEncoder<i16> for i16
A signed integer value between −32768 and 32767.
impl BinaryEncoder<i16> for i16
A signed integer value between −32768 and 32767.
Source§impl BinaryEncoder<i32> for i32
A signed integer value between −2147483648 and 2147483647.
impl BinaryEncoder<i32> for i32
A signed integer value between −2147483648 and 2147483647.
Source§impl BinaryEncoder<i64> for i64
A signed integer value between −9223372036854775808 and 9223372036854775807.
impl BinaryEncoder<i64> for i64
A signed integer value between −9223372036854775808 and 9223372036854775807.
Source§impl BinaryEncoder<u8> for u8
An unsigned byt integer value between 0 and 255.
impl BinaryEncoder<u8> for u8
An unsigned byt integer value between 0 and 255.
Source§impl BinaryEncoder<u16> for u16
An unsigned integer value between 0 and 65535.
impl BinaryEncoder<u16> for u16
An unsigned integer value between 0 and 65535.
Source§impl BinaryEncoder<u32> for u32
An unsigned integer value between 0 and 4294967295.
impl BinaryEncoder<u32> for u32
An unsigned integer value between 0 and 4294967295.
Source§impl BinaryEncoder<u64> for u64
An unsigned integer value between 0 and 18446744073709551615.
impl BinaryEncoder<u64> for u64
An unsigned integer value between 0 and 18446744073709551615.
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