I know Single is not a smart pointer, but it effectively acts like one—maybe?
I don't know. I know many people hate Deref and DerefMut for anything that isn't a smart pointer, but Single<T> is just a "pointer" to T stored in evenio.
Sounds reasonable. The public .0 field of Single could interfere with deref coercion but other than that it seems fine.
Should do it for TrySingle as well for parity.
I know
Single
is not a smart pointer, but it effectively acts like one—maybe?I don't know. I know many people hate
Deref
andDerefMut
for anything that isn't a smart pointer, butSingle<T>
is just a "pointer" toT
stored inevenio
.Related Work
Json<T>
in axum implsDeref
andDerefMut
https://docs.rs/axum/latest/axum/struct.Json.html