// FromString returns UUID parsed from string input.
// Input is expected in a form accepted by UnmarshalText.
184243
func FromString(input string) (u UUID, err error) {
	err = u.UnmarshalText([]byte(input))
	return
}
194986
func FromString(id string) (ID, error) {
	i := &ID{}
	err := i.UnmarshalText([]byte(id))
	return *i, err
}
1020395
func ToString(i interface{}) string {
	switch t := i.(type) {
	case nil:
		return ""
	case []byte:
		return string(t)
	case string:
		return t
	case *string:
		return *t
	case bool:
		return strconv.FormatBool(t)
	case float32:
		return strconv.FormatFloat(float64(t), 'f', -1, 32)
	case float64:
		return strconv.FormatFloat(t, 'f', -1, 64)
	case int:
		return strconv.Itoa(t)
	case int32:
		return strconv.FormatInt(int64(t), 10)
	case int64:
		return strconv.FormatInt(t, 10)
	case template.HTML:
		return string(t)
	case template.URL:
		return string(t)
	case fmt.Stringer:
		return t.String()
	case error:
		return t.Error()
	default:
		return fmt.Sprint(i)
	}
}
864264
func FromHexString(s string) (Multihash, error) {
	b, err := hex.DecodeString(s)
	if err != nil {
		return Multihash{}, err
	}

	return Cast(b)
}
262129
func FromString(str string) (UUID, error) {
	u := UUID{}

	err := u.SetString(str)

	return u, err
}
230116
func (t *TransportPort) FromString(s string) error {
	ps := strings.Split(s, "/")
	if len(ps) == 2 {
		t.Proto = ParseProtocol(ps[0])
		if p, err := strconv.ParseUint(ps[1], 10, 16); err == nil {
			t.Port = uint16(p)
			return nil
		}
	}
	return BadRequestErrorf("invalid format for transport port: %s", s)
}
391373
func FromBytes(b []byte) (KSUID, error) {
	var ksuid KSUID

	if len(b) != byteLength {
		return Nil, errSize
	}

	copy(ksuid[:], b)
	return ksuid, nil
}
1093867
func (intstr *IntOrString) String() string {
	if intstr.Type == String {
		return intstr.StrVal
	}
	return strconv.Itoa(intstr.IntValue())
}
878768
func (f *FileName) FromString(name string) {
	name = strings.TrimPrefix(name, "/")

	cp := strings.Split(name, "/")

	cp = append([]string{serverPolicyRootShareName}, cp...)

	f.Name = strings.Join(cp, "\x00")
	f.Length = uint32(len(f.Name))
}
943103
func (u UUID) String() string {
	output := make([]byte, UUIDStringLen)

	output[0] = hexBytes[(u[0]&0xf0)>>4]
	output[1] = hexBytes[(u[0] & 0x0f)]
	output[2] = hexBytes[(u[1]&0xf0)>>4]
	output[3] = hexBytes[(u[1] & 0x0f)]
	output[4] = hexBytes[(u[2]&0xf0)>>4]
	output[5] = hexBytes[(u[2] & 0x0f)]
	output[6] = hexBytes[(u[3]&0xf0)>>4]
	output[7] = hexBytes[(u[3] & 0x0f)]
	output[8] = '-'
	output[9] = hexBytes[(u[4]&0xf0)>>4]
	output[10] = hexBytes[(u[4] & 0x0f)]
	output[11] = hexBytes[(u[5]&0xf0)>>4]
	output[12] = hexBytes[(u[5] & 0x0f)]
	output[13] = '-'
	output[14] = hexBytes[(u[6]&0xf0)>>4]
	output[15] = hexBytes[(u[6] & 0x0f)]
	output[16] = hexBytes[(u[7]&0xf0)>>4]
	output[17] = hexBytes[(u[7] & 0x0f)]
	output[18] = '-'
	output[19] = hexBytes[(u[8]&0xf0)>>4]
	output[20] = hexBytes[(u[8] & 0x0f)]
	output[21] = hexBytes[(u[9]&0xf0)>>4]
	output[22] = hexBytes[(u[9] & 0x0f)]
	output[23] = '-'
	output[24] = hexBytes[(u[10]&0xf0)>>4]
	output[25] = hexBytes[(u[10] & 0x0f)]
	output[26] = hexBytes[(u[11]&0xf0)>>4]
	output[27] = hexBytes[(u[11] & 0x0f)]
	output[28] = hexBytes[(u[12]&0xf0)>>4]
	output[29] = hexBytes[(u[12] & 0x0f)]
	output[30] = hexBytes[(u[13]&0xf0)>>4]
	output[31] = hexBytes[(u[13] & 0x0f)]
	output[32] = hexBytes[(u[14]&0xf0)>>4]
	output[33] = hexBytes[(u[14] & 0x0f)]
	output[34] = hexBytes[(u[15]&0xf0)>>4]
	output[35] = hexBytes[(u[15] & 0x0f)]

	return string(output)
}
1081274
func (c *Client) FromString(targetPath, content string) (resource.Resource, error) {
	return c.rs.ResourceCache.GetOrCreate(resources.CACHE_OTHER, targetPath, func() (resource.Resource, error) {
		return c.rs.NewForFs(
			c.rs.FileCaches.AssetsCache().Fs,
			resources.ResourceSourceDescriptor{
				LazyPublish: true,
				OpenReadSeekCloser: func() (hugio.ReadSeekCloser, error) {
					return hugio.NewReadSeekerNoOpCloserFromString(content), nil
				},
				RelTargetFilename: filepath.Clean(targetPath)})

	})

}
293526
func FromString(in string) (*Signature, error) {
	var res Signature = Signature{}
	var key string
	var value string

	for _, m := range signatureRegex.FindAllStringSubmatch(in, -1) {
		key = m[1]
		value = m[2]

		if key == "keyId" {
			res.KeyID = value
		} else if key == "algorithm" {
			alg, err := algorithmFromString(value)
			if err != nil {
				return nil, err
			}
			res.Algorithm = alg
		} else if key == "headers" {
			res.Headers = headerListFromString(value)
		} else if key == "signature" {
			res.Signature = value
		} else {
			return nil, errors.New(fmt.Sprintf("Unexpected key in signature '%s'", key))
		}
	}

	if len(res.Signature) == 0 {
		return nil, errors.New("Missing signature")
	}

	if len(res.KeyID) == 0 {
		return nil, errors.New("Missing keyId")
	}

	if res.Algorithm == nil {
		return nil, errors.New("Missing algorithm")
	}

	return &res, nil
}
730719
func (res *RemotePvtDataResponse) ToString() string {
	a := make([]string, len(res.Elements))
	for i, el := range res.Elements {
		a[i] = fmt.Sprintf("%s with %d elements", el.Digest.String(), len(el.Payload))
	}
	return fmt.Sprintf("%v", a)
}
1230194
func (uuid uuid) string() string {
	if uuid == nil || len(uuid) != 16 {
		return ""
	}
	b := []byte(uuid)
	return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x",
		b[:4], b[4:6], b[6:8], b[8:10], b[10:])
}
364997
func FromString(input string, options ...Options) (string, error) {
	bs := bom.CleanBom([]byte(input))
	text, err := FromReader(bytes.NewReader(bs), options...)
	if err != nil {
		return "", err
	}
	return text, nil
}
394859
func (formatter *Formatter) ToString(data interface{}) string {
	if str, ok := data.(string); ok {
		return str
	}

	if byteSlice, ok := data.([]byte); ok {
		return string(byteSlice)
	}

	return fmt.Sprintf("%v", data)
}
607563
func (dm DiffMappings) ToString(sourceContainer tlc.Container, targetContainer tlc.Container) string {
	s := ""
	for sourceIndex, diffMapping := range dm {
		s += fmt.Sprintf("%s <- %s (%s in common)\n",
			sourceContainer.Files[sourceIndex].Path,
			targetContainer.Files[diffMapping.TargetIndex].Path,
			progress.FormatBytes(diffMapping.NumBytes),
		)
	}
	return s
}