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.
| 64 | // |
| 65 | // The interface is mainly used as a constraint for generic type parameters. |
| 66 | type 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. |
no outgoing calls
no test coverage detected