pub struct ARConfiguration { /* private fields */ }ARConfiguration and objc2 only.Expand description
An object to describe and configure the Augmented Reality techniques to be used in an ARSession.
See also Apple’s documentation
Implementations§
Source§impl ARConfiguration
impl ARConfiguration
Sourcepub unsafe fn isSupported() -> bool
pub unsafe fn isSupported() -> bool
Determines whether this device supports the ARConfiguration.
Sourcepub unsafe fn supportedVideoFormats() -> Retained<NSArray<ARVideoFormat>>
Available on crate features ARVideoFormat and objc2-foundation only.
pub unsafe fn supportedVideoFormats() -> Retained<NSArray<ARVideoFormat>>
ARVideoFormat and objc2-foundation only.A list of supported video formats for this configuration and device.
The first element in the list is the default format for session output.
Sourcepub unsafe fn videoFormat(&self) -> Retained<ARVideoFormat>
Available on crate feature ARVideoFormat only.
pub unsafe fn videoFormat(&self) -> Retained<ARVideoFormat>
ARVideoFormat only.Video format of the session output.
Sourcepub unsafe fn setVideoFormat(&self, video_format: &ARVideoFormat)
Available on crate feature ARVideoFormat only.
pub unsafe fn setVideoFormat(&self, video_format: &ARVideoFormat)
ARVideoFormat only.Setter for videoFormat.
Sourcepub unsafe fn worldAlignment(&self) -> ARWorldAlignment
pub unsafe fn worldAlignment(&self) -> ARWorldAlignment
Determines how the coordinate system should be aligned with the world.
The default is ARWorldAlignmentGravity.
Sourcepub unsafe fn setWorldAlignment(&self, world_alignment: ARWorldAlignment)
pub unsafe fn setWorldAlignment(&self, world_alignment: ARWorldAlignment)
Setter for worldAlignment.
Sourcepub unsafe fn isLightEstimationEnabled(&self) -> bool
pub unsafe fn isLightEstimationEnabled(&self) -> bool
Enable or disable light estimation.
Enabled by default.
Sourcepub unsafe fn setLightEstimationEnabled(&self, light_estimation_enabled: bool)
pub unsafe fn setLightEstimationEnabled(&self, light_estimation_enabled: bool)
Setter for isLightEstimationEnabled.
Sourcepub unsafe fn providesAudioData(&self) -> bool
pub unsafe fn providesAudioData(&self) -> bool
Determines whether to capture and provide audio data.
Disabled by default.
Sourcepub unsafe fn setProvidesAudioData(&self, provides_audio_data: bool)
pub unsafe fn setProvidesAudioData(&self, provides_audio_data: bool)
Setter for providesAudioData.
Sourcepub unsafe fn frameSemantics(&self) -> ARFrameSemantics
pub unsafe fn frameSemantics(&self) -> ARFrameSemantics
The type of semantic understanding to provide with each frame.
Use the supportsFrameSemantics class method to check if the configuration type you intend to run supports the set of frame semantics.
For example, when running a session with a configuration of type ARWorldTrackingConfiguration one would need to use +[ ARWorldTrackingConfiguration supportsFrameSemantics:] to perform said check. An exception is thrown if the option is not supported. Defaults to ARFrameSemanticNone.
See: ARFrameSemantics
See: +[ARConfiguration supportsFrameSemantics:]
Sourcepub unsafe fn setFrameSemantics(&self, frame_semantics: ARFrameSemantics)
pub unsafe fn setFrameSemantics(&self, frame_semantics: ARFrameSemantics)
Setter for frameSemantics.
Sourcepub unsafe fn supportsFrameSemantics(frame_semantics: ARFrameSemantics) -> bool
pub unsafe fn supportsFrameSemantics(frame_semantics: ARFrameSemantics) -> bool
Determines whether the type of frame semantics is supported by the device and ARConfiguration class.
Semantic frame understanding is not supported on all devices. Use the supportsFrameSemantics class method to check if the configuration
type you intend to run supports the set of frame semantics. For example, when running a session with a configuration of type
ARWorldTrackingConfiguration one would need to use
+[ ARWorldTrackingConfiguration supportsFrameSemantics:] to perform said check.
See: ARFrameSemantics
Sourcepub unsafe fn configurableCaptureDeviceForPrimaryCamera() -> Option<Retained<AVCaptureDevice>>
Available on crate feature objc2-av-foundation only.
pub unsafe fn configurableCaptureDeviceForPrimaryCamera() -> Option<Retained<AVCaptureDevice>>
objc2-av-foundation only.Returns a pointer to the capture device of the camera that’s used for rendering, so developers can adjust capture settings.
May return nil if it is not recommended to modify capture settings, for example if the primary camera is used for tracking.
Sourcepub unsafe fn recommendedVideoFormatFor4KResolution() -> Option<Retained<ARVideoFormat>>
Available on crate feature ARVideoFormat only.
pub unsafe fn recommendedVideoFormatFor4KResolution() -> Option<Retained<ARVideoFormat>>
ARVideoFormat only.Returns a video format using a 4K resolution from the list of supported video formats.
May return nil if 4K is not supported for this configuration or device.
Sourcepub unsafe fn recommendedVideoFormatForHighResolutionFrameCapturing() -> Option<Retained<ARVideoFormat>>
Available on crate feature ARVideoFormat only.
pub unsafe fn recommendedVideoFormatForHighResolutionFrameCapturing() -> Option<Retained<ARVideoFormat>>
ARVideoFormat only.Returns a recommended video format that supports capturing high resolution frames with a significantly higher resolution than the streaming camera resolution.
Using this format may consume more power. Other video formats may support capturing high resolution frames as well, albeit at a lower quality or resolution.
See: [ARSession captureHighResolutionFrameWithCompletion:]
Sourcepub unsafe fn videoHDRAllowed(&self) -> bool
pub unsafe fn videoHDRAllowed(&self) -> bool
Whether HDR capturing is allowed if the current video format supports it. Defaults to
NO.
Sourcepub unsafe fn setVideoHDRAllowed(&self, video_hdr_allowed: bool)
pub unsafe fn setVideoHDRAllowed(&self, video_hdr_allowed: bool)
Setter for videoHDRAllowed.
pub unsafe fn new() -> Retained<Self>
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init/new methods).
§Example
Check that an instance of NSObject has the precise class NSObject.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load instead.Use Ivar::load instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T.
See Ivar::load_ptr for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T.
This is the reference-variant. Use Retained::downcast if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString to a NSMutableString,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass: for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject.
§Panics
This works internally by calling isKindOfClass:. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject and
NSProxy implement this method.
§Examples
Cast an NSString back and forth from NSObject.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();Try (and fail) to cast an NSObject to an NSString.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}Trait Implementations§
Source§impl AsRef<ARConfiguration> for ARBodyTrackingConfiguration
impl AsRef<ARConfiguration> for ARBodyTrackingConfiguration
Source§fn as_ref(&self) -> &ARConfiguration
fn as_ref(&self) -> &ARConfiguration
Source§impl AsRef<ARConfiguration> for ARConfiguration
impl AsRef<ARConfiguration> for ARConfiguration
Source§impl AsRef<ARConfiguration> for ARFaceTrackingConfiguration
impl AsRef<ARConfiguration> for ARFaceTrackingConfiguration
Source§fn as_ref(&self) -> &ARConfiguration
fn as_ref(&self) -> &ARConfiguration
Source§impl AsRef<ARConfiguration> for ARGeoTrackingConfiguration
impl AsRef<ARConfiguration> for ARGeoTrackingConfiguration
Source§fn as_ref(&self) -> &ARConfiguration
fn as_ref(&self) -> &ARConfiguration
Source§impl AsRef<ARConfiguration> for ARImageTrackingConfiguration
impl AsRef<ARConfiguration> for ARImageTrackingConfiguration
Source§fn as_ref(&self) -> &ARConfiguration
fn as_ref(&self) -> &ARConfiguration
Source§impl AsRef<ARConfiguration> for ARObjectScanningConfiguration
impl AsRef<ARConfiguration> for ARObjectScanningConfiguration
Source§fn as_ref(&self) -> &ARConfiguration
fn as_ref(&self) -> &ARConfiguration
Source§impl AsRef<ARConfiguration> for AROrientationTrackingConfiguration
impl AsRef<ARConfiguration> for AROrientationTrackingConfiguration
Source§fn as_ref(&self) -> &ARConfiguration
fn as_ref(&self) -> &ARConfiguration
Source§impl AsRef<ARConfiguration> for ARPositionalTrackingConfiguration
impl AsRef<ARConfiguration> for ARPositionalTrackingConfiguration
Source§fn as_ref(&self) -> &ARConfiguration
fn as_ref(&self) -> &ARConfiguration
Source§impl AsRef<ARConfiguration> for ARWorldTrackingConfiguration
impl AsRef<ARConfiguration> for ARWorldTrackingConfiguration
Source§fn as_ref(&self) -> &ARConfiguration
fn as_ref(&self) -> &ARConfiguration
Source§impl AsRef<AnyObject> for ARConfiguration
impl AsRef<AnyObject> for ARConfiguration
Source§impl AsRef<NSObject> for ARConfiguration
impl AsRef<NSObject> for ARConfiguration
Source§impl Borrow<ARConfiguration> for ARBodyTrackingConfiguration
impl Borrow<ARConfiguration> for ARBodyTrackingConfiguration
Source§fn borrow(&self) -> &ARConfiguration
fn borrow(&self) -> &ARConfiguration
Source§impl Borrow<ARConfiguration> for ARFaceTrackingConfiguration
impl Borrow<ARConfiguration> for ARFaceTrackingConfiguration
Source§fn borrow(&self) -> &ARConfiguration
fn borrow(&self) -> &ARConfiguration
Source§impl Borrow<ARConfiguration> for ARGeoTrackingConfiguration
impl Borrow<ARConfiguration> for ARGeoTrackingConfiguration
Source§fn borrow(&self) -> &ARConfiguration
fn borrow(&self) -> &ARConfiguration
Source§impl Borrow<ARConfiguration> for ARImageTrackingConfiguration
impl Borrow<ARConfiguration> for ARImageTrackingConfiguration
Source§fn borrow(&self) -> &ARConfiguration
fn borrow(&self) -> &ARConfiguration
Source§impl Borrow<ARConfiguration> for ARObjectScanningConfiguration
impl Borrow<ARConfiguration> for ARObjectScanningConfiguration
Source§fn borrow(&self) -> &ARConfiguration
fn borrow(&self) -> &ARConfiguration
Source§impl Borrow<ARConfiguration> for AROrientationTrackingConfiguration
impl Borrow<ARConfiguration> for AROrientationTrackingConfiguration
Source§fn borrow(&self) -> &ARConfiguration
fn borrow(&self) -> &ARConfiguration
Source§impl Borrow<ARConfiguration> for ARPositionalTrackingConfiguration
impl Borrow<ARConfiguration> for ARPositionalTrackingConfiguration
Source§fn borrow(&self) -> &ARConfiguration
fn borrow(&self) -> &ARConfiguration
Source§impl Borrow<ARConfiguration> for ARWorldTrackingConfiguration
impl Borrow<ARConfiguration> for ARWorldTrackingConfiguration
Source§fn borrow(&self) -> &ARConfiguration
fn borrow(&self) -> &ARConfiguration
Source§impl Borrow<AnyObject> for ARConfiguration
impl Borrow<AnyObject> for ARConfiguration
Source§impl Borrow<NSObject> for ARConfiguration
impl Borrow<NSObject> for ARConfiguration
Source§impl ClassType for ARConfiguration
impl ClassType for ARConfiguration
Source§const NAME: &'static str = "ARConfiguration"
const NAME: &'static str = "ARConfiguration"
Source§type ThreadKind = <<ARConfiguration as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<ARConfiguration as ClassType>::Super as ClassType>::ThreadKind
Source§impl CopyingHelper for ARConfiguration
Available on crate feature objc2-foundation only.
impl CopyingHelper for ARConfiguration
objc2-foundation only.Source§type Result = ARConfiguration
type Result = ARConfiguration
Self if the type has no
immutable counterpart. Read moreSource§impl Debug for ARConfiguration
impl Debug for ARConfiguration
Source§impl Deref for ARConfiguration
impl Deref for ARConfiguration
Source§impl Hash for ARConfiguration
impl Hash for ARConfiguration
Source§impl Message for ARConfiguration
impl Message for ARConfiguration
Source§impl NSCopying for ARConfiguration
impl NSCopying for ARConfiguration
Source§impl NSObjectProtocol for ARConfiguration
impl NSObjectProtocol for ARConfiguration
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass directly, or cast your objects with AnyObject::downcast_ref