I was surprised to find out this syntax even allowed.
So, this works -
assert_eq!(Ok::<_, ()>(9).map(Some), Ok(Some(9)));
And this one works as well -
#[derive(PartialEq)] struct Foo(u8); assert_eq!(Ok::<_, ()>(9).map(Foo), Ok(Foo(9)));
So, newtypes and enum variants with payload are acting like functions? I mean I can pass them as a closure to, say, map().
Is this documented? Any pointers?