Enum tokio_modbus::Request
source · pub enum Request<'a> {
ReadCoils(Address, Quantity),
ReadDiscreteInputs(Address, Quantity),
WriteSingleCoil(Address, bool),
WriteMultipleCoils(Address, Cow<'a, [bool]>),
ReadInputRegisters(Address, Quantity),
ReadHoldingRegisters(Address, Quantity),
WriteSingleRegister(Address, u16),
WriteMultipleRegisters(Address, Cow<'a, [u16]>),
MaskWriteRegister(Address, u16, u16),
ReadWriteMultipleRegisters(Address, Quantity, Address, Cow<'a, [u16]>),
Custom(u8, Cow<'a, [u8]>),
Disconnect,
}
Expand description
A request represents a message from the client (master) to the server (slave).
Variants§
ReadCoils(Address, Quantity)
A request to read multiple coils. The first parameter is the address of the first coil to read. The second parameter is the number of coils to read.
ReadDiscreteInputs(Address, Quantity)
A request to read multiple discrete inputs The first parameter is the address of the first discrete input to read. The second parameter is the number of discrete inputs to read.
WriteSingleCoil(Address, bool)
A request to write a single coil. The first parameter is the address of the coil. The second parameter is the value to write to the coil.
WriteMultipleCoils(Address, Cow<'a, [bool]>)
A request to write multiple coils. The first parameter is the address of the first coil to write. The second parameter is the vector of values to write to the coils.
ReadInputRegisters(Address, Quantity)
A request to read multiple input registers. The first parameter is the address of the first input register to read. The second parameter is the number of input registers to read.
ReadHoldingRegisters(Address, Quantity)
A request to read multiple holding registers. The first parameter is the address of the first holding register to read. The second parameter is the number of holding registers to read.
WriteSingleRegister(Address, u16)
A request to write a single register. The first parameter is the address of the register to read. The second parameter is the value to write to the register.
WriteMultipleRegisters(Address, Cow<'a, [u16]>)
A request to write to multiple registers. The first parameter is the address of the first register to write. The second parameter is the vector of values to write to the registers.
MaskWriteRegister(Address, u16, u16)
A request to set or clear individual bits of a holding register. The first parameter is the address of the holding register. The second parameter is the AND mask. The third parameter is the OR mask.
ReadWriteMultipleRegisters(Address, Quantity, Address, Cow<'a, [u16]>)
A request to simultaneously read multiple registers and write multiple registers. The first parameter is the address of the first register to read. The second parameter is the number of registers to read. The third parameter is the address of the first register to write. The fourth parameter is the vector of values to write to the registers.
Custom(u8, Cow<'a, [u8]>)
A raw Modbus request. The first parameter is the Modbus function code. The second parameter is the raw bytes of the request.
Disconnect
A poison pill for stopping the client service and to release the underlying transport, e.g. for disconnecting from an exclusively used serial port.
This is an ugly workaround, because tokio-proto
does not
provide other means to gracefully shut down the ClientService
.
Otherwise the bound transport is never freed as long as the
executor is active, even when dropping the Modbus client
context.
Implementations§
source§impl<'a> Request<'a>
impl<'a> Request<'a>
sourcepub fn into_owned(self) -> Request<'static>
pub fn into_owned(self) -> Request<'static>
Converts the request into an owned instance with 'static'
lifetime.
sourcepub const fn function_code(&self) -> FunctionCode
pub const fn function_code(&self) -> FunctionCode
Get the FunctionCode
of the Request
.
Trait Implementations§
source§impl<'a> PartialEq for Request<'a>
impl<'a> PartialEq for Request<'a>
impl<'a> Eq for Request<'a>
impl<'a> StructuralPartialEq for Request<'a>
Auto Trait Implementations§
impl<'a> Freeze for Request<'a>
impl<'a> RefUnwindSafe for Request<'a>
impl<'a> Send for Request<'a>
impl<'a> Sync for Request<'a>
impl<'a> Unpin for Request<'a>
impl<'a> UnwindSafe for Request<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)