4 Commits

Author SHA1 Message Date
zach
d704a5068e refactor!: make UserData more generic 2024-03-18 10:24:47 -07:00
Chris Dickinson
75f2ea2efc doc: add example of linking modules in a plugin (#616)
Add an example of dynamically linking plugins and a benchmark that does
an apples-to-apples comparison of `reflect` using host functions vs.
`reflect` using a linked wasm module. (To my surprise, the host
functions are a _little bit faster_!)
2023-12-01 11:38:27 -08:00
zach
2a24d13c9b refactor!: use tracing crate for logging, add extism_log_callback function (#578)
- Uses `tracing` instead of `log` crate
- Uses `tracing-subscriber` instead of `fern`
- This allows us to automatically capture `log` events using
`tracing-subscriber`
- Breaking: Makes `extism::set_log_file` private and only used through
the C API, Rust users should use `tracing-subscriber` to determine which
filters/levels to log.
- Adds `extism::set_log_callback` function to set a callback that can be
used for custom logging from Rust.
- Adds `bool extism_log_custom(const char *level)` and
`extism_log_drain(void (*fn)(const char *s, size_t length)` to the C API
to enable custom sinks in other SDKs
2023-11-16 10:35:22 -08:00
zach
0e65c3afae refactor!: Cleanup UserData implementation, update example in README (#550)
Fixes #545 

- Adds a type parameter to `UserData` type to avoid dynamic typing
issues
- Adds KV example from README to `examples/readme.rs` to make sure it
stays in-sync
- Implement `Default` for `UserData<T>` when `T` implements `Default`
- Make `UserData` argument non-optional in `Function::new`,
`UserData::default()` can be used instead.
2023-10-26 11:19:48 -07:00