Our DynStorage trait uses a &mut dyn FnMut as a callback for
implementing mount_and_then (instead of a FnOnce like Filesystem). This
is because there is no no-std way to pass a FnOnce in an dyn compatible
trait method.
If alloc is available, this limitation can be avoided by using a
Box<dyn FnOnce>. This patch adds an alloc feature to the crate and a
DynStorageAlloc trait behind that feature that provides mount_and_then
functions using a boxed FnOnce instead of a reference to an FnMut.
The const_ram_storage! and ram_storage! macros used to have trait and
result arguments to set the storage trait to implement and the result
type to use. As this defaulted to relative paths, it made the result of
the macro dependent on the context and could cause confusion. At the
same time, there is no real use case for substituting these types.
This patch removes the arguments for good and just uses
$crate::driver::Storage and $crate::io::Result instead.
This patch replaces the version function with two constants,
BACKEND_VERSION and DISK_VERSION, and changes the Version struct to be
a wrapper for a littlefs version number. DISK_VERSION is now the disk
version used by this crate, not the newest version supported by the
backend.