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>
👎Deprecated: do not need to be async, use new() instead
pub async fn create<P: Into<Vec<u8>>>(path: P) -> Result<Self>
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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AsyncTag
impl !RefUnwindSafe for AsyncTag
impl Send for AsyncTag
impl Sync for AsyncTag
impl Unpin for AsyncTag
impl !UnwindSafe for AsyncTag
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
Mutably borrows from an owned value. Read more