From 45b51dd51a4791b717befffa3d8c1c364ebfcb26 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Mon, 8 Jul 2024 15:31:55 -0400 Subject: [PATCH] macros: add type-wide attributes --- rpc/types/src/json.rs | 3 +++ rpc/types/src/macros.rs | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/rpc/types/src/json.rs b/rpc/types/src/json.rs index 43f5095..4abca39 100644 --- a/rpc/types/src/json.rs +++ b/rpc/types/src/json.rs @@ -553,6 +553,9 @@ define_request_and_response! { get_output_distribution, cc73fe71162d564ffda8e549b79a350bca53c454 => core_rpc_server_commands_defs.h => 2445..=2520, + /// This type is also used in the (undocumented) + /// [`/get_output_distribution.bin`](https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server.h#L138) + /// binary endpoint. GetOutputDistribution, Request { amounts: Vec, diff --git a/rpc/types/src/macros.rs b/rpc/types/src/macros.rs index 08fc389..31bc6be 100644 --- a/rpc/types/src/macros.rs +++ b/rpc/types/src/macros.rs @@ -57,6 +57,9 @@ macro_rules! define_request_and_response { $monero_code_line_end:literal, // The base `struct` name. + // Attributes added here will apply to _both_ + // request and response types. + $( #[$type_attr:meta] )* $type_name:ident, // The request type (and any doc comments, derives, etc). @@ -89,6 +92,9 @@ macro_rules! define_request_and_response { $monero_code_line_start, $monero_code_line_end, )] + /// + $( #[$type_attr] )* + /// $( #[$request_type_attr] )* [<$type_name Request>] { $( @@ -112,6 +118,9 @@ macro_rules! define_request_and_response { $monero_code_line_start, $monero_code_line_end, )] + /// + $( #[$type_attr] )* + /// $( #[$response_type_attr] )* $response_base_type => [<$type_name Response>] { $(