mirror of
https://github.com/Devolutions/IronRDP.git
synced 2026-11-24 01:04:51 +00:00
9abd6eb482
## Summary Final step of the staged migration started in #1242 and continued in #1243 / #1244. Completes the typed error story for `ironrdp-server` by converting the last consumer-facing trait surface and dropping the `anyhow` dependency entirely. Closes #1209. ## Public API changes ```diff pub trait RdpServerDisplayUpdates { - async fn next_update(&mut self) -> anyhow::Result<Option<DisplayUpdate>>; + async fn next_update(&mut self) -> ServerResult<Option<DisplayUpdate>>; } pub trait RdpServerDisplay: Send { - async fn updates(&mut self) -> anyhow::Result<Box<dyn RdpServerDisplayUpdates>>; + async fn updates(&mut self) -> ServerResult<Box<dyn RdpServerDisplayUpdates>>; } ``` These are **breaking changes** for handler implementations of the two display traits. ## Internal changes - `from_anyhow` private bridge and `AnyhowError` wrapper struct removed from `error.rs`. - `anyhow` dependency removed from `ironrdp-server/Cargo.toml`. - `builder.rs` `NoopDisplayUpdates` / `NoopDisplay` impls and the docstring examples in `display.rs` and `README.md` updated to match the new trait shapes. - `crates/ironrdp/examples/server.rs` and `crates/ironrdp-testsuite-extra/tests/main.rs` updated to return `ServerResult` from their `RdpServerDisplay/Updates` impls. - `benches/src/perfenc.rs` updated to construct `ServerError` variants instead of `anyhow::Error` and converts at its own `anyhow::Result` main boundary via `.map_err(|e| anyhow::anyhow!(e))`. - `urbdrc.rs`, the `usb`-gated USB device facade, converted from `anyhow` to `ServerResult`/`ServerError` (69 sites). This file predates the typed error migration and was never touched by it, so removing the `anyhow` dependency broke it under the `usb` feature. Typed external errors from `ironrdp-usb`/`ironrdp-rdpeusb` are wrapped with `ServerError::custom`; hand-rolled invariant checks (former `bail!`/`ensure!`) use `ServerError::reason`. ## After this PR `ironrdp-server` has **no anyhow dependency** and the public surface is fully typed against `ServerError`, including the `usb`-gated facade. The full chain: | Step | PR | Scope | |------|-----|-------| | 1 | #1242 | Add `ServerError` / `ServerErrorKind` / ext traits, convert 5 public functions, internal anyhow stays via private bridge | | 2 | #1243 | Convert encoder/helper/echo internals | | 3 | #1244 | Convert server.rs internals + `on_disconnected` parameter | | **4** | **this PR** | Convert display traits and the usb facade, drop anyhow dep, finish | ## Stacking note Stacked on `feat/server-typed-error-server` (#1244). Rebase on landing in PR-number order. ## Test plan - `cargo xtask check fmt -v` clean - `cargo xtask check lints -v` clean (workspace, all-targets, with helper + __bench features) - `cargo xtask check tests -v` passes (including doctests) - `cargo xtask check features --case workspace/powerset-runtime` clean (44/44, covers `ironrdp-server` across the full feature powerset including `usb`) - `cargo build --workspace --all-targets` clean Closes #1209.