The intent was to run custom code after the user is done modifying the socket,
for example to update a (not yet existing) port->socket map in SocketSet. However
this wouldn't work, since the SocketRef would have to borrow the SocketSet at
the same time as the Socket to be able to notify the SocketSet.
I believe such indexing can be achieved by setting a "dirty" bit *before* giving
the socket to the user, then on poll() reindexing all dirty sockets. This could
even be faster: if user gets a socket multiple times between polls, it'd be reindexed
only once.
- Add `medium` in `DeviceCapabilities`.
- Rename EthernetInterface to Interface.
- Add support to Interface for both Ethernet and IP mediums. The medium to use is detected from `device.capabilities().medium`.
- Ethernet-only features are gated behind the "ethernet" feature, as before.
- IP features are always enabled for now.
These were flagged by `cargo clippy`:
warning: you seem to be trying to use match for destructuring a
single pattern. Consider using `if let`
warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()`
is equivalent
warning: using `write!()` with a format string that ends in a single
newline
warning: useless conversion to the same type:
`smoltcp::wire::Ipv4Address`
warning: called `map(f)` on an `Option` value where `f` is a closure
that returns the unit type `()`
warning: returning the result of a `let` binding from a block
warning: use of `unwrap_or` followed by a function call