Best way to convert ref fixed array to slice?

Is there a turbofish style for this?

https://play.rust-lang.org/?version=nightly&mode=release&edition=2018&gist=d1f3eb181d67907705baf7d09c25cce7

&b"different"[..]

1 Like

There's an unstable method .as_slice(), but that's not of much use without being stabilized...

If the types are unambiguous, how about using .as_ref()? [T] implements AsRef<[T]>, so calling that method should trigger the deref coercion from [T; N] to [T] and get you an &[T] result.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.