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

Method len

src/objects/sequence.rs:38–45  ·  view source on GitHub ↗
(&self, py: Python)

Source from the content-addressed store, hash-verified

36 /// Returns the number of objects in sequence. This is equivalent to Python `len()`.
37 #[inline]
38 pub fn len(&self, py: Python) -> PyResult<isize> {
39 let v = unsafe { ffi::PySequence_Size(self.0.as_ptr()) };
40 if v == -1 {
41 Err(PyErr::fetch(py))
42 } else {
43 Ok(v as isize)
44 }
45 }
46
47 /// Return the concatenation of o1 and o2. Equivalent to python `o1 + o2`
48 #[inline]

Callers

nothing calls this directly

Calls 1

as_ptrMethod · 0.45

Tested by

no test coverage detected