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