opcua_types/service_types/
network_group_data_type.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    string::UAString,
17    service_types::EndpointUrlListDataType,
18};
19
20#[derive(Debug, Clone, PartialEq)]
21pub struct NetworkGroupDataType {
22    pub server_uri: UAString,
23    pub network_paths: Option<Vec<EndpointUrlListDataType>>,
24}
25
26impl MessageInfo for NetworkGroupDataType {
27    fn object_id(&self) -> ObjectId {
28        ObjectId::NetworkGroupDataType_Encoding_DefaultBinary
29    }
30}
31
32impl BinaryEncoder<NetworkGroupDataType> for NetworkGroupDataType {
33    fn byte_len(&self) -> usize {
34        let mut size = 0;
35        size += self.server_uri.byte_len();
36        size += byte_len_array(&self.network_paths);
37        size
38    }
39
40    #[allow(unused_variables)]
41    fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize> {
42        let mut size = 0;
43        size += self.server_uri.encode(stream)?;
44        size += write_array(stream, &self.network_paths)?;
45        Ok(size)
46    }
47
48    #[allow(unused_variables)]
49    fn decode<S: Read>(stream: &mut S, decoding_options: &DecodingOptions) -> EncodingResult<Self> {
50        let server_uri = UAString::decode(stream, decoding_options)?;
51        let network_paths: Option<Vec<EndpointUrlListDataType>> = read_array(stream, decoding_options)?;
52        Ok(NetworkGroupDataType {
53            server_uri,
54            network_paths,
55        })
56    }
57}