Documentation
¶
Overview ¶
Package stdlib provides wrappers of standard library packages to be imported natively in mvm.
Index ¶
- Variables
- func PackagePatchers() map[string][]PackagePatcher
- func RegisterPackagePatcher(importPath string, fn PackagePatcher)
- func SrcFS() fs.FS
- type BridgeClose
- type BridgeError
- type BridgeFlagValue
- type BridgeGoString
- type BridgeHeapInterface
- type BridgeMarshalJSON
- type BridgeRead
- type BridgeReadFrom
- type BridgeReaderWriterTo
- type BridgeSortInterface
- type BridgeString
- type BridgeUnmarshalJSON
- type BridgeWrite
- type BridgeWriteTo
- type BridgeWriterReaderFrom
- type PackagePatcher
Constants ¶
This section is empty.
Variables ¶
var Values = map[string]map[string]reflect.Value{}
Values variable stores the map of stdlib values per package.
Functions ¶
func PackagePatchers ¶
func PackagePatchers() map[string][]PackagePatcher
PackagePatchers returns the registered patchers keyed by import path. Callers must not mutate the returned map.
func RegisterPackagePatcher ¶
func RegisterPackagePatcher(importPath string, fn PackagePatcher)
RegisterPackagePatcher adds fn to the patcher list for importPath. Intended for init() in side-effect intercept packages such as stdlib/jsonx, so the interpreter itself needs no knowledge of them.
Types ¶
type BridgeClose ¶
type BridgeClose struct{ Fn func() error }
BridgeClose bridges the io.Closer interface method.
type BridgeError ¶
BridgeError bridges the error interface method. Val holds the concrete value for non-string format verbs (%d, %x, etc.).
func (*BridgeError) Error ¶
func (b *BridgeError) Error() string
Error implements the error interface.
type BridgeFlagValue ¶
BridgeFlagValue bridges flag.Value (String, Set).
func (*BridgeFlagValue) Set ¶
func (b *BridgeFlagValue) Set(s string) error
Set implements flag.Value.
func (*BridgeFlagValue) String ¶
func (b *BridgeFlagValue) String() string
String implements flag.Value.
type BridgeGoString ¶
BridgeGoString bridges the fmt.GoStringer interface method.
func (*BridgeGoString) Format ¶
func (b *BridgeGoString) Format(f fmt.State, verb rune)
Format implements fmt.Formatter.
func (*BridgeGoString) GoString ¶
func (b *BridgeGoString) GoString() string
GoString implements fmt.GoStringer.
type BridgeHeapInterface ¶
type BridgeHeapInterface struct {
BridgeSortInterface
FnPush func(any)
FnPop func() any
}
BridgeHeapInterface bridges heap.Interface (Len, Less, Swap, Push, Pop). Embeds BridgeSortInterface for the sort.Interface methods.
func (*BridgeHeapInterface) Pop ¶
func (b *BridgeHeapInterface) Pop() any
Pop implements heap.Interface.
func (*BridgeHeapInterface) Push ¶
func (b *BridgeHeapInterface) Push(x any)
Push implements heap.Interface.
type BridgeMarshalJSON ¶
BridgeMarshalJSON bridges the json.Marshaler interface method.
func (*BridgeMarshalJSON) MarshalJSON ¶
func (b *BridgeMarshalJSON) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type BridgeRead ¶
BridgeRead bridges the io.Reader interface method.
type BridgeReadFrom ¶
BridgeReadFrom bridges the io.ReaderFrom interface method.
type BridgeReaderWriterTo ¶
type BridgeReaderWriterTo struct {
FnRead func([]byte) (int, error)
FnWriteTo func(io.Writer) (int64, error)
}
BridgeReaderWriterTo is a composite bridge implementing io.Reader + io.WriterTo. Used to preserve WriterTo capability when wrapping for an io.Reader target (e.g. io.Copy).
type BridgeSortInterface ¶
type BridgeSortInterface struct {
FnLen func() int
FnLess func(int, int) bool
FnSwap func(int, int)
}
BridgeSortInterface bridges sort.Interface (Len, Less, Swap).
func (*BridgeSortInterface) Len ¶
func (b *BridgeSortInterface) Len() int
func (*BridgeSortInterface) Less ¶
func (b *BridgeSortInterface) Less(i, j int) bool
func (*BridgeSortInterface) Swap ¶
func (b *BridgeSortInterface) Swap(i, j int)
type BridgeString ¶
BridgeString bridges the fmt.Stringer interface method.
func (*BridgeString) Format ¶
func (b *BridgeString) Format(f fmt.State, verb rune)
Format implements fmt.Formatter.
func (*BridgeString) String ¶
func (b *BridgeString) String() string
String implements fmt.Stringer.
type BridgeUnmarshalJSON ¶
BridgeUnmarshalJSON bridges the json.Unmarshaler interface method.
func (*BridgeUnmarshalJSON) UnmarshalJSON ¶
func (b *BridgeUnmarshalJSON) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type BridgeWrite ¶
BridgeWrite bridges the io.Writer interface method.
type BridgeWriteTo ¶
BridgeWriteTo bridges the io.WriterTo interface method.
type BridgeWriterReaderFrom ¶
type BridgeWriterReaderFrom struct {
FnWrite func([]byte) (int, error)
FnReadFrom func(io.Reader) (int64, error)
}
BridgeWriterReaderFrom is a composite bridge implementing io.Writer + io.ReaderFrom. Used to preserve ReaderFrom capability when wrapping for an io.Writer target (e.g. io.Copy).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package all is the convenience aggregator for stdlib bindings: blank-import it to get the full set (core + ext + jsonx).
|
Package all is the convenience aggregator for stdlib bindings: blank-import it to get the full set (core + ext + jsonx). |
|
Package core provides wrappers for core standard library packages.
|
Package core provides wrappers for core standard library packages. |
|
Package jsonx is a mvm-aware replacement for the encoding/json functions that need to honour mvm-defined methods on struct types (MarshalJSON, UnmarshalJSON).
|
Package jsonx is a mvm-aware replacement for the encoding/json functions that need to honour mvm-defined methods on struct types (MarshalJSON, UnmarshalJSON). |
|
src
|
|
|
cmp
Package cmp provides types and functions related to comparing ordered values.
|
Package cmp provides types and functions related to comparing ordered values. |
|
iter
Package iter provides basic definitions related to iterators over sequences.
|
Package iter provides basic definitions related to iterators over sequences. |
|
maps
Package maps defines various functions useful with maps of any type.
|
Package maps defines various functions useful with maps of any type. |
|
slices
Package slices defines various functions useful with slices of any type.
|
Package slices defines various functions useful with slices of any type. |