From fa1e5cafafce3ea42801324124fcd0927cecaf89 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Mon, 8 Jul 2024 17:08:21 -0400 Subject: [PATCH] doc fixes --- rpc/types/README.md | 12 ++++++++---- rpc/types/src/bin.rs | 5 ++--- rpc/types/src/json.rs | 3 +-- rpc/types/src/lib.rs | 5 ++++- rpc/types/src/misc/key_image_spent_status.rs | 5 +++++ rpc/types/src/misc/misc.rs | 3 ++- rpc/types/src/misc/mod.rs | 3 ++- rpc/types/src/misc/pool_info_extent.rs | 5 +++++ rpc/types/src/misc/status.rs | 2 -- rpc/types/src/other.rs | 3 +-- 10 files changed, 30 insertions(+), 16 deletions(-) diff --git a/rpc/types/README.md b/rpc/types/README.md index 4b337be..21905fa 100644 --- a/rpc/types/README.md +++ b/rpc/types/README.md @@ -31,8 +31,9 @@ However, each type will document: # Naming The naming for types within `{json,bin,other}` follow the following scheme: -- Convert the endpoint or method name into `UpperCamelCase` -- Remove any suffix extension +1. Convert the endpoint or method name into `UpperCamelCase` +1. Remove any suffix extension +1. Add `Request/Response` suffix For example: @@ -57,8 +58,11 @@ however some fields contain binary values inside JSON strings, for example: `binary` here is (de)serialized as a normal [`String`]. In order to be clear on which fields contain binary data, the struct fields that have them will use [`crate::misc::BinaryString`] instead of [`String`]. -- TODO: list the specific types. -- TODO: we need to figure out a type that (de)serializes correctly, `String` errors with `serde_json` +These mixed types are: +- [`crate::json::GetTransactionPoolBacklogResponse`] +- [`crate::json::GetOutputDistributionResponse`] + +TODO: we need to figure out a type that (de)serializes correctly, `String` errors with `serde_json` # Feature flags List of feature flags for `cuprate-rpc-types`. diff --git a/rpc/types/src/bin.rs b/rpc/types/src/bin.rs index 3c4d42c..89f4cea 100644 --- a/rpc/types/src/bin.rs +++ b/rpc/types/src/bin.rs @@ -1,7 +1,6 @@ -//! Binary types from [binary](https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#get_blocksbin) endpoints. +//! Binary types from [`.bin` endpoints](https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#get_blocksbin). //! -//! Most (if not all) of these types are defined here: -//! - +//! All types are originally defined in [`rpc/core_rpc_server_commands_defs.h`](https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server_commands_defs.h). //---------------------------------------------------------------------------------------------------- Import use crate::{ diff --git a/rpc/types/src/json.rs b/rpc/types/src/json.rs index a4a0f6c..7bce4ef 100644 --- a/rpc/types/src/json.rs +++ b/rpc/types/src/json.rs @@ -1,7 +1,6 @@ //! JSON types from the [`/json_rpc`](https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#json-rpc-methods) endpoint. //! -//! Most (if not all) of these types are defined here: -//! - +//! All types are originally defined in [`rpc/core_rpc_server_commands_defs.h`](https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server_commands_defs.h). //---------------------------------------------------------------------------------------------------- Import use crate::{ diff --git a/rpc/types/src/lib.rs b/rpc/types/src/lib.rs index ce3711a..45cca69 100644 --- a/rpc/types/src/lib.rs +++ b/rpc/types/src/lib.rs @@ -102,7 +102,10 @@ ) )] // TODO: remove me after finishing impl -#![allow(dead_code)] +#![allow( + dead_code, + rustdoc::broken_intra_doc_links // TODO: remove after `{bin,json,other}.rs` gets merged +)] //---------------------------------------------------------------------------------------------------- Mod mod constants; diff --git a/rpc/types/src/misc/key_image_spent_status.rs b/rpc/types/src/misc/key_image_spent_status.rs index ede2382..d075e64 100644 --- a/rpc/types/src/misc/key_image_spent_status.rs +++ b/rpc/types/src/misc/key_image_spent_status.rs @@ -11,6 +11,11 @@ use cuprate_epee_encoding::{ }; //---------------------------------------------------------------------------------------------------- KeyImageSpentStatus +#[doc = crate::macros::monero_definition_link!( + cc73fe71162d564ffda8e549b79a350bca53c454, + "rpc/core_rpc_server_commands_defs.h", + 456..=460 +)] /// Used in [`crate::other::IsKeyImageSpentResponse`]. #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] diff --git a/rpc/types/src/misc/misc.rs b/rpc/types/src/misc/misc.rs index bf9b47e..187cd6a 100644 --- a/rpc/types/src/misc/misc.rs +++ b/rpc/types/src/misc/misc.rs @@ -31,7 +31,8 @@ use crate::{ /// /// This macro: /// 1. Defines a `pub struct` with all `pub` fields -/// 2. Implements `epee` on the struct +/// 2. Implements `serde` on the struct +/// 3. Implements `epee` on the struct /// /// When using, consider documenting: /// - The original Monero definition site with [`monero_definition_link`] diff --git a/rpc/types/src/misc/mod.rs b/rpc/types/src/misc/mod.rs index 14820ab..31dba35 100644 --- a/rpc/types/src/misc/mod.rs +++ b/rpc/types/src/misc/mod.rs @@ -1,6 +1,7 @@ //! Miscellaneous types. //! -//! These are `struct`s that appear in request/response types. +//! These are data types that appear in request/response types. +//! //! For example, [`crate::json::GetConnectionsResponse`] contains //! the [`crate::misc::ConnectionInfo`] struct defined here. diff --git a/rpc/types/src/misc/pool_info_extent.rs b/rpc/types/src/misc/pool_info_extent.rs index cf8c995..09b6c96 100644 --- a/rpc/types/src/misc/pool_info_extent.rs +++ b/rpc/types/src/misc/pool_info_extent.rs @@ -11,6 +11,11 @@ use cuprate_epee_encoding::{ }; //---------------------------------------------------------------------------------------------------- PoolInfoExtent +#[doc = crate::macros::monero_definition_link!( + cc73fe71162d564ffda8e549b79a350bca53c454, + "rpc/core_rpc_server_commands_defs.h", + 223..=228 +)] /// Used in [`crate::bin::GetBlocksResponse`]. #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] diff --git a/rpc/types/src/misc/status.rs b/rpc/types/src/misc/status.rs index cf83b26..f2dff1a 100644 --- a/rpc/types/src/misc/status.rs +++ b/rpc/types/src/misc/status.rs @@ -26,8 +26,6 @@ use crate::constants::{ /// /// This type represents `monerod`'s frequently appearing string field, `status`. /// -/// This field appears within RPC [JSON response](crate::json) types. -/// /// Reference: . /// /// ## Serialization and string formatting diff --git a/rpc/types/src/other.rs b/rpc/types/src/other.rs index e979b4e..c888aec 100644 --- a/rpc/types/src/other.rs +++ b/rpc/types/src/other.rs @@ -1,7 +1,6 @@ //! JSON types from the [`other`](https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#other-daemon-rpc-calls) endpoints. //! -//! Most (if not all) of these types are defined here: -//! - +//! All types are originally defined in [`rpc/core_rpc_server_commands_defs.h`](https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server_commands_defs.h). //---------------------------------------------------------------------------------------------------- Import use crate::{