Skip to main content

Crate rust_ethernet_ip

Crate rust_ethernet_ip 

Source
Expand description

EtherNet/IP client library for Allen-Bradley CompactLogix and ControlLogix PLCs.

rust-ethernet-ip provides async Rust APIs for explicit EtherNet/IP and CIP tag operations, plus FFI surfaces used by the repository’s .NET wrapper. The current released crate line is 1.2.0.

§Highlights

  • Async client API via EipClient
  • Symbolic tag addressing, including program-scoped tags, array indexing, and nested UDT paths
  • Batch reads, writes, and mixed execution with BatchOperation
  • Route-path support for backplane and routed topologies via RoutePath
  • UDT discovery, schema export, diagnostics, subscriptions, and tag-group polling

§Quick Start

use rust_ethernet_ip::{EipClient, PlcValue};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut client = EipClient::connect("192.168.1.100:44818").await?;
    let running = client.read_tag("Program:Main.MotorRunning").await?;
    client
        .write_tag("Program:Main.SetPoint", PlcValue::Dint(1500))
        .await?;

    println!("running={running:?}");
    Ok(())
}

Routed example:

use rust_ethernet_ip::{EipClient, RoutePath};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let route = RoutePath::new().add_slot(0);
    let _client = EipClient::with_route_path("192.168.1.100:44818", route).await?;
    Ok(())
}

§Known PLC/Firmware Limits

Earlier release lines classified several direct write shapes as controller/firmware limitations. Hardware probes on 2026-07-02 through 2026-07-08 corrected that picture, and the fixes ship in this line. Real-hardware validation for the 1.2.0 release line (CompactLogix 5069-L330ERM fw38, full-coverage across Rust/C#/Python/C++) confirmed:

  • Standalone standard Logix STRING tags write directly using the standard 0x02A0/0x0FCE structure encoding.
  • Scalar UDT array element members (DINT/REAL/BOOL/INT) write directly when the full member path is preserved.
  • STRING members inside UDTs and UDT array elements — including custom string types with a user-defined name/length (e.g. Str82, Str400) — write directly: the library discovers the target’s real structure handle instead of assuming the built-in 0x0FCE. A 0x2107 Read/Write Tag data-type mismatch here now indicates a genuine type mismatch, not a firmware block.
  • Strings/structures larger than one CIP packet are read and written via CIP Read/Write Tag Fragmented (0x52/0x53).

Remaining limits: whole-UDT array-element writes as a single structure are not supported (update members individually), and read_tag returns custom string types as PlcValue::Udt — use read_string_tag when the tag is known to be a string. See docs/STRING_HANDLING.md for size limits per tag scope.

Re-exports§

pub use batch::BatchConfig;
pub use batch::BatchError;
pub use batch::BatchOperation;
pub use batch::BatchResult;
pub use client::Backoff;
pub use client::Client;
pub use client::ConnectionEvent;
pub use client::EipClient;
pub use client::RetryClient;
pub use client::RetryPolicy;
pub use config::ProductionConfig;Deprecated
pub use config::ConnectionConfig;
pub use config::LogFormat;
pub use config::LogLevel;
pub use config::LogRotationSchedule;
pub use config::LoggingConfig;
pub use config::MonitoringConfig;
pub use config::PerformanceConfig;
pub use config::PlcSpecificConfig;
pub use config::SecurityConfig;
pub use error::EtherNetIpError;
pub use error::Result;
pub use fleet::Fleet;
pub use fleet::FleetEvent;
pub use monitoring::ProductionMonitor;Deprecated
pub use monitoring::ConnectionMetrics;
pub use monitoring::DiagnosticsSnapshot;
pub use monitoring::ErrorCategory;
pub use monitoring::ErrorMetrics;
pub use monitoring::HealthCheckMode;
pub use monitoring::HealthMetrics;
pub use monitoring::HealthStatus;
pub use monitoring::MonitoringMetrics;
pub use monitoring::OperationMetrics;
pub use monitoring::PerformanceMetrics;
pub use plc_manager::PlcManager;Deprecated
pub use plc_manager::PlcConfig;
pub use plc_manager::PlcConnection;
pub use route::RouteHop;
pub use route::RoutePath;
pub use schema::SchemaCapabilities;
pub use schema::SchemaDataType;
pub use schema::SchemaExport;
pub use schema::SchemaLibraryInfo;
pub use schema::SchemaRoutePath;
pub use schema::SchemaScope;
pub use schema::SchemaTag;
pub use schema::SchemaTargetInfo;
pub use schema::SchemaUdt;
pub use schema::SchemaUdtMember;
pub use subscription::SubscriptionManager;Deprecated
pub use subscription::SubscriptionManager as RealTimeSubscriptionManager;Deprecated
pub use subscription::SubscriptionOptions;
pub use subscription::SubscriptionOptions as RealTimeSubscriptionOptions;
pub use subscription::TagSubscription;
pub use subscription::TagSubscription as RealTimeSubscription;
pub use subscription::TagSubscriptionEvent;
pub use tag_group::TagGroupConfig;
pub use tag_group::TagGroupEvent;
pub use tag_group::TagGroupEventKind;
pub use tag_group::TagGroupFailureCategory;
pub use tag_group::TagGroupFailureDiagnostic;
pub use tag_group::TagGroupSnapshot;
pub use tag_group::TagGroupSubscription;
pub use tag_group::TagGroupValueResult;
pub use tag_manager::TagCache;Deprecated
pub use tag_manager::TagManager;
pub use tag_manager::TagMetadata;
pub use tag_manager::TagPermissions;
pub use tag_manager::TagScope;

Modules§

batch
client
config
error
fleet
monitoring
plc_manager
route
schema
subscription
tag_group
tag_manager
tag_path
types
udt
version

Structs§

TagAttributes
Tag attributes from PLC
UdtData
UdtDefinition
Definition of a User Defined Type
UdtMember
Member of a UDT
UdtTemplate
UDT Template information from PLC

Enums§

PlcValue
TagPath
Represents different types of tag addressing supported by Allen-Bradley PLCs

Traits§

EtherNetIpStream
Trait for streams that can be used with EipClient

Functions§

init_tracing
Initialize tracing subscriber with environment-based filtering
try_init_tracing
Try to initialize tracing subscriber (non-panicking version)