// RWDFromString returns a rw.ReadWriteDeleter from it's name.
492460
func RWDFromString(str string) rw.ReadWriteDeleter {
	var res rw.ReadWriteDeleter
	switch str {
	case "file":
		res = &file.File{}
	case "gcs":
		res = &gcs.GCS{}
	case "s3":
		res = &s3.S3{}
	}
	return res
}
463629
func idFromString(s string) (string, error) {
	_, err := uuid.FromString(s)
	if err != nil {
		return "", ErrMalformed
	}

	return s, nil
}
1141010
func (ctx *Context) RenderFromString(tplSrc string, data ...map[string]interface{}) {
	var renderData map[string]interface{}
	if len(data) == 0 {
		renderData = make(map[string]interface{})
	} else {
		renderData = data[0]
	}
	renderData["xsrf_token"] = ctx.xsrfToken()
	content, e := ctx.App.View.RenderFromString(ctx.templateLoader, tplSrc, renderData)
	if e != nil {
		panic(e)
	}
	ctx.Send(content)
}
449071
func NewFromString(endpoint string, client *http.Client) (*Client, error) {
	e, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	return New(e, client), nil
}
733842
func LevelFromString(t string) (Level, error) {
	l := Level(0)
	err := (&l).UnmarshalText([]byte(t))
	return l, err
}
1106148
func TraceIDFromString(s string) (TraceID, error) {
	var hi, lo uint64
	var err error
	if len(s) > 32 {
		return TraceID{}, fmt.Errorf("TraceID cannot be longer than 32 hex characters: %s", s)
	} else if len(s) > 16 {
		hiLen := len(s) - 16
		if hi, err = strconv.ParseUint(s[0:hiLen], 16, 64); err != nil {
			return TraceID{}, err
		}
		if lo, err = strconv.ParseUint(s[hiLen:], 16, 64); err != nil {
			return TraceID{}, err
		}
	} else {
		if lo, err = strconv.ParseUint(s, 16, 64); err != nil {
			return TraceID{}, err
		}
	}
	return TraceID{High: hi, Low: lo}, nil
}
788870
func (c *RWI) WriteFrom(r io.Reader) error {
	_, err := io.Copy(c.writer, r)
	return err
}
1106664
func (r Render) AddFromString(name, templateString string) *template.Template {
	tmpl := template.Must(template.New(name).Parse(templateString))
	r.Add(name, tmpl)
	return tmpl
}
986742
func (w *Writer) WriteString(s string) (int, error) {
	c, l, ln := cap(w.buf), len(w.buf), len(s)
	avail := c - l

	// requires flush
	if avail < ln {
		if err := w.Flush(); err != nil {
			return 0, err
		}
		l = len(w.buf)
	}
	// too big to fit in buffer;
	// write directly to w.w
	//
	// yes, this is unsafe. *but*
	// io.Writer is not allowed
	// to mutate its input or
	// maintain a reference to it,
	// per the spec in package io.
	//
	// plus, if the string is really
	// too big to fit in the buffer, then
	// creating a copy to write it is
	// expensive (and, strictly speaking,
	// unnecessary)
	if c < ln {
		return w.w.Write(unsafestr(s))
	}

	// grow buf slice; copy; return
	w.buf = w.buf[:l+ln]
	return copy(w.buf[l:], s), nil
}
798900
func VolumeFromString(vp string) (*Volume, error) {
	vp = "name=" + vp
	vpQuery, err := common.MakeQueryString(vp)
	if err != nil {
		return nil, err
	}

	v, err := url.ParseQuery(vpQuery)
	if err != nil {
		return nil, err
	}
	return VolumeFromParams(v)
}
11677
func (b *BinaryAttribute) GetSysValFromString(userVal string) []byte {
	f, err := strconv.ParseFloat(userVal, 64)
	if err != nil {
		panic(err)
	}
	ret := make([]byte, 1)
	if f > 0 {
		ret[0] = 1
	}
	return ret
}
531142
func TypeFromString(t string) value.ValueType {
	switch strings.ToLower(t) {
	case "integer":
		// This isn't necessarily true, as integer could be bool
		return value.IntType
	case "real":
		return value.NumberType
	default:
		return value.StringType
	}
}
394750
func (d *Digest) WriteString(s string) (n int, err error) {
	return d.Write([]byte(s))
}
1206197
func NewFromString(encoded string) (*Value, error) {
	out, err := base64.RawURLEncoding.DecodeString(encoded)
	if err != nil {
		return nil, err
	}

	return New(out), nil
}
527154
func MustFromString(str string) UUID {
	u, err := FromString(str)
	if err != nil {
		panic(err)
	}

	return u
}
854183
func ReadString(r Reader) (String, error) {
	var s String
	err := s.ReadFrom(r, UNKNOWN_LEN)
	return s, err
}
98218
func HashFromString(dataStr string) (Hash, error) {
	data, err := hex.DecodeString(dataStr)
	if err != nil {
		return Hash{}, errors.WithStack(err)
	}
	return HashFromBytes(data)
}