// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package proto

import (
	

	
)

// Reset clears every field in the message.
// The resulting message shares no observable memory with its previous state
// other than the memory for the message itself.
func ( Message) {
	if ,  := .(interface{ () });  && hasProtoMethods {
		.()
		return
	}
	resetMessage(.ProtoReflect())
}

func ( protoreflect.Message) {
	if !.IsValid() {
		panic(fmt.Sprintf("cannot reset invalid %v message", .Descriptor().FullName()))
	}

	// Clear all known fields.
	 := .Descriptor().Fields()
	for  := 0;  < .Len(); ++ {
		.Clear(.Get())
	}

	// Clear extension fields.
	.Range(func( protoreflect.FieldDescriptor,  protoreflect.Value) bool {
		.Clear()
		return true
	})

	// Clear unknown fields.
	.SetUnknown(nil)
}