(
rows: &mut Vec<InspectorValueRow>,
source: &str,
name: &str,
value: &SceneValue,
path: &mut Vec<ValuePathStep>,
depth: usize,
ctx: &ValueRowContext<'_>,
)
| 3380 | match value { |
| 3381 | SceneValue::UVec2 { x, y } => Some((x, y)), |
| 3382 | SceneValue::IVec2 { x, y } => Some((u32::try_from(x).ok()?, u32::try_from(y).ok()?)), |
| 3383 | SceneValue::Vec2 { x, y } if x >= 0.0 && y >= 0.0 => Some((x as u32, y as u32)), |
| 3384 | _ => None, |
| 3385 | } |
| 3386 | } |
| 3387 | |
| 3388 | fn scene_value_as_uvec3(value: SceneValue) -> Option<(u32, u32, u32)> { |
| 3389 | match value { |
| 3390 | SceneValue::UVec3 { x, y, z } => Some((x, y, z)), |
| 3391 | SceneValue::IVec3 { x, y, z } => Some(( |
| 3392 | u32::try_from(x).ok()?, |
| 3393 | u32::try_from(y).ok()?, |
| 3394 | u32::try_from(z).ok()?, |
| 3395 | )), |
| 3396 | SceneValue::Vec3 { x, y, z } if x >= 0.0 && y >= 0.0 && z >= 0.0 => { |
| 3397 | Some((x as u32, y as u32, z as u32)) |
| 3398 | } |
| 3399 | _ => None, |
| 3400 | } |
| 3401 | } |
| 3402 | |
| 3403 | fn scene_value_as_uvec4(value: SceneValue) -> Option<(u32, u32, u32, u32)> { |
| 3404 | match value { |
| 3405 | SceneValue::UVec4 { x, y, z, w } => Some((x, y, z, w)), |
| 3406 | SceneValue::IVec4 { x, y, z, w } => Some(( |
| 3407 | u32::try_from(x).ok()?, |
| 3408 | u32::try_from(y).ok()?, |
| 3409 | u32::try_from(z).ok()?, |
| 3410 | u32::try_from(w).ok()?, |
| 3411 | )), |
| 3412 | SceneValue::Vec4 { x, y, z, w } if x >= 0.0 && y >= 0.0 && z >= 0.0 && w >= 0.0 => { |
| 3413 | Some((x as u32, y as u32, z as u32, w as u32)) |
| 3414 | } |
| 3415 | _ => None, |
| 3416 | } |
| 3417 | } |
| 3418 | |
| 3419 | fn generic_inner(ty: &str, outer: &str) -> Option<String> { |
| 3420 | ty.strip_prefix(outer)? |
| 3421 | .strip_prefix('<')? |
| 3422 | .strip_suffix('>') |
| 3423 | .map(str::to_string) |
| 3424 | } |
| 3425 | |
| 3426 | fn strip_line_comment(line: &str) -> &str { |
| 3427 | line.split("//").next().unwrap_or(line) |
| 3428 | } |
| 3429 | |
| 3430 | fn brace_delta(line: &str) -> i32 { |
| 3431 | let opens = line.chars().filter(|ch| *ch == '{').count() as i32; |
| 3432 | let closes = line.chars().filter(|ch| *ch == '}').count() as i32; |
| 3433 | opens - closes |
| 3434 | } |
| 3435 | |
| 3436 | fn push_value_rows( |
| 3437 | rows: &mut Vec<InspectorValueRow>, |
| 3438 | source: &str, |
| 3439 | name: &str, |
no test coverage detected