pub struct AsyncTcpClient<const N: usize = 9> { /* private fields */ }Expand description
Async Modbus TCP client facade.
All Modbus request methods (read_holding_registers, write_single_coil,
etc.) are available directly on this type via Deref to
[AsyncClientCore].
The constant generic parameter N is the compile-time pipeline depth
forwarded to ClientServices<_, _, N> (default 9).
Implementations§
Source§impl AsyncTcpClient<9>
impl AsyncTcpClient<9>
Sourcepub fn connect(host: &str, port: u16) -> Result<Self, AsyncError>
👎Deprecated: use AsyncTcpClient::new(…) and then client.connect().await
pub fn connect(host: &str, port: u16) -> Result<Self, AsyncError>
use AsyncTcpClient::new(…) and then client.connect().await
Deprecated constructor alias.
Use AsyncTcpClient::new and then call client.connect().await?.
Sourcepub fn connect_with_poll_interval(
host: &str,
port: u16,
poll_interval: Duration,
) -> Result<Self, AsyncError>
👎Deprecated: use AsyncTcpClient::new_with_poll_interval(…) and then client.connect().await
pub fn connect_with_poll_interval( host: &str, port: u16, poll_interval: Duration, ) -> Result<Self, AsyncError>
use AsyncTcpClient::new_with_poll_interval(…) and then client.connect().await
Deprecated constructor alias.
Use AsyncTcpClient::new_with_poll_interval and then call
client.connect().await?.
Sourcepub fn new(host: &str, port: u16) -> Result<Self, AsyncError>
pub fn new(host: &str, port: u16) -> Result<Self, AsyncError>
Creates an async TCP client for host:port without connecting.
Uses the default pipeline depth of 9 and a 20 ms polling interval. Call
[AsyncClientCore::connect] on the returned client before sending
requests.
Sourcepub fn new_with_poll_interval(
host: &str,
port: u16,
poll_interval: Duration,
) -> Result<Self, AsyncError>
pub fn new_with_poll_interval( host: &str, port: u16, poll_interval: Duration, ) -> Result<Self, AsyncError>
Creates an async TCP client for host:port with a custom
poll_interval.
Uses the default pipeline depth of 9. Call [AsyncClientCore::connect]
on the returned client before sending requests.
Sourcepub fn new_with_config(
tcp_config: ModbusTcpConfig,
poll_interval: Duration,
) -> Result<Self, AsyncError>
pub fn new_with_config( tcp_config: ModbusTcpConfig, poll_interval: Duration, ) -> Result<Self, AsyncError>
Creates an async TCP client with a fully custom ModbusTcpConfig and
a custom poll_interval, using the default pipeline depth of 9.
Use this when you need to override fields such as response_timeout_ms,
retry_attempts, or backoff strategy.
Call [AsyncClientCore::connect] on the returned client before sending
requests.
Source§impl<const N: usize> AsyncTcpClient<N>
impl<const N: usize> AsyncTcpClient<N>
Sourcepub fn connect_with_pipeline(host: &str, port: u16) -> Result<Self, AsyncError>
👎Deprecated: use AsyncTcpClient::new_with_pipeline(…) and then client.connect().await
pub fn connect_with_pipeline(host: &str, port: u16) -> Result<Self, AsyncError>
use AsyncTcpClient::new_with_pipeline(…) and then client.connect().await
Deprecated constructor alias.
Use AsyncTcpClient::new_with_pipeline and then call
client.connect().await?.
Sourcepub fn connect_with_pipeline_and_poll_interval(
host: &str,
port: u16,
poll_interval: Duration,
) -> Result<Self, AsyncError>
👎Deprecated: use AsyncTcpClient::new_with_pipeline_and_poll_interval(…) and then client.connect().await
pub fn connect_with_pipeline_and_poll_interval( host: &str, port: u16, poll_interval: Duration, ) -> Result<Self, AsyncError>
use AsyncTcpClient::new_with_pipeline_and_poll_interval(…) and then client.connect().await
Deprecated constructor alias.
Use AsyncTcpClient::new_with_pipeline_and_poll_interval and then call
client.connect().await?.
Sourcepub fn new_with_pipeline(host: &str, port: u16) -> Result<Self, AsyncError>
pub fn new_with_pipeline(host: &str, port: u16) -> Result<Self, AsyncError>
Creates an async TCP client with compile-time pipeline depth N.
Uses a 20 ms polling interval. Call [AsyncClientCore::connect] on the
returned client before sending requests.
Sourcepub fn new_with_pipeline_and_poll_interval(
host: &str,
port: u16,
poll_interval: Duration,
) -> Result<Self, AsyncError>
pub fn new_with_pipeline_and_poll_interval( host: &str, port: u16, poll_interval: Duration, ) -> Result<Self, AsyncError>
Creates an async TCP client with compile-time pipeline depth N and a
custom poll_interval.
Call [AsyncClientCore::connect] on the returned client before sending
requests.
Sourcepub fn new_with_config_and_pipeline(
tcp_config: ModbusTcpConfig,
poll_interval: Duration,
) -> Result<Self, AsyncError>
pub fn new_with_config_and_pipeline( tcp_config: ModbusTcpConfig, poll_interval: Duration, ) -> Result<Self, AsyncError>
Creates an async TCP client with a fully custom ModbusTcpConfig and
a custom poll_interval.
Use this when you need to override fields such as response_timeout_ms,
retry_attempts, or backoff strategy beyond what the convenience
constructors expose.
Call [AsyncClientCore::connect] on the returned client before sending
requests.