Modify specified layout so that the allocated memory region can also hold a ListNode: NOTE: This will return a tuple, consisting of the adjusted size, and the alignment (size, align).
(layout: Layout)
| 127 | // Modify specified layout so that the allocated memory region can also hold a ListNode: |
| 128 | // NOTE: This will return a tuple, consisting of the adjusted size, and the alignment (size, align). |
| 129 | fn sizealign(layout: Layout) -> (usize, usize) |
| 130 | { |
| 131 | let layout = layout |
| 132 | .align_to(mem::align_of::<ListNode>()) |
| 133 | .expect("[ERR] FAILED TO ADJUST ALIGNMENT") |
| 134 | .pad_to_align(); |
| 135 | let size = layout.size().max(mem::size_of::<ListNode>()); |
| 136 | (size, layout.align()) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 |