MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / create_simulator

Method create_simulator

packages/server/src/native/bridge.rs:339–370  ·  view source on GitHub ↗
(
        &self,
        name: &str,
        device_type_identifier: &str,
        runtime_identifier: Option<&str>,
        paired_watch: Option<&NativePairedWatchSpec>,
    )

Source from the content-addressed store, hash-verified

337 }
338
339 pub fn create_simulator(
340 &self,
341 name: &str,
342 device_type_identifier: &str,
343 runtime_identifier: Option<&str>,
344 paired_watch: Option<&NativePairedWatchSpec>,
345 ) -> Result<serde_json::Value, AppError> {
346 let name = CString::new(name).map_err(|e| AppError::bad_request(e.to_string()))?;
347 let device_type_identifier = CString::new(device_type_identifier)
348 .map_err(|e| AppError::bad_request(e.to_string()))?;
349 let runtime_identifier = optional_c_string(runtime_identifier)?;
350 let paired_watch_name = optional_c_string(paired_watch.map(|watch| watch.name.as_str()))?;
351 let paired_watch_device_type_identifier =
352 optional_c_string(paired_watch.map(|watch| watch.device_type_identifier.as_str()))?;
353 let paired_watch_runtime_identifier =
354 optional_c_string(paired_watch.and_then(|watch| watch.runtime_identifier.as_deref()))?;
355
356 let json = unsafe {
357 let mut error = ptr::null_mut();
358 let raw = ffi::xcw_native_create_simulator(
359 name.as_ptr(),
360 device_type_identifier.as_ptr(),
361 optional_c_ptr(&runtime_identifier),
362 optional_c_ptr(&paired_watch_name),
363 optional_c_ptr(&paired_watch_device_type_identifier),
364 optional_c_ptr(&paired_watch_runtime_identifier),
365 &mut error,
366 );
367 string_from_raw(raw, error)?
368 };
369 serde_json::from_str(&json).map_err(|e| AppError::internal(e.to_string()))
370 }
371
372 pub fn boot_simulator(&self, udid: &str) -> Result<(), AppError> {
373 unsafe {

Callers 1

create_simulatorFunction · 0.80

Calls 5

optional_c_stringFunction · 0.85
optional_c_ptrFunction · 0.85
string_from_rawFunction · 0.85
as_strMethod · 0.45

Tested by

no test coverage detected