pub enum TagPath {
Controller {
tag_name: String,
},
Program {
program_name: String,
tag_name: String,
},
Array {
base_path: Box<TagPath>,
indices: Vec<u32>,
},
Bit {
base_path: Box<TagPath>,
bit_index: u8,
},
Member {
base_path: Box<TagPath>,
member_name: String,
},
StringLength {
base_path: Box<TagPath>,
},
StringData {
base_path: Box<TagPath>,
index: u32,
},
}
Expand description
Represents different types of tag addressing supported by Allen-Bradley PLCs
Variants§
Controller
Simple controller-scoped tag: “MyTag”
Program
Program-scoped tag: “Program:MainProgram.MyTag”
Array
Array element access: “MyArray[5]” or “MyArray[1,2,3]”
Bit
Bit access within a tag: “MyDINT.15”
Member
UDT member access: “MyUDT.Member1”
StringLength
String length access: “MyString.LEN”
StringData
String data access: “MyString.DATA[5]”
Implementations§
Source§impl TagPath
impl TagPath
Sourcepub fn parse(path_str: &str) -> Result<Self>
pub fn parse(path_str: &str) -> Result<Self>
Parses a tag path string into a structured TagPath
§Examples
use rust_ethernet_ip::TagPath;
// Simple controller tag
let path = TagPath::parse("MyTag")?;
// Program-scoped tag
let path = TagPath::parse("Program:MainProgram.MyTag")?;
// Array element
let path = TagPath::parse("MyArray[5]")?;
// Multi-dimensional array
let path = TagPath::parse("Matrix[1,2,3]")?;
// Bit access
let path = TagPath::parse("StatusWord.15")?;
// UDT member
let path = TagPath::parse("MotorData.Speed")?;
// Complex nested path
let path = TagPath::parse("Program:Safety.Devices[2].Status.15")?;
Sourcepub fn to_cip_path(&self) -> Result<Vec<u8>>
pub fn to_cip_path(&self) -> Result<Vec<u8>>
Generates the CIP path bytes for this tag path
This converts the structured tag path into the binary format required by the CIP protocol for EtherNet/IP communication.
Sourcepub fn base_tag_name(&self) -> String
pub fn base_tag_name(&self) -> String
Returns the base tag name without any path qualifiers
Sourcepub fn is_program_scoped(&self) -> bool
pub fn is_program_scoped(&self) -> bool
Returns true if this is a program-scoped tag
Sourcepub fn program_name(&self) -> Option<String>
pub fn program_name(&self) -> Option<String>
Returns the program name if this is a program-scoped tag
Trait Implementations§
impl StructuralPartialEq for TagPath
Auto Trait Implementations§
impl Freeze for TagPath
impl RefUnwindSafe for TagPath
impl Send for TagPath
impl Sync for TagPath
impl Unpin for TagPath
impl UnwindSafe for TagPath
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