See Rust Playground. It seems reasonable to me that expand()
can return Target
. inter
can be dropped before the end of expand()
, and before out_len
or parts
. The compiler seems to disagree, however. Any clues who's right? And if I'm right, how do I explain my point of view to the compiler?
the problem is the 'a
in T: From<Intermediate<'a>> + 'static
,
what you really wanted is for<'b> T: From<Intermediate<'b>> + 'static,
edit: maybe it does not need to be generic in which case fn expand<'a, T>(src: &'a Source, label: &'a [u8], len: usize) -> Target{
also works
2 Likes
It did actually need to be generic, but the for <'b>
seems to have solved my problem. Thanks!
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.