opcua_types/service_types/
relative_path.rs

1// OPCUA for Rust
2// SPDX-License-Identifier: MPL-2.0
3// Copyright (C) 2017-2022 Adam Lock
4//
5// This file was autogenerated from Opc.Ua.Types.bsd by tools/schema/gen_types.js
6//
7// DO NOT EDIT THIS FILE
8#![allow(unused_attributes)]
9use std::io::{Read, Write};
10#[allow(unused_imports)]
11use crate::{
12    encoding::*,
13    basic_types::*,
14    service_types::impls::MessageInfo,
15    node_ids::ObjectId,
16    service_types::RelativePathElement,
17};
18
19#[derive(Debug, Clone, PartialEq)]
20pub struct RelativePath {
21    pub elements: Option<Vec<RelativePathElement>>,
22}
23
24impl MessageInfo for RelativePath {
25    fn object_id(&self) -> ObjectId {
26        ObjectId::RelativePath_Encoding_DefaultBinary
27    }
28}
29
30impl BinaryEncoder<RelativePath> for RelativePath {
31    fn byte_len(&self) -> usize {
32        let mut size = 0;
33        size += byte_len_array(&self.elements);
34        size
35    }
36
37    #[allow(unused_variables)]
38    fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize> {
39        let mut size = 0;
40        size += write_array(stream, &self.elements)?;
41        Ok(size)
42    }
43
44    #[allow(unused_variables)]
45    fn decode<S: Read>(stream: &mut S, decoding_options: &DecodingOptions) -> EncodingResult<Self> {
46        let elements: Option<Vec<RelativePathElement>> = read_array(stream, decoding_options)?;
47        Ok(RelativePath {
48            elements,
49        })
50    }
51}