pub trait BinaryEncodable {
// Required methods
fn byte_len(&self, ctx: &Context<'_>) -> usize;
fn encode<S: Write + ?Sized>(
&self,
stream: &mut S,
ctx: &Context<'_>,
) -> EncodingResult<()>;
// Provided methods
fn override_encoding(&self) -> Option<BuiltInDataEncoding> { ... }
fn encode_to_vec(&self, ctx: &Context<'_>) -> 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.
§Implementing
The majority of implementers should just use the derive(BinaryEncodable) macro,
if you need to implement this yourself for some reason, the following must be satisfied:
byte_lenmust return a length exactly equal to whatencodewill write, orencodemust be guaranteed to fail. Sincebyte_lenis infallible, you are allowed to return some invalid value there, then fail later when callingencode. This should be avoided.encodemust usewrite_allon the stream, not justwrite, to ensure that all the data is written, even if the stream is interrupted. Prefer callingencodeon inner types instead.
Required Methods§
Provided Methods§
Sourcefn override_encoding(&self) -> Option<BuiltInDataEncoding>
fn override_encoding(&self) -> Option<BuiltInDataEncoding>
Override the extension object encoding used for this type. This only makes sense if the type can only ever be encoded using a single built-in encoding.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> BinaryEncodable for Option<Vec<T>>where
T: BinaryEncodable,
impl<T> BinaryEncodable for Option<Vec<T>>where
T: BinaryEncodable,
Implementors§
impl BinaryEncodable for ActionMethodDataType
impl BinaryEncodable for ActionState
impl BinaryEncodable for ActionTargetDataType
impl BinaryEncodable for ActivateSessionRequest
impl BinaryEncodable for ActivateSessionResponse
impl BinaryEncodable for AddNodesItem
impl BinaryEncodable for AddNodesRequest
impl BinaryEncodable for AddNodesResponse
impl BinaryEncodable for AddNodesResult
impl BinaryEncodable for AddReferencesItem
impl BinaryEncodable for AddReferencesRequest
impl BinaryEncodable for AddReferencesResponse
impl BinaryEncodable for AdditionalParametersType
impl BinaryEncodable for AggregateConfiguration
impl BinaryEncodable for AggregateFilter
impl BinaryEncodable for AggregateFilterResult
impl BinaryEncodable for AliasNameDataType
impl BinaryEncodable for Annotation
impl BinaryEncodable for AnnotationDataType
impl BinaryEncodable for AnonymousIdentityToken
impl BinaryEncodable for ApplicationDescription
impl BinaryEncodable for ApplicationType
impl BinaryEncodable for Argument
impl BinaryEncodable for AttributeOperand
impl BinaryEncodable for AxisInformation
impl BinaryEncodable for AxisScaleEnumeration
impl BinaryEncodable for BitFieldDefinition
impl BinaryEncodable for BrokerConnectionTransportDataType
impl BinaryEncodable for BrokerDataSetReaderTransportDataType
impl BinaryEncodable for BrokerDataSetWriterTransportDataType
impl BinaryEncodable for BrokerTransportQualityOfService
impl BinaryEncodable for BrokerWriterGroupTransportDataType
impl BinaryEncodable for BrowseDescription
impl BinaryEncodable for BrowseDirection
impl BinaryEncodable for BrowseNextRequest
impl BinaryEncodable for BrowseNextResponse
impl BinaryEncodable for BrowsePath
impl BinaryEncodable for BrowsePathResult
impl BinaryEncodable for BrowsePathTarget
impl BinaryEncodable for BrowseRequest
impl BinaryEncodable for BrowseResponse
impl BinaryEncodable for BrowseResult
impl BinaryEncodable for BrowseResultMask
impl BinaryEncodable for BuildInfo
impl BinaryEncodable for ByteStringBody
impl BinaryEncodable for CallMethodRequest
impl BinaryEncodable for CallMethodResult
impl BinaryEncodable for CallRequest
impl BinaryEncodable for CallResponse
impl BinaryEncodable for CancelRequest
impl BinaryEncodable for CancelResponse
impl BinaryEncodable for ChannelSecurityToken
impl BinaryEncodable for ChassisIdSubtype
impl BinaryEncodable for CloseSecureChannelRequest
impl BinaryEncodable for CloseSecureChannelResponse
impl BinaryEncodable for CloseSessionRequest
impl BinaryEncodable for CloseSessionResponse
impl BinaryEncodable for ComplexNumberType
impl BinaryEncodable for ConfigurationVersionDataType
impl BinaryEncodable for ContentFilter
impl BinaryEncodable for ContentFilterElement
impl BinaryEncodable for ContentFilterElementResult
impl BinaryEncodable for ContentFilterResult
impl BinaryEncodable for ConversionLimitEnum
impl BinaryEncodable for CreateMonitoredItemsRequest
impl BinaryEncodable for CreateMonitoredItemsResponse
impl BinaryEncodable for CreateSessionRequest
impl BinaryEncodable for CreateSessionResponse
impl BinaryEncodable for CreateSubscriptionRequest
impl BinaryEncodable for CreateSubscriptionResponse
impl BinaryEncodable for CurrencyUnitType
impl BinaryEncodable for DataChangeFilter
impl BinaryEncodable for DataChangeNotification
impl BinaryEncodable for DataChangeTrigger
impl BinaryEncodable for DataSetMetaDataType
impl BinaryEncodable for DataSetOrderingType
impl BinaryEncodable for DataSetReaderDataType
impl BinaryEncodable for DataSetWriterDataType
impl BinaryEncodable for DataTypeAttributes
impl BinaryEncodable for DataValue
impl BinaryEncodable for DatagramConnectionTransport2DataType
impl BinaryEncodable for DatagramConnectionTransportDataType
impl BinaryEncodable for DatagramDataSetReaderTransportDataType
impl BinaryEncodable for DatagramWriterGroupTransport2DataType
impl BinaryEncodable for DatagramWriterGroupTransportDataType
impl BinaryEncodable for DateTime
DateTime encoded as 64-bit signed int