// MustInterfaceToValue converts a native Go value x to a Value. If the
// conversion fails, this function will panic. This function is mostly for test
// purposes.
358776
func MustInterfaceToValue(x interface{}) Value {
	v, err := InterfaceToValue(x)
	if err != nil {
		panic(err)
	}
	return v
}
1251678
func ValidateInterface(v interface{}, ctx *Context) error {
	f := func(v string) (string, error) {
		return v, Validate(v, ctx)
	}

	walker := &renderWalker{
		F:       f,
		Replace: false,
	}
	err := reflectwalk.Walk(v, walker)
	if err != nil {
		return err
	}

	return nil
}
1053010
func (g *PCPGaugeVector) MustInc(inc float64, instance string) {
	if err := g.Inc(inc, instance); err != nil {
		panic(err)
	}
}
896759
func (v *CounterVec) MustCurryWith(labels Labels) *CounterVec {
	vec, err := v.CurryWith(labels)
	if err != nil {
		panic(err)
	}
	return vec
}
1329563
func (org *Organization) ConvertToView(usrMgr *user.Manager, valMgr *validation.Manager) (*OrganizationView, error) {
	view := &OrganizationView{}
	view.DNS = org.DNS
	view.Globalid = org.Globalid
	view.PublicKeys = org.PublicKeys
	view.SecondsValidity = org.SecondsValidity
	view.OrgOwners = org.OrgOwners
	view.OrgMembers = org.OrgMembers
	view.RequiredScopes = org.RequiredScopes
	view.IncludeSubOrgsOf = org.IncludeSubOrgsOf

	var err error
	view.Members, err = ConvertUsernamesToIdentifiers(org.Members, valMgr)
	if err != nil {
		return view, err
	}
	view.Owners, err = ConvertUsernamesToIdentifiers(org.Owners, valMgr)

	return view, err
}
744024
func LValueToInterface(val lua.LValue) interface{} {
	switch val.Type() {
	case lua.LTNil:
		return nil
	case lua.LTBool:
		return lua.LVAsBool(val)
	case lua.LTNumber:
		return float64(lua.LVAsNumber(val))
	case lua.LTString:
		return lua.LVAsString(val)
	case lua.LTUserData:
		ud := val.(*lua.LUserData).Value
		switch v := ud.(type) {
		case *LuaMap:
			return v.m
		case *LuaList:
			return v.l
		default:
			return v
		}

	case lua.LTTable:
		t := val.(*lua.LTable)
		m := make(map[interface{}]interface{}, t.Len())
		t.ForEach(func(k, v lua.LValue) { m[k] = v })
		return m
	default:
		panic(fmt.Sprintf("unrecognized data type %#v", val))
	}
}
348128
func (r *Rule) RequiresDerivative() bool {
	for _, rule := range r.Egress {
		if rule.RequiresDerivative() {
			return true
		}
	}
	return false
}
720824
func boolFromInterface(val interface{}) (bool, error) {
	switch val.(type) {
	case bool:
		return val.(bool), nil
	}
	return false, fmt.Errorf("Expected boolean value for Bool, got \"%v\"\n", val)
}
229615
func (c *ConfigFile) MustValue(section, key string, defaultVal ...string) string {
	val, err := c.GetValue(section, key)
	if len(defaultVal) > 0 && (err != nil || len(val) == 0) {
		return defaultVal[0]
	}
	return val
}
1138692
func validateInterface(iface *net.Interface) error {
	if !ifaceNameRegexp.MatchString(iface.Name) {
		return fmt.Errorf("Invalid interface name %q", iface.Name)
	}
	return nil
}
1187682
func (s *VirtualInterface) SetVirtualInterfaceType(v string) *VirtualInterface {
	s.VirtualInterfaceType = &v
	return s
}
386551
func MakeInterface(length int, swap func(i, j int), less func(i, j int) bool) Interface {
	return &funcs{length, lessSwap{less, swap}}
}
1043104
func (p *Psyringe) MustInject(targets ...interface{}) {
	if err := p.Inject(targets...); err != nil {
		panic(err)
	}
}
1041496
func (w *ByteWriter) MustWriteVal(val interface{}, offset int) int {
	if off, err := w.WriteVal(val, offset); err != nil {
		panic(err)
	} else {
		return off
	}
}
221879
func (d *Dispatch) MustCall(method string, params ...interface{}) (result *VARIANT) {
	id, err := d.GetId(method)
	if err != nil {
		panic(err)
	}

	result, err = d.Invoke(id, DISPATCH_METHOD, params)
	if err != nil {
		panic(err)
	}

	return
}
814167
func CastInterfaceToInterfaceSlice(slice interface{}) ([]interface{}, error) {
	s := reflect.ValueOf(slice)
	if s.Kind() != reflect.Slice {
		return []interface{}{}, fmt.Errorf("Input is not a slice: %#v", slice)
	}

	ret := make([]interface{}, s.Len())

	for i := 0; i < s.Len(); i++ {
		ret[i] = s.Index(i).Interface()
	}

	return ret, nil
}
1286765
func (f *Forms) MustInt(key string, defaults ...int) int {
	v, err := strconv.Atoi((*http.Request)(f).FormValue(key))
	if len(defaults) > 0 && err != nil {
		return defaults[0]
	}
	return v
}