pub struct CAEmitterCell { /* private fields */ }CAEmitterCell only.Expand description
Implementations§
Source§impl CAEmitterCell
impl CAEmitterCell
pub fn emitterCell() -> Retained<Self>
pub fn defaultValueForKey(key: &NSString) -> Option<Retained<AnyObject>>
pub fn shouldArchiveValueForKey(&self, key: &NSString) -> bool
pub fn name(&self) -> Option<Retained<NSString>>
pub fn isEnabled(&self) -> bool
Sourcepub fn setEnabled(&self, enabled: bool)
pub fn setEnabled(&self, enabled: bool)
Setter for isEnabled.
pub fn birthRate(&self) -> c_float
Sourcepub fn setBirthRate(&self, birth_rate: c_float)
pub fn setBirthRate(&self, birth_rate: c_float)
Setter for birthRate.
pub fn lifetime(&self) -> c_float
Sourcepub fn setLifetime(&self, lifetime: c_float)
pub fn setLifetime(&self, lifetime: c_float)
Setter for lifetime.
pub fn lifetimeRange(&self) -> c_float
Sourcepub fn setLifetimeRange(&self, lifetime_range: c_float)
pub fn setLifetimeRange(&self, lifetime_range: c_float)
Setter for lifetimeRange.
pub fn emissionLatitude(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setEmissionLatitude(&self, emission_latitude: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setEmissionLatitude(&self, emission_latitude: CGFloat)
objc2-core-foundation only.Setter for emissionLatitude.
pub fn emissionLongitude(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setEmissionLongitude(&self, emission_longitude: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setEmissionLongitude(&self, emission_longitude: CGFloat)
objc2-core-foundation only.Setter for emissionLongitude.
pub fn emissionRange(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setEmissionRange(&self, emission_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setEmissionRange(&self, emission_range: CGFloat)
objc2-core-foundation only.Setter for emissionRange.
pub fn velocity(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setVelocity(&self, velocity: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setVelocity(&self, velocity: CGFloat)
objc2-core-foundation only.Setter for velocity.
pub fn velocityRange(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setVelocityRange(&self, velocity_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setVelocityRange(&self, velocity_range: CGFloat)
objc2-core-foundation only.Setter for velocityRange.
pub fn xAcceleration(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setXAcceleration(&self, x_acceleration: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setXAcceleration(&self, x_acceleration: CGFloat)
objc2-core-foundation only.Setter for xAcceleration.
pub fn yAcceleration(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setYAcceleration(&self, y_acceleration: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setYAcceleration(&self, y_acceleration: CGFloat)
objc2-core-foundation only.Setter for yAcceleration.
pub fn zAcceleration(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setZAcceleration(&self, z_acceleration: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setZAcceleration(&self, z_acceleration: CGFloat)
objc2-core-foundation only.Setter for zAcceleration.
pub fn scale(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setScale(&self, scale: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setScale(&self, scale: CGFloat)
objc2-core-foundation only.Setter for scale.
pub fn scaleRange(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setScaleRange(&self, scale_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setScaleRange(&self, scale_range: CGFloat)
objc2-core-foundation only.Setter for scaleRange.
pub fn scaleSpeed(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setScaleSpeed(&self, scale_speed: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setScaleSpeed(&self, scale_speed: CGFloat)
objc2-core-foundation only.Setter for scaleSpeed.
pub fn spin(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setSpin(&self, spin: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setSpin(&self, spin: CGFloat)
objc2-core-foundation only.Setter for spin.
pub fn spinRange(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setSpinRange(&self, spin_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setSpinRange(&self, spin_range: CGFloat)
objc2-core-foundation only.Setter for spinRange.
pub fn color(&self) -> Option<Retained<CGColor>>
objc2-core-graphics only.Sourcepub fn setColor(&self, color: Option<&CGColor>)
Available on crate feature objc2-core-graphics only.
pub fn setColor(&self, color: Option<&CGColor>)
objc2-core-graphics only.Setter for color.
pub fn redRange(&self) -> c_float
Sourcepub fn setRedRange(&self, red_range: c_float)
pub fn setRedRange(&self, red_range: c_float)
Setter for redRange.
pub fn greenRange(&self) -> c_float
Sourcepub fn setGreenRange(&self, green_range: c_float)
pub fn setGreenRange(&self, green_range: c_float)
Setter for greenRange.
pub fn blueRange(&self) -> c_float
Sourcepub fn setBlueRange(&self, blue_range: c_float)
pub fn setBlueRange(&self, blue_range: c_float)
Setter for blueRange.
pub fn alphaRange(&self) -> c_float
Sourcepub fn setAlphaRange(&self, alpha_range: c_float)
pub fn setAlphaRange(&self, alpha_range: c_float)
Setter for alphaRange.
pub fn redSpeed(&self) -> c_float
Sourcepub fn setRedSpeed(&self, red_speed: c_float)
pub fn setRedSpeed(&self, red_speed: c_float)
Setter for redSpeed.
pub fn greenSpeed(&self) -> c_float
Sourcepub fn setGreenSpeed(&self, green_speed: c_float)
pub fn setGreenSpeed(&self, green_speed: c_float)
Setter for greenSpeed.
pub fn blueSpeed(&self) -> c_float
Sourcepub fn setBlueSpeed(&self, blue_speed: c_float)
pub fn setBlueSpeed(&self, blue_speed: c_float)
Setter for blueSpeed.
pub fn alphaSpeed(&self) -> c_float
Sourcepub fn setAlphaSpeed(&self, alpha_speed: c_float)
pub fn setAlphaSpeed(&self, alpha_speed: c_float)
Setter for alphaSpeed.
pub fn contents(&self) -> Option<Retained<AnyObject>>
Sourcepub unsafe fn setContents(&self, contents: Option<&AnyObject>)
pub unsafe fn setContents(&self, contents: Option<&AnyObject>)
pub fn contentsRect(&self) -> CGRect
objc2-core-foundation only.Sourcepub fn setContentsRect(&self, contents_rect: CGRect)
Available on crate feature objc2-core-foundation only.
pub fn setContentsRect(&self, contents_rect: CGRect)
objc2-core-foundation only.Setter for contentsRect.
pub fn contentsScale(&self) -> CGFloat
objc2-core-foundation only.Sourcepub fn setContentsScale(&self, contents_scale: CGFloat)
Available on crate feature objc2-core-foundation only.
pub fn setContentsScale(&self, contents_scale: CGFloat)
objc2-core-foundation only.Setter for contentsScale.
pub fn minificationFilter(&self) -> Retained<NSString>
Sourcepub fn setMinificationFilter(&self, minification_filter: &NSString)
pub fn setMinificationFilter(&self, minification_filter: &NSString)
Setter for minificationFilter.
This is copied when set.
pub fn magnificationFilter(&self) -> Retained<NSString>
Sourcepub fn setMagnificationFilter(&self, magnification_filter: &NSString)
pub fn setMagnificationFilter(&self, magnification_filter: &NSString)
Setter for magnificationFilter.
This is copied when set.
pub fn minificationFilterBias(&self) -> c_float
Sourcepub fn setMinificationFilterBias(&self, minification_filter_bias: c_float)
pub fn setMinificationFilterBias(&self, minification_filter_bias: c_float)
Setter for minificationFilterBias.
pub fn emitterCells(&self) -> Option<Retained<NSArray<CAEmitterCell>>>
Sourcepub fn setEmitterCells(&self, emitter_cells: Option<&NSArray<CAEmitterCell>>)
pub fn setEmitterCells(&self, emitter_cells: Option<&NSArray<CAEmitterCell>>)
Setter for emitterCells.
This is copied when set.
pub fn style(&self) -> Option<Retained<NSDictionary>>
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<AnyObject> for CAEmitterCell
impl AsRef<AnyObject> for CAEmitterCell
Source§impl AsRef<CAEmitterCell> for CAEmitterCell
impl AsRef<CAEmitterCell> for CAEmitterCell
Source§impl AsRef<NSObject> for CAEmitterCell
impl AsRef<NSObject> for CAEmitterCell
Source§impl Borrow<AnyObject> for CAEmitterCell
impl Borrow<AnyObject> for CAEmitterCell
Source§impl Borrow<NSObject> for CAEmitterCell
impl Borrow<NSObject> for CAEmitterCell
Source§impl CAMediaTiming for CAEmitterCell
impl CAMediaTiming for CAEmitterCell
Source§fn beginTime(&self) -> CFTimeInterval
fn beginTime(&self) -> CFTimeInterval
CAMediaTiming and objc2-core-foundation only.Source§fn setBeginTime(&self, begin_time: CFTimeInterval)
fn setBeginTime(&self, begin_time: CFTimeInterval)
CAMediaTiming and objc2-core-foundation only.beginTime.Source§fn duration(&self) -> CFTimeInterval
fn duration(&self) -> CFTimeInterval
CAMediaTiming and objc2-core-foundation only.Source§fn setDuration(&self, duration: CFTimeInterval)
fn setDuration(&self, duration: CFTimeInterval)
CAMediaTiming and objc2-core-foundation only.duration.Source§fn setSpeed(&self, speed: c_float)
fn setSpeed(&self, speed: c_float)
CAMediaTiming only.speed.Source§fn timeOffset(&self) -> CFTimeInterval
fn timeOffset(&self) -> CFTimeInterval
CAMediaTiming and objc2-core-foundation only.Source§fn setTimeOffset(&self, time_offset: CFTimeInterval)
fn setTimeOffset(&self, time_offset: CFTimeInterval)
CAMediaTiming and objc2-core-foundation only.timeOffset.Source§fn repeatCount(&self) -> c_float
fn repeatCount(&self) -> c_float
CAMediaTiming only.Source§fn setRepeatCount(&self, repeat_count: c_float)
fn setRepeatCount(&self, repeat_count: c_float)
CAMediaTiming only.repeatCount.Source§fn repeatDuration(&self) -> CFTimeInterval
fn repeatDuration(&self) -> CFTimeInterval
CAMediaTiming and objc2-core-foundation only.Source§fn setRepeatDuration(&self, repeat_duration: CFTimeInterval)
fn setRepeatDuration(&self, repeat_duration: CFTimeInterval)
CAMediaTiming and objc2-core-foundation only.repeatDuration.Source§fn autoreverses(&self) -> bool
fn autoreverses(&self) -> bool
CAMediaTiming only.Source§fn setAutoreverses(&self, autoreverses: bool)
fn setAutoreverses(&self, autoreverses: bool)
CAMediaTiming only.autoreverses.Source§fn fillMode(&self) -> Retained<CAMediaTimingFillMode>
fn fillMode(&self) -> Retained<CAMediaTimingFillMode>
CAMediaTiming only.Source§fn setFillMode(&self, fill_mode: &CAMediaTimingFillMode)
fn setFillMode(&self, fill_mode: &CAMediaTimingFillMode)
CAMediaTiming only.Source§impl ClassType for CAEmitterCell
impl ClassType for CAEmitterCell
Source§const NAME: &'static str = "CAEmitterCell"
const NAME: &'static str = "CAEmitterCell"
Source§type ThreadKind = <<CAEmitterCell as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<CAEmitterCell as ClassType>::Super as ClassType>::ThreadKind
Source§impl Debug for CAEmitterCell
impl Debug for CAEmitterCell
Source§impl DefaultRetained for CAEmitterCell
impl DefaultRetained for CAEmitterCell
Source§impl Deref for CAEmitterCell
impl Deref for CAEmitterCell
Source§impl Hash for CAEmitterCell
impl Hash for CAEmitterCell
Source§impl Message for CAEmitterCell
impl Message for CAEmitterCell
Source§impl NSObjectProtocol for CAEmitterCell
impl NSObjectProtocol for CAEmitterCell
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