void generate(final Ir ir) throws IOException
    {
        try (Writer libRs = outputManager.createOutput("lib"))
        {
            indent(libRs, 0, "#![forbid(unsafe_code)]\n");
            indent(libRs, 0, "#![allow(clippy::all)]\n");
            indent(libRs, 0, "#![allow(non_camel_case_types)]\n\n");
            indent(libRs, 0, "#![allow(ambiguous_glob_reexports)]\n\n");
            indent(libRs, 0, "use ::core::{convert::TryInto};\n\n");

            final ArrayList<String> modules = new ArrayList<>();
            try (Stream<Path> walk = Files.walk(outputManager.getSrcDirPath()))
            {
                walk
                    .filter(Files::isRegularFile)
                    .map((path) -> path.getFileName().toString())
                    .filter((fileName) -> fileName.endsWith(".rs"))
                    .filter((fileName) -> !fileName.equals("lib.rs"))
                    .map((fileName) -> fileName.substring(0, fileName.length() - 3))
                    .sorted()
                    .forEach(modules::add);
            }

            // add modules
            for (final String mod : modules)
            {
                indent(libRs, 0, "pub mod %s;\n", toLowerSnakeCase(mod));
            }
            indent(libRs, 0, "\n");

            generateSbeSchemaConsts(libRs, ir);

            generateSbeErrorEnum(libRs);
            generateEitherEnum(libRs);

            generateEncoderTraits(libRs);
            generateDecoderTraits(schemaVersionType, libRs);

            generateReadBuf(libRs, byteOrder);
            generateWriteBuf(libRs, byteOrder);
        }
    }
Create a new 'lib.rs' for the library being generated.

@param outputManager     for generating the codecs to.
@param byteOrder         for the Encoding.
@param schemaVersionType for acting_version type.
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/LibRsDef.java