docs: private void defineWriteStructMethod()
      {
          MethodDefinition write = new MethodDefinition(
                  a(PUBLIC),
                  "write",
                  null,
                  arg("struct", structType),
                  arg("protocol", TProtocol.class)
          );
  
          classDefinition.addMethod(write);
  
          // TProtocolReader reader = new TProtocolReader(protocol);
          write.addLocalVariable(type(TProtocolWriter.class), "writer");
          write.newObject(TProtocolWriter.class);
          write.dup();
          write.loadVariable("protocol");
          write.invokeConstructor(type(TProtocolWriter.class), type(TProtocol.class));
          write.storeVariable("writer");
  
          LocalVariableDefinition protocol = write.getLocalVariable("writer");
  
          // protocol.writeStructBegin("bonk");
          write.loadVariable(protocol)
                  .loadConstant(metadata.getStructName())
                  .invokeVirtual(TProtocolWriter.class, "writeStructBegin", void.class, String.class);
  
          // write fields
          for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
              writeField(write, protocol, field);
          }
  
          write.loadVariable(protocol)
                  .invokeVirtual(TProtocolWriter.class, "writeStructEnd", void.class);
  
          write.ret();
      }