Best way to convert ref fixed array to slice?

Is there a turbofish style for this?

&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.