Expand description
The Rust API for Arin, an annotation layer any agent can draw on.
§This crate is not the application
Arin is a menu bar app and a daemon that draws on your screen, and it is installed as an application rather than with Cargo:
brew install anistark/tools/arinThat compiles from source, which is deliberate: an unsigned app that was downloaded is
quarantined and refused by Gatekeeper, while one compiled on your own machine is not. A
signed cask replaces it later, and the install line gains --cask when it does.
cargo install arin will not work and is not meant to. There is no binary here. What
is here is the contract for talking to the daemon from Rust, which is everything in
arin_protocol re-exported under the name the project is actually called.
§Why a facade
Two names for one contract, so that neither audience has to know about the other.
Someone writing a client reaches for arin because that is the name of the thing they
are talking to. Someone implementing the wire format in another language reaches for
arin-protocol because that is what it describes. Both get the same types.
Depend on whichever reads better. This crate tracks the protocol within a compatible range, so the two do not drift.
use arin::{Anchor, DisplayId, LogicalRect};
let rect = LogicalRect::new(412.0, 88.0, 120.0, 32.0);
assert!(rect.is_valid());
let anchor = Anchor::new(rect, DisplayId(1));
assert_eq!(anchor.display_id, DisplayId(1));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.
- Arrow
- Draw an arrow from one position to another. The head sits at
to. - 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§
- Arrow
End - One end of an arrow.
- Arrow
Target - An
ArrowEnd, checked. - 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. - Textbox
Style - What a text box is for.
- 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.