From 29fb8fb3d65310423f150c59cd9dc4b63f810e7d Mon Sep 17 00:00:00 2001
From: l0r1s <contact@lorismoulin.com>
Date: Mon, 3 Jul 2023 16:12:35 +0100
Subject: [PATCH] feat: added docs for HrmpChannel config and builder

---
 crates/configuration/src/hrmp_channel.rs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/crates/configuration/src/hrmp_channel.rs b/crates/configuration/src/hrmp_channel.rs
index 3536e65..613ff86 100644
--- a/crates/configuration/src/hrmp_channel.rs
+++ b/crates/configuration/src/hrmp_channel.rs
@@ -2,6 +2,7 @@ use std::marker::PhantomData;
 
 use crate::shared::{macros::states, types::ParaId};
 
+/// A HRMP channel configuration, with fine-grained configuration options.
 #[derive(Debug, Clone, PartialEq)]
 pub struct HrmpChannelConfig {
     sender: ParaId,
@@ -11,18 +12,22 @@ pub struct HrmpChannelConfig {
 }
 
 impl HrmpChannelConfig {
+    /// The sending parachain ID.
     pub fn sender(&self) -> ParaId {
         self.sender
     }
 
+    /// The receiving parachain ID.
     pub fn recipient(&self) -> ParaId {
         self.recipient
     }
 
+    /// The maximum capacity of messages in the channel.
     pub fn max_capacity(&self) -> u32 {
         self.max_capacity
     }
 
+    /// The maximum size of a message in the channel.
     pub fn max_message_size(&self) -> u32 {
         self.max_message_size
     }
@@ -34,6 +39,7 @@ states! {
     WithRecipient
 }
 
+/// A HRMP channel configuration builder, used to build a `HrmpChannelConfig` declaratively with fields validation.
 #[derive(Debug)]
 pub struct HrmpChannelConfigBuilder<State> {
     config: HrmpChannelConfig,
@@ -68,6 +74,7 @@ impl HrmpChannelConfigBuilder<Initial> {
         Self::default()
     }
 
+    /// Set the sending parachain ID.
     pub fn with_sender(self, sender: ParaId) -> HrmpChannelConfigBuilder<WithSender> {
         self.transition(HrmpChannelConfig {
             sender,
@@ -77,6 +84,7 @@ impl HrmpChannelConfigBuilder<Initial> {
 }
 
 impl HrmpChannelConfigBuilder<WithSender> {
+    /// Set the receiving parachain ID.
     pub fn with_recipient(self, recipient: ParaId) -> HrmpChannelConfigBuilder<WithRecipient> {
         self.transition(HrmpChannelConfig {
             recipient,
@@ -86,6 +94,7 @@ impl HrmpChannelConfigBuilder<WithSender> {
 }
 
 impl HrmpChannelConfigBuilder<WithRecipient> {
+    /// Set the max capacity of messages in the channel.
     pub fn with_max_capacity(self, max_capacity: u32) -> Self {
         self.transition(HrmpChannelConfig {
             max_capacity,
@@ -93,6 +102,7 @@ impl HrmpChannelConfigBuilder<WithRecipient> {
         })
     }
 
+    /// Set the maximum size of a message in the channel.
     pub fn with_max_message_size(self, max_message_size: u32) -> Self {
         self.transition(HrmpChannelConfig {
             max_message_size,
-- 
GitLab