code: func (s *Struct) Generate(dir string) error {
  	if s.Enum != nil {
  		return s.Enum.generate(dir)
  	}
  
  	if err := s.generateEnums(dir); err != nil {
  		return err
  	}
  	filename := filepath.Join(dir, s.Name+".capnp")
  	return commons.GenerateFile(s, "./templates/capnp/struct_capnp.tmpl", "struct_capnp", filename, true)
  }
docs: // Generate generates struct code