Skip to main content

rust_ethernet_ip/client/
string.rs

1use super::EipClient;
2use crate::error::EtherNetIpError;
3
4const STRING_COMPAT_REASON: &str = "this exploratory STRING write path never had a valid, atomic wire contract; use write_tag(..., PlcValue::String(...)) or write_string_tag instead; removal is planned for 2.0";
5const STRING_CONNECTED_REASON: &str = "the retired Class 3 connected STRING subsystem parsed Forward Open and connected replies at the wrong layer; use write_tag(..., PlcValue::String(...)) or write_string_tag instead; removal is planned for 2.0";
6
7fn unsupported(api: &'static str, reason: &'static str) -> crate::error::Result<()> {
8    Err(EtherNetIpError::Unsupported { api, reason })
9}
10
11impl EipClient {
12    /// Retired non-atomic AB STRING component writer.
13    #[deprecated(
14        since = "1.2.0",
15        note = "never provided a safe atomic STRING write contract; use write_tag(..., PlcValue::String(...)) or write_string_tag; removal planned for 2.0"
16    )]
17    pub async fn write_ab_string_components(
18        &mut self,
19        _tag_name: &str,
20        _value: &str,
21    ) -> crate::error::Result<()> {
22        unsupported("write_ab_string_components", STRING_COMPAT_REASON)
23    }
24
25    /// Retired malformed AB STRING-as-UDT writer.
26    #[deprecated(
27        since = "1.2.0",
28        note = "never parsed the PLC reply correctly and could report false success; use write_tag(..., PlcValue::String(...)) or write_string_tag; removal planned for 2.0"
29    )]
30    pub async fn write_ab_string_udt(
31        &mut self,
32        _tag_name: &str,
33        _value: &str,
34    ) -> crate::error::Result<()> {
35        unsupported(
36            "write_ab_string_udt",
37            "this exploratory STRING-as-UDT path parsed the raw CPF envelope as a CIP reply and could report false success; use write_tag(..., PlcValue::String(...)) or write_string_tag instead; removal is planned for 2.0",
38        )
39    }
40
41    /// Retired connected explicit-messaging STRING writer.
42    #[deprecated(
43        since = "1.2.0",
44        note = "connected STRING messaging never established a valid Forward Open path; use write_tag(..., PlcValue::String(...)) or write_string_tag; removal planned for 2.0"
45    )]
46    pub async fn write_string_connected(
47        &mut self,
48        _tag_name: &str,
49        _value: &str,
50    ) -> crate::error::Result<()> {
51        unsupported("write_string_connected", STRING_CONNECTED_REASON)
52    }
53
54    /// Retired reverse-engineered unconnected STRING writer.
55    #[deprecated(
56        since = "1.2.0",
57        note = "malformed exploratory STRING payload; use write_tag(..., PlcValue::String(...)) or write_string_tag; removal planned for 2.0"
58    )]
59    pub async fn write_string_unconnected(
60        &mut self,
61        _tag_name: &str,
62        _value: &str,
63    ) -> crate::error::Result<()> {
64        unsupported(
65            "write_string_unconnected",
66            "this exploratory unconnected STRING payload does not match the Logix Write Tag structure format; use write_tag(..., PlcValue::String(...)) or write_string_tag instead; removal is planned for 2.0",
67        )
68    }
69
70    /// Retired legacy STRING writer.
71    ///
72    /// Use [`EipClient::write_tag`] with [`crate::PlcValue::String`] or
73    /// [`EipClient::write_string_tag`]. Those paths use the hardware-validated
74    /// standard Logix STRING structure encoding.
75    #[deprecated(
76        since = "1.2.0",
77        note = "legacy malformed STRING writer; use write_tag(..., PlcValue::String(...)) or write_string_tag; removal planned for 2.0"
78    )]
79    pub async fn write_string(
80        &mut self,
81        _tag_name: &str,
82        _value: &str,
83    ) -> crate::error::Result<()> {
84        unsupported(
85            "write_string",
86            "the legacy writer omitted the request path-size byte and read the service-reply byte as status; use write_tag(..., PlcValue::String(...)) or write_string_tag instead; removal is planned for 2.0",
87        )
88    }
89}