private static void generatePrimitiveDecoder(
        final StringBuilder sb,
        final int level,
        final Token fieldToken,
        final Token typeToken,
        final String name,
        final Encoding encoding) throws IOException
    {
        if (typeToken.arrayLength() > 1)
        {
            generatePrimitiveArrayDecoder(sb, level, fieldToken, typeToken, name, encoding);
        }
        else if (encoding.presence() == Encoding.Presence.CONSTANT)
        {
            generatePrimitiveConstantDecoder(sb, level, name, encoding);
        }
        else if (encoding.presence() == Encoding.Presence.OPTIONAL)
        {
            generatePrimitiveOptionalDecoder(sb, level, fieldToken, name, encoding);
        }
        else
        {
            generatePrimitiveRequiredDecoder(sb, level, fieldToken, name, encoding);
        }
    }
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