// UnmarshalText implements encoding.TextUnmarshaler.
170604
func (u *UUID) UnmarshalText(data []byte) error {
	if len(data) == 0 {
		return nil
	}
	id := Parse(string(data))
	if id == nil {
		return errors.New("invalid UUID")
	}
	*u = id
	return nil
}
1330907
func (v *SimpleType) UnmarshalText(value []byte) error {
	switch s := string(value); s {
	case "BOOL":
		*v = SimpleTypeBool
		return nil
	case "BYTE":
		*v = SimpleTypeByte
		return nil
	case "INT8":
		*v = SimpleTypeInt8
		return nil
	case "INT16":
		*v = SimpleTypeInt16
		return nil
	case "INT32":
		*v = SimpleTypeInt32
		return nil
	case "INT64":
		*v = SimpleTypeInt64
		return nil
	case "FLOAT64":
		*v = SimpleTypeFloat64
		return nil
	case "STRING":
		*v = SimpleTypeString
		return nil
	case "STRUCT_EMPTY":
		*v = SimpleTypeStructEmpty
		return nil
	default:
		val, err := strconv.ParseInt(s, 10, 32)
		if err != nil {
			return fmt.Errorf("unknown enum value %q for %q: %v", s, "SimpleType", err)
		}
		*v = SimpleType(val)
		return nil
	}
}
130713
func (g *Game) UnmarshalText(text []byte) error {
	game, err := decodePGN(string(text))
	if err != nil {
		return err
	}
	g.copy(game)
	return nil
}
338703
func (n *Node) UnmarshalText(text []byte) error {
	dec, err := ParseV4(string(text))
	if err == nil {
		*n = *dec
	}
	return err
}
750364
func (t *Token) UnmarshalText(data []byte) error {

	number := uint64(0)
	idx := 0.0
	chars := []byte(Base62)

	charsLength := float64(len(chars))
	tokenLength := float64(len(data))

	if tokenLength > MaxTokenLength {
		return ErrTokenTooBig
	} else if tokenLength < MinTokenLength {
		return ErrTokenTooSmall
	}

	for _, c := range data {
		power := tokenLength - (idx + 1)
		index := bytes.IndexByte(chars, c)
		if index < 0 {
			return ErrInvalidCharacter
		}
		number += uint64(index) * uint64(math.Pow(charsLength, power))
		idx++
	}

	// the token was successfully decoded
	*t = Token(number)
	return nil
}
713188
func (u *UUID) UnmarshalText(text []byte) error {
	t := uuid.UUID{}
	err := t.UnmarshalText(text)
	for i, b := range t.Bytes() {
		u[i] = b
	}
	return err
}
86057
func (n *NetID) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}
	if len(b) != len(n) {
		return fmt.Errorf("lorawan: exactly %d bytes are expected", len(n))
	}
	copy(n[:], b)
	return nil
}
65378
func (c *Cid) UnmarshalText(text []byte) error {
	decodedCid, err := Decode(string(text))
	if err != nil {
		return err
	}
	c.str = decodedCid.str
	return nil
}
580242
func (t *Time) UnmarshalText(data []byte) error {
	tt, err := time.Parse(time.RFC3339, string(data))
	if _, ok := err.(*time.ParseError); ok {
		tt, err = time.Parse(DeisDatetimeFormat, string(data))
		if _, ok := err.(*time.ParseError); ok {
			tt, err = time.Parse(PyOpenSSLTimeDateTimeFormat, string(data))
		}
	}
	*t = Time{&tt}
	return err
}
46094
func (h *Hash) UnmarshalText(input []byte) error {
	return hexutil.UnmarshalFixedText("Hash", input, h[:])
}
754746
func (i *Int) UnmarshalText(text []byte) error {
	var ss []int
	for _, x := range strings.Split(string(text), ",") {
		f, err := strconv.Atoi(x)
		if err != nil {
			return errors.WithStack(err)
		}
		ss = append(ss, f)
	}
	*i = ss
	return nil
}
857886
func (h *UnprefixedHash) UnmarshalText(input []byte) error {
	return hexutil.UnmarshalFixedUnprefixedText("UnprefixedHash", input, h[:])
}
514911
func (t *ISO8601Time) UnmarshalText(text []byte) error {
	ts, err := time.Parse(time.RFC3339, string(text))
	if err != nil {
		return err
	}
	*t = ISO8601Time(ts)
	return nil
}
429022
func (a *DevAddr) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}

	if len(b) != len(a) {
		return fmt.Errorf("lorawan: exactly %d bytes are expected", len(a))
	}
	copy(a[:], b)
	return nil
}
1309852
func (bh *Header) UnmarshalText(text []byte) error {
	if bh.seenRefs == nil {
		bh.seenRefs = set{}
	}
	if bh.seenGroups == nil {
		bh.seenGroups = set{}
	}
	if bh.seenProgs == nil {
		bh.seenProgs = set{}
	}
	var t Tag
	for i, l := range bytes.Split(text, []byte{'\n'}) {
		if len(l) > 0 && l[len(l)-1] == '\r' {
			l = l[:len(l)-1]
		}
		if len(l) == 0 {
			continue
		}
		if l[0] != '@' || len(l) < 3 {
			return errBadHeader
		}
		copy(t[:], l[1:3])
		var err error
		switch t {
		case headerTag:
			err = headerLine(l, bh)
		case refDictTag:
			err = referenceLine(l, bh)
		case readGroupTag:
			err = readGroupLine(l, bh)
		case programTag:
			err = programLine(l, bh)
		case commentTag:
			err = commentLine(l, bh)
		default:
			return errBadHeader
		}
		if err != nil {
			return fmt.Errorf("%v: line %d: %q", err, i+1, l)
		}
	}

	return nil
}
809821
func (d *MyDuration) UnmarshalText(text []byte) error {
	res, err := time.ParseDuration(string(text))
	if err != nil {
		return err
	}
	d.Duration = res
	return nil
}
211176
func (co *ChangeOption) UnmarshalText(b []byte) error {
	s := strings.ToLower(strings.Trim(string(b), `"`))
	switch s {
	case strings.ToLower(string(RestartAllOnInstanceChanged)), strings.ToLower(string(RestartAllOnInstanceZeroDown)):
		*co = ChangeOption(s)
	case "":
		*co = DefaultChangeOption
	default:
		return errors.New("Invalid ChangeOption: " + s)
	}
	return nil
}