(copy-bytes Mod ptr length)
copy the length bytes from the given address
copy the length bytes from the given address
(read-opts Mod)
used internally by call
used internally by call
(read Mod ptr)
(read Mod ptr opts)
read an object from a ptr, returning [?err ?ok]
read an object from a ptr, returning [?err ?ok]
(write-opts Mod)
used internally by call
used internally by call
(call Mod export-name)
(call Mod export-name obj)
Automatically write-to and read-from a wasm function. See fress.wasm/module-call
Automatically write-to and read-from a wasm function. See fress.wasm/module-call
(write-bytes Mod bytes)
write bytes into memory, returning a FatPtr
write bytes into memory, returning a FatPtr
(reader-lookup Mod)
used internally
used internally
(dealloc Mod fptr)
(dealloc Mod ptr len)
return ownership of bytes back to rust for them to be freed
return ownership of bytes back to rust for them to be freed
(reset-reader-caches Mod)
(reset-reader-caches Mod priorityCache structCache)
manully reset or overwrite reader cache instances
manully reset or overwrite reader cache instances
(get-exports Mod)
the export object
the export object
(get-view Mod)
return a Uint8Array view over module memory
return a Uint8Array view over module memory
(reader-struct-cache Mod)
used internally
used internally
(reader-priority-cache Mod)
used internally
used internally
(write Mod any)
(write Mod any opts)
write an object into memory, returning a FatPtr
write an object into memory, returning a FatPtr
(alloc Mod len)
request a slice of memory of the given length, returning a FatPtr
request a slice of memory of the given length, returning a FatPtr
(get-memory Mod)
the module's memory
the module's memory
(instantiate array-buffer)
(instantiate array-buffer opts)
Instantiate a wasm module and add the IFressWasmModule protocol.
Instantiate a wasm module and add the IFressWasmModule protocol. + opts :imports -> Map<(string|kw), fn> - this exposes javascript functions to be called by wasm code. For each fn, there should be a corresponding externs entry in your rust lib. - don't forget that wasm can only call functions with scalar values :read-opts - passed to read calls internal to IFressWasmModule/call - if provided, reader cache instances will persist across module calls - { :handlers {'string' fn<rdr, tag, field-count>} :reader-priority-cache ?ArrayList :reader-struct-cache ?ArrayList } :write-opts - passed to write calls internal to IFressWasmModule/call => native Promise
Given a WASM module and the string name of an exported wasm function, call that function, optionally passing any fressian'able object. This function handles all intermediate ptr handling for you.
your_fn(ptr: *mut u8, len: usize)
your_fn(ptr: *mut u8, len: usize) -> *mut u8
Given a WASM module and the string name of an exported wasm function, call that function, optionally passing any fressian'able object. This function handles all intermediate ptr handling for you. + If you pass an object, it will be automatically written into wasm memory and the resulting ptr+len handed off to your specified fn. This assumes that the exported function's signature accepts *precisely*: `your_fn(ptr: *mut u8, len: usize)` - All wasm functions that you wish to recieve fressian data should have these parameters. + if your function returns a ptr it will automatically be read from and returned as [?err ?ok]. `your_fn(ptr: *mut u8, len: usize) -> *mut u8` + If no ptr is given it will return as [nil] + panics are automatically handled and returned as [{:type :panic, :msg '...'}] Note: read and write opts must be passed at module instantiation, otherwise this function will become a tangled mess. In the future we may be able to generate code which will obviate the need for this fn. => [?err ?ok]
(reader-cache coll)
Use to prime reader caches with values AOT. Coll should reduced in cache order: the index becomes the cache lookup code.
Use to prime reader caches with values AOT. Coll should reduced in cache order: the index becomes the cache lookup code.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close