Expand description
Wire protocol types for Arin.
This crate is the public contract. It is pure types plus validation: no IO, no async runtime, no platform code. It must build and test anywhere.
§Shape
JSON lines over a Unix domain socket, one object per line, UTF-8. Every message
carries a v field. The daemon accepts any minor version within its major and
ignores fields it does not know, so changes stay additive within a major version.
use arin_protocol::{ClientMessage, Envelope};
let line = r#"{"v":"0.1","type":"point","x":412.0,"y":88.0,"display_id":1}"#;
let msg: Envelope<ClientMessage> = serde_json::from_str(line).unwrap();
assert!(msg.version.is_compatible_with(arin_protocol::PROTOCOL_VERSION));§Coordinates
Every coordinate is a logical point paired with an explicit display. Never physical pixels. Physical conversion belongs inside platform crates and nowhere else.
Structs§
- Ack
- A client message was accepted.
- Activated
- The application a focus request brought forward.
- Anchor
- Where an annotation is pinned.
- Annotation
Id - Identifies a single annotation within a session.
- Await
Window - Wait until an application’s window is showing, or give up.
- Clear
- Remove annotations. Only ever affects the calling session’s own annotations.
- Display
Id - Identifies a display. Stable for the lifetime of a session.
- Display
Info - Display metadata, returned on acks so clients can convert screenshot pixels.
- Draw
- Draw a freehand path.
- Envelope
- A message plus the protocol version it was written against.
- Focus
- Bring an application’s windows to the front.
- Highlight
- Outline a region.
- Invalidated
- An annotation is no longer valid and has been removed.
- Logical
Point - A point in logical coordinates, relative to the origin of its display.
- Logical
Rect - A rectangle in logical coordinates.
- Point
- Put the orb on a target.
- Position
- A position expressed relative to a display rather than in points.
- Protocol
Error - A client message was rejected.
- Session
Id - Identifies a client session. Annotations are scoped to one.
- Session
Start - Open a session.
- Stroke
Style - Stroke appearance for a freehand path.
- Textbox
- Place a text box.
- Version
- A
major.minorprotocol version. - Version
Parse Error - Returned when a
vfield is not amajor.minorpair.
Enums§
- Client
Message - Anything a client can send.
- Daemon
Message - Anything the daemon can send.
- Error
Code - Machine-readable rejection causes.
- Highlight
Target - Which form of
Highlighta client sent. - Invalidation
Reason - Why an annotation was invalidated.
- Point
Target - Which form of
Pointa client sent. - Validation
Error - A message that parsed but cannot be acted on.
Constants§
- MAX_
PAYLOAD_ BYTES - Maximum accepted payload for a single line, in bytes.
- PROTOCOL_
VERSION - The protocol version this build speaks.
Traits§
- Validate
- Messages that can be checked beyond their parsed shape.