pwt-macros: builder macro: add comments to proprties in examples
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 4 Oct 2023 07:26:20 +0000 (09:26 +0200)
committerDominik Csapak <d.csapak@proxmox.com>
Thu, 5 Oct 2023 07:43:27 +0000 (09:43 +0200)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
pwt-macros/src/lib.rs

index 5256b975ae2eca808b2c71c44b469309e2be1d5f..0a6020b3ac2d6739a5928be3b5d3a9f9baa88682 100644 (file)
@@ -43,6 +43,7 @@ pub fn widget(attr: TokenStream, item: TokenStream) -> TokenStream {
 /// #[builder]
 /// struct Foo {
 ///     #[builder]
+///     /// this is some field
 ///     some_field: String,
 /// }
 /// ```
@@ -55,6 +56,8 @@ pub fn widget(attr: TokenStream, item: TokenStream) -> TokenStream {
 /// # }
 /// impl Foo {
 ///     /// Set `some_field`
+///     ///
+///     /// this is some field
 ///     pub fn set_some_field(&mut self, some_field: String) {
 ///         self.some_field = some_field;
 ///     }
@@ -77,6 +80,7 @@ pub fn widget(attr: TokenStream, item: TokenStream) -> TokenStream {
 /// #[builder]
 /// struct Foo {
 ///     #[builder(IntoPropValue, into_prop_value)]
+///     /// this is some field
 ///     some_field: f32,
 /// }
 /// ```
@@ -92,6 +96,8 @@ pub fn widget(attr: TokenStream, item: TokenStream) -> TokenStream {
 /// # }
 /// impl Foo {
 ///     /// Set `some_field`
+///     ///
+///     /// this is some field
 ///     pub fn set_some_field(&mut self, some_field: impl IntoPropValue<f32>) {
 ///         self.some_field = some_field.into_prop_value();
 ///     }
@@ -115,6 +121,7 @@ pub fn widget(attr: TokenStream, item: TokenStream) -> TokenStream {
 /// #[builder]
 /// struct Foo {
 ///     #[builder(IntoPropValue, into_prop_value, 0.0)]
+///     /// this is some field
 ///     some_field: f32,
 /// }
 /// ```
@@ -130,6 +137,8 @@ pub fn widget(attr: TokenStream, item: TokenStream) -> TokenStream {
 /// # }
 /// impl Foo {
 ///     /// Set `some_field`
+///     ///
+///     /// this is some field
 ///     pub fn set_some_field(&mut self, some_field: impl IntoPropValue<Option<f32>>) {
 ///         self.some_field = some_field.into_prop_value().unwrap_or(0.0);
 ///     }
@@ -155,6 +164,7 @@ pub fn widget(attr: TokenStream, item: TokenStream) -> TokenStream {
 /// #[builder]
 /// struct Foo {
 ///     #[builder_cb(IntoEventCallback, into_event_callback, Option<f32>)]
+///     /// this is some field
 ///     on_something: Option<Callback<Option<f32>>>,
 /// }
 /// ```
@@ -173,6 +183,8 @@ pub fn widget(attr: TokenStream, item: TokenStream) -> TokenStream {
 /// # }
 /// impl Foo {
 ///     /// Set `on_something`
+///     ///
+///     /// this is some field
 ///     pub fn set_on_something(&mut self, on_something: impl IntoEventCallback<f32>) {
 ///         self.on_something = on_something.into_event_callback();
 ///     }