MCPcopy Index your code
hub / github.com/RustPython/RustPython / py_join

Method py_join

crates/vm/src/anystr.rs:304–319  ·  view source on GitHub ↗
(
        &self,
        mut iter: impl core::iter::Iterator<Item = PyResult<impl AnyStrWrapper<Self> + TryFromObject>>,
    )

Source from the content-addressed store, hash-verified

302 }
303
304 fn py_join(
305 &self,
306 mut iter: impl core::iter::Iterator<Item = PyResult<impl AnyStrWrapper<Self> + TryFromObject>>,
307 ) -> PyResult<Self::Container> {
308 let mut joined = if let Some(elem) = iter.next() {
309 elem?.as_ref().unwrap().to_container()
310 } else {
311 return Ok(Self::Container::new());
312 };
313 for elem in iter {
314 let elem = elem?;
315 joined.push_str(self);
316 joined.push_str(elem.as_ref().unwrap());
317 }
318 Ok(joined)
319 }
320
321 fn py_partition<'a, F, S>(
322 &'a self,

Callers 2

joinMethod · 0.80
joinMethod · 0.80

Implementers 2

bytes_inner.rscrates/vm/src/bytes_inner.rs
str.rscrates/vm/src/builtins/str.rs

Calls 6

newFunction · 0.85
nextMethod · 0.45
to_containerMethod · 0.45
unwrapMethod · 0.45
as_refMethod · 0.45
push_strMethod · 0.45

Tested by

no test coverage detected