Version 0.11.0
Changes in this version:
[0.11.0] - 2024-07-27
New Functions 🚀
use_user_media
New Features 🚀
-
Codecs:
- All codecs now live in their own crate
codee
- There are now binary codecs in addition to string codecs.
FromToBytesCodec
WebpackSerdeCodec
BincodeSerdeCodec
ProstCodec
(see also the section "Breaking Changes 🛠" below)
- Every binary codec can be used as a string codec with the
Base64
wrapper which encodes the binary data as a
base64
string.- This required feature
base64
- It can be wrapped for example like this:
Base64<WebpackSerdeCodec>
.
- This required feature
- There is now an
OptionCodec
wrapper that allows to wrap any string codec that encodesT
to encodeOption<T>
.- Use it like this:
OptionCodec<FromToStringCodec<f64>>
.
- Use it like this:
- All codecs now live in their own crate
-
ElementMaybeSignal
is now implemented forwebsys::HtmlElement
(thanks to @blorbb). -
UseStorageOptions
now hasdelay_during_hydration
which has to be used when you conditionally show parts of
the DOM controlled by a value from storage. This leads to hydration errors which can be fixed by setting this new
option totrue
. -
cookie::SameSite
is now re-exported -
Changing the signal returned by
use_cookie
now tries and changes the headers during SSR. -
New book chapter about codecs
-
The macro
use_derive_signal!
is now exported (thanks to @mscofield0).
Breaking Changes 🛠
UseStorageOptions
andUseEventSourceOptions
no longer accept acodec
value because this is already provided as a
generic parameter to the respective function calls.- Codecs have been refactored. There are now two traits that codecs implement:
Encoder
andDecoder
. The
traitStringCodec
is gone. The methods are now associated methods and their params now always take references.JsonCodec
has been renamed toJsonSerdeCodec
.- The feature to enable this codec is now called
json_serde
instead of justserde
. ProstCodec
now encodes as binary data. If you want to keep using it with string data you can wrap it like
this:Base64<ProstCodec>
.- All of these structs, traits and features now live in their own crate called
codee
- A bunch of new codecs are available. Have a look at the docs for crate
codee
.
use_websocket
:UseWebsocketOptions
has been renamed toUseWebSocketOptions
(uppercase S) to be consistent with the return
type.UseWebSocketOptions::reconnect_limit
andUseEventSourceOptions::reconnect_limit
is nowReconnectLimit
instead
ofu64
. UseReconnectLimit::Infinite
for infinite retries orReconnectLimit::Limited(...)
for limited
retries.use_websocket
now uses codecs to send typed messages over the network.- When calling you have give type parameters for the message type and the
codec:use_websocket::<String, WebpackSerdeCodec>
- You can use binary or string codecs.
- The
UseWebSocketReturn::send
closure now takes a&T
which is encoded using the codec. - The
UseWebSocketReturn::message
signal now returns anOption<T>
which is decoded using the codec. UseWebSocketReturn::send_bytes
andUseWebSocketReturn::message_bytes
are gone.UseWebSocketOptions::on_message
andUseWebSocketOptions::on_message_bytes
have been renamed
toon_message_raw
andon_message_raw_bytes
.- The new
UseWebSocketOptions::on_message
takes a&T
. UseWebSocketOptions::on_error
now takes aUseWebSocketError
instead of aweb_sys::Event
.
- When calling you have give type parameters for the message type and the
use_storage
now always saves the default value to storage if the key doesn't exist yet.- Renamed
BreakpointsSematic
toBreakpointsSemantic
andbreakpoints_sematic
tobreakpoints_semantic
(note then
) (thanks to @mondeja).
Fixes 🍕
- Fixed auto-reconnect in
use_websocket
- Fixed typo in compiler error messages in
use_cookie
(thanks to @SleeplessOne1917). - Fixed potential signal out of scope issue with
use_raf_fn
Other Changes 🔥
- Better links in docs that work both in the book and in rustdoc (thanks to @mondeja).
- Better CI/CD (thanks to @EstebanBorai).