(&self, args: &[Value], _context: &Context)
| 30 | } |
| 31 | |
| 32 | fn invoke(&self, args: &[Value], _context: &Context) -> Result<Value, DscError> { |
| 33 | let Some(condition) = args[0].as_bool() else { |
| 34 | return Err(DscError::Function("if".to_string(), t!("functions.if.conditionNotBoolean").to_string())); |
| 35 | }; |
| 36 | |
| 37 | if condition { |
| 38 | Ok(args[1].clone()) |
| 39 | } else { |
| 40 | Ok(args[2].clone()) |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | #[cfg(test)] |
nothing calls this directly
no test coverage detected