Skip to content

Commit

Permalink
support xml srde
Browse files Browse the repository at this point in the history
  • Loading branch information
huykingsofm committed Dec 25, 2024
1 parent ce87471 commit 847cf24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ func To[P, Enum any](enum Enum) (P, bool) {

// MustTo returns the representation (the type is relied on P type parameter)
// for the given enum value. It returns zero value if the enum is invalid or the
// enum doesn't have any representation of type P..
// enum doesn't have any representation of type P.
func MustTo[P, Enum any](enum Enum) P {
val, _ := To[P](enum)
return val
}

// IsValid checks if an enum value is valid.
// It returns true if the enum value is valid, and false otherwise.
// IsValid checks if an enum value is valid. It returns true if the enum value
// is valid, and false otherwise.
func IsValid[Enum any](value Enum) bool {
_, ok := mtmap.Get2(mtkey.Enum2Repr[Enum, string](value))
return ok
Expand Down

0 comments on commit 847cf24

Please sign in to comment.