This innocent-starting PR unfortunately ended up with a bigger change surface than what I originally thought. Please take a look. If necessary, I can (try to) split.
Here, a summary of the changes. I've only listed these crates, whose update/removal ended up in (significant) code changes:
heapless 0.7 -> 0.8
(We still also use a version of heapless 0.7 because domain (the library our built-in mDNS uses) still needs it. But not for long, I hope.)
The biggest change in heapless 0.8 that affects us is that it it no longer implements From<&str> for heapless::String<N>. Instead, it implements TryFrom<&str> for heapless::String<N> (i.e. now returns an error rather than panicking if the &str is too big to fit in the heapless::String instance).
domain 0.7 -> 0.9
This was one of the two big changes (the removal of embassy-net described below being the other). The new domain API had changed significantly, so a lot of the code in the built-in mDNS responder had to be touched. Should work OK after the changes though, as I've already done this change a month ago for edge-mdns (which is more or less a replica of our built-in mDNS provider).
crypto-bigint 0.4 -> 0.5
Small API change in the reduce function (now called rem(-ainder))
Retired: embassy-net (+ smoltcp)
We used to have built-in support for using the baremetal UDP stack of embassy-net and smoltcp, under the embassy-net feature.
This support is no longer necessary, as we can finally introduce the UdpSend and UdpReceive pair of async traits since Rust 1.75 (as I just did!).
On the other hand, embassy-net and smoltcp bump their versions quite often (and are at 0.x still), so I don't see the point of maintaining the UDP mapping for these in rs-matter.
Implementing UdpSend and UdpReceiveis not really necessary to do in rs-matter, as the user can do it outside, and it should be 10-20 lines of code, similarly to how we still do this for the STD async-io crate here.
As a result of the introduction of UdpSend and UdpReceive, we no longer need the Pipe utility, which was removed, nor the rs_matter::transport::udp module, which was also removed (the UDP traits are in rs_matter::transport::network now).
Made optional: async-io
async-io is one way to spin an async UDP stack on top of Rust STD. I cannot completely retire the async-io dependency from the rs-matter crate, as we need something to run our example. Yet, it is now optional, because users might prefer to use other async STD crates for the UDP stack. Namely, tokio.
Unlike embassy-net, async-io is now stable, at version 2.X, so keep it as an optional dependency even if we only need it for the examples is probably OK.
Retired: esp-idf-sys (for ESP IDF)
ESP IDF in Rust is a STD environment. Folks using ESP IDF with Rust should just use async-io (or tokio) for a UDP stack. During the last year, the explicit support for ESP IDF was upstreamed in both async-io V2 (and the smol echosystem as a whole), and in tokio V1.X.
ESP IDF still needs some "hand-holding" for multicast subscriptions (in mDNS) but this is due to upstream bugs that I need to address, and we better not workaround those anymore in rs-matter.
Example
I've removed the ESP-IDF specific parts from the example for now. I do realize we do need some examples on MCUs - not just with ESP IDF, but also baremetal ESP32. And other MCUs - like this example. But probably that needs to wait until we have an infrastructure similar to the C++ Matter SDK for running examples for various boards, rather than hacking support for all possible MCUs in a single example.
Update: no-std-net
The no-std-net crate is no longer actively developed. Moreover, its version 0.6 (the latest one) is not even compatible with STD. But we use it because we need the inet types in no_std.
Fortunately, the Rust STD inet types (SocketAddr, IpAddr and so on) will be available in Rust core as well, starting from Rust 1.77.
So in a couple of months we will remove this dependency as well.
This innocent-starting PR unfortunately ended up with a bigger change surface than what I originally thought. Please take a look. If necessary, I can (try to) split.
Here, a summary of the changes. I've only listed these crates, whose update/removal ended up in (significant) code changes:
heapless 0.7 -> 0.8
(We still also use a version of heapless 0.7 because
domain
(the library our built-in mDNS uses) still needs it. But not for long, I hope.)The biggest change in heapless 0.8 that affects us is that it it no longer implements
From<&str> for heapless::String<N>
. Instead, it implementsTryFrom<&str> for heapless::String<N>
(i.e. now returns an error rather than panicking if the&str
is too big to fit in theheapless::String
instance).domain 0.7 -> 0.9
This was one of the two big changes (the removal of
embassy-net
described below being the other). The newdomain
API had changed significantly, so a lot of the code in the built-in mDNS responder had to be touched. Should work OK after the changes though, as I've already done this change a month ago foredge-mdns
(which is more or less a replica of our built-in mDNS provider).crypto-bigint 0.4 -> 0.5
Small API change in the
reduce
function (now calledrem
(-ainder))Retired:
embassy-net
(+smoltcp
)We used to have built-in support for using the baremetal UDP stack of
embassy-net
andsmoltcp
, under theembassy-net
feature. This support is no longer necessary, as we can finally introduce theUdpSend
andUdpReceive
pair of async traits since Rust 1.75 (as I just did!). On the other hand,embassy-net
andsmoltcp
bump their versions quite often (and are at 0.x still), so I don't see the point of maintaining the UDP mapping for these inrs-matter
.Implementing
UdpSend
andUdpReceive
is not really necessary to do inrs-matter
, as the user can do it outside, and it should be 10-20 lines of code, similarly to how we still do this for the STDasync-io
crate here.As a result of the introduction of
UdpSend
andUdpReceive
, we no longer need thePipe
utility, which was removed, nor thers_matter::transport::udp
module, which was also removed (the UDP traits are inrs_matter::transport::network
now).Made optional:
async-io
async-io
is one way to spin an async UDP stack on top of Rust STD. I cannot completely retire theasync-io
dependency from thers-matter
crate, as we need something to run our example. Yet, it is now optional, because users might prefer to use other async STD crates for the UDP stack. Namely,tokio
.Unlike
embassy-net
,async-io
is now stable, at version 2.X, so keep it as an optional dependency even if we only need it for the examples is probably OK.Retired:
esp-idf-sys
(for ESP IDF)ESP IDF in Rust is a STD environment. Folks using ESP IDF with Rust should just use
async-io
(ortokio
) for a UDP stack. During the last year, the explicit support for ESP IDF was upstreamed in bothasync-io
V2 (and thesmol
echosystem as a whole), and intokio
V1.X.ESP IDF still needs some "hand-holding" for multicast subscriptions (in mDNS) but this is due to upstream bugs that I need to address, and we better not workaround those anymore in
rs-matter
.Example
I've removed the ESP-IDF specific parts from the example for now. I do realize we do need some examples on MCUs - not just with ESP IDF, but also baremetal ESP32. And other MCUs - like this example. But probably that needs to wait until we have an infrastructure similar to the C++ Matter SDK for running examples for various boards, rather than hacking support for all possible MCUs in a single example.
Update:
no-std-net
The
no-std-net
crate is no longer actively developed. Moreover, its version 0.6 (the latest one) is not even compatible with STD. But we use it because we need theinet
types inno_std
.Fortunately, the Rust STD inet types (
SocketAddr
,IpAddr
and so on) will be available in Rustcore
as well, starting from Rust 1.77.So in a couple of months we will remove this dependency as well.