Skip to main content

Crate arin_protocol

Crate arin_protocol 

Source
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.
AnnotationId
Identifies a single annotation within a session.
Arrow
Draw an arrow from one position to another. The head sits at to.
AwaitWindow
Wait until an application’s window is showing, or give up.
Clear
Remove annotations. Only ever affects the calling session’s own annotations.
DisplayId
Identifies a display. Stable for the lifetime of a session.
DisplayInfo
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.
LogicalPoint
A point in logical coordinates, relative to the origin of its display.
LogicalRect
A rectangle in logical coordinates.
Point
Put the orb on a target.
Position
A position expressed relative to a display rather than in points.
ProtocolError
A client message was rejected.
SessionId
Identifies a client session. Annotations are scoped to one.
SessionStart
Open a session.
StrokeStyle
Stroke appearance for a freehand path.
Textbox
Place a text box.
Version
A major.minor protocol version.
VersionParseError
Returned when a v field is not a major.minor pair.

Enums§

ArrowEnd
One end of an arrow.
ArrowTarget
An ArrowEnd, checked.
ClientMessage
Anything a client can send.
DaemonMessage
Anything the daemon can send.
ErrorCode
Machine-readable rejection causes.
HighlightTarget
Which form of Highlight a client sent.
InvalidationReason
Why an annotation was invalidated.
PointTarget
Which form of Point a client sent.
TextboxStyle
What a text box is for.
ValidationError
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.