MCPcopy Create free account
hub / github.com/dispatchrun/wazergo / Object

Interface Object

types/types.go:66–82  ·  view source on GitHub ↗

Object is an interface which represents values that can be loaded or stored in memory. The interface is mainly used as a constraint for generic type parameters.

Source from the content-addressed store, hash-verified

64//
65// The interface is mainly used as a constraint for generic type parameters.
66type Object[T any] interface {
67 // Writes a human-readable representation of the object to w.
68 FormatObject(w io.Writer, memory api.Memory, object []byte)
69 // Loads and returns the object from the given byte slice. If the object
70 // contains pointers it migh read them from the module memory passed as
71 // first argument.
72 LoadObject(memory api.Memory, object []byte) T
73 // Stores the object to the given tye slice. If the object contains pointers
74 // it might write them to the module memory passed as first argument (doing
75 // so without writing to arbitrary location is difficult so this use case is
76 // rather rare).
77 StoreObject(memory api.Memory, object []byte)
78 // Returns the size of the the object in bytes. The byte slices passed to
79 // LoadObject and StoreObjects are guaranteed to be at least of the length
80 // returned by this method.
81 ObjectSize() int
82}
83
84// UnsafeLoadObject is a helper which may be used to implement the LoadObject
85// method for object types which do not contain any inner pointers.

Callers 15

testFormatObjectFunction · 0.65
FormatValueMethod · 0.65
FormatValueMethod · 0.65
testLoadAndStoreObjectFunction · 0.65
LoadObjectMethod · 0.65
LoadMethod · 0.65
testLoadAndStoreObjectFunction · 0.65
testFormatObjectFunction · 0.65
StoreObjectMethod · 0.65
StoreMethod · 0.65
testLoadAndStoreObjectFunction · 0.65
testFormatObjectFunction · 0.65

Implementers 2

Vec3dtypes/types_test.go
Nonetypes/types.go

Calls

no outgoing calls

Tested by

no test coverage detected