12 lines
270 B
Rust
12 lines
270 B
Rust
|
#[cfg(not(feature = "no-unsafe"))]
|
||
|
pub fn from_utf8_unchecked(v: &[u8]) -> &str {
|
||
|
unsafe {
|
||
|
::std::str::from_utf8_unchecked(v)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[cfg(feature = "no-unsafe")]
|
||
|
pub fn from_utf8_unchecked(v: &[u8]) -> &str {
|
||
|
::std::str::from_utf8(v).expect("from_utf8_unchecked")
|
||
|
}
|