INNER CODE UNIT · Rust

write_single_register

slowtec/tokio-modbus · src/client/mod.rs:327

    async fn write_single_register<'a>(&'a mut self, addr: Address, word: Word) -> Result<()> {
        self.client
            .call(Request::WriteSingleRegister(addr, word))
            .await
            .map(|result| {
                result.map(|response| match response {
                    Response::WriteSingleRegister(rsp_addr, rsp_word) => {
                        debug_assert_eq!(addr, rsp_addr);
                        debug_assert_eq!(word, rsp_word);
                    }
                    _ => unreachable!("call() should reject mismatching responses"),
                })
            })
    }

    async fn write_multiple_registers<'a>(
        &'a mut self,
        addr: Address,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…