diff --git a/examples/rtu-over-tcp-server.rs b/examples/rtu-over-tcp-server.rs index 857d0429..084fbfa9 100644 --- a/examples/rtu-over-tcp-server.rs +++ b/examples/rtu-over-tcp-server.rs @@ -168,7 +168,7 @@ async fn client_context(socket_addr: SocketAddr) { let mut ctx = tokio_modbus::prelude::rtu::attach_slave(transport, Slave(1)); println!("CLIENT: Reading 2 input registers..."); - let response = ctx.read_input_registers(0x00, 2).await.unwrap(); + let response = ctx.read_input_registers(0x00, 2).await.unwrap().unwrap(); println!("CLIENT: The result is '{response:?}'"); assert_eq!(response, [1234, 5678]); @@ -179,7 +179,7 @@ async fn client_context(socket_addr: SocketAddr) { // Read back a block including the two registers we wrote. println!("CLIENT: Reading 4 holding registers..."); - let response = ctx.read_holding_registers(0x00, 4).await.unwrap(); + let response = ctx.read_holding_registers(0x00, 4).await.unwrap().unwrap(); println!("CLIENT: The result is '{response:?}'"); assert_eq!(response, [10, 7777, 8888, 40]); diff --git a/examples/tcp-client-custom-fn.rs b/examples/tcp-client-custom-fn.rs index c0f690d7..610d6712 100644 --- a/examples/tcp-client-custom-fn.rs +++ b/examples/tcp-client-custom-fn.rs @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { println!("Fetching the coupler ID"); let rsp = ctx .call(Request::Custom(0x66, Cow::Borrowed(&[0x11, 0x42]))) - .await?; + .await??; match rsp { Response::Custom(f, rsp) => { diff --git a/examples/tcp-client.rs b/examples/tcp-client.rs index f35948c7..36e06bbb 100644 --- a/examples/tcp-client.rs +++ b/examples/tcp-client.rs @@ -12,7 +12,7 @@ async fn main() -> Result<(), Box> { let mut ctx = tcp::connect(socket_addr).await?; println!("Fetching the coupler ID"); - let data = ctx.read_input_registers(0x1000, 7).await?; + let data = ctx.read_input_registers(0x1000, 7).await??; let bytes: Vec = data.iter().fold(vec![], |mut x, elem| { x.push((elem & 0xff) as u8); diff --git a/examples/tcp-server.rs b/examples/tcp-server.rs index 2f3565cb..6ccdcacc 100644 --- a/examples/tcp-server.rs +++ b/examples/tcp-server.rs @@ -168,7 +168,7 @@ async fn client_context(socket_addr: SocketAddr) { let mut ctx = tcp::connect(socket_addr).await.unwrap(); println!("CLIENT: Reading 2 input registers..."); - let response = ctx.read_input_registers(0x00, 2).await.unwrap(); + let response = ctx.read_input_registers(0x00, 2).await.unwrap().unwrap(); println!("CLIENT: The result is '{response:?}'"); assert_eq!(response, [1234, 5678]); @@ -179,7 +179,7 @@ async fn client_context(socket_addr: SocketAddr) { // Read back a block including the two registers we wrote. println!("CLIENT: Reading 4 holding registers..."); - let response = ctx.read_holding_registers(0x00, 4).await.unwrap(); + let response = ctx.read_holding_registers(0x00, 4).await.unwrap().unwrap(); println!("CLIENT: The result is '{response:?}'"); assert_eq!(response, [10, 7777, 8888, 40]); diff --git a/examples/tls-server.rs b/examples/tls-server.rs index a6a809a8..779c154c 100644 --- a/examples/tls-server.rs +++ b/examples/tls-server.rs @@ -271,7 +271,7 @@ async fn client_context(socket_addr: SocketAddr) { let mut ctx = tcp::attach(transport); println!("CLIENT: Reading 2 input registers..."); - let response = ctx.read_input_registers(0x00, 2).await.unwrap(); + let response = ctx.read_input_registers(0x00, 2).await.unwrap().unwrap(); println!("CLIENT: The result is '{response:?}'"); assert_eq!(response, [1234, 5678]); @@ -282,7 +282,7 @@ async fn client_context(socket_addr: SocketAddr) { // Read back a block including the two registers we wrote. println!("CLIENT: Reading 4 holding registers..."); - let response = ctx.read_holding_registers(0x00, 4).await.unwrap(); + let response = ctx.read_holding_registers(0x00, 4).await.unwrap().unwrap(); println!("CLIENT: The result is '{response:?}'"); assert_eq!(response, [10, 7777, 8888, 40]);