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

Method pack_into

crates/stdlib/src/pystruct.rs:271–283  ·  view source on GitHub ↗
(
            &self,
            buffer: ArgMemoryBuffer,
            offset: isize,
            args: PosArgs,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

269
270 #[pymethod]
271 fn pack_into(
272 &self,
273 buffer: ArgMemoryBuffer,
274 offset: isize,
275 args: PosArgs,
276 vm: &VirtualMachine,
277 ) -> PyResult<()> {
278 let offset = get_buffer_offset(buffer.len(), offset, self.size(), true, vm)?;
279 buffer.with_ref(|data| {
280 self.spec
281 .pack_into(&mut data[offset..], args.into_vec(), vm)
282 })
283 }
284
285 #[pymethod]
286 fn unpack(&self, data: ArgBytesLike, vm: &VirtualMachine) -> PyResult<PyTupleRef> {

Callers 1

pack_intoFunction · 0.45

Calls 5

get_buffer_offsetFunction · 0.85
with_refMethod · 0.80
lenMethod · 0.45
sizeMethod · 0.45
into_vecMethod · 0.45

Tested by

no test coverage detected