File: go1_21_context.go

package info (click to toggle)
golang-github-traefik-yaegi 0.16.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 24,608 kB
  • sloc: sh: 457; makefile: 39
file content (62 lines) | stat: -rw-r--r-- 2,032 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Code generated by 'yaegi extract context'. DO NOT EDIT.

//go:build go1.21 && !go1.22
// +build go1.21,!go1.22

package stdlib

import (
	"context"
	"reflect"
	"time"
)

func init() {
	Symbols["context/context"] = map[string]reflect.Value{
		// function, constant and variable definitions
		"AfterFunc":         reflect.ValueOf(context.AfterFunc),
		"Background":        reflect.ValueOf(context.Background),
		"Canceled":          reflect.ValueOf(&context.Canceled).Elem(),
		"Cause":             reflect.ValueOf(context.Cause),
		"DeadlineExceeded":  reflect.ValueOf(&context.DeadlineExceeded).Elem(),
		"TODO":              reflect.ValueOf(context.TODO),
		"WithCancel":        reflect.ValueOf(context.WithCancel),
		"WithCancelCause":   reflect.ValueOf(context.WithCancelCause),
		"WithDeadline":      reflect.ValueOf(context.WithDeadline),
		"WithDeadlineCause": reflect.ValueOf(context.WithDeadlineCause),
		"WithTimeout":       reflect.ValueOf(context.WithTimeout),
		"WithTimeoutCause":  reflect.ValueOf(context.WithTimeoutCause),
		"WithValue":         reflect.ValueOf(context.WithValue),
		"WithoutCancel":     reflect.ValueOf(context.WithoutCancel),

		// type definitions
		"CancelCauseFunc": reflect.ValueOf((*context.CancelCauseFunc)(nil)),
		"CancelFunc":      reflect.ValueOf((*context.CancelFunc)(nil)),
		"Context":         reflect.ValueOf((*context.Context)(nil)),

		// interface wrapper definitions
		"_Context": reflect.ValueOf((*_context_Context)(nil)),
	}
}

// _context_Context is an interface wrapper for Context type
type _context_Context struct {
	IValue    interface{}
	WDeadline func() (deadline time.Time, ok bool)
	WDone     func() <-chan struct{}
	WErr      func() error
	WValue    func(key any) any
}

func (W _context_Context) Deadline() (deadline time.Time, ok bool) {
	return W.WDeadline()
}
func (W _context_Context) Done() <-chan struct{} {
	return W.WDone()
}
func (W _context_Context) Err() error {
	return W.WErr()
}
func (W _context_Context) Value(key any) any {
	return W.WValue(key)
}