Errors
Every fallible call returns Result<T>, the crate's alias for core::result::Result<T, Error>.
ErrorWhat a call returns on failure
Error is #[non_exhaustive], so any match needs a wildcard arm.
| Variant | Meaning |
|---|---|
Io(std::io::Error) | An underlying serial or OS error. |
NotFound | No port has the box's VID/PID, or no box matches the discovery id or predicate. |
NoReply | No reply to the version query during the handshake: wrong port or baud, or not a Medius box. |
BadProtoVer { got } | The box replied to the handshake with a proto_ver other than 9, carried in got. The discovery openers return it for a matched box on another protocol. |
QueryTimeout | A query hit its deadline with no RESP back. |
Disconnected | The box disconnected. |
FrameTooLong | A payload was over the 512-byte frame limit. |
CatchTableFull { needed, limit } | A catch_events call needs needed entries and the box holds limit. Refused before anything is sent, because the box reports a refusal only in a flag. |
EmptySubscription | A catch subscription named no filters, so the stream would never yield. |
CaptureNotApplicable { class } | A Capture on an input class, which arrives decoded and carries no packet. |
NotAnInputFilter { class } | input_events was given a traffic class, which cannot decode to an input edge. |
WildcardNotInput | CatchFilter::everything() covers traffic too; use CatchFilter::all_input(). |
RelativeDirection { direction, what } | A call addressed Direction::With or Against where only a fixed sign or edge fits (what names the thing addressed). Those two resolve against the bearing at emit time. Use Both, Positive, or Negative. |
LockScaleRange { scale, min, max } | A lock scale outside min to max. The percent is signed, from full reversal to full amplification. |
LockScaleUsage { scale, class } | A negative (reversing) lock scale on a button, key or media usage. One bit has nothing to reverse: use 0 to block it or 100 to pass it. |
ImperfectRequired | set_rewrite or apply_patch while the imperfect-clone opt-in is off. Turn it on with allow_imperfect_clones(true). |
RawDirection { direction } | A raw call's direction, or a ClipFrame raw report's, was not IN or OUT. |
ClipFrameCount { what, count, limit } | A ClipFrame has count of what (edges or raw reports) and carries at most limit. |
ClipFrameTooLong { len } | A ClipFrame encodes to len bytes, and one append carries ≤512 (CLIP_ENTRY_MAX). Split it across frames. |
ClipTransferData { want, got } | A clip transfer has got data bytes where its setup packet announces want: wLength for an OUT request, none for an IN one. |
ClipPacketTrigger { reason } | A clip packet trigger in a shape the box refuses, caught before anything is sent. reason names which of the refusals it is. |
RewriteMaskLength { match_len, mask_len } | A rewrite rule's match and mask were not the same length. |
RewriteMatchTooLong { len, limit } | A rewrite rule has len match bytes and the box compares at most limit (REWRITE_MATCH_MAX, 16). |
RewriteActionClass { action, class } | A rewrite rule's action does not fit its class. |
RewritePayloadTooLarge { action, class, len, offset, cap } | A rewrite rule's payload does not fit the box's cap-byte head for the class. |
RewriteTableFull { limit } | A new rewrite rule while all limit slots are in use. Remove one first. |
RewritePoolFull { len, free, limit } | A rewrite rule's len-byte payload, when only free bytes are left in the box's limit-byte payload pool (REWRITE_PAYLOAD_POOL, 2048) after the other held rules. An overwrite frees the bytes of the rule it replaces. Remove a rule or shorten a payload first. |
TransformOpFields { op, src, dst } | A transform's op does not fit its source and destination fields, or names one field as both. To weigh a field in place, use scale. |
TransformTableFull { limit } | A new transform while all limit slots are in use. Remove one first. |
HalfEdgeInputFilter | An input subscription narrowed to one edge. Without the release, a fresh press can't be told from a chord. Match on Input::Press instead. |
ReservedId { class, id } | An exact id of 0xFFFF. That is the wire's every-id sentinel, so it would address the whole class. Only a media usage is wide enough to reach it. |
Update { op, status, arg } | The box refused a firmware update op. Carries the op, the UpdateStatus and its arg. |