objc2_core_ml/generated/MLModel_MLModelCompilation.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// MLModelCompilation.
11///
12/// MLModel (MLModelCompilation)
13///
14/// Class with utilties for performing .mlmodel compilation
15#[cfg(feature = "MLModel")]
16impl MLModel {
17 extern_methods!(
18 /// Compile a .mlmodel for this device
19 ///
20 ///
21 /// Parameter `modelURL`: URL file path to .mlmodel file you wish to compile
22 ///
23 /// Parameter `error`: Any errors are surfaced here
24 ///
25 ///
26 /// Returns: a URL to the compiled .mlmodelc directory if successful
27 /// The model is compiled to a temporary location on disk
28 /// You must move the compiled model to a permanent location if you wish to keep it
29 ///
30 ///
31 /// The returned model can be loaded using:
32 ///
33 /// ```text
34 /// [MLModel modelWithContentsOfURL:error:]
35 /// ```
36 #[deprecated = "Use the asynchronous interface compileModelAtURL:completionHandler:error: instead."]
37 #[unsafe(method(compileModelAtURL:error:_))]
38 #[unsafe(method_family = none)]
39 pub unsafe fn compileModelAtURL_error(
40 model_url: &NSURL,
41 ) -> Result<Retained<NSURL>, Retained<NSError>>;
42
43 #[cfg(feature = "block2")]
44 /// Compile a .mlmodel or .mlpackage for this device. Perform the compilation asynchronously.
45 ///
46 ///
47 /// Parameter `modelURL`: URL file path to .mlmodel file you wish to compile
48 ///
49 /// Parameter `handler`: When the model compilation completes successfully the completion handler is invoked with a valid URL to the compiled .mlmodelc directory.
50 /// On failure, signified by nil compiledModelURL, the NSError object is populated.
51 ///
52 ///
53 /// The model is compiled to a temporary location in the file system. You must move the compiled model to a permanent location if you wish to keep it. Then the model can be loaded using the returned URL:
54 ///
55 /// ```text
56 /// [MLModel modelWithContentsOfURL:error:]
57 /// ```
58 #[unsafe(method(compileModelAtURL:completionHandler:))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn compileModelAtURL_completionHandler(
61 model_url: &NSURL,
62 handler: &block2::DynBlock<dyn Fn(*mut NSURL, *mut NSError)>,
63 );
64 );
65}