| 352 | } |
| 353 | |
| 354 | fn require_str(&self, v: Val, name: &str) -> Result<String, VmErr> { |
| 355 | if v.is_heap() && let HeapObj::Str(s) = self.heap.get(v) { return Ok(s.clone()); } |
| 356 | Err(VmErr::TypeMsg(crate::s!("'", str name, "' did not return a string"))) |
| 357 | } |
| 358 | |
| 359 | /* `format(v, spec)` dispatch: instance `__format__(spec)` wins; otherwise the built-in spec engine runs. Empty spec on an instance still goes through `__format__` so user formatting can opt in. */ |
| 360 | pub(crate) fn format_op(&mut self, v: Val, spec: &str, chunk: &SSAChunk, slots: &mut [Val]) -> Result<String, VmErr> { |