MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / utf16_bytes

Method utf16_bytes

src/objects/string.rs:169–171  ·  view source on GitHub ↗
(input: &[u16])

Source from the content-addressed store, hash-verified

167 }
168 PyStringData::Utf16(data) => {
169 fn utf16_bytes(input: &[u16]) -> &[u8] {
170 unsafe { mem::transmute(input) }
171 }
172 match String::from_utf16(data) {
173 Ok(s) => Ok(Cow::Owned(s)),
174 Err(_) => Err(PyErr::from_instance(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected