| Crates.io | makcu-rs |
| lib.rs | makcu-rs |
| version | 0.1.1 |
| created_at | 2025-07-24 14:43:22.77415+00 |
| updated_at | 2025-07-26 08:19:38.115285+00 |
| description | Fast and modular communication interface using serial ports, built with async-first design in Rust. |
| homepage | https://github.com/whatzwastaken/makcu-rs |
| repository | https://github.com/whatzwastaken/makcu-rs |
| max_upload_size | |
| id | 1766146 |
| size | 57,893 |
Fast and modular communication interface over serial ports. Built with performance and async-first in mind.
| Operation | makcu-py-lib v2.0 | makcu-cpp | makcu-rs (avg_us) | Evaluation |
|---|---|---|---|---|
| Mouse Move | 2000 Β΅s | 70 Β΅s | 0.0 Β΅s | β Best |
| Click | 1000β2000 Β΅s | 160 Β΅s | 0.1 Β΅s | β Best |
| Press / Release | ~1000 Β΅s | 55β100 Β΅s | 0.1 Β΅s / 0.0 Β΅s | β Best |
| Wheel Scroll | 1000β2000 Β΅s | 48 Β΅s | 0.0 Β΅s | β Best |
| Batch (9 ops) | 3000 Β΅s | <100 Β΅s | 0.5 Β΅s | β Best |
| Async (5 ops) | 2000 Β΅s | 200 Β΅s | β No data | β Needs testing |
| Connect | ~800 Β΅s | β | 860.3 Β΅s | β οΈ Acceptable |
serialport and tokio-serialmockserial feature)profile feature)crossbeam-channel)Add this to your Cargo.toml:
[dependencies]
makcu-rs = "0.1"
Or with optional features:
makcu-rs = { version = "0.1", features = ["async", "mockserial", "profile"] }
use makcu_rs::{Device, MouseButton};
use std::time::Duration;
fn main() -> anyhow::Result<()> {
let dev = Device::new("/dev/ttyUSB0", 115200, Duration::from_millis(100));
dev.connect()?;
dev.move_rel(100, 0)?;
dev.click(MouseButton::Left)?;
dev.wheel(-2)?;
dev.disconnect();
Ok(())
}
#[tokio::main]
async fn main() -> std::io::Result<()> {
use makcu_rs::{DeviceAsync, MouseButton};
let dev = DeviceAsync::new("/dev/ttyUSB0", 115200).await?;
dev.move_rel(50, 0).await?;
dev.click(MouseButton::Right).await?;
dev.wheel(1).await?;
Ok(())
}
| Feature | Description |
|---|---|
async |
Enables tokio-based async interface |
profile |
Built-in performance statistics collection |
mockserial |
Fake serial port for unit testing |
Enable with:
cargo build --features "profile mockserial"
Send a command and wait for a response with a timeout:
let response = dev.set_serial("ABC123")?;
println!("Response: {response}");
dev.batch()
.move_rel(100, 20)
.click(MouseButton::Left)
.wheel(-1)
.run()?;
If the profile feature is enabled, collect per-operation timing:
let stats = makcu_rs::Device::profiler_stats();
dbg!(stats);
To simulate serial behavior during development:
[features]
mockserial = []
Licensed under either of:
ΠΡΡΡΡΡΠΉ ΠΈ ΠΌΠΎΠ΄ΡΠ»ΡΠ½ΡΠΉ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ ΡΠ°Π±ΠΎΡΡ Ρ COM-ΠΏΠΎΡΡΠ°ΠΌΠΈ. Π‘ ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠΎΠΉ ΡΡΠ΅ΠΊΠΈΠ½Π³Π°, Π°ΡΠΈΠ½Ρ ΡΠΎΠ½Π½ΠΎΡΡΠΈ ΠΈ ΠΏΠ°ΠΊΠ΅ΡΠ½ΡΡ ΠΊΠΎΠΌΠ°Π½Π΄.
tokio) ΡΠ΅ΠΆΠΈΠΌΠ°mockserial ΡΠ΅ΠΆΠΈΠΌlet dev = Device::new("COM3", 115200, Duration::from_millis(100));
dev.connect()?;
dev.click(MouseButton::Left)?;
dev.disconnect();
let dev = DeviceAsync::new("COM3", 115200).await?;
dev.press(MouseButton::Middle).await?;
ΠΡΠΎΠ΅ΠΊΡ ΡΠ°ΡΠΏΡΠΎΡΡΡΠ°Π½ΡΠ΅ΡΡΡ ΠΏΠΎΠ΄ MIT ΠΈΠ»ΠΈ Apache 2.0 Π»ΠΈΡΠ΅Π½Π·ΠΈΠ΅ΠΉ Π½Π° Π²Π°Ρ Π²ΡΠ±ΠΎΡ.
Π‘ΠΎΠ·Π΄Π°Π²Π°ΠΉΡΠ΅ issue Π½Π° GitHub ΠΈΠ»ΠΈ ΠΏΠΈΡΠΈΡΠ΅ Π°Π²ΡΠΎΡΡ: @whatzwasthere (TG/GitHub)
| Feature | ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅ |
|---|---|
async |
ΠΠΊΠ»ΡΡΠ°Π΅Ρ tokio-ΡΠΎΠ²ΠΌΠ΅ΡΡΠΈΠΌΡΠΉ API |
profile |
ΠΠΊΠ»ΡΡΠ°Π΅Ρ Π²ΡΡΡΠΎΠ΅Π½Π½ΡΠΉ ΠΏΡΠΎΡΠ°ΠΉΠ»Π΅Ρ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΉ |
mockserial |
Π€Π΅ΠΉΠΊΠΎΠ²ΡΠΉ COM-ΠΏΠΎΡΡ (Π΄Π»Ρ ΡΠ΅ΡΡΠΈΡΠΎΠ²Π°Π½ΠΈΡ) |
π‘ makcu-rs ΠΏΠΎΠΌΠΎΠ³Π°Π΅Ρ ΡΠ΄ΠΎΠ±Π½ΠΎ ΡΠΏΡΠ°Π²Π»ΡΡΡ Π²Π½Π΅ΡΠ½ΠΈΠΌΠΈ ΡΡΡΡΠΎΠΉΡΡΠ²Π°ΠΌΠΈ (ΠΌΡΡΠΈ, ΡΡΠ΅ΠΊΠΏΠ°Π΄Ρ, ΠΌΠ°Π½ΠΈΠΏΡΠ»ΡΡΠΎΡΡ) ΡΠ΅ΡΠ΅Π· COM-ΠΏΠΎΡΡ, ΠΌΠΈΠ½ΠΈΠΌΠΈΠ·ΠΈΡΡΡ Π·Π°Π΄Π΅ΡΠΆΠΊΠΈ ΠΈ ΠΏΠΎΠ²ΡΡΠ°Ρ Π½Π°Π΄ΡΠΆΠ½ΠΎΡΡΡ Π²Π·Π°ΠΈΠΌΠΎΠ΄Π΅ΠΉΡΡΠ²ΠΈΡ.