<!-- Source: https://medius.k4tech.net/library -->
# Medius Rust Library

_Official Rust client_

The [`medius`](https://crates.io/crates/medius) crate injects input on top of a real mouse, keyboard, or combo over a USB-serial link.

| Property | Value |
| --- | --- |
| Crate version | `3.0.0` |
| [Edition](https://doc.rust-lang.org/edition-guide/rust-2024/index.html) | `2024` |
| [MSRV](https://doc.rust-lang.org/cargo/reference/rust-version.html) (minimum supported Rust version) | `1.85` |
| License | [`MIT`](https://opensource.org/license/mit) |
| Transport | 4 Mbaud, framed-only |
| Thread safety | `Send + Sync` (clone freely) |
| Safety | `#![forbid(unsafe_code)]` |

## Installation

```bash
cargo add medius
```

With optional features:

```bash
cargo add medius --features async,mock
```

| Feature | Description |
| --- | --- |
| [`async`](/library/features/async.md) | Runtime-agnostic `AsyncDevice`, async queries. |
| [`mock`](/library/features/mock.md) | In-process fake box for tests. |
| [`flash`](/library/features/flash.md) | [`esptool`](https://github.com/espressif/esptool) firmware flashing. |
| [`tracing`](/library/features/tracing.md) | Tracing instrumentation across the connection lifecycle. |

## Getting started

- [Connection](/library/connection.md): Open, find, handshake
- [Discovery](/library/discovery.md): List boxes, open by identity

## API

- [Inject](/library/inject.md): press, release, force_release
- [Move](/library/move.md): move_axis, move_rel, wheel
- [Lock](/library/lock.md): lock, lock_axis, lock_all
- [Catch](/library/catch.md): Stream physical input
- [Clip](/library/clip.md): Preload input, box-clocked playback
- [Requests](/library/requests.md): version, health, and the device-info queries
- [LED](/library/led.md): Drive a status LED
- [Admin](/library/admin.md): reset, reboot
- [Options](/library/options.md): imperfect clones, movement riding
- [Lifecycle](/library/lifecycle.md): reapply, reconnect
- [Logs & counters](/library/diagnostics.md): Read logs, snapshot counters

## Features

- [async](/library/features/async.md): AsyncDevice
- [mock](/library/features/mock.md): In-process fake box
- [flash](/library/features/flash.md): esptool flashing
- [tracing](/library/features/tracing.md): Structured diagnostics

## Guides

_Behavior and how-to, outside the reference_

- [Calls & input](/library/guides/calls.md): Call kinds, async, motion, clicks
- [Connection](/library/guides/connection.md): Ports, threads, keepalive
- [Testing](/library/guides/testing.md): MockBox in tests

## Reference

- [Types & errors](/library/types.md): Enums, Result, Error
