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