Expand description
A compact implementation of the Agent Client Protocol v1.
Two traits carry the protocol. An agent implements Agent and gets a
ClientConn to call the client with; a client implements Client
and gets an AgentConn to call the agent with. Routing is provided —
you write handlers, never a dispatch table.
Every optional method defaults to replying “method not found”, so a peer that asks for something you do not serve gets a clean refusal rather than waiting forever.
Each side is a feature, and both are on by default. Turn off the one you do not implement:
cacp = { version = "0.0.1", default-features = false, features = ["client"] }Depend on cacp-proto instead if you only need the wire types; it pulls
in no async runtime.
Re-exports§
pub use codec::Message;pub use client::AgentConn;pub use client::Client;pub use client::connect;pub use client::connect_on;pub use client::spawn;pub use server::Agent;pub use server::ClientConn;pub use server::serve;pub use server::serve_on;pub use server::serve_on_stdio;pub use proto as schema;
Modules§
- client
- Drive an ACP agent from a client.
- codec
- The JSON-RPC 2.0 envelope and its newline-delimited framing.
- method
- Every method name in ACP v1, in one place.
- server
- Serve the agent side of ACP.
Structs§
- Error
- A JSON-RPC error, as it appears on the wire.
- Peer
- A handle for calling the other side. Cheap to clone.
Enums§
- Request
Id - A JSON-RPC request id. Any shape is legal; peers echo back whatever they
were sent.
Nullis the id of an error about a frame too malformed to have one.
Traits§
- Handler
- The inbound half of a connection.
Type Aliases§
- Result
- Every fallible operation in this crate reports a wire-shaped error.