private static void generateCompositeEncoder(
        final StringBuilder sb,
        final int level,
        final Token typeToken,
        final String name) throws IOException
    {
        final String encoderName = toLowerSnakeCase(encoderName(name));
        final String encoderTypeName = format("%s::%s",
            codecModName(typeToken.referencedName() == null ? typeToken.name() : typeToken.referencedName()),
            encoderName(formatStructName(typeToken.applicableTypeName())));
        indent(sb, level, "/// COMPOSITE ENCODER\n");
        indent(sb, level, "#[inline]\n");
        indent(sb, level, "pub fn %s(self) -> %2$s<Self> {\n",
            encoderName,
            encoderTypeName);

        // NB: must create variable 'offset' before moving 'self'
        indent(sb, level + 1, "let offset = self.%s;\n", getBufOffset(typeToken));
        indent(sb, level + 1, "%s::default().wrap(self, offset)\n", encoderTypeName);
        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