Currently, it doesn't seem possible to access non-static borrowed data in the menu context if the concrete type of the Context is also required.
Take the following example:
struct Context<'non_static> {
my_borrowed_data: &'non_static u32,
}
#[rtic::app]
{
struct LocalResources {
// What should the lifetime of `Context` be here when it must be specified concretely?
menu: menu::Runner<'static, Context<'?>>
}
}
The 'non_static lifetime is run-time dependent (i.e. 'a). However, if this Context type must be specified concrete (i.e. when specifying an RTIC resource), it's not possible to write the concrete type of Context without a generic lifetime. This makes it effectively impossible for Context to borrow non-static objects if the concrete type of Context must be used.
Proposal
To work around this, we would need to erase the concrete type of Context from the library types. What I believe this would be is an API as follows:
Problem
Currently, it doesn't seem possible to access non-static borrowed data in the menu context if the concrete type of the
Context
is also required.Take the following example:
The
'non_static
lifetime is run-time dependent (i.e.'a
). However, if thisContext
type must be specified concrete (i.e. when specifying an RTIC resource), it's not possible to write the concrete type ofContext
without a generic lifetime. This makes it effectively impossible forContext
to borrow non-static objects if the concrete type ofContext
must be used.Proposal
To work around this, we would need to erase the concrete type of
Context
from the library types. What I believe this would be is an API as follows:This would allow the
Context
type to be concrete, but expose an anonymous lifetime via the borrow ofcontext
ininput_byte
.