Skip to content

Commit

Permalink
Fix rust comment rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Dec 1, 2023
1 parent 75baad6 commit e86edf3
Show file tree
Hide file tree
Showing 15 changed files with 271 additions and 271 deletions.
2 changes: 1 addition & 1 deletion lib/xdrgen/generators/rust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def render_source_comment(out, defn)
///
EOS

out.puts "/// " + defn.text_value.split("\n").join("\n// ")
out.puts "/// " + defn.text_value.split("\n").join("\n/// ")

out.puts <<-EOS.strip_heredoc
///
Expand Down
6 changes: 3 additions & 3 deletions spec/output/generator_spec_rust/block_comments.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2689,9 +2689,9 @@ mod test {
/// AccountFlags is an XDR Enum defines as:
///
/// enum AccountFlags
// { // masks for each flag
// AUTH_REQUIRED_FLAG = 0x1
// };
/// { // masks for each flag
/// AUTH_REQUIRED_FLAG = 0x1
/// };
///
// enum
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
Expand Down
60 changes: 30 additions & 30 deletions spec/output/generator_spec_rust/enum.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2689,28 +2689,28 @@ 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
// };
/// {
/// 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)]
Expand Down Expand Up @@ -2868,10 +2868,10 @@ Self::FbaMessage => "FbaMessage",
/// Color is an XDR Enum defines as:
///
/// enum Color {
// RED=0,
// GREEN=1,
// BLUE=2
// };
/// RED=0,
/// GREEN=1,
/// BLUE=2
/// };
///
// enum
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
Expand Down Expand Up @@ -2974,10 +2974,10 @@ Self::Blue => "Blue",
/// Color2 is an XDR Enum defines as:
///
/// enum Color2 {
// RED2=RED,
// GREEN2=1,
// BLUE2=2
// };
/// RED2=RED,
/// GREEN2=1,
/// BLUE2=2
/// };
///
// enum
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
Expand Down
48 changes: 24 additions & 24 deletions spec/output/generator_spec_rust/nesting.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2689,10 +2689,10 @@ mod test {
/// UnionKey is an XDR Enum defines as:
///
/// enum UnionKey {
// ONE = 1,
// TWO = 2,
// OFFER = 3
// };
/// ONE = 1,
/// TWO = 2,
/// OFFER = 3
/// };
///
// enum
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
Expand Down Expand Up @@ -2801,8 +2801,8 @@ pub type Foo = i32;
/// MyUnionOne is an XDR NestedStruct defines as:
///
/// struct {
// int someInt;
// }
/// int someInt;
/// }
///
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -2835,9 +2835,9 @@ impl WriteXdr for MyUnionOne {
/// MyUnionTwo is an XDR NestedStruct defines as:
///
/// struct {
// int someInt;
// Foo foo;
// }
/// int someInt;
/// Foo foo;
/// }
///
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -2873,21 +2873,21 @@ 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;
// };
/// {
/// 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)]
Expand Down
10 changes: 5 additions & 5 deletions spec/output/generator_spec_rust/optional.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2695,11 +2695,11 @@ pub type Arr = [i32; 2];
/// HasOptions is an XDR Struct defines as:
///
/// struct HasOptions
// {
// int* firstOption;
// int *secondOption;
// Arr *thirdOption;
// };
/// {
/// int* firstOption;
/// int *secondOption;
/// Arr *thirdOption;
/// };
///
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down
14 changes: 7 additions & 7 deletions spec/output/generator_spec_rust/struct.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2695,13 +2695,13 @@ 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>;
// };
/// {
/// 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))]
Expand Down
96 changes: 48 additions & 48 deletions spec/output/generator_spec_rust/test.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3717,15 +3717,15 @@ 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;
// };
/// {
/// 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))]
Expand Down Expand Up @@ -3776,9 +3776,9 @@ self.field7.write_xdr(w)?;
/// LotsOfMyStructs is an XDR Struct defines as:
///
/// struct LotsOfMyStructs
// {
// MyStruct members<>;
// };
/// {
/// MyStruct members<>;
/// };
///
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -3811,9 +3811,9 @@ impl WriteXdr for LotsOfMyStructs {
/// HasStuff is an XDR Struct defines as:
///
/// struct HasStuff
// {
// LotsOfMyStructs data;
// };
/// {
/// LotsOfMyStructs data;
/// };
///
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -3846,10 +3846,10 @@ impl WriteXdr for HasStuff {
/// Color is an XDR Enum defines as:
///
/// enum Color {
// RED,
// BLUE = 5,
// GREEN
// };
/// RED,
/// BLUE = 5,
/// GREEN
/// };
///
// enum
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
Expand Down Expand Up @@ -3964,9 +3964,9 @@ pub const BAR: u64 = FOO;
/// NesterNestedEnum is an XDR NestedEnum defines as:
///
/// enum {
// BLAH_1,
// BLAH_2
// }
/// BLAH_1,
/// BLAH_2
/// }
///
// enum
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
Expand Down Expand Up @@ -4064,8 +4064,8 @@ Self::2 => "2",
/// NesterNestedStruct is an XDR NestedStruct defines as:
///
/// struct {
// int blah;
// }
/// int blah;
/// }
///
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
Expand Down Expand Up @@ -4098,11 +4098,11 @@ impl WriteXdr for NesterNestedStruct {
/// NesterNestedUnion is an XDR NestedUnion defines as:
///
/// union switch (Color color) {
// case RED:
// void;
// default:
// int blah2;
// }
/// case RED:
/// void;
/// default:
/// int blah2;
/// }
///
// union with discriminant Color
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
Expand Down Expand Up @@ -4197,25 +4197,25 @@ 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;
//
//
// };
/// {
/// 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))]
Expand Down
Loading

0 comments on commit e86edf3

Please sign in to comment.