How can I convert a reference to any type to a reference to an array of length 1?

Viewed 435

I have an instance of type &T. How do I cast it to &[T; 1]? Something like std::slice::from_ref, except that it should return an array, instead of a slice.

1 Answers
Related