private static void generateBitSetDecoder(
        final StringBuilder sb,
        final int level,
        final Token bitsetToken,
        final String name) throws IOException
    {
        final Encoding encoding = bitsetToken.encoding();
        final String rustPrimitiveType = rustTypeName(encoding.primitiveType());
        final String referencedName = bitsetToken.referencedName();
        final String structTypeName = format("%s::%s",
            toLowerSnakeCase(referencedName == null ? bitsetToken.name() : referencedName),
            formatStructName(bitsetToken.applicableTypeName()));
        indent(sb, level, "/// BIT SET DECODER\n");
        indent(sb, level, "#[inline]\n");
        indent(sb, level, "pub fn %s(&self) -> %s {\n", formatFunctionName(name), structTypeName);

        if (bitsetToken.version() > 0)
        {
            indent(sb, level + 1, "if self.acting_version() < %d {\n", bitsetToken.version());
            indent(sb, level + 2, "return %s::default();\n", structTypeName);
            indent(sb, level + 1, "}\n\n");
        }

        indent(sb, level + 1, "%s::new(self.get_buf().get_%s_at(self.%s))\n",
            structTypeName,
            rustPrimitiveType,
            getBufOffset(bitsetToken));
        indent(sb, level, "}\n\n");
    }
Create a new Rust language {@link CodeGenerator}.

@param ir            for the messages and types.
@param crateVersion  for the generated crate.
@param outputManager for generating the codecs to.
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/RustGenerator.java