MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / require_str

Method require_str

compiler/src/modules/vm/handlers/dunder.rs:354–357  ·  view source on GitHub ↗
(&self, v: Val, name: &str)

Source from the content-addressed store, hash-verified

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> {

Callers 4

display_opMethod · 0.80
repr_opMethod · 0.80
repr_deepMethod · 0.80
format_opMethod · 0.80

Calls 2

is_heapMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected