(&self, udid: &str)
| 859 | } |
| 860 | |
| 861 | pub fn create_session(&self, udid: &str) -> Result<NativeSession, AppError> { |
| 862 | let udid = CString::new(udid).map_err(|e| AppError::bad_request(e.to_string()))?; |
| 863 | unsafe { |
| 864 | let mut error = ptr::null_mut(); |
| 865 | let handle = ffi::xcw_native_session_create(udid.as_ptr(), &mut error); |
| 866 | if handle.is_null() { |
| 867 | return Err(take_error(error) |
| 868 | .unwrap_or_else(|| AppError::native("Unable to create native session."))); |
| 869 | } |
| 870 | Ok(NativeSession { handle }) |
| 871 | } |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | fn optional_c_string(value: Option<&str>) -> Result<Option<CString>, AppError> { |
no test coverage detected