// UnmarshalChaincodeID returns a ChaincodeID from bytes
762379
func UnmarshalChaincodeID(bytes []byte) (*pb.ChaincodeID, error) {
	ccid := &pb.ChaincodeID{}
	err := proto.Unmarshal(bytes, ccid)
	if err != nil {
		return nil, errors.Wrap(err, "error unmarshaling ChaincodeID")
	}

	return ccid, nil
}
304116
func (p *RekeyIndPayload) UnmarshalBinary(data []byte) error {
	return p.DevLoRaWANVersion.UnmarshalBinary(data)
}
1206988
func (u *UUID) UnmarshalText(text []byte) error {
	id := make([]byte, base64.StdEncoding.DecodedLen(len(text)))
	length, err := base64.StdEncoding.Decode(id, text)
	if err != nil {
		return err
	}
	if length != 16 {
		return ErrInvalidUUIDLength
	}
	copy((*u)[:], id[:16])
	return nil
}
323225
func (id *FlexID) UnmarshalText(b []byte) error {
	if id == nil {
		return errNilValue
	}
	parts := strings.Split(string(b), pathSeperator)
	switch len(parts) {
	case 1:
		// Try to parse as a Manifold ID
		mid := &ID{}
		if err := mid.UnmarshalText(b); err != nil {
			return errInvalidParts
		}
		copy(id[:], (*mid.AsFlexID())[:])
	case 3:
		copy(id[:], parts)
	default:
		return errInvalidParts
	}

	if err := id.Validate(nil); err != nil {
		return err
	}

	return nil
}
668239
func (r *RequestWriteV3) UnmarshalBinary(data []byte) error {
	return UnmarshalBinary(data, &r.Handle, &r.WriteFlags, &r.Offset, &r.RequiredSize, &r.Reserved, &r.Payload)
}
759295
func (id *ULID) UnmarshalText(v []byte) error {
	return parse(v, false, id)
}
803221
func (id *ID) UnmarshalText(buf []byte) error {
	s := string(buf)
	bytes, err := hex.DecodeString(s)
	if err != nil {
		return errors.WithStack(InvalidIDError{s})
	}
	return id.UnmarshalBinary(bytes)
}
800265
func (id *ObjectID) UnmarshalJSON(data []byte) (err error) {
	a := bson.NewObjectId()
	err = a.UnmarshalJSON(data)
	if err != nil {
		log.Printf("ERROR: %s\n", err)
		return
	}
	*id = ObjectID(a)
	return
}
403169
func (c *Code) UnmarshalText(text []byte) error {
	i, ok := _stringToCode[strings.ToLower(string(text))]
	if !ok {
		return fmt.Errorf("unknown code string: %s", string(text))
	}
	*c = i
	return nil
}
723217
func (id *ID) UnmarshalBinary(data []byte) error {
	return id.h.UnmarshalBinary(data)
}
791218
func UnmarshalUUID(s string) (uuid UUID, err error) {
	if len(s) != 36 {
		err = errors.New("Invalid UUID length")
		return
	}
	if s[8:9] != "-" || s[13:14] != "-" || s[18:19] != "-" || s[23:24] != "-" {
		err = errors.New("Invalid UUID format")
		return
	}

	b, err := hex.DecodeString(s[0:8] + s[9:13] + s[14:18] + s[19:23] + s[24:])
	if err != nil {
		return
	}

	_, err = io.ReadFull(bytes.NewBuffer(b), uuid[:])
	return
}
550666
func (u *UUID) UnmarshalJSON(b []byte) (err error) {
	var ovsUUID []string
	if err := json.Unmarshal(b, &ovsUUID); err == nil {
		u.GoUUID = ovsUUID[1]
	}
	return err
}
832452
func (id *ID) UnmarshalJSON(data []byte) error {
	i, err := parseJSONString(data)
	if err == nil {
		*id = i
		return nil
	}

	i, err = parseJSONInt(data)
	if err == nil {
		*id = i
		return nil
	}

	return fmt.Errorf("%s is not a valid ID", data)
}
696228
func (p *ResetIndPayload) UnmarshalBinary(data []byte) error {
	return p.DevLoRaWANVersion.UnmarshalBinary(data)
}
260725
func (c *Code) UnmarshalJSON(b []byte) error {
	// From json.Unmarshaler: By convention, to approximate the behavior of
	// Unmarshal itself, Unmarshalers implement UnmarshalJSON([]byte("null")) as
	// a no-op.
	if string(b) == "null" {
		return nil
	}
	if c == nil {
		return fmt.Errorf("nil receiver passed to UnmarshalJSON")
	}

	if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil {
		if ci >= _maxCode {
			return fmt.Errorf("invalid code: %q", ci)
		}

		*c = Code(ci)
		return nil
	}

	if jc, ok := strToCode[string(b)]; ok {
		*c = jc
		return nil
	}
	return fmt.Errorf("invalid code: %q", string(b))
}
86845
func (u *UUID) UnmarshalJSON(b []byte) error {
	var s string
	if err := json.Unmarshal(b, &s); err != nil {
		return err
	}

	new, err := ParseUUID(s)
	if err == nil {
		u.UUID = new.UUID
	}
	return err
}
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
}