Libertas in action · One link, one round trip
CopyFrom & CopyTo
Follow the data across the page: from the editor into a request, then from the reply back into the same editor.
CopyFrom reads the editor when constructing the request.
CopyTo applies the reply to the originating editor.
App · Rust declarationsPayload structs in one protocol Union
Client · Screen snapshotsConceptual GUI · Tap the City link to try it
pub struct EditAddress { postal_code: String, /// City — tap to look up #[libertas_read_only] #[libertas_link("LookupCity")] city: String,}
Link on the City field names the request a tap invokes.
No request is sent yet.
② Before · Choose the link
Open EditAddress editorDelivery address
Tap the City row to find the city for this postal code.
{ "LookupCity": {
"postal_code": "02139"
} }
pub struct LookupCity { #[libertas_hidden] #[libertas_copy_from( "^<EditAddress>.postal_code")] postal_code: String,}
The client copies postal_code into this request. Hidden input means choosing the link sends it immediately.
The App receives LookupCity and looks up the city.
pub struct CityFound { #[libertas_copy_to( "^<EditAddress>.city")] city: String,}
An update response. The client applies city to the editor bound to this link.
{ "CityFound": {
"city": "Cambridge"
} }
⑤ After · City filled
Example resultDelivery address
Postal code02139The city is filled. The same editor stays open and still awaits its own submission.
Drawn screens and local simulation. Try 02139, 10001 or 94105. Message values are shown readably; the wire encoding is Avro.
- 1 Tap the link
- 2 CopyFrom → Send
- 3 Reply → CopyTo
Read down the zigzag: the declaration draws the editor; the linked City row sends LookupCity; CityFound returns the city to the same editor. Tap the link to replay it.
The link owns the action
Link("LookupCity") names the request. CopyFrom reads the current draft; the outer editor itself is not sent.
The payload carries values
The structs declare the fields and copy paths. The request sends the postal code, and the reply returns the city.
The reply updates this draft
CopyTo fills City in the originating editor. The page stays open; saving the address is a separate outer submission.
How these structs belong to one protocol
Rust excerpts; derives and the outer editor's opening and Save flow are omitted.
pub enum AddressProtocol {
#[libertas_request]
EditAddress(EditAddress),
#[libertas_request]
#[libertas_link_only]
#[libertas_next_response("CityFound")]
LookupCity(LookupCity),
#[libertas_response("update")]
CityFound(CityFound),
}