github.com/HaHadaxigua/yaegi@v1.0.1/stdlib/go1_16_context.go (about)

     1  // Code generated by 'yaegi extract context'. DO NOT EDIT.
     2  
     3  // +build go1.16,!go1.17
     4  
     5  package stdlib
     6  
     7  import (
     8  	"context"
     9  	"reflect"
    10  	"time"
    11  )
    12  
    13  func init() {
    14  	Symbols["context/context"] = map[string]reflect.Value{
    15  		// function, constant and variable definitions
    16  		"Background":       reflect.ValueOf(context.Background),
    17  		"Canceled":         reflect.ValueOf(&context.Canceled).Elem(),
    18  		"DeadlineExceeded": reflect.ValueOf(&context.DeadlineExceeded).Elem(),
    19  		"TODO":             reflect.ValueOf(context.TODO),
    20  		"WithCancel":       reflect.ValueOf(context.WithCancel),
    21  		"WithDeadline":     reflect.ValueOf(context.WithDeadline),
    22  		"WithTimeout":      reflect.ValueOf(context.WithTimeout),
    23  		"WithValue":        reflect.ValueOf(context.WithValue),
    24  
    25  		// type definitions
    26  		"CancelFunc": reflect.ValueOf((*context.CancelFunc)(nil)),
    27  		"Context":    reflect.ValueOf((*context.Context)(nil)),
    28  
    29  		// interface wrapper definitions
    30  		"_Context": reflect.ValueOf((*_context_Context)(nil)),
    31  	}
    32  }
    33  
    34  // _context_Context is an interface wrapper for Context type
    35  type _context_Context struct {
    36  	IValue    interface{}
    37  	WDeadline func() (deadline time.Time, ok bool)
    38  	WDone     func() <-chan struct{}
    39  	WErr      func() error
    40  	WValue    func(key interface{}) interface{}
    41  }
    42  
    43  func (W _context_Context) Deadline() (deadline time.Time, ok bool) {
    44  	return W.WDeadline()
    45  }
    46  func (W _context_Context) Done() <-chan struct{} {
    47  	return W.WDone()
    48  }
    49  func (W _context_Context) Err() error {
    50  	return W.WErr()
    51  }
    52  func (W _context_Context) Value(key interface{}) interface{} {
    53  	return W.WValue(key)
    54  }