Skip to main content

Crate arin

Crate arin 

Source
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/arin

That 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.
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.