Registry / utility / ref-slice

ref-slice

JSON →
library1.2.1rscratesunverified

Turn a reference into a slice of length one.

# Cargo.toml [dependencies] ref_slice = "1.2.1"
INSTALL
IMPORT
SIG · REF-SLICE
R
ref-slice
utilityrustv1.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ref_slice
use ref_slice::ref_slice;

Convert a reference to a single-element slice

use ref_slice::ref_slice; fn main() { let x = 42; let slice: &[i32] = ref_slice(&x); assert_eq!(slice.len(), 1); assert_eq!(slice[0], 42); }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.2.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
ref-slice — cargo add ref-slice · libregistry