Struct plctag_async::AsyncTag
source · pub struct AsyncTag { /* private fields */ }Expand description
tag entry, represents a tag in PLC controller
Implementations§
source§impl AsyncTag
impl AsyncTag
sourcepub async fn create<P: Into<Vec<u8>>>(path: P) -> Result<Self>
pub async fn create<P: Into<Vec<u8>>>(path: P) -> Result<Self>
create instance of AsyncTag
Tag String Attributes
See https://github.com/libplctag/libplctag/wiki/Tag-String-Attributes for tag string attributes.
sourcepub fn get_attr(
&mut self,
attr: impl AsRef<str>,
default_value: i32
) -> Result<i32>
pub fn get_attr(
&mut self,
attr: impl AsRef<str>,
default_value: i32
) -> Result<i32>
get tag attribute
sourcepub fn elem_count(&mut self) -> Result<i32>
pub fn elem_count(&mut self) -> Result<i32>
element count
sourcepub fn get_value<T: Decode>(&mut self, byte_offset: u32) -> Result<T>
pub fn get_value<T: Decode>(&mut self, byte_offset: u32) -> Result<T>
get value from mem, you should call read() before this operation
sourcepub fn get_value_in_place<T: Decode>(
&mut self,
byte_offset: u32,
place: &mut T
) -> Result<()>
pub fn get_value_in_place<T: Decode>(
&mut self,
byte_offset: u32,
place: &mut T
) -> Result<()>
get value from mem, you should call read() before this operation
sourcepub fn set_value<T: Encode>(&mut self, byte_offset: u32, value: T) -> Result<()>
pub fn set_value<T: Encode>(&mut self, byte_offset: u32, value: T) -> Result<()>
set value in mem, you should call write() later
sourcepub async fn read_value<T: Decode>(&mut self, offset: u32) -> Result<T>
pub async fn read_value<T: Decode>(&mut self, offset: u32) -> Result<T>
perform read & returns the value
sourcepub async fn read_value_in_place<T: Decode>(
&mut self,
offset: u32,
place: &mut T
) -> Result<()>
pub async fn read_value_in_place<T: Decode>(
&mut self,
offset: u32,
place: &mut T
) -> Result<()>
perform read & returns the value
sourcepub async fn write_value<T: Encode + Send>(
&mut self,
offset: u32,
value: T
) -> Result<()>
pub async fn write_value<T: Encode + Send>(
&mut self,
offset: u32,
value: T
) -> Result<()>
set the value and write to PLC Controller
sourcepub fn get_bytes_unchecked(
&self,
byte_offset: u32,
buf: &mut [u8]
) -> Result<usize>
pub fn get_bytes_unchecked(
&self,
byte_offset: u32,
buf: &mut [u8]
) -> Result<usize>
get raw bytes. If buffer length would exceed the end of the data in the tag data buffer, an out of bounds error is returned