Skip to content

Commit 75a56d5

Browse files
mwardMichael Ward
and
Michael Ward
authored
[Rust] Updated code generator to resolve Issue #1028 (#1037)
* [Rust] updated LibRsDef.generate() to add "#![allow(clippy::all)]" * [Rust] generating 'From<ENUM> for PRIMITIVE' instead of 'Into<PRIMITIVE> for ENUM' to satisfy 'from_over_into' lint * [Rust] removed unused method parameter * fixed formatting * [Rust] Updated code generator to resolve Issue #1022 * [Rust] meant issue #1028 not 1022 (renamed files accordingly) --------- Co-authored-by: Michael Ward <[email protected]>
1 parent 3199ae7 commit 75a56d5

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ tasks.register('generateRustTestCodecs', JavaExec) {
653653
'sbe-tool/src/test/resources/issue972.xml',
654654
'sbe-tool/src/test/resources/issue984.xml',
655655
'sbe-tool/src/test/resources/issue987.xml',
656+
'sbe-tool/src/test/resources/issue1028.xml',
656657
'sbe-tool/src/test/resources/example-bigendian-test-schema.xml',
657658
'sbe-tool/src/test/resources/nested-composite-name.xml',
658659
]
@@ -866,7 +867,7 @@ tasks.register('generateGolangCodecs') {
866867
'generateGolangFlyweightCodecTestComposite',
867868
'generateGolangFlyweightCodecsWithXIncludes',
868869
'generateGolangFlyweightCodecsWithXSD',
869-
'generateIrCodecs',
870+
'generateIrCodecs',
870871
':sbe-all:jar'
871872
}
872873

rust/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ issue_895 = { path = "../generated/rust/issue895" }
1616
issue_972 = { path = "../generated/rust/issue972" }
1717
issue_984 = { path = "../generated/rust/issue984" }
1818
issue_987 = { path = "../generated/rust/issue987" }
19+
issue_1028 = { path = "../generated/rust/issue1028" }
1920
baseline_bigendian = { path = "../generated/rust/baseline-bigendian" }
2021
nested_composite_name = { path = "../generated/rust/nested-composite-name" }
2122

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/RustGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ private static void generateCompositeDecoder(
15801580
indent(out, 2, "offset: usize,\n");
15811581
indent(out, 1, "}\n\n");
15821582

1583-
final int version = tokens.stream().findFirst().get().version();
1583+
final int version = tokens.get(1).version(); // skip BEGIN_COMPOSITE
15841584
appendImplReaderForComposite(schemaVersionType, version, out, 1, decoderName);
15851585

15861586
// impl<'a, P> start
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<sbe:messageSchema
2+
xmlns:ns2="http://www.fixprotocol.org/ns/simple/1.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:sbe="http://fixprotocol.io/2016/sbe"
5+
package="issue1028"
6+
id="1028"
7+
version="4"
8+
semanticVersion="8.2.3"
9+
description="B3 Binary Entrypoint FIXP messages"
10+
byteOrder="littleEndian"
11+
xsi:schemaLocation="http://fixprotocol.io/2016/sbe sbe.xsd">
12+
<types>
13+
<set name="EventIndicator" encodingType="uint8" description="Set of indicators for a given event. First use case: indicates possible retransmission of message during recovery process." sinceVersion="4">
14+
<choice name="PossResend" description="1=Message is sent during recovery process, 0=Normal message.">0</choice>
15+
</set>
16+
<composite name="messageHeader" description="Message identifiers and length of message root.">
17+
<type name="blockLength" primitiveType="uint16" description="Length of the root of the FIX message contained before repeating groups or variable/conditions fields."/>
18+
<type name="templateId" primitiveType="uint16" description="Template ID used to encode the message."/>
19+
<type name="schemaId" primitiveType="uint16" description="ID of the system publishing the message."/>
20+
<type name="version" primitiveType="uint16" description="Schema version."/>
21+
</composite>
22+
<composite name="OutboundBusinessHeader" description="Header used for outbound business messages.">
23+
<ref name="eventIndicator" type="EventIndicator" sinceVersion="4"/>
24+
</composite>
25+
</types>
26+
27+
<sbe:message name="ExecutionReport_New" id="200" description="Execution Report - New message is sent in response to a NewOrderSingle or SimpleNewOrder messages, or also from a restated iceberg order.">
28+
<field name="businessHeader" type="OutboundBusinessHeader" id="35524" description="Common header to all outbound business messages."/>
29+
</sbe:message>
30+
</sbe:messageSchema>

0 commit comments

Comments
 (0)