File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ extern crate proc_macro;
33use quote:: quote;
44use syn:: parse_macro_input;
55
6- /// A data structure representing a Solana account.
6+ /// The event attribute allows a struct to be used with
7+ /// [emit!](./macro.emit.html) so that programs can log significant events in
8+ /// their programs that clients can subscribe to. Currently, this macro is for
9+ /// structs only.
710#[ proc_macro_attribute]
811pub fn event (
912 _args : proc_macro:: TokenStream ,
@@ -42,6 +45,10 @@ pub fn event(
4245 } )
4346}
4447
48+ /// Creates an event in an Anchor program, which can subsequently be subscribed
49+ /// to by clients. Calling this method will internally borsh serialize the
50+ /// [event](./attr.event.html), base64 encode the bytes, and then add a
51+ /// [msg!](../solana_program/macro.msg.html) log to the transaction.
4552#[ proc_macro]
4653pub fn emit ( input : proc_macro:: TokenStream ) -> proc_macro:: TokenStream {
4754 let data: proc_macro2:: TokenStream = input. into ( ) ;
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ mod sysvar;
4242mod vec;
4343
4444// Internal module used by macros.
45+ #[ doc( hidden) ]
4546pub mod __private {
4647 pub use base64;
4748}
You can’t perform that action at this time.
0 commit comments