MCPcopy Create free account
hub / github.com/PerroEngine/Perro / expect_i32

Function expect_i32

perro_source/core/perro_animation/src/panim/fields.rs:404–417  ·  view source on GitHub ↗
(value: &SceneValue, key: &str, line_no: usize)

Source from the content-addressed store, hash-verified

402 };
403
404 Ok(Some((selector, property)))
405}
406
407fn expect_f32(value: &SceneValue, key: &str, line_no: usize) -> Result<f32, String> {
408 value
409 .as_f32()
410 .ok_or_else(|| format!("line {}: `{}` expects f32", line_no, key))
411}
412
413fn expect_i32(value: &SceneValue, key: &str, line_no: usize) -> Result<i32, String> {
414 if let Some(v) = value.as_i32() {
415 return Ok(v);
416 }
417 if let Some(v) = value.as_f32()
418 && v.is_finite()
419 && v.fract() == 0.0
420 && v >= i32::MIN as f32

Callers 1

parse_node_2d_actionFunction · 0.85

Calls 2

as_i32Method · 0.45
as_f32Method · 0.45

Tested by

no test coverage detected