func (srv *Server) Handlers(f interface{}) []Handler {
	rootv := reflect.ValueOf(f)
	wt, argInterfacet, err := checkHandlersWrapperFunc(rootv)
	if err != nil {
		panic(errgo.Notef(err, "bad handler function"))
	}
	hasClose := wt.Implements(ioCloserType)
	hs := make([]Handler, 0, wt.NumMethod())
	for i := 0; i < wt.NumMethod(); i++ {
		i := i
		m := wt.Method(i)
		if m.PkgPath != "" {
			continue
		}
		if m.Name == "Close" {
			if !hasClose {
				panic(errgo.Newf("bad type for Close method (got %v want func(%v) error", m.Type, wt))
			}
			continue
		}
		if wt.Kind() != reflect.Interface {
			// The type in the Method struct includes the receiver type,
			// which we don't want to look at (and we won't see when
			// we get the method from the actual value at dispatch time),
			// so we hide it.
			m.Type = withoutReceiver(m.Type)
		}
		h, err := srv.methodHandler(m, rootv, argInterfacet, hasClose)
		if err != nil {
			panic(err)
		}
		hs = append(hs, h)
	}
	if len(hs) == 0 {
		panic(errgo.Newf("no exported methods defined on %s", wt))
	}
	return hs
}
// Handlers returns a list of handlers that will be handled by the value
// returned by the given argument, which must be a function in one of the
// following forms:
//
// 	func(p httprequest.Params) (T, context.Context, error)
// 	func(p httprequest.Params, handlerArg I) (T, context.Context, error)
//
// for some type T and some interface type I. Each exported method defined on T defines a handler,
// and should be in one of the forms accepted by Server.Handle
// with the additional constraint that the argument to each
// of the handlers must be compatible with the type I when the
// second form is used above.
//
// The returned context will be used as the value of Params.Context
// when Params is passed to any method. It will also be used
// when writing an error if the function returns an error.
//
// Handlers will panic if f is not of the required form, no methods are
// defined on T or any method defined on T is not suitable for Handle.
//
// When any of the returned handlers is invoked, f will be called and
// then the appropriate method will be called on the value it returns.
// If specified, the handlerArg parameter to f will hold the ArgT argument that
// will be passed to the handler method.
//
// If T implements io.Closer, its Close method will be called
// after the request is completed.
Handlers returns a list of handlers that will be handled by the value
returned by the given argument, which must be a function in one of the
following forms.

func(p httprequest.Params) (T, context.Context, error)
func(p httprequest.Params, handlerArg I) (T, context.Context, error)

for some type T and some interface type I. Each exported method defined on T defines a handler,
and should be in one of the forms accepted by Server.Handle
with the additional constraint that the argument to each
of the handlers must be compatible with the type I when the
second form is used above.

The returned context will be used as the value of Params.Context
when Params is passed to any method. It will also be used
when writing an error if the function returns an error.

Handlers will panic if f is not of the required form, no methods are
defined on T or any method defined on T is not suitable for Handle.

When any of the returned handlers is invoked, f will be called and
then the appropriate method will be called on the value it returns.
If specified, the handlerArg parameter to f will hold the ArgT argument that
will be passed to the handler method.

If T implements io.Closer, its Close method will be called
after the request is completed.
// Handlers returns a list of handlers that will be handled by the value // returned by the given argument which must be a function in one of the // following forms : // // func ( p httprequest . Params ) ( T context . Context error ) // func ( p httprequest . Params handlerArg I ) ( T context . Context error ) // // for some type T and some interface type I . Each exported method defined on T defines a handler // and should be in one of the forms accepted by Server . Handle // with the additional constraint that the argument to each // of the handlers must be compatible with the type I when the // second form is used above . // // The returned context will be used as the value of Params . Context // when Params is passed to any method . It will also be used // when writing an error if the function returns an error . // // Handlers will panic if f is not of the required form no methods are // defined on T or any method defined on T is not suitable for Handle . // // When any of the returned handlers is invoked f will be called and // then the appropriate method will be called on the value it returns . // If specified the handlerArg parameter to f will hold the ArgT argument that // will be passed to the handler method . // // If T implements io . Closer its Close method will be called // after the request is completed .
func (srv *Server) Handlers(f interface{}) []Handler {
	rootv := reflect.ValueOf(f)
	wt, argInterfacet, err := checkHandlersWrapperFunc(rootv)
	if err != nil {
		panic(errgo.Notef(err, "bad handler function"))
	}
	hasClose := wt.Implements(ioCloserType)
	hs := make([]Handler, 0, wt.NumMethod())
	for i := 0; i < wt.NumMethod(); i++ {
		i := i
		m := wt.Method(i)
		if m.PkgPath != "" {
			continue
		}
		if m.Name == "Close" {
			if !hasClose {
				panic(errgo.Newf("bad type for Close method (got %v want func(%v) error", m.Type, wt))
			}
			continue
		}
		if wt.Kind() != reflect.Interface {
			m.Type = withoutReceiver(m.Type)
		}
		h, err := srv.methodHandler(m, rootv, argInterfacet, hasClose)
		if err != nil {
			panic(err)
		}
		hs = append(hs, h)
	}
	if len(hs) == 0 {
		panic(errgo.Newf("no exported methods defined on %s", wt))
	}
	return hs
}
func ( srv * Server ) Handlers ( f interface { } ) [ ] Handler { rootv := reflect . ValueOf ( f ) wt , argInterfacet , err := checkHandlersWrapperFunc ( rootv ) if err != nil { panic ( errgo . Notef ( err , " " ) ) } hasClose := wt . Implements ( ioCloserType ) hs := make ( [ ] Handler , 0 , wt . NumMethod ( ) ) for i := 0 ; i < wt . NumMethod ( ) ; i ++ { i := i m := wt . Method ( i ) if m . PkgPath != " " { continue } if m . Name == " " { if ! hasClose { panic ( errgo . Newf ( " " , m . Type , wt ) ) } continue } if wt . Kind ( ) != reflect . Interface { m . Type = withoutReceiver ( m . Type ) } h , err := srv . methodHandler ( m , rootv , argInterfacet , hasClose ) if err != nil { panic ( err ) } hs = append ( hs , h ) } if len ( hs ) == 0 { panic ( errgo . Newf ( " " , wt ) ) } return hs }
Handlers returns a list of handlers that will be handled by the value
returned by the given argument, which must be a function in one of the
following forms.
Handlers returns a list of handlers that will be handled by the value returned by the given argument which must be a function in one of the following forms .
// The type in the Method struct includes the receiver type, // which we don't want to look at (and we won't see when // we get the method from the actual value at dispatch time), // so we hide it.