| ... | @@ -34,39 +34,39 @@ pub const Allocator = struct { | ... | @@ -34,39 +34,39 @@ pub const Allocator = struct { |
| 34 | /// The returned slice must have its pointer aligned at least to `new_alignment` bytes. | 34 | /// The returned slice must have its pointer aligned at least to `new_alignment` bytes. |
| 35 | reallocFn: fn ( | 35 | reallocFn: fn ( |
| 36 | self: *Allocator, | 36 | self: *Allocator, |
| 37 | // Guaranteed to be the same as what was returned from most recent call to | 37 | /// Guaranteed to be the same as what was returned from most recent call to |
| 38 | // `reallocFn` or `shrinkFn`. | 38 | /// `reallocFn` or `shrinkFn`. |
| 39 | // If `old_mem.len == 0` then this is a new allocation and `new_byte_count` | 39 | /// If `old_mem.len == 0` then this is a new allocation and `new_byte_count` |
| 40 | // is guaranteed to be >= 1. | 40 | /// is guaranteed to be >= 1. |
| 41 | old_mem: []u8, | 41 | old_mem: []u8, |
| 42 | // If `old_mem.len == 0` then this is `undefined`, otherwise: | 42 | /// If `old_mem.len == 0` then this is `undefined`, otherwise: |
| 43 | // Guaranteed to be the same as what was returned from most recent call to | 43 | /// Guaranteed to be the same as what was returned from most recent call to |
| 44 | // `reallocFn` or `shrinkFn`. | 44 | /// `reallocFn` or `shrinkFn`. |
| 45 | // Guaranteed to be >= 1. | 45 | /// Guaranteed to be >= 1. |
| 46 | // Guaranteed to be a power of 2. | 46 | /// Guaranteed to be a power of 2. |
| 47 | old_alignment: u29, | 47 | old_alignment: u29, |
| 48 | // If `new_byte_count` is 0 then this is a free and it is guaranteed that | 48 | /// If `new_byte_count` is 0 then this is a free and it is guaranteed that |
| 49 | // `old_mem.len != 0`. | 49 | /// `old_mem.len != 0`. |
| 50 | new_byte_count: usize, | 50 | new_byte_count: usize, |
| 51 | // Guaranteed to be >= 1. | 51 | /// Guaranteed to be >= 1. |
| 52 | // Guaranteed to be a power of 2. | 52 | /// Guaranteed to be a power of 2. |
| 53 | // Returned slice's pointer must have this alignment. | 53 | /// Returned slice's pointer must have this alignment. |
| 54 | new_alignment: u29, | 54 | new_alignment: u29, |
| 55 | ) Error![]u8, | 55 | ) Error![]u8, |
| 56 | | 56 | |
| 57 | /// This function deallocates memory. It must succeed. | 57 | /// This function deallocates memory. It must succeed. |
| 58 | shrinkFn: fn ( | 58 | shrinkFn: fn ( |
| 59 | self: *Allocator, | 59 | self: *Allocator, |
| 60 | // Guaranteed to be the same as what was returned from most recent call to | 60 | /// Guaranteed to be the same as what was returned from most recent call to |
| 61 | // `reallocFn` or `shrinkFn`. | 61 | /// `reallocFn` or `shrinkFn`. |
| 62 | old_mem: []u8, | 62 | old_mem: []u8, |
| 63 | // Guaranteed to be the same as what was returned from most recent call to | 63 | /// Guaranteed to be the same as what was returned from most recent call to |
| 64 | // `reallocFn` or `shrinkFn`. | 64 | /// `reallocFn` or `shrinkFn`. |
| 65 | old_alignment: u29, | 65 | old_alignment: u29, |
| 66 | // Guaranteed to be less than or equal to `old_mem.len`. | 66 | /// Guaranteed to be less than or equal to `old_mem.len`. |
| 67 | new_byte_count: usize, | 67 | new_byte_count: usize, |
| 68 | // If `new_byte_count == 0` then this is `undefined`, otherwise: | 68 | /// If `new_byte_count == 0` then this is `undefined`, otherwise: |
| 69 | // Guaranteed to be less than or equal to `old_alignment`. | 69 | /// Guaranteed to be less than or equal to `old_alignment`. |
| 70 | new_alignment: u29, | 70 | new_alignment: u29, |
| 71 | ) []u8, | 71 | ) []u8, |
| 72 | | 72 | |