Function
pack_into
(
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( |