Documentation
¶
Overview ¶
Package stubs is the method-signature "shape" catalog (S1..S16) that lets interpreted methods satisfy native stdlib interfaces (fmt.Stringer, json.Marshaler, sort.Interface, io.Reader, ...) at the reflect boundary.
Each shape has a generated stub pool (pool_s*.go) and a hand-written handler dispatcher (registry_s*.go). The Attach* wrappers resolve a method's shape to a free stub slot PC, then delegate rtype synthesis to runtype.
Index ¶
- func FillMethods(res *runtype.Reservation, methods []Method) error
- func SlotsUsedS1() uint32
- func SlotsUsedS2() uint32
- func SlotsUsedS3() uint32
- func SlotsUsedS4() uint32
- func SlotsUsedS5() uint32
- func SlotsUsedS6() uint32
- func SlotsUsedS7() uint32
- func SlotsUsedS8() uint32
- func SlotsUsedS9() uint32
- func SlotsUsedS10() uint32
- func SlotsUsedS11() uint32
- func SlotsUsedS12() uint32
- func SlotsUsedS13() uint32
- func SlotsUsedS14() uint32
- func SlotsUsedS15() uint32
- func SlotsUsedS16() uint32
- func SlotsUsedS17() uint32
- func SlotsUsedS18() uint32
- func SlotsUsedS19() uint32
- func SlotsUsedS20() uint32
- func SlotsUsedS21() uint32
- func SlotsUsedS22() uint32
- func SlotsUsedS23() uint32
- func SlotsUsedS24() uint32
- func SlotsUsedS25() uint32
- func SlotsUsedS26() uint32
- func SlotsUsedS27() uint32
- func SlotsUsedS28() uint32
- func SlotsUsedS29() uint32
- func SlotsUsedS30() uint32
- func SlotsUsedS31() uint32
- type HandlerS1
- type HandlerS2
- type HandlerS3
- type HandlerS4
- type HandlerS5
- type HandlerS6
- type HandlerS7
- type HandlerS8
- type HandlerS9
- type HandlerS10
- type HandlerS11
- type HandlerS12
- type HandlerS13
- type HandlerS14
- type HandlerS15
- type HandlerS16
- type HandlerS17
- type HandlerS18
- type HandlerS19
- type HandlerS20
- type HandlerS21
- type HandlerS22
- type HandlerS23
- type HandlerS24
- type HandlerS25
- type HandlerS26
- type HandlerS27
- type HandlerS28
- type HandlerS29
- type HandlerS30
- type HandlerS31
- type Method
- type Shape
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FillMethods ¶
func FillMethods(res *runtype.Reservation, methods []Method) error
FillMethods installs methods into a reserved rtype in place (the reserve/fill path), resolving each method's stub slot first.
func SlotsUsedS1 ¶
func SlotsUsedS1() uint32
SlotsUsedS1 reports how many S1 stub slots have been consumed. Exported for tests that verify idempotency at the interp layer.
func SlotsUsedS2 ¶
func SlotsUsedS2() uint32
SlotsUsedS2 reports how many S2 stub slots have been consumed.
func SlotsUsedS3 ¶
func SlotsUsedS3() uint32
SlotsUsedS3 reports how many S3 stub slots have been consumed.
func SlotsUsedS4 ¶
func SlotsUsedS4() uint32
SlotsUsedS4 reports how many S4 stub slots have been consumed.
func SlotsUsedS5 ¶
func SlotsUsedS5() uint32
SlotsUsedS5 reports how many S5 stub slots have been consumed.
func SlotsUsedS6 ¶
func SlotsUsedS6() uint32
SlotsUsedS6 reports how many S6 stub slots have been consumed.
func SlotsUsedS7 ¶
func SlotsUsedS7() uint32
SlotsUsedS7 reports how many S7 stub slots have been consumed.
func SlotsUsedS8 ¶
func SlotsUsedS8() uint32
SlotsUsedS8 reports how many S8 stub slots have been consumed.
func SlotsUsedS9 ¶
func SlotsUsedS9() uint32
SlotsUsedS9 reports how many S9 stub slots have been consumed.
func SlotsUsedS10 ¶
func SlotsUsedS10() uint32
SlotsUsedS10 reports how many S10 stub slots have been consumed.
func SlotsUsedS11 ¶
func SlotsUsedS11() uint32
SlotsUsedS11 reports how many S11 stub slots have been consumed.
func SlotsUsedS12 ¶
func SlotsUsedS12() uint32
SlotsUsedS12 reports how many S12 stub slots have been consumed.
func SlotsUsedS13 ¶
func SlotsUsedS13() uint32
SlotsUsedS13 reports how many S13 stub slots have been consumed.
func SlotsUsedS14 ¶
func SlotsUsedS14() uint32
SlotsUsedS14 reports how many S14 stub slots have been consumed.
func SlotsUsedS15 ¶
func SlotsUsedS15() uint32
SlotsUsedS15 reports how many S15 stub slots have been consumed.
func SlotsUsedS16 ¶
func SlotsUsedS16() uint32
SlotsUsedS16 reports how many S16 stub slots have been consumed.
func SlotsUsedS17 ¶
func SlotsUsedS17() uint32
SlotsUsedS17 reports how many S17 stub slots have been consumed.
func SlotsUsedS18 ¶
func SlotsUsedS18() uint32
SlotsUsedS18 reports how many S18 stub slots have been consumed.
func SlotsUsedS19 ¶
func SlotsUsedS19() uint32
SlotsUsedS19 reports how many S19 stub slots have been consumed.
func SlotsUsedS20 ¶
func SlotsUsedS20() uint32
SlotsUsedS20 reports how many S20 stub slots have been consumed.
func SlotsUsedS21 ¶
func SlotsUsedS21() uint32
SlotsUsedS21 reports how many S21 stub slots have been consumed.
func SlotsUsedS22 ¶
func SlotsUsedS22() uint32
SlotsUsedS22 reports how many S22 stub slots have been consumed.
func SlotsUsedS23 ¶
func SlotsUsedS23() uint32
SlotsUsedS23 reports how many S23 stub slots have been consumed.
func SlotsUsedS24 ¶
func SlotsUsedS24() uint32
SlotsUsedS24 reports how many S24 stub slots have been consumed.
func SlotsUsedS25 ¶
func SlotsUsedS25() uint32
SlotsUsedS25 reports how many S25 stub slots have been consumed.
func SlotsUsedS26 ¶
func SlotsUsedS26() uint32
SlotsUsedS26 reports how many S26 stub slots have been consumed.
func SlotsUsedS27 ¶
func SlotsUsedS27() uint32
SlotsUsedS27 reports how many S27 stub slots have been consumed.
func SlotsUsedS28 ¶
func SlotsUsedS28() uint32
SlotsUsedS28 reports how many S28 stub slots have been consumed.
func SlotsUsedS29 ¶
func SlotsUsedS29() uint32
SlotsUsedS29 reports how many S29 stub slots have been consumed.
func SlotsUsedS30 ¶
func SlotsUsedS30() uint32
SlotsUsedS30 reports how many S30 stub slots have been consumed.
func SlotsUsedS31 ¶
func SlotsUsedS31() uint32
SlotsUsedS31 reports how many S31 stub slots have been consumed.
Types ¶
type HandlerS1 ¶
HandlerS1 is the per-method callback for shape S1: func(*T) string. recv is the receiver pointer per Go's iface-dispatch convention. For non-direct kinds it points at the boxed value; for direct-iface kinds it IS the value reinterpreted as a pointer.
type HandlerS2 ¶
HandlerS2 is the per-method callback for shape S2: func(*T) ([]byte, error). Covers MarshalJSON, MarshalBinary, MarshalText.
type HandlerS3 ¶
HandlerS3 is the per-method callback for shape S3: func(*T, []byte) error. Covers UnmarshalJSON, UnmarshalBinary, UnmarshalText.
type HandlerS4 ¶
HandlerS4 is the per-method callback for shape S4: func(*T, error) bool. Covers errors.Is dispatch: (T).Is(target error) bool.
type HandlerS5 ¶
HandlerS5 is the per-method callback for shape S5: func(*T, any) bool. Covers errors.As dispatch: (T).As(target any) bool, where target is a non-nil pointer the method writes through.
type HandlerS6 ¶
HandlerS6 is the per-method callback for shape S6: func(*T) error. Covers single-error unwrap: (T).Unwrap() error.
type HandlerS7 ¶
HandlerS7 is the per-method callback for shape S7: func(*T) []error. Covers multi-error unwrap: (T).Unwrap() []error.
type HandlerS8 ¶
HandlerS8 is the per-method callback for shape S8: func(*T) int. Covers sort.Interface.Len.
type HandlerS9 ¶
HandlerS9 is the per-method callback for shape S9: func(*T, int, int) bool. Covers sort.Interface.Less.
type HandlerS10 ¶
HandlerS10 is the per-method callback for shape S10: func(*T, int, int). Covers sort.Interface.Swap (no result).
type HandlerS11 ¶
HandlerS11 is the per-method callback for shape S11: func(*T, any). Covers heap.Interface.Push (no result).
type HandlerS12 ¶
HandlerS12 is the per-method callback for shape S12: func(*T) any. Covers heap.Interface.Pop.
type HandlerS13 ¶
HandlerS13 is the per-method callback for shape S13: func(*T, []byte) (int, error). Covers io.Reader.Read and io.Writer.Write.
type HandlerS14 ¶
HandlerS14 is the per-method callback for shape S14: func(*T, fmt.State, rune). Covers fmt.Formatter.Format (no result).
type HandlerS15 ¶
HandlerS15 is the per-method callback for shape S15: func(*T, *xml.Encoder, xml.StartElement) error. Covers xml.Marshaler.MarshalXML.
type HandlerS16 ¶
HandlerS16 is the per-method callback for shape S16: func(*T, *xml.Decoder, xml.StartElement) error. Covers xml.Unmarshaler.UnmarshalXML.
type HandlerS17 ¶
HandlerS17 is the per-method callback for shape S17: func(*T) (int, bool). Covers fmt.State.Width and fmt.State.Precision.
type HandlerS18 ¶
HandlerS18 is the per-method callback for shape S18: func(*T, int) bool. Covers fmt.State.Flag.
type HandlerS19 ¶
HandlerS19 is the per-method callback for shape S19: func(*T, fmt.ScanState, rune) error. Covers fmt.Scanner.Scan.
type HandlerS20 ¶
HandlerS20 is the per-method callback for shape S20: func(*T, string) error. Covers flag.Value.Set.
type HandlerS21 ¶
HandlerS21 is the per-method callback for shape S21: func(*T) bool. Covers flag.boolFlag.IsBoolFlag.
type HandlerS22 ¶
HandlerS22 is the per-method callback for shape S22: func(*T) int64. Covers fs.FileInfo.Size.
type HandlerS23 ¶
HandlerS23 is the per-method callback for shape S23: func(*T) fs.FileMode. Covers fs.FileInfo.Mode and fs.DirEntry.Type.
type HandlerS24 ¶
HandlerS24 is the per-method callback for shape S24: func(*T) time.Time. Covers fs.FileInfo.ModTime.
type HandlerS25 ¶
HandlerS25 is the per-method callback for shape S25: func(*T) (fs.FileInfo, error). Covers fs.DirEntry.Info and fs.File.Stat.
type HandlerS26 ¶
HandlerS26 is the per-method callback for shape S26: func(*T, string) (fs.File, error). Covers fs.FS.Open.
type HandlerS27 ¶
HandlerS27 is the per-method callback for shape S27: func(*T, string) (fs.FileInfo, error). Covers fs.StatFS.Stat.
type HandlerS28 ¶
HandlerS28 is the per-method callback for shape S28: func(*T, string) (fs.FS, error). Covers fs.SubFS.Sub.
type HandlerS29 ¶
HandlerS29 is the per-method callback for shape S29: func(*T, string) ([]string, error). Covers fs.GlobFS.Glob.
type HandlerS30 ¶
HandlerS30 is the per-method callback for shape S30: func(*T, string) ([]fs.DirEntry, error). Covers fs.ReadDirFS.ReadDir.
type HandlerS31 ¶
HandlerS31 is the per-method callback for shape S31: func(*T, string) ([]byte, error). Covers fs.ReadFileFS.ReadFile.
type Method ¶
Method describes one method to install on a synthesized type. Shape selects which stub pool the slot comes from; Handler must be the matching HandlerS* function type for the Shape (default ShapeS1 expects HandlerS1).
type Shape ¶
type Shape uint8
Shape identifies a method-signature shape. Each shape has its own stub pool, handler type, and dispatcher. New shapes can be added without touching existing shapes.
const ( // ShapeS1 is func() string. // Covers fmt.Stringer.String, error.Error, fmt.GoStringer.GoString, // flag.Value.String. ShapeS1 Shape = 0 // ShapeS2 is func() ([]byte, error). // Covers json.Marshaler.MarshalJSON, encoding.BinaryMarshaler, // encoding.TextMarshaler, xml.Marshaler.MarshalXML (almost; subset). ShapeS2 Shape = 1 // ShapeS3 is func([]byte) error. // Covers json.Unmarshaler.UnmarshalJSON, encoding.BinaryUnmarshaler, // encoding.TextUnmarshaler. ShapeS3 Shape = 2 // ShapeS4 is func(error) bool. // Covers the errors-tree predicate errors.Is dispatches: (T).Is(error) bool. ShapeS4 Shape = 3 // ShapeS5 is func(any) bool. // Covers errors.As dispatch: (T).As(any) bool. ShapeS5 Shape = 4 // ShapeS6 is func() error. // Covers single-error unwrap: (T).Unwrap() error. ShapeS6 Shape = 5 // ShapeS7 is func() []error. // Covers multi-error unwrap: (T).Unwrap() []error. ShapeS7 Shape = 6 // ShapeS8 is func() int. // Covers sort.Interface.Len. ShapeS8 Shape = 7 // ShapeS9 is func(int, int) bool. // Covers sort.Interface.Less. ShapeS9 Shape = 8 // ShapeS10 is func(int, int). // Covers sort.Interface.Swap. ShapeS10 Shape = 9 // ShapeS11 is func(any). // Covers heap.Interface.Push. ShapeS11 Shape = 10 // ShapeS12 is func() any. // Covers heap.Interface.Pop. ShapeS12 Shape = 11 // ShapeS13 is func([]byte) (int, error). // Covers io.Reader.Read and io.Writer.Write. ShapeS13 Shape = 12 // ShapeS14 is func(fmt.State, rune). // Covers fmt.Formatter.Format. ShapeS14 Shape = 13 // ShapeS15 is func(*xml.Encoder, xml.StartElement) error. // Covers xml.Marshaler.MarshalXML. ShapeS15 Shape = 14 // ShapeS16 is func(*xml.Decoder, xml.StartElement) error. // Covers xml.Unmarshaler.UnmarshalXML. ShapeS16 Shape = 15 // ShapeS17 is func() (int, bool). // Covers fmt.State.Width and fmt.State.Precision. ShapeS17 Shape = 16 // ShapeS18 is func(int) bool. // Covers fmt.State.Flag. ShapeS18 Shape = 17 // ShapeS19 is func(fmt.ScanState, rune) error. // Covers fmt.Scanner.Scan. ShapeS19 Shape = 18 // ShapeS20 is func(string) error. // Covers flag.Value.Set. ShapeS20 Shape = 19 // ShapeS21 is func() bool. // Covers flag.boolFlag.IsBoolFlag. ShapeS21 Shape = 20 // ShapeS22 is func() int64. Covers fs.FileInfo.Size. ShapeS22 Shape = 21 // ShapeS23 is func() fs.FileMode. Covers fs.FileInfo.Mode and fs.DirEntry.Type. ShapeS23 Shape = 22 // ShapeS24 is func() time.Time. Covers fs.FileInfo.ModTime. ShapeS24 Shape = 23 // ShapeS25 is func() (fs.FileInfo, error). Covers fs.DirEntry.Info and fs.File.Stat. ShapeS25 Shape = 24 // ShapeS26 is func(string) (fs.File, error). Covers fs.FS.Open. ShapeS26 Shape = 25 // ShapeS27 is func(string) (fs.FileInfo, error). Covers fs.StatFS.Stat. ShapeS27 Shape = 26 // ShapeS28 is func(string) (fs.FS, error). Covers fs.SubFS.Sub. ShapeS28 Shape = 27 // ShapeS29 is func(string) ([]string, error). Covers fs.GlobFS.Glob. ShapeS29 Shape = 28 // ShapeS30 is func(string) ([]fs.DirEntry, error). Covers fs.ReadDirFS.ReadDir. ShapeS30 Shape = 29 // ShapeS31 is func(string) ([]byte, error). Covers fs.ReadFileFS.ReadFile. ShapeS31 Shape = 30 )
Source Files
¶
- doc.go
- fill.go
- pool_s1.go
- pool_s10.go
- pool_s11.go
- pool_s12.go
- pool_s13.go
- pool_s14.go
- pool_s15.go
- pool_s16.go
- pool_s17.go
- pool_s18.go
- pool_s19.go
- pool_s2.go
- pool_s20.go
- pool_s21.go
- pool_s22.go
- pool_s23.go
- pool_s24.go
- pool_s25.go
- pool_s26.go
- pool_s27.go
- pool_s28.go
- pool_s29.go
- pool_s3.go
- pool_s30.go
- pool_s31.go
- pool_s4.go
- pool_s5.go
- pool_s6.go
- pool_s7.go
- pool_s8.go
- pool_s9.go
- registry.go
- registry_s1.go
- registry_s10.go
- registry_s11.go
- registry_s12.go
- registry_s13.go
- registry_s14.go
- registry_s15.go
- registry_s16.go
- registry_s17.go
- registry_s18.go
- registry_s19.go
- registry_s2.go
- registry_s20.go
- registry_s21.go
- registry_s22.go
- registry_s23.go
- registry_s24.go
- registry_s25.go
- registry_s26.go
- registry_s27.go
- registry_s28.go
- registry_s29.go
- registry_s3.go
- registry_s30.go
- registry_s31.go
- registry_s4.go
- registry_s5.go
- registry_s6.go
- registry_s7.go
- registry_s8.go
- registry_s9.go