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

Function pack_into

crates/stdlib/src/pystruct.rs:111–121  ·  view source on GitHub ↗
(
        fmt: IntoStructFormatBytes,
        buffer: ArgMemoryBuffer,
        offset: isize,
        args: PosArgs,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

109
110 #[pyfunction]
111 fn pack_into(
112 fmt: IntoStructFormatBytes,
113 buffer: ArgMemoryBuffer,
114 offset: isize,
115 args: PosArgs,
116 vm: &VirtualMachine,
117 ) -> PyResult<()> {
118 let format_spec = fmt.format_spec(vm)?;
119 let offset = get_buffer_offset(buffer.len(), offset, format_spec.size, true, vm)?;
120 buffer.with_ref(|data| format_spec.pack_into(&mut data[offset..], args.into_vec(), vm))
121 }
122
123 #[pyfunction]
124 fn unpack(

Callers 1

_test_pack_intoMethod · 0.85

Calls 6

get_buffer_offsetFunction · 0.85
with_refMethod · 0.80
format_specMethod · 0.45
lenMethod · 0.45
pack_intoMethod · 0.45
into_vecMethod · 0.45

Tested by 1

_test_pack_intoMethod · 0.68