Skip to main content

Module rust_src

Module rust_src 

Source
Expand description

Extracts the event surface from crates/ag-ui/src/event/**/*.rs.

Deliberately a text scanner, not a compiler: drift-check has to keep working while ag-ui is mid-refactor and does not build. It reads whichever of the two shapes the crate uses (or both at once):

  • a #[serde(tag = "type")] enum, where the wire tag is either an explicit #[serde(rename = "TEXT_MESSAGE_START")] or the variant name;
  • a macro table that generates that enum, whose entries pair a payload type with its tag (TextMessageStart(TextMessageStartEvent) => "TEXT_MESSAGE_START");
  • per-event payload structs named <Name>Event, where the wire tag follows from the type name.

It also reads the BaseEvent envelope on its own. That struct is not an event type β€” it is flattened into every payload β€” so it belongs to none of the shapes above, and its fields are fields of all 36 events.

StructsΒ§

Item πŸ”’
ParsedFields πŸ”’
RustBaseEvent
The envelope every event payload flattens in, as the Rust source declares it.
RustEvent
One event type as the Rust source declares it.
RustField
One field of an event payload, named as it appears on the wire.
RustSurface
Everything the scan found.
UnionMember πŸ”’
One member of the tagged union, wherever it was declared.

EnumsΒ§

ItemKind πŸ”’

ConstantsΒ§

BASE_EVENT
The envelope struct every payload flattens in. Not an event type itself, but its fields are fields of every event, so it is read separately.
NOT_EVENTS πŸ”’
Structs that end in Event but are envelope plumbing, not event types.

FunctionsΒ§

arg_value πŸ”’
rename = "X" inside a serde argument list.
collect_rs_files πŸ”’
container_rename_all πŸ”’
field_head πŸ”’
pub message_id: MessageId, -> (message_id, offset of MessageId).
find_type_end πŸ”’
Length of the type expression at the start of s, up to the , that ends the field. Generics, tuples and slices nest.
has_flag πŸ”’
A bare flatten / skip / default flag inside a serde argument list.
is_wire_tag πŸ”’
Whether a string has the shape of an AG-UI event tag.
item_body πŸ”’
Body of the item whose name ends at at, plus the offset just past it.
item_head πŸ”’
Recognises pub struct Foo, enum Bar, pub(crate) mod baz and some_macro! { heads.
parse_fields πŸ”’
Reads named fields out of a struct or struct-variant body.
parse_macro_table πŸ”’
Reads a macro table that pairs payload types with wire tags, as in TextMessageStart(TextMessageStartEvent) => "TEXT_MESSAGE_START",.
parse_variants πŸ”’
Reads the variants of a #[serde(tag = "type")] enum.
relative πŸ”’
scan
Scans dir recursively for the event surface.
scan_items πŸ”’
Walks top-level items, carrying each one’s attributes with it.
screaming_snake_literal πŸ”’
The first "SCREAMING_SNAKE" string literal in entry.
serde_args πŸ”’
The argument lists of every serde(...) attribute in attrs.
strip_attributes πŸ”’
Removes #[...] attributes from a macro-table entry.
variant_call πŸ”’
The first Variant(PayloadType) in entry, as (variant, payload).