type T1<'a> = Box<dyn Bar<'a>>;
type T2<'a> = Box<dyn Bar<'a> + 'a>;
So by returning the type alias we are not returning Box<dyn Trait<'a>> but Box<dyn Trait<'a> + 'a>.
type T1<'a> = Box<dyn Bar<'a>>;
type T2<'a> = Box<dyn Bar<'a> + 'a>;
So by returning the type alias we are not returning Box<dyn Trait<'a>> but Box<dyn Trait<'a> + 'a>.
SPOILER AHEAD:
So why does the function returning an alias work while the other one doesn't?
The answer can be found here:
doc.rust-lang.org/reference/li...
SPOILER AHEAD:
So why does the function returning an alias work while the other one doesn't?
The answer can be found here:
doc.rust-lang.org/reference/li...
Working on: Writing notes for Client / Server networking
Number of interruptions: 1
Did you manage the entire time: yes
Working on: Writing notes for Client / Server networking
Number of interruptions: 1
Did you manage the entire time: yes
But yes, you are right.
But yes, you are right.