pub fn match_result_code<F, T>(result_code: i32, on_success: F) -> Result<T>where
F: FnOnce() -> T,Expand description
Evaluates a result code and executes a closure on success (result_code > 0).
§Arguments
result_code- An integer representing the operation result codeon_success- A closure that will be executed if result_code > 0
§Type Parameters
F- The type of the closureT- The return type of the closure
§Returns
Returns a Result<T> where:
Ok(T)- Contains the value returned by the closure if result_code > 0Ok(None)- If result_code == 0 (no data/empty result)Err(Error)- For negative result codes
§Note
This function treats 0 as a valid “no data” state and positive values as success.