There is a trait in library that I'm trying to use:
pub trait ViewWrapper: 'static {
/// Type that this view wraps.
type V: View + ?Sized;
/// Runs a function on the inner view, returning the result.
///
/// Returns `None` if the inner view is unavailable. This should only
/// happen with some views if they are already borrowed by another call.
fn with_view<F, R>(&self, f: F) -> Option<R>
where
F: FnOnce(&Self::V) -> R;//HOW AM I SUPPOSED TO KNOW WHAT TYPE IS THIS???
When I try to implement this method I'm getting:
fn with_view<F, R>(&self, f: F) -> Option<R>
| - this type parameter
...
85 | Some(&self.m_view)
| ^^^^^^^^^^^^^^^^ expected type parameter `R`, found reference
I really think that the compiler's help is unhelpful here. How am I supposed to know what should be the type of the R????