Open konsumer opened 4 weeks ago
Thanks for the report, looks like the docs were never cleaned up after I added the std::string_view
optimizations, testing it is a good idea too. Contributions welcome, otherwise I'll eventually get around to fixing this.
Since it was mentioned in discord, just to clarify, a std::string_view
is just a slice or pointer and length combo. The idea is that std::string_view
can be very cheaply constructed from existing data and is lightweight to pass around and copy (as it doesn't include the actual data). It was a much needed improvement to the C++ standard library as it reduces cases where using raw pointers is tempting or the need to promote everything to std::string
to for passing std::string&
.
I am playing with cpp host, and I noticed the README is off, and also the unit-tests do not have an example of what I am trying to do.
Imagine a single
trace
function, wasm-side:This will perform the string-formatting, wasm-side, and just send a simple string to host to be logged.
After a bit of fighting, and asking in disocrd (thanks @bhelx !) I worked out in the host, you can expose it like this:
But the README makes no mention of
inputStringView
and there were no unit-tests about this. The closest I saw was the keyval example, which uses a few functions that are undefined.