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

Function unpack_from

crates/stdlib/src/pystruct.rs:141–151  ·  view source on GitHub ↗
(
        fmt: IntoStructFormatBytes,
        args: UpdateFromArgs,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

139
140 #[pyfunction]
141 fn unpack_from(
142 fmt: IntoStructFormatBytes,
143 args: UpdateFromArgs,
144 vm: &VirtualMachine,
145 ) -> PyResult<PyTupleRef> {
146 let format_spec = fmt.format_spec(vm)?;
147 let offset =
148 get_buffer_offset(args.buffer.len(), args.offset, format_spec.size, false, vm)?;
149 args.buffer
150 .with_ref(|buf| format_spec.unpack(&buf[offset..][..format_spec.size], vm))
151 }
152
153 #[pyattr]
154 #[pyclass(name = "unpack_iterator", traverse)]

Callers

nothing calls this directly

Calls 5

get_buffer_offsetFunction · 0.85
with_refMethod · 0.80
format_specMethod · 0.45
lenMethod · 0.45
unpackMethod · 0.45

Tested by

no test coverage detected