private static void generateEntryPoint( final String messageTypeName, final OutputManager outputManager, final String topType, final RustCodecType codecType) throws IOException { try (Writer writer = outputManager.createOutput(messageTypeName + format(" %s entry point", codecType.name()))) { final String gerund = codecType.gerund(); writer.append(format("pub fn start_%s_%s<%s>(data: &%s%s [u8]) -> %s {\n", gerund, formatMethodName(messageTypeName), DATA_LIFETIME, DATA_LIFETIME, codecType == RustCodecType.Encoder ? " mut" : "", withLifetime(topType))); indent(writer, 1, "%s::wrap(%s { data: data, pos: 0 })\n", topType, codecType.scratchType()); writer.append("}\n"); } }
private static void generateEntryPoint( final String messageTypeName, final OutputManager outputManager, final String topType, final RustCodecType codecType) throws IOException { try (Writer writer = outputManager.createOutput(messageTypeName + format(" %s entry point", codecType.name()))) { final String gerund = codecType.gerund(); writer.append(format("pub fn start_%s_%s<%s>(data: &%s%s [u8]) -> %s {\n", gerund, formatMethodName(messageTypeName), DATA_LIFETIME, DATA_LIFETIME, codecType == RustCodecType.Encoder ? " mut" : "", withLifetime(topType))); indent(writer, 1, "%s::wrap(%s { data: data, pos: 0 })\n", topType, codecType.scratchType()); writer.append("}\n"); } }
private static void generateEntryPoint( final String messageTypeName, final OutputManager outputManager, final String topType, final RustCodecType codecType) throws IOException { try (Writer writer = outputManager.createOutput(messageTypeName + format(" %s entry point", codecType.name()))) { final String gerund = codecType.gerund(); writer.append(format("pub fn start_%s_%s<%s>(data: &%s%s [u8]) -> %s {\n", gerund, formatMethodName(messageTypeName), DATA_LIFETIME, DATA_LIFETIME, codecType == RustCodecType.Encoder ? " mut" : "", withLifetime(topType))); indent(writer, 1, "%s::wrap(%s { data: data, pos: 0 })\n", topType, codecType.scratchType()); writer.append("}\n"); } }