Similar to [`MachBuffer::register_constants`] but registers a single constant metadata. This function is useful in situations where not all constants are known at the time of emission.
(&mut self, constant: &VCodeConstant, data: &VCodeConstantData)
| 668 | /// situations where not all constants are known at the time of |
| 669 | /// emission. |
| 670 | pub fn register_constant(&mut self, constant: &VCodeConstant, data: &VCodeConstantData) { |
| 671 | let c2 = self.constants.push(MachBufferConstant { |
| 672 | upcoming_label: None, |
| 673 | align: data.alignment(), |
| 674 | size: data.as_slice().len(), |
| 675 | }); |
| 676 | assert_eq!(*constant, c2); |
| 677 | } |
| 678 | |
| 679 | /// Completes constant emission by iterating over `self.used_constants` and |
| 680 | /// filling in the "holes" with the constant values provided by `constants`. |