from_ref in core::slice - Rust (original) (raw)

core::slice

Function from_ref

1.28.0 (const: 1.63.0) ยท Source

pub const fn from_ref<T>(s: &T) -> &[T]

Expand description

Converts a reference to T into a slice of length 1 (without copying).