MCPcopy Index your code
hub / github.com/dgrunwald/rust-cpython / data_impl

Method data_impl

src/objects/string.rs:275–283  ·  view source on GitHub ↗
(&self, py: Python)

Source from the content-addressed store, hash-verified

273
274 #[cfg(feature = "python27-sys")]
275 fn data_impl(&self, py: Python) -> PyStringData {
276 if let Ok(bytes) = self.0.cast_as::<PyBytes>(py) {
277 PyStringData::Utf8(bytes.data(py))
278 } else if let Ok(unicode) = self.0.cast_as::<PyUnicode>(py) {
279 unicode.data(py)
280 } else {
281 panic!("PyString is neither `str` nor `unicode`")
282 }
283 }
284
285 #[cfg(feature = "python3-sys")]
286 fn data_impl(&self, _py: Python) -> PyStringData {

Callers 1

dataMethod · 0.80

Calls 6

PyUnicode_READYFunction · 0.85
PyUnicode_GET_LENGTHFunction · 0.85
PyUnicode_DATAFunction · 0.85
PyUnicode_KINDFunction · 0.85
dataMethod · 0.80
as_ptrMethod · 0.45

Tested by

no test coverage detected