mikrotik_rs/
lib.rs

1#![warn(missing_docs)]
2//! # MikroTik-rs
3//!
4//! `mikrotik-rs` is an asynchronous Rust library for interfacing with MikroTik routers.
5//! It allows for sending commands and receiving responses in parallel through channels.
6//!
7//! ## Features
8//! - Asynchronous command execution
9//! - Parallel command handling with responses through channels
10//! - Non-blocking communication with the router
11//!
12//! ## Examples
13//!
14//! Basic usage:
15//!
16//! ```rust,no_run
17//! use mikrotik_rs::{protocol::command::CommandBuilder, MikrotikDevice};
18//! use tokio;
19//!
20//! #[tokio::main]
21//! async fn main() -> io::Result<()> {
22//!     // Router's address with port
23//!     let addr = "192.168.88.1:8728";
24//!
25//!     // Router's username and password
26//!     let username = "admin";
27//!     let password = "password";
28//!
29//!     let mut client = MikrotikDevice::connect(addr, username, Some(password)).await?;
30//!
31//!     let command = CommandBuilder::new().command("/interface/print").build(); // Example command
32//!     let response_channel = client.send_command(command).await?;
33//!     while let Some(response) = response_channel.recv().await {
34//!        println!("{:?}", response);
35//!     }
36//! }
37//! ```
38//!
39//! ## Usage
40//!
41//! Add this to your `Cargo.toml`:
42//!
43//! ```toml
44//! [dependencies]
45//! mikrotik-rs = "0.1"
46//! tokio = { version = "1", features = ["full"] }
47//! ```
48//!
49//! ## Note
50//!
51//! This library requires the `tokio` runtime.
52
53#[cfg(target_pointer_width = "16")]
54compiler_error!("This library supports 32-bit architectures or higher.");
55
56mod actor;
57/// Device module for connecting to MikroTik routers and sending commands.
58mod device;
59/// Error module for handling errors during device operations.
60pub mod error;
61/// Macros module to make your life easier.
62pub mod macros;
63/// Protocol module for handling MikroTik API communication.
64pub mod protocol;
65
66pub use device::MikrotikDevice;