From 841a48f5ea6b5869a98274c74f73e02ccfff67f5 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 1 Dec 2023 15:19:47 -0800 Subject: [PATCH] Fix comment rendering of code blocks in rust generated code --- lib/xdrgen/generators/rust.rb | 4 +- .../block_comments.x/MyXDR.rs | 10 +- .../generator_spec_rust/const.x/MyXDR.rs | 12 +- .../generator_spec_rust/enum.x/MyXDR.rs | 72 ++++--- .../generator_spec_rust/nesting.x/MyXDR.rs | 68 +++--- .../generator_spec_rust/optional.x/MyXDR.rs | 18 +- .../generator_spec_rust/struct.x/MyXDR.rs | 22 +- .../generator_spec_rust/test.x/MyXDR.rs | 196 +++++++++++------- .../generator_spec_rust/union.x/MyXDR.rs | 60 +++--- .../block_comments.x/MyXDR.rs | 10 +- .../const.x/MyXDR.rs | 12 +- .../enum.x/MyXDR.rs | 72 ++++--- .../nesting.x/MyXDR.rs | 68 +++--- .../optional.x/MyXDR.rs | 18 +- .../struct.x/MyXDR.rs | 22 +- .../test.x/MyXDR.rs | 196 +++++++++++------- .../union.x/MyXDR.rs | 60 +++--- 17 files changed, 555 insertions(+), 365 deletions(-) diff --git a/lib/xdrgen/generators/rust.rb b/lib/xdrgen/generators/rust.rb index 77309d57b..e43077308 100644 --- a/lib/xdrgen/generators/rust.rb +++ b/lib/xdrgen/generators/rust.rb @@ -350,11 +350,13 @@ def render_source_comment(out, defn) out.puts <<-EOS.strip_heredoc /// #{name defn} is an XDR #{defn.class.name.demodulize} defines as: /// + /// ```text EOS - out.puts "/// " + defn.text_value.split("\n").join("\n/// ") + out.puts "/// " + defn.text_value.split("\n").join("\n/// ") out.puts <<-EOS.strip_heredoc + /// ``` /// EOS end diff --git a/spec/output/generator_spec_rust/block_comments.x/MyXDR.rs b/spec/output/generator_spec_rust/block_comments.x/MyXDR.rs index f9c4c54a2..70fa480fb 100644 --- a/spec/output/generator_spec_rust/block_comments.x/MyXDR.rs +++ b/spec/output/generator_spec_rust/block_comments.x/MyXDR.rs @@ -2688,10 +2688,12 @@ mod test { /// AccountFlags is an XDR Enum defines as: /// -/// enum AccountFlags -/// { // masks for each flag -/// AUTH_REQUIRED_FLAG = 0x1 -/// }; +/// ```text +/// enum AccountFlags +/// { // masks for each flag +/// AUTH_REQUIRED_FLAG = 0x1 +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] diff --git a/spec/output/generator_spec_rust/const.x/MyXDR.rs b/spec/output/generator_spec_rust/const.x/MyXDR.rs index c615727c0..459077778 100644 --- a/spec/output/generator_spec_rust/const.x/MyXDR.rs +++ b/spec/output/generator_spec_rust/const.x/MyXDR.rs @@ -2688,19 +2688,25 @@ mod test { /// Foo is an XDR Const defines as: /// -/// const FOO = 1; +/// ```text +/// const FOO = 1; +/// ``` /// pub const FOO: u64 = 1; /// TestArray is an XDR Typedef defines as: /// -/// typedef int TestArray[FOO]; +/// ```text +/// typedef int TestArray[FOO]; +/// ``` /// pub type TestArray = [i32; Foo]; /// TestArray2 is an XDR Typedef defines as: /// -/// typedef int TestArray2; +/// ```text +/// typedef int TestArray2; +/// ``` /// pub type TestArray2 = VecM::; diff --git a/spec/output/generator_spec_rust/enum.x/MyXDR.rs b/spec/output/generator_spec_rust/enum.x/MyXDR.rs index 9976ff927..80740add2 100644 --- a/spec/output/generator_spec_rust/enum.x/MyXDR.rs +++ b/spec/output/generator_spec_rust/enum.x/MyXDR.rs @@ -2688,29 +2688,31 @@ mod test { /// MessageType is an XDR Enum defines as: /// -/// enum MessageType -/// { -/// ERROR_MSG, -/// HELLO, -/// DONT_HAVE, -/// -/// GET_PEERS, // gets a list of peers this guy knows about -/// PEERS, -/// -/// GET_TX_SET, // gets a particular txset by hash -/// TX_SET, -/// -/// GET_VALIDATIONS, // gets validations for a given ledger hash -/// VALIDATIONS, -/// -/// TRANSACTION, //pass on a tx you have heard about -/// JSON_TRANSACTION, -/// -/// // FBA -/// GET_FBA_QUORUMSET, -/// FBA_QUORUMSET, -/// FBA_MESSAGE -/// }; +/// ```text +/// enum MessageType +/// { +/// ERROR_MSG, +/// HELLO, +/// DONT_HAVE, +/// +/// GET_PEERS, // gets a list of peers this guy knows about +/// PEERS, +/// +/// GET_TX_SET, // gets a particular txset by hash +/// TX_SET, +/// +/// GET_VALIDATIONS, // gets validations for a given ledger hash +/// VALIDATIONS, +/// +/// TRANSACTION, //pass on a tx you have heard about +/// JSON_TRANSACTION, +/// +/// // FBA +/// GET_FBA_QUORUMSET, +/// FBA_QUORUMSET, +/// FBA_MESSAGE +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2867,11 +2869,13 @@ Self::FbaMessage => "FbaMessage", /// Color is an XDR Enum defines as: /// -/// enum Color { -/// RED=0, -/// GREEN=1, -/// BLUE=2 -/// }; +/// ```text +/// enum Color { +/// RED=0, +/// GREEN=1, +/// BLUE=2 +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2973,11 +2977,13 @@ Self::Blue => "Blue", /// Color2 is an XDR Enum defines as: /// -/// enum Color2 { -/// RED2=RED, -/// GREEN2=1, -/// BLUE2=2 -/// }; +/// ```text +/// enum Color2 { +/// RED2=RED, +/// GREEN2=1, +/// BLUE2=2 +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] diff --git a/spec/output/generator_spec_rust/nesting.x/MyXDR.rs b/spec/output/generator_spec_rust/nesting.x/MyXDR.rs index 868367d5e..677ed00aa 100644 --- a/spec/output/generator_spec_rust/nesting.x/MyXDR.rs +++ b/spec/output/generator_spec_rust/nesting.x/MyXDR.rs @@ -2688,11 +2688,13 @@ mod test { /// UnionKey is an XDR Enum defines as: /// -/// enum UnionKey { -/// ONE = 1, -/// TWO = 2, -/// OFFER = 3 -/// }; +/// ```text +/// enum UnionKey { +/// ONE = 1, +/// TWO = 2, +/// OFFER = 3 +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2794,15 +2796,19 @@ Self::Offer => "Offer", /// Foo is an XDR Typedef defines as: /// -/// typedef int Foo; +/// ```text +/// typedef int Foo; +/// ``` /// pub type Foo = i32; /// MyUnionOne is an XDR NestedStruct defines as: /// -/// struct { -/// int someInt; -/// } +/// ```text +/// struct { +/// int someInt; +/// } +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2834,10 +2840,12 @@ impl WriteXdr for MyUnionOne { /// MyUnionTwo is an XDR NestedStruct defines as: /// -/// struct { -/// int someInt; -/// Foo foo; -/// } +/// ```text +/// struct { +/// int someInt; +/// Foo foo; +/// } +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2872,22 +2880,24 @@ self.foo.write_xdr(w)?; /// MyUnion is an XDR Union defines as: /// -/// union MyUnion switch (UnionKey type) -/// { -/// case ONE: -/// struct { -/// int someInt; -/// } one; -/// -/// case TWO: -/// struct { -/// int someInt; -/// Foo foo; -/// } two; -/// -/// case OFFER: -/// void; -/// }; +/// ```text +/// union MyUnion switch (UnionKey type) +/// { +/// case ONE: +/// struct { +/// int someInt; +/// } one; +/// +/// case TWO: +/// struct { +/// int someInt; +/// Foo foo; +/// } two; +/// +/// case OFFER: +/// void; +/// }; +/// ``` /// // union with discriminant UnionKey #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] diff --git a/spec/output/generator_spec_rust/optional.x/MyXDR.rs b/spec/output/generator_spec_rust/optional.x/MyXDR.rs index 37599abbb..c38ee2890 100644 --- a/spec/output/generator_spec_rust/optional.x/MyXDR.rs +++ b/spec/output/generator_spec_rust/optional.x/MyXDR.rs @@ -2688,18 +2688,22 @@ mod test { /// Arr is an XDR Typedef defines as: /// -/// typedef int Arr[2]; +/// ```text +/// typedef int Arr[2]; +/// ``` /// pub type Arr = [i32; 2]; /// HasOptions is an XDR Struct defines as: /// -/// struct HasOptions -/// { -/// int* firstOption; -/// int *secondOption; -/// Arr *thirdOption; -/// }; +/// ```text +/// struct HasOptions +/// { +/// int* firstOption; +/// int *secondOption; +/// Arr *thirdOption; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] diff --git a/spec/output/generator_spec_rust/struct.x/MyXDR.rs b/spec/output/generator_spec_rust/struct.x/MyXDR.rs index 481c06e0d..1c59b5e8c 100644 --- a/spec/output/generator_spec_rust/struct.x/MyXDR.rs +++ b/spec/output/generator_spec_rust/struct.x/MyXDR.rs @@ -2688,20 +2688,24 @@ mod test { /// Int64 is an XDR Typedef defines as: /// -/// typedef hyper int64; +/// ```text +/// typedef hyper int64; +/// ``` /// pub type Int64 = i64; /// MyStruct is an XDR Struct defines as: /// -/// struct MyStruct -/// { -/// int someInt; -/// int64 aBigInt; -/// opaque someOpaque[10]; -/// string someString<>; -/// string maxString<100>; -/// }; +/// ```text +/// struct MyStruct +/// { +/// int someInt; +/// int64 aBigInt; +/// opaque someOpaque[10]; +/// string someString<>; +/// string maxString<100>; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] diff --git a/spec/output/generator_spec_rust/test.x/MyXDR.rs b/spec/output/generator_spec_rust/test.x/MyXDR.rs index 1e31c5490..bd9f912c2 100644 --- a/spec/output/generator_spec_rust/test.x/MyXDR.rs +++ b/spec/output/generator_spec_rust/test.x/MyXDR.rs @@ -2688,7 +2688,9 @@ mod test { /// Uint512 is an XDR Typedef defines as: /// -/// typedef opaque uint512[64]; +/// ```text +/// typedef opaque uint512[64]; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2801,7 +2803,9 @@ impl AsRef<[u8]> for Uint512 { /// Uint513 is an XDR Typedef defines as: /// -/// typedef opaque uint513<64>; +/// ```text +/// typedef opaque uint513<64>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2900,7 +2904,9 @@ impl AsRef<[u8]> for Uint513 { /// Uint514 is an XDR Typedef defines as: /// -/// typedef opaque uint514<>; +/// ```text +/// typedef opaque uint514<>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2999,7 +3005,9 @@ impl AsRef<[u8]> for Uint514 { /// Str is an XDR Typedef defines as: /// -/// typedef string str<64>; +/// ```text +/// typedef string str<64>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3098,7 +3106,9 @@ impl AsRef<[u8]> for Str { /// Str2 is an XDR Typedef defines as: /// -/// typedef string str2<>; +/// ```text +/// typedef string str2<>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3197,7 +3207,9 @@ impl AsRef<[u8]> for Str2 { /// Hash is an XDR Typedef defines as: /// -/// typedef opaque Hash[32]; +/// ```text +/// typedef opaque Hash[32]; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3310,7 +3322,9 @@ impl AsRef<[u8]> for Hash { /// Hashes1 is an XDR Typedef defines as: /// -/// typedef Hash Hashes1[12]; +/// ```text +/// typedef Hash Hashes1[12]; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3396,7 +3410,9 @@ impl AsRef<[Hash]> for Hashes1 { /// Hashes2 is an XDR Typedef defines as: /// -/// typedef Hash Hashes2<12>; +/// ```text +/// typedef Hash Hashes2<12>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3495,7 +3511,9 @@ impl AsRef<[Hash]> for Hashes2 { /// Hashes3 is an XDR Typedef defines as: /// -/// typedef Hash Hashes3<>; +/// ```text +/// typedef Hash Hashes3<>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3594,7 +3612,9 @@ impl AsRef<[Hash]> for Hashes3 { /// OptHash1 is an XDR Typedef defines as: /// -/// typedef Hash *optHash1; +/// ```text +/// typedef Hash *optHash1; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3643,7 +3663,9 @@ impl WriteXdr for OptHash1 { /// OptHash2 is an XDR Typedef defines as: /// -/// typedef Hash* optHash2; +/// ```text +/// typedef Hash* optHash2; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3692,40 +3714,50 @@ impl WriteXdr for OptHash2 { /// Int1 is an XDR Typedef defines as: /// -/// typedef int int1; +/// ```text +/// typedef int int1; +/// ``` /// pub type Int1 = i32; /// Int2 is an XDR Typedef defines as: /// -/// typedef hyper int2; +/// ```text +/// typedef hyper int2; +/// ``` /// pub type Int2 = i64; /// Int3 is an XDR Typedef defines as: /// -/// typedef unsigned int int3; +/// ```text +/// typedef unsigned int int3; +/// ``` /// pub type Int3 = u32; /// Int4 is an XDR Typedef defines as: /// -/// typedef unsigned hyper int4; +/// ```text +/// typedef unsigned hyper int4; +/// ``` /// pub type Int4 = u64; /// MyStruct is an XDR Struct defines as: /// -/// struct MyStruct -/// { -/// uint512 field1; -/// optHash1 field2; -/// int1 field3; -/// unsigned int field4; -/// float field5; -/// double field6; -/// bool field7; -/// }; +/// ```text +/// struct MyStruct +/// { +/// uint512 field1; +/// optHash1 field2; +/// int1 field3; +/// unsigned int field4; +/// float field5; +/// double field6; +/// bool field7; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3775,10 +3807,12 @@ self.field7.write_xdr(w)?; /// LotsOfMyStructs is an XDR Struct defines as: /// -/// struct LotsOfMyStructs -/// { -/// MyStruct members<>; -/// }; +/// ```text +/// struct LotsOfMyStructs +/// { +/// MyStruct members<>; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3810,10 +3844,12 @@ impl WriteXdr for LotsOfMyStructs { /// HasStuff is an XDR Struct defines as: /// -/// struct HasStuff -/// { -/// LotsOfMyStructs data; -/// }; +/// ```text +/// struct HasStuff +/// { +/// LotsOfMyStructs data; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3845,11 +3881,13 @@ impl WriteXdr for HasStuff { /// Color is an XDR Enum defines as: /// -/// enum Color { -/// RED, -/// BLUE = 5, -/// GREEN -/// }; +/// ```text +/// enum Color { +/// RED, +/// BLUE = 5, +/// GREEN +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -3951,22 +3989,28 @@ Self::Green => "Green", /// Foo is an XDR Const defines as: /// -/// const FOO = 1244; +/// ```text +/// const FOO = 1244; +/// ``` /// pub const FOO: u64 = 1244; /// Bar is an XDR Const defines as: /// -/// const BAR = FOO; +/// ```text +/// const BAR = FOO; +/// ``` /// pub const BAR: u64 = FOO; /// NesterNestedEnum is an XDR NestedEnum defines as: /// -/// enum { -/// BLAH_1, -/// BLAH_2 -/// } +/// ```text +/// enum { +/// BLAH_1, +/// BLAH_2 +/// } +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -4063,9 +4107,11 @@ Self::2 => "2", /// NesterNestedStruct is an XDR NestedStruct defines as: /// -/// struct { -/// int blah; -/// } +/// ```text +/// struct { +/// int blah; +/// } +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -4097,12 +4143,14 @@ impl WriteXdr for NesterNestedStruct { /// NesterNestedUnion is an XDR NestedUnion defines as: /// -/// union switch (Color color) { -/// case RED: -/// void; -/// default: -/// int blah2; -/// } +/// ```text +/// union switch (Color color) { +/// case RED: +/// void; +/// default: +/// int blah2; +/// } +/// ``` /// // union with discriminant Color #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -4196,26 +4244,28 @@ impl WriteXdr for NesterNestedUnion { /// Nester is an XDR Struct defines as: /// -/// struct Nester -/// { -/// enum { -/// BLAH_1, -/// BLAH_2 -/// } nestedEnum; -/// -/// struct { -/// int blah; -/// } nestedStruct; -/// -/// union switch (Color color) { -/// case RED: -/// void; -/// default: -/// int blah2; -/// } nestedUnion; -/// -/// -/// }; +/// ```text +/// struct Nester +/// { +/// enum { +/// BLAH_1, +/// BLAH_2 +/// } nestedEnum; +/// +/// struct { +/// int blah; +/// } nestedStruct; +/// +/// union switch (Color color) { +/// case RED: +/// void; +/// default: +/// int blah2; +/// } nestedUnion; +/// +/// +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] diff --git a/spec/output/generator_spec_rust/union.x/MyXDR.rs b/spec/output/generator_spec_rust/union.x/MyXDR.rs index a2c4324a0..9c601f042 100644 --- a/spec/output/generator_spec_rust/union.x/MyXDR.rs +++ b/spec/output/generator_spec_rust/union.x/MyXDR.rs @@ -2688,22 +2688,28 @@ mod test { /// SError is an XDR Typedef defines as: /// -/// typedef int Error; +/// ```text +/// typedef int Error; +/// ``` /// pub type SError = i32; /// Multi is an XDR Typedef defines as: /// -/// typedef int Multi; +/// ```text +/// typedef int Multi; +/// ``` /// pub type Multi = i32; /// UnionKey is an XDR Enum defines as: /// -/// enum UnionKey { -/// ERROR, -/// MULTI -/// }; +/// ```text +/// enum UnionKey { +/// ERROR, +/// MULTI +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2800,15 +2806,17 @@ Self::Multi => "Multi", /// MyUnion is an XDR Union defines as: /// -/// union MyUnion switch (UnionKey type) -/// { -/// case ERROR: -/// Error error; -/// case MULTI: -/// Multi things<>; -/// -/// -/// }; +/// ```text +/// union MyUnion switch (UnionKey type) +/// { +/// case ERROR: +/// Error error; +/// case MULTI: +/// Multi things<>; +/// +/// +/// }; +/// ``` /// // union with discriminant UnionKey #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2909,14 +2917,16 @@ Self::Multi(v) => v.write_xdr(w)?, /// IntUnion is an XDR Union defines as: /// -/// union IntUnion switch (int type) -/// { -/// case 0: -/// Error error; -/// case 1: -/// Multi things<>; -/// -/// }; +/// ```text +/// union IntUnion switch (int type) +/// { +/// case 0: +/// Error error; +/// case 1: +/// Multi things<>; +/// +/// }; +/// ``` /// // union with discriminant i32 #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -3017,7 +3027,9 @@ Self::V1(v) => v.write_xdr(w)?, /// IntUnion2 is an XDR Typedef defines as: /// -/// typedef IntUnion IntUnion2; +/// ```text +/// typedef IntUnion IntUnion2; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] diff --git a/spec/output/generator_spec_rust_custom_str_impls/block_comments.x/MyXDR.rs b/spec/output/generator_spec_rust_custom_str_impls/block_comments.x/MyXDR.rs index f9c4c54a2..70fa480fb 100644 --- a/spec/output/generator_spec_rust_custom_str_impls/block_comments.x/MyXDR.rs +++ b/spec/output/generator_spec_rust_custom_str_impls/block_comments.x/MyXDR.rs @@ -2688,10 +2688,12 @@ mod test { /// AccountFlags is an XDR Enum defines as: /// -/// enum AccountFlags -/// { // masks for each flag -/// AUTH_REQUIRED_FLAG = 0x1 -/// }; +/// ```text +/// enum AccountFlags +/// { // masks for each flag +/// AUTH_REQUIRED_FLAG = 0x1 +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] diff --git a/spec/output/generator_spec_rust_custom_str_impls/const.x/MyXDR.rs b/spec/output/generator_spec_rust_custom_str_impls/const.x/MyXDR.rs index c615727c0..459077778 100644 --- a/spec/output/generator_spec_rust_custom_str_impls/const.x/MyXDR.rs +++ b/spec/output/generator_spec_rust_custom_str_impls/const.x/MyXDR.rs @@ -2688,19 +2688,25 @@ mod test { /// Foo is an XDR Const defines as: /// -/// const FOO = 1; +/// ```text +/// const FOO = 1; +/// ``` /// pub const FOO: u64 = 1; /// TestArray is an XDR Typedef defines as: /// -/// typedef int TestArray[FOO]; +/// ```text +/// typedef int TestArray[FOO]; +/// ``` /// pub type TestArray = [i32; Foo]; /// TestArray2 is an XDR Typedef defines as: /// -/// typedef int TestArray2; +/// ```text +/// typedef int TestArray2; +/// ``` /// pub type TestArray2 = VecM::; diff --git a/spec/output/generator_spec_rust_custom_str_impls/enum.x/MyXDR.rs b/spec/output/generator_spec_rust_custom_str_impls/enum.x/MyXDR.rs index 4342e5471..3e9b8dd70 100644 --- a/spec/output/generator_spec_rust_custom_str_impls/enum.x/MyXDR.rs +++ b/spec/output/generator_spec_rust_custom_str_impls/enum.x/MyXDR.rs @@ -2688,29 +2688,31 @@ mod test { /// MessageType is an XDR Enum defines as: /// -/// enum MessageType -/// { -/// ERROR_MSG, -/// HELLO, -/// DONT_HAVE, -/// -/// GET_PEERS, // gets a list of peers this guy knows about -/// PEERS, -/// -/// GET_TX_SET, // gets a particular txset by hash -/// TX_SET, -/// -/// GET_VALIDATIONS, // gets validations for a given ledger hash -/// VALIDATIONS, -/// -/// TRANSACTION, //pass on a tx you have heard about -/// JSON_TRANSACTION, -/// -/// // FBA -/// GET_FBA_QUORUMSET, -/// FBA_QUORUMSET, -/// FBA_MESSAGE -/// }; +/// ```text +/// enum MessageType +/// { +/// ERROR_MSG, +/// HELLO, +/// DONT_HAVE, +/// +/// GET_PEERS, // gets a list of peers this guy knows about +/// PEERS, +/// +/// GET_TX_SET, // gets a particular txset by hash +/// TX_SET, +/// +/// GET_VALIDATIONS, // gets validations for a given ledger hash +/// VALIDATIONS, +/// +/// TRANSACTION, //pass on a tx you have heard about +/// JSON_TRANSACTION, +/// +/// // FBA +/// GET_FBA_QUORUMSET, +/// FBA_QUORUMSET, +/// FBA_MESSAGE +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2867,11 +2869,13 @@ Self::FbaMessage => "FbaMessage", /// Color is an XDR Enum defines as: /// -/// enum Color { -/// RED=0, -/// GREEN=1, -/// BLUE=2 -/// }; +/// ```text +/// enum Color { +/// RED=0, +/// GREEN=1, +/// BLUE=2 +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2973,11 +2977,13 @@ Self::Blue => "Blue", /// Color2 is an XDR Enum defines as: /// -/// enum Color2 { -/// RED2=RED, -/// GREEN2=1, -/// BLUE2=2 -/// }; +/// ```text +/// enum Color2 { +/// RED2=RED, +/// GREEN2=1, +/// BLUE2=2 +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] diff --git a/spec/output/generator_spec_rust_custom_str_impls/nesting.x/MyXDR.rs b/spec/output/generator_spec_rust_custom_str_impls/nesting.x/MyXDR.rs index 328a96498..3b9486e32 100644 --- a/spec/output/generator_spec_rust_custom_str_impls/nesting.x/MyXDR.rs +++ b/spec/output/generator_spec_rust_custom_str_impls/nesting.x/MyXDR.rs @@ -2688,11 +2688,13 @@ mod test { /// UnionKey is an XDR Enum defines as: /// -/// enum UnionKey { -/// ONE = 1, -/// TWO = 2, -/// OFFER = 3 -/// }; +/// ```text +/// enum UnionKey { +/// ONE = 1, +/// TWO = 2, +/// OFFER = 3 +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2794,15 +2796,19 @@ Self::Offer => "Offer", /// Foo is an XDR Typedef defines as: /// -/// typedef int Foo; +/// ```text +/// typedef int Foo; +/// ``` /// pub type Foo = i32; /// MyUnionOne is an XDR NestedStruct defines as: /// -/// struct { -/// int someInt; -/// } +/// ```text +/// struct { +/// int someInt; +/// } +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2834,10 +2840,12 @@ impl WriteXdr for MyUnionOne { /// MyUnionTwo is an XDR NestedStruct defines as: /// -/// struct { -/// int someInt; -/// Foo foo; -/// } +/// ```text +/// struct { +/// int someInt; +/// Foo foo; +/// } +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2872,22 +2880,24 @@ self.foo.write_xdr(w)?; /// MyUnion is an XDR Union defines as: /// -/// union MyUnion switch (UnionKey type) -/// { -/// case ONE: -/// struct { -/// int someInt; -/// } one; -/// -/// case TWO: -/// struct { -/// int someInt; -/// Foo foo; -/// } two; -/// -/// case OFFER: -/// void; -/// }; +/// ```text +/// union MyUnion switch (UnionKey type) +/// { +/// case ONE: +/// struct { +/// int someInt; +/// } one; +/// +/// case TWO: +/// struct { +/// int someInt; +/// Foo foo; +/// } two; +/// +/// case OFFER: +/// void; +/// }; +/// ``` /// // union with discriminant UnionKey #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] diff --git a/spec/output/generator_spec_rust_custom_str_impls/optional.x/MyXDR.rs b/spec/output/generator_spec_rust_custom_str_impls/optional.x/MyXDR.rs index 5bd254b68..735992c52 100644 --- a/spec/output/generator_spec_rust_custom_str_impls/optional.x/MyXDR.rs +++ b/spec/output/generator_spec_rust_custom_str_impls/optional.x/MyXDR.rs @@ -2688,18 +2688,22 @@ mod test { /// Arr is an XDR Typedef defines as: /// -/// typedef int Arr[2]; +/// ```text +/// typedef int Arr[2]; +/// ``` /// pub type Arr = [i32; 2]; /// HasOptions is an XDR Struct defines as: /// -/// struct HasOptions -/// { -/// int* firstOption; -/// int *secondOption; -/// Arr *thirdOption; -/// }; +/// ```text +/// struct HasOptions +/// { +/// int* firstOption; +/// int *secondOption; +/// Arr *thirdOption; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] diff --git a/spec/output/generator_spec_rust_custom_str_impls/struct.x/MyXDR.rs b/spec/output/generator_spec_rust_custom_str_impls/struct.x/MyXDR.rs index ddda1e12e..ace8f79b3 100644 --- a/spec/output/generator_spec_rust_custom_str_impls/struct.x/MyXDR.rs +++ b/spec/output/generator_spec_rust_custom_str_impls/struct.x/MyXDR.rs @@ -2688,20 +2688,24 @@ mod test { /// Int64 is an XDR Typedef defines as: /// -/// typedef hyper int64; +/// ```text +/// typedef hyper int64; +/// ``` /// pub type Int64 = i64; /// MyStruct is an XDR Struct defines as: /// -/// struct MyStruct -/// { -/// int someInt; -/// int64 aBigInt; -/// opaque someOpaque[10]; -/// string someString<>; -/// string maxString<100>; -/// }; +/// ```text +/// struct MyStruct +/// { +/// int someInt; +/// int64 aBigInt; +/// opaque someOpaque[10]; +/// string someString<>; +/// string maxString<100>; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] diff --git a/spec/output/generator_spec_rust_custom_str_impls/test.x/MyXDR.rs b/spec/output/generator_spec_rust_custom_str_impls/test.x/MyXDR.rs index 4df3a5556..a4b4224a9 100644 --- a/spec/output/generator_spec_rust_custom_str_impls/test.x/MyXDR.rs +++ b/spec/output/generator_spec_rust_custom_str_impls/test.x/MyXDR.rs @@ -2688,7 +2688,9 @@ mod test { /// Uint512 is an XDR Typedef defines as: /// -/// typedef opaque uint512[64]; +/// ```text +/// typedef opaque uint512[64]; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2801,7 +2803,9 @@ impl AsRef<[u8]> for Uint512 { /// Uint513 is an XDR Typedef defines as: /// -/// typedef opaque uint513<64>; +/// ```text +/// typedef opaque uint513<64>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2900,7 +2904,9 @@ impl AsRef<[u8]> for Uint513 { /// Uint514 is an XDR Typedef defines as: /// -/// typedef opaque uint514<>; +/// ```text +/// typedef opaque uint514<>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -2999,7 +3005,9 @@ impl AsRef<[u8]> for Uint514 { /// Str is an XDR Typedef defines as: /// -/// typedef string str<64>; +/// ```text +/// typedef string str<64>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3098,7 +3106,9 @@ impl AsRef<[u8]> for Str { /// Str2 is an XDR Typedef defines as: /// -/// typedef string str2<>; +/// ```text +/// typedef string str2<>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3197,7 +3207,9 @@ impl AsRef<[u8]> for Str2 { /// Hash is an XDR Typedef defines as: /// -/// typedef opaque Hash[32]; +/// ```text +/// typedef opaque Hash[32]; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3310,7 +3322,9 @@ impl AsRef<[u8]> for Hash { /// Hashes1 is an XDR Typedef defines as: /// -/// typedef Hash Hashes1[12]; +/// ```text +/// typedef Hash Hashes1[12]; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3396,7 +3410,9 @@ impl AsRef<[Hash]> for Hashes1 { /// Hashes2 is an XDR Typedef defines as: /// -/// typedef Hash Hashes2<12>; +/// ```text +/// typedef Hash Hashes2<12>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3495,7 +3511,9 @@ impl AsRef<[Hash]> for Hashes2 { /// Hashes3 is an XDR Typedef defines as: /// -/// typedef Hash Hashes3<>; +/// ```text +/// typedef Hash Hashes3<>; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3594,7 +3612,9 @@ impl AsRef<[Hash]> for Hashes3 { /// OptHash1 is an XDR Typedef defines as: /// -/// typedef Hash *optHash1; +/// ```text +/// typedef Hash *optHash1; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3643,7 +3663,9 @@ impl WriteXdr for OptHash1 { /// OptHash2 is an XDR Typedef defines as: /// -/// typedef Hash* optHash2; +/// ```text +/// typedef Hash* optHash2; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3692,40 +3714,50 @@ impl WriteXdr for OptHash2 { /// Int1 is an XDR Typedef defines as: /// -/// typedef int int1; +/// ```text +/// typedef int int1; +/// ``` /// pub type Int1 = i32; /// Int2 is an XDR Typedef defines as: /// -/// typedef hyper int2; +/// ```text +/// typedef hyper int2; +/// ``` /// pub type Int2 = i64; /// Int3 is an XDR Typedef defines as: /// -/// typedef unsigned int int3; +/// ```text +/// typedef unsigned int int3; +/// ``` /// pub type Int3 = u32; /// Int4 is an XDR Typedef defines as: /// -/// typedef unsigned hyper int4; +/// ```text +/// typedef unsigned hyper int4; +/// ``` /// pub type Int4 = u64; /// MyStruct is an XDR Struct defines as: /// -/// struct MyStruct -/// { -/// uint512 field1; -/// optHash1 field2; -/// int1 field3; -/// unsigned int field4; -/// float field5; -/// double field6; -/// bool field7; -/// }; +/// ```text +/// struct MyStruct +/// { +/// uint512 field1; +/// optHash1 field2; +/// int1 field3; +/// unsigned int field4; +/// float field5; +/// double field6; +/// bool field7; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3775,10 +3807,12 @@ self.field7.write_xdr(w)?; /// LotsOfMyStructs is an XDR Struct defines as: /// -/// struct LotsOfMyStructs -/// { -/// MyStruct members<>; -/// }; +/// ```text +/// struct LotsOfMyStructs +/// { +/// MyStruct members<>; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3810,10 +3844,12 @@ impl WriteXdr for LotsOfMyStructs { /// HasStuff is an XDR Struct defines as: /// -/// struct HasStuff -/// { -/// LotsOfMyStructs data; -/// }; +/// ```text +/// struct HasStuff +/// { +/// LotsOfMyStructs data; +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -3845,11 +3881,13 @@ impl WriteXdr for HasStuff { /// Color is an XDR Enum defines as: /// -/// enum Color { -/// RED, -/// BLUE = 5, -/// GREEN -/// }; +/// ```text +/// enum Color { +/// RED, +/// BLUE = 5, +/// GREEN +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -3951,22 +3989,28 @@ Self::Green => "Green", /// Foo is an XDR Const defines as: /// -/// const FOO = 1244; +/// ```text +/// const FOO = 1244; +/// ``` /// pub const FOO: u64 = 1244; /// Bar is an XDR Const defines as: /// -/// const BAR = FOO; +/// ```text +/// const BAR = FOO; +/// ``` /// pub const BAR: u64 = FOO; /// NesterNestedEnum is an XDR NestedEnum defines as: /// -/// enum { -/// BLAH_1, -/// BLAH_2 -/// } +/// ```text +/// enum { +/// BLAH_1, +/// BLAH_2 +/// } +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -4063,9 +4107,11 @@ Self::2 => "2", /// NesterNestedStruct is an XDR NestedStruct defines as: /// -/// struct { -/// int blah; -/// } +/// ```text +/// struct { +/// int blah; +/// } +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] @@ -4097,12 +4143,14 @@ impl WriteXdr for NesterNestedStruct { /// NesterNestedUnion is an XDR NestedUnion defines as: /// -/// union switch (Color color) { -/// case RED: -/// void; -/// default: -/// int blah2; -/// } +/// ```text +/// union switch (Color color) { +/// case RED: +/// void; +/// default: +/// int blah2; +/// } +/// ``` /// // union with discriminant Color #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -4196,26 +4244,28 @@ impl WriteXdr for NesterNestedUnion { /// Nester is an XDR Struct defines as: /// -/// struct Nester -/// { -/// enum { -/// BLAH_1, -/// BLAH_2 -/// } nestedEnum; -/// -/// struct { -/// int blah; -/// } nestedStruct; -/// -/// union switch (Color color) { -/// case RED: -/// void; -/// default: -/// int blah2; -/// } nestedUnion; -/// -/// -/// }; +/// ```text +/// struct Nester +/// { +/// enum { +/// BLAH_1, +/// BLAH_2 +/// } nestedEnum; +/// +/// struct { +/// int blah; +/// } nestedStruct; +/// +/// union switch (Color color) { +/// case RED: +/// void; +/// default: +/// int blah2; +/// } nestedUnion; +/// +/// +/// }; +/// ``` /// #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] diff --git a/spec/output/generator_spec_rust_custom_str_impls/union.x/MyXDR.rs b/spec/output/generator_spec_rust_custom_str_impls/union.x/MyXDR.rs index 525d43a32..54787a07d 100644 --- a/spec/output/generator_spec_rust_custom_str_impls/union.x/MyXDR.rs +++ b/spec/output/generator_spec_rust_custom_str_impls/union.x/MyXDR.rs @@ -2688,22 +2688,28 @@ mod test { /// SError is an XDR Typedef defines as: /// -/// typedef int Error; +/// ```text +/// typedef int Error; +/// ``` /// pub type SError = i32; /// Multi is an XDR Typedef defines as: /// -/// typedef int Multi; +/// ```text +/// typedef int Multi; +/// ``` /// pub type Multi = i32; /// UnionKey is an XDR Enum defines as: /// -/// enum UnionKey { -/// ERROR, -/// MULTI -/// }; +/// ```text +/// enum UnionKey { +/// ERROR, +/// MULTI +/// }; +/// ``` /// // enum #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2800,15 +2806,17 @@ Self::Multi => "Multi", /// MyUnion is an XDR Union defines as: /// -/// union MyUnion switch (UnionKey type) -/// { -/// case ERROR: -/// Error error; -/// case MULTI: -/// Multi things<>; -/// -/// -/// }; +/// ```text +/// union MyUnion switch (UnionKey type) +/// { +/// case ERROR: +/// Error error; +/// case MULTI: +/// Multi things<>; +/// +/// +/// }; +/// ``` /// // union with discriminant UnionKey #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -2909,14 +2917,16 @@ Self::Multi(v) => v.write_xdr(w)?, /// IntUnion is an XDR Union defines as: /// -/// union IntUnion switch (int type) -/// { -/// case 0: -/// Error error; -/// case 1: -/// Multi things<>; -/// -/// }; +/// ```text +/// union IntUnion switch (int type) +/// { +/// case 0: +/// Error error; +/// case 1: +/// Multi things<>; +/// +/// }; +/// ``` /// // union with discriminant i32 #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -3017,7 +3027,9 @@ Self::V1(v) => v.write_xdr(w)?, /// IntUnion2 is an XDR Typedef defines as: /// -/// typedef IntUnion IntUnion2; +/// ```text +/// typedef IntUnion IntUnion2; +/// ``` /// #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))]