Skip to content

Commit

Permalink
Create empty payloads for event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
morr0ne committed Aug 15, 2024
1 parent cf7f247 commit fbdaa58
Show file tree
Hide file tree
Showing 2 changed files with 1,909 additions and 381 deletions.
16 changes: 14 additions & 2 deletions gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ fn write_events(
let mut events = Vec::new();

for (opcode, event) in interface.events.iter().enumerate() {
let _opcode = opcode as u16;
let opcode = opcode as u16;

let docs = description_to_docs(event.description.as_ref());
let name = make_ident(event.name.to_snek_case());
Expand All @@ -655,11 +655,23 @@ fn write_events(
args.push(quote! {#name: #ty})
}

let mut build_args = Vec::new();

build_args.push(quote! {});

events.push(quote! {
#(#docs)*
async fn #name(#(#args),*) -> crate::server::Result<()> {
tracing::debug!(#tracing_inner, object.id);
todo!()

let (payload,fds) = crate::wire::PayloadBuilder::new()
#(#build_args)*
.build();

client
.send_message(crate::wire::Message::new(object.id, #opcode, payload, fds))
.await
.map_err(crate::server::error::Error::IoError)
}
});
}
Expand Down
Loading

0 comments on commit fbdaa58

Please sign in to comment.