HKQuery

Struct HKQuery 

Source
pub struct HKQuery { /* private fields */ }
Available on crate feature HKQuery only.
Expand description

Implementations§

Source§

impl HKQuery

Source

pub unsafe fn objectType(&self) -> Option<Retained<HKObjectType>>

Available on crate feature HKObjectType only.
Source

pub unsafe fn sampleType(&self) -> Option<Retained<HKSampleType>>

👎Deprecated
Available on crate feature HKObjectType only.
Source

pub unsafe fn predicate(&self) -> Option<Retained<NSPredicate>>

Source

pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>

Source§

impl HKQuery

Methods declared on superclass NSObject.

Source

pub unsafe fn new() -> Retained<Self>

Source§

impl HKQuery

HKObjectPredicates.

Source

pub unsafe fn predicateForObjectsWithMetadataKey( key: &NSString, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches objects with metadata that contains a given key.

Parameter key: The metadata key.

Source

pub unsafe fn predicateForObjectsWithMetadataKey_allowedValues( key: &NSString, allowed_values: &NSArray, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses

Creates a query predicate that matches objects with metadata containing a value the matches one of the given values for the given key.

Parameter key: The metadata key.

Parameter allowedValues: The list of values that the metadata value can be equal to.

§Safety

allowed_values generic should be of the correct type.

Source

pub unsafe fn predicateForObjectsWithMetadataKey_operatorType_value( key: &NSString, operator_type: NSPredicateOperatorType, value: &AnyObject, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses

Creates a query predicate that matches objects with a value for a given metadata key matches the given operator type and value.

Parameter key: The metadata key.

Parameter operatorType: The comparison operator type for the expression.

Parameter value: The value to be compared against.

§Safety

value should be of the correct type.

Source

pub unsafe fn predicateForObjectsFromSource( source: &HKSource, ) -> Retained<NSPredicate>

Available on crate feature HKSource only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches objects saved by a given source.

Parameter source: The source.

Source

pub unsafe fn predicateForObjectsFromSources( sources: &NSSet<HKSource>, ) -> Retained<NSPredicate>

Available on crate feature HKSource only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches objects saved by any of the given sources.

Parameter sources: The list of sources.

Source

pub unsafe fn predicateForObjectsFromSourceRevisions( source_revisions: &NSSet<HKSourceRevision>, ) -> Retained<NSPredicate>

Available on crate feature HKSourceRevision only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches objects saved by any of the specified HKSourceRevisions.

Parameter sourceRevisions: The list of source revisions.

Source

pub unsafe fn predicateForObjectsFromDevices( devices: &NSSet<HKDevice>, ) -> Retained<NSPredicate>

Available on crate feature HKDevice only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches objects associated with any of the given devices. All properties of each HKDevice are considered in the query and must match exactly, including nil values. To perform searches based on specific device properties, use predicateForObjectsWithDeviceProperty:allowedValues:.

Parameter devices: The set of devices that generated data.

Source

pub unsafe fn predicateForObjectsWithDeviceProperty_allowedValues( key: &NSString, allowed_values: &NSSet<NSString>, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches objects associated with an HKDevice with the specified device property matching any value included in allowedValues. To query for samples with devices that match all the properties of an HKDevice, use predicateForObjectsFromDevices.

Parameter key: The device property key. (See HKDevice.h)

Parameter allowedValues: The set of values for which the device property can match. An empty set will match all devices whose property value is nil.

Source

pub unsafe fn predicateForObjectWithUUID(uuid: &NSUUID) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches the object saved with a particular UUID.

Parameter UUID: The UUID of the object.

Source

pub unsafe fn predicateForObjectsWithUUIDs( uui_ds: &NSSet<NSUUID>, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches the objects saved with one of the given UUIDs.

Parameter UUIDs: The set of NSUUIDs.

Source

pub unsafe fn predicateForObjectsWithNoCorrelation() -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches the objects that are not associated with an HKCorrelation.

Source

pub unsafe fn predicateForObjectsFromWorkout( workout: &HKWorkout, ) -> Retained<NSPredicate>

Available on crate features HKObject and HKSample and HKWorkout only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches the objects that have been added to the given workout.

Parameter workout: The HKWorkout that the object was added to.

Source

pub unsafe fn predicateForObjectsAssociatedWithElectrocardiogram( electrocardiogram: &HKElectrocardiogram, ) -> Retained<NSPredicate>

Available on crate features HKElectrocardiogram and HKObject and HKSample only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches the objects that have been added to the given electrocardiogram

Parameter electrocardiogram: The HKElectrocardiogram that the object was added to.

Source

pub unsafe fn predicateForWorkoutEffortSamplesRelatedToWorkout_activity( workout: &HKWorkout, activity: Option<&HKWorkoutActivity>, ) -> Retained<NSPredicate>

Available on crate features HKObject and HKSample and HKWorkout and HKWorkoutActivity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches Workout Effort samples that have been related to the given workout

Parameter workout: The HKWorkout that the object is related to.

Parameter activity: The HKWorkoutActivity that the object is related to.

Source§

impl HKQuery

HKSamplePredicates.

Source

pub unsafe fn predicateForSamplesWithStartDate_endDate_options( start_date: Option<&NSDate>, end_date: Option<&NSDate>, options: HKQueryOptions, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches samples with a startDate and an endDate that lie inside of a given time interval.

Parameter startDate: The start date of the predicate’s time interval.

Parameter endDate: The end date of the predicate’s time interval.

Parameter options: The rules for how a sample’s time interval overlaps with the predicate’s time interval.

Source§

impl HKQuery

HKQuantitySamplePredicates.

Source

pub unsafe fn predicateForQuantitySamplesWithOperatorType_quantity( operator_type: NSPredicateOperatorType, quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate feature HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches quantity samples with values that match the expression formed by the given operator and quantity.

Parameter operatorType: The operator type for the expression.

Parameter quantity: The quantity that the sample’s quantity is being compared to. It is the right hand side of the expression.

Source§

impl HKQuery

HKCategorySamplePredicates.

Source

pub unsafe fn predicateForCategorySamplesWithOperatorType_value( operator_type: NSPredicateOperatorType, value: NSInteger, ) -> Retained<NSPredicate>

Source

pub unsafe fn predicateForCategorySamplesEqualToValues( values: &NSSet<NSNumber>, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches all specified category values.

Source§

impl HKQuery

HKWorkoutPredicates.

Source

pub unsafe fn predicateForWorkoutsWithWorkoutActivityType( workout_activity_type: HKWorkoutActivityType, ) -> Retained<NSPredicate>

Available on crate feature HKWorkout only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts with the given HKWorkoutActivityType.

Parameter workoutActivityType: The HKWorkoutActivity type of the workout

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_duration( operator_type: NSPredicateOperatorType, duration: NSTimeInterval, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and duration

Parameter operatorType: The operator type for the expression.

Parameter duration: The value that the workout’s duration is being compared to. It is the right hand side of the expression.

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_totalEnergyBurned( operator_type: NSPredicateOperatorType, total_energy_burned: &HKQuantity, ) -> Retained<NSPredicate>

👎Deprecated: Use predicateForWorkoutsWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierActiveEnergyBurned
Available on crate feature HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and totalEnergyBurned

Parameter operatorType: The operator type for the expression.

Parameter totalEnergyBurned: The value that the workout’s totalEnergyBurned is being compared to. It is the right hand side of the expression. The unit for this value should be of type Energy.

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_totalDistance( operator_type: NSPredicateOperatorType, total_distance: &HKQuantity, ) -> Retained<NSPredicate>

👎Deprecated: Use predicateForWorkoutsWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for the desired distance type
Available on crate feature HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and totalEnergyBurned

Parameter operatorType: The operator type for the expression.

Parameter totalDistance: The value that the workout’s totalEnergyBurned is being compared to. It is the right hand side of the expression. The unit for this value should be of type Distance.

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_totalSwimmingStrokeCount( operator_type: NSPredicateOperatorType, total_swimming_stroke_count: &HKQuantity, ) -> Retained<NSPredicate>

👎Deprecated: Use predicateForWorkoutsWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierSwimmingStrokeCount
Available on crate feature HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and totalSwimmingStrokeCount

Parameter operatorType: The operator type for the expression.

Parameter totalSwimmingStrokeCount: The value that the workout’s totalSwimmingStrokeCount is being compared to. It is the right hand side of the expression. The unit for this value should be of type Count.

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_totalFlightsClimbed( operator_type: NSPredicateOperatorType, total_flights_climbed: &HKQuantity, ) -> Retained<NSPredicate>

👎Deprecated: Use predicateForWorkoutsWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierFlightsClimbed
Available on crate feature HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and totalFlightsClimbed

Parameter operatorType: The operator type for the expression.

Parameter totalFlightsClimbed: The value that the workout’s totalFlightsClimbed is being compared to. It is the right hand side of the expression. The unit for this value should be of type Count.

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_quantityType_sumQuantity( operator_type: NSPredicateOperatorType, quantity_type: &HKQuantityType, sum_quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate features HKObjectType and HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and sumQuantity in the statistics for the specified type.

Parameter operatorType: The operator type for the expression.

Parameter quantityType: The quantity type to compare statistics for. Should be a cumulative quantity type.

Parameter sumQuantity: The sum value that the workout statistics are being compared to. The unit for this value should match the allowed values for the quantityType.

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_quantityType_minimumQuantity( operator_type: NSPredicateOperatorType, quantity_type: &HKQuantityType, minimum_quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate features HKObjectType and HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and minimumQuantity in the statistics for the specified type.

Parameter operatorType: The operator type for the expression.

Parameter quantityType: The quantity type to compare statistics for. Should be a discrete quantity type.

Parameter minimumQuantity: The minumum value that the workout statistics are being compared to. The unit for this value should match the allowed values for the quantityType.

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_quantityType_maximumQuantity( operator_type: NSPredicateOperatorType, quantity_type: &HKQuantityType, maximum_quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate features HKObjectType and HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and maximumQuantity in the statistics for the specified type.

Parameter operatorType: The operator type for the expression.

Parameter quantityType: The quantity type to compare statistics for. Should be a discrete quantity type.

Parameter maximumQuantity: The maximum value that the workout statistics are being compared to. The unit for this value should match the allowed values for the quantityType.

Source

pub unsafe fn predicateForWorkoutsWithOperatorType_quantityType_averageQuantity( operator_type: NSPredicateOperatorType, quantity_type: &HKQuantityType, average_quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate features HKObjectType and HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkouts by the given operator type and averageQuantity in the statistics for the specified type.

Parameter operatorType: The operator type for the expression.

Parameter quantityType: The quantity type to compare statistics for. Should be a discrete quantity type.

Parameter averageQuantity: The average value that the workout statistics are being compared to. The unit for this value should match the allowed values for the quantityType.

Source§

impl HKQuery

HKWorkoutActivityPredicates.

Source

pub unsafe fn predicateForWorkoutActivitiesWithWorkoutActivityType( workout_activity_type: HKWorkoutActivityType, ) -> Retained<NSPredicate>

Available on crate feature HKWorkout only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkoutActivity objects with the given HKWorkoutActivityType. The resulting predicate should be wrapped using predicateForWorkoutsWithActivityPredicate: before being used in a query.

Parameter workoutActivityType: The HKWorkoutActivity type of the workout

Source

pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_duration( operator_type: NSPredicateOperatorType, duration: NSTimeInterval, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkoutActivity objects by the given operator type and duration. The resulting predicate should be wrapped using predicateForWorkoutsWithActivityPredicate: before being used in a query.

Parameter operatorType: The operator type for the expression.

Parameter duration: The value that the workout’s duration is being compared to. It is the right hand side of the expression.

Source

pub unsafe fn predicateForWorkoutActivitiesWithStartDate_endDate_options( start_date: Option<&NSDate>, end_date: Option<&NSDate>, options: HKQueryOptions, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkoutActivity objects with a startDate and an endDate that lie inside of a given time interval. The resulting predicate should be wrapped using predicateForWorkoutsWithActivityPredicate: before being used in a query.

Parameter startDate: The start date of the predicate’s time interval.

Parameter endDate: The end date of the predicate’s time interval.

Parameter options: The rules for how a activity’s time interval overlaps with the predicate’s time interval.

Source

pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_quantityType_sumQuantity( operator_type: NSPredicateOperatorType, quantity_type: &HKQuantityType, sum_quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate features HKObjectType and HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkoutActivity objetcs by the given operator type and sumQuantity in the statistics for the specified type. The resulting predicate should be wrapped using predicateForWorkoutsWithActivityPredicate: before being used in a query.

Parameter operatorType: The operator type for the expression.

Parameter quantityType: The quantity type to compare statistics for. Should be a cumulative quantity type.

Parameter sumQuantity: The sum value that the activity statistics are being compared to. The unit for this value should match the allowed values for the quantityType.

Source

pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_quantityType_minimumQuantity( operator_type: NSPredicateOperatorType, quantity_type: &HKQuantityType, minimum_quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate features HKObjectType and HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkoutActivity objetcs by the given operator type and minimumQuantity in the statistics for the specified type. The resulting predicate should be wrapped using predicateForWorkoutsWithActivityPredicate: before being used in a query.

Parameter operatorType: The operator type for the expression.

Parameter quantityType: The quantity type to compare statistics for. Should be a discrete quantity type.

Parameter minimumQuantity: The minumum value that the activty statistics are being compared to. The unit for this value should match the allowed values for the quantityType.

Source

pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_quantityType_maximumQuantity( operator_type: NSPredicateOperatorType, quantity_type: &HKQuantityType, maximum_quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate features HKObjectType and HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkoutActivity objetcs by the given operator type and maximumQuantity in the statistics for the specified type. The resulting predicate should be wrapped using predicateForWorkoutsWithActivityPredicate: before being used in a query.

Parameter operatorType: The operator type for the expression.

Parameter quantityType: The quantity type to compare statistics for. Should be a discrete quantity type.

Parameter maximumQuantity: The maximum value that the activity statistics are being compared to. The unit for this value should match the allowed values for the quantityType.

Source

pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_quantityType_averageQuantity( operator_type: NSPredicateOperatorType, quantity_type: &HKQuantityType, average_quantity: &HKQuantity, ) -> Retained<NSPredicate>

Available on crate features HKObjectType and HKQuantity only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKWorkoutActivity objetcs by the given operator type and averageQuantity in the statistics for the specified type. The resulting predicate should be wrapped using predicateForWorkoutsWithActivityPredicate: before being used in a query.

Parameter operatorType: The operator type for the expression.

Parameter quantityType: The quantity type to compare statistics for. Should be a discrete quantity type.

Parameter averageQuantity: The average value that the activity statistics are being compared to. The unit for this value should match the allowed values for the quantityType.

Source

pub unsafe fn predicateForWorkoutsWithActivityPredicate( activity_predicate: &NSPredicate, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches workouts containing an activity matching the passed predicate.

Parameter activityPredicate: The predicate on the activities of the workout

Source§

impl HKQuery

HKActivitySummaryPredicates.

Source

pub unsafe fn predicateForActivitySummaryWithDateComponents( date_components: &NSDateComponents, ) -> Retained<NSPredicate>

Creates a predicate for use with HKActivitySummaryQuery

Creates a query predicate that matches HKActivitySummaries with the given date components.

Parameter dateComponents: The date components of the activity summary. These date components should contain era, year, month, and day components in the gregorian calendar.

Source

pub unsafe fn predicateForActivitySummariesBetweenStartDateComponents_endDateComponents( start_date_components: &NSDateComponents, end_date_components: &NSDateComponents, ) -> Retained<NSPredicate>

Creates a predicate for use with HKActivitySummaryQuery

Creates a query predicate that matches HKActivitySummaries that fall between the given date components.

Parameter startDateComponents: The date components that define the beginning of the range. These date components should contain era, year, month, and day components in the gregorian calendar.

Parameter endDateComponents: The date components that define the end of the range. These date components should contain era, year, month, and day components in the gregorian calendar.

Source§

impl HKQuery

HKClinicalRecordPredicates.

Source

pub unsafe fn predicateForClinicalRecordsWithFHIRResourceType( resource_type: &HKFHIRResourceType, ) -> Retained<NSPredicate>

Available on crate feature HKFHIRResource only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKClinicalRecords with a specific FHIR resource type.

Parameter resourceType: The FHIR resource type.

Source

pub unsafe fn predicateForClinicalRecordsFromSource_FHIRResourceType_identifier( source: &HKSource, resource_type: &HKFHIRResourceType, identifier: &NSString, ) -> Retained<NSPredicate>

Available on crate features HKFHIRResource and HKSource only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKClinicalRecords for a given source, FHIR resource type, and FHIR identifier.

Parameter source: The source.

Parameter resourceType: The FHIR resource type.

Parameter identifier: The FHIR identifier.

Source§

impl HKQuery

HKElectrocardiogramPredicates.

Source

pub unsafe fn predicateForElectrocardiogramsWithClassification( classification: HKElectrocardiogramClassification, ) -> Retained<NSPredicate>

Available on crate feature HKElectrocardiogram only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKElectrocardiograms with a specific classification.

Parameter classification: The classification for the electrocardiogram.

Source

pub unsafe fn predicateForElectrocardiogramsWithSymptomsStatus( symptoms_status: HKElectrocardiogramSymptomsStatus, ) -> Retained<NSPredicate>

Available on crate feature HKElectrocardiogram only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKElectrocardiograms with a specificied symptoms status.

Parameter symptomsStatus: The symptoms status for the electrocardiogram.

Source§

impl HKQuery

HKVerifiableClinicalRecordPredicates.

Source

pub unsafe fn predicateForVerifiableClinicalRecordsWithRelevantDateWithinDateInterval( date_interval: &NSDateInterval, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a predicate that matches HKVerifiableClinicalRecords with a relevant date within a date interval.

Parameter dateInterval: The date interval that the record’s relevant date is in.

Source§

impl HKQuery

HKStateOfMind.

Source

pub unsafe fn predicateForStatesOfMindWithValence_operatorType( valence: c_double, operator_type: NSPredicateOperatorType, ) -> Retained<NSPredicate>

Creates a predicate for use with HKStateOfMind

Creates a query predicate that matches HKStateOfMind samples that have a valence property matching the operator type and valence.

Parameter valence: The value to be compared against.

Parameter operatorType: The comparison operator type for the expression.

Source

pub unsafe fn predicateForStatesOfMindWithKind( kind: HKStateOfMindKind, ) -> Retained<NSPredicate>

Available on crate feature HKStateOfMind only.

Creates a predicate for use with HKStateOfMind

Creates a query predicate that matches HKStateOfMind samples that have the specified kind of feeling type.

Parameter kind: The kind of feeling type to be compared against.

Source

pub unsafe fn predicateForStatesOfMindWithLabel( label: HKStateOfMindLabel, ) -> Retained<NSPredicate>

Available on crate feature HKStateOfMind only.

Creates a predicate for use with HKStateOfMind

Creates a query predicate that matches HKStateOfMind samples that have the specified label.

Parameter label: The label to be compared against.

Source

pub unsafe fn predicateForStatesOfMindWithAssociation( association: HKStateOfMindAssociation, ) -> Retained<NSPredicate>

Available on crate feature HKStateOfMind only.

Creates a predicate for use with HKStateOfMind

Creates a query predicate that matches HKStateOfMind samples that have the specified association.

Parameter association: The association to be compared against.

Source§

impl HKQuery

HKMedicationDoseEvent.

Source

pub unsafe fn predicateForMedicationDoseEventWithStatus( status: HKMedicationDoseEventLogStatus, ) -> Retained<NSPredicate>

Available on crate feature HKMedicationDoseEvent only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKMedicationDoseEvent samples that have the status specified.

Parameter status: The logged status of the medication dose event to match.

Source

pub unsafe fn predicateForMedicationDoseEventWithStatuses( statuses: &NSSet<NSNumber>, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKMedicationDoseEvent samples that have any of the statuses specified.

Parameter statuses: The logged statuses of the medication dose event to match.

Source

pub unsafe fn predicateForMedicationDoseEventWithScheduledDate( scheduled_date: &NSDate, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKMedicationDoseEvent samples that have the exact scheduled date specified.

Parameter scheduledDate: The exact scheduled date of the medication dose event to match.

Source

pub unsafe fn predicateForMedicationDoseEventWithScheduledDates( scheduled_dates: &NSSet<NSDate>, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKMedicationDoseEvent samples that have any of the exact scheduled dates specified.

Parameter scheduledDates: The exact scheduled dates of any medication dose event to match.

Source

pub unsafe fn predicateForMedicationDoseEventWithScheduledStartDate_endDate( start_date: Option<&NSDate>, end_date: Option<&NSDate>, ) -> Retained<NSPredicate>

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKMedicationDoseEvent samples that have a scheduled date within a window of scheduled times. If nil is provided to either parameter, the respective side of the window is unbound.

Parameter startDate: The beginning of the window for scheduled dates of any medication dose event to match.

Parameter endDate: The beginning of the window for scheduled dates of any medication dose event to match.

Source

pub unsafe fn predicateForMedicationDoseEventWithMedicationConceptIdentifier( medication_concept_identifier: &HKHealthConceptIdentifier, ) -> Retained<NSPredicate>

Available on crate feature HKHealthConceptIdentifier only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKMedicationDoseEvent samples that match a medication’s concept identifier.

Parameter medicationConceptIdentifier: The identifier of the medication that a dose event was created for.

Source

pub unsafe fn predicateForMedicationDoseEventWithMedicationConceptIdentifiers( medication_concept_identifiers: &NSSet<HKHealthConceptIdentifier>, ) -> Retained<NSPredicate>

Available on crate feature HKHealthConceptIdentifier only.

Creates a predicate for use with HKQuery subclasses.

Creates a query predicate that matches HKMedicationDoseEvent samples generated by any medication in a set of medication concept identifiers.

Parameter medicationConceptIdentifiers: Any identifier of a medication that a dose event was created for.

Source§

impl HKQuery

HKUserAnnotatedMedications.

Source

pub unsafe fn predicateForUserAnnotatedMedicationsWithIsArchived( is_archived: bool, ) -> Retained<NSPredicate>

Creates a predicate for use with HKUserAnnotatedMedicationQuery.

Creates a query predicate that matches HKUserAnnotatedMedication objects that have the archived status specified.

Parameter isArchived: The archived status of the medication. Ex: True will match medications in the archived section in the Health App.

Source

pub unsafe fn predicateForUserAnnotatedMedicationsWithHasSchedule( has_schedule: bool, ) -> Retained<NSPredicate>

Creates a predicate for use with HKUserAnnotatedMedicationQuery.

Creates a query predicate that matches HKUserAnnotatedMedication objects that match the schedule status specified.

Parameter hasSchedule: The schedule status of the medication. Ex: True will match medications that have a reminders schedule set up in the Health App.

Methods from Deref<Target = NSObject>§

Source

pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !

Handle messages the object doesn’t recognize.

See Apple’s documentation for details.

Methods from Deref<Target = AnyObject>§

Source

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());
Source

pub unsafe fn get_ivar<T>(&self, name: &str) -> &T
where T: Encode,

👎Deprecated: this is difficult to use correctly, use 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.

Source

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 HKQuery

Source§

fn as_ref(&self) -> &AnyObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKActivitySummaryQuery

Available on crate feature HKActivitySummaryQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKAnchoredObjectQuery

Available on crate feature HKAnchoredObjectQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKCorrelationQuery

Available on crate feature HKCorrelationQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKDocumentQuery

Available on crate feature HKDocumentQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKElectrocardiogramQuery

Available on crate feature HKElectrocardiogramQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKHeartbeatSeriesQuery

Available on crate feature HKHeartbeatSeriesQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKObserverQuery

Available on crate feature HKObserverQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKQuantitySeriesSampleQuery

Available on crate feature HKQuantitySeriesSampleQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKQuery

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKSampleQuery

Available on crate feature HKSampleQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKSourceQuery

Available on crate feature HKSourceQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKStatisticsCollectionQuery

Available on crate feature HKStatisticsCollectionQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKStatisticsQuery

Available on crate feature HKStatisticsQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKUserAnnotatedMedicationQuery

Available on crate feature HKUserAnnotatedMedicationQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKVerifiableClinicalRecordQuery

Available on crate feature HKVerifiableClinicalRecordQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKWorkoutEffortRelationshipQuery

Available on crate feature HKWorkoutEffortRelationshipQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HKQuery> for HKWorkoutRouteQuery

Available on crate feature HKWorkoutRouteQuery only.
Source§

fn as_ref(&self) -> &HKQuery

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<NSObject> for HKQuery

Source§

fn as_ref(&self) -> &NSObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<AnyObject> for HKQuery

Source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKActivitySummaryQuery

Available on crate feature HKActivitySummaryQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKAnchoredObjectQuery

Available on crate feature HKAnchoredObjectQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKCorrelationQuery

Available on crate feature HKCorrelationQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKDocumentQuery

Available on crate feature HKDocumentQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKElectrocardiogramQuery

Available on crate feature HKElectrocardiogramQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKHeartbeatSeriesQuery

Available on crate feature HKHeartbeatSeriesQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKObserverQuery

Available on crate feature HKObserverQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKQuantitySeriesSampleQuery

Available on crate feature HKQuantitySeriesSampleQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKSampleQuery

Available on crate feature HKSampleQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKSourceQuery

Available on crate feature HKSourceQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKStatisticsCollectionQuery

Available on crate feature HKStatisticsCollectionQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKStatisticsQuery

Available on crate feature HKStatisticsQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKUserAnnotatedMedicationQuery

Available on crate feature HKUserAnnotatedMedicationQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKVerifiableClinicalRecordQuery

Available on crate feature HKVerifiableClinicalRecordQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKWorkoutEffortRelationshipQuery

Available on crate feature HKWorkoutEffortRelationshipQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HKQuery> for HKWorkoutRouteQuery

Available on crate feature HKWorkoutRouteQuery only.
Source§

fn borrow(&self) -> &HKQuery

Immutably borrows from an owned value. Read more
Source§

impl Borrow<NSObject> for HKQuery

Source§

fn borrow(&self) -> &NSObject

Immutably borrows from an owned value. Read more
Source§

impl ClassType for HKQuery

Source§

const NAME: &'static str = "HKQuery"

The name of the Objective-C class that this type represents. Read more
Source§

type Super = NSObject

The superclass of this class. Read more
Source§

type ThreadKind = <<HKQuery as ClassType>::Super as ClassType>::ThreadKind

Whether the type can be used from any thread, or from only the main thread. Read more
Source§

fn class() -> &'static AnyClass

Get a reference to the Objective-C class that this type represents. Read more
Source§

fn as_super(&self) -> &Self::Super

Get an immutable reference to the superclass.
Source§

impl Debug for HKQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for HKQuery

Source§

type Target = NSObject

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Hash for HKQuery

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for HKQuery

Source§

fn retain(&self) -> Retained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

impl NSObjectProtocol for HKQuery

Source§

fn isEqual(&self, other: Option<&AnyObject>) -> bool
where Self: Sized + Message,

Check whether the object is equal to an arbitrary other object. Read more
Source§

fn hash(&self) -> usize
where Self: Sized + Message,

An integer that can be used as a table address in a hash table structure. Read more
Source§

fn isKindOfClass(&self, cls: &AnyClass) -> bool
where Self: Sized + Message,

Check if the object is an instance of the class, or one of its subclasses. Read more
Source§

fn is_kind_of<T>(&self) -> bool
where T: ClassType, Self: Sized + Message,

👎Deprecated: use isKindOfClass directly, or cast your objects with AnyObject::downcast_ref
Check if the object is an instance of the class type, or one of its subclasses. Read more
Source§

fn isMemberOfClass(&self, cls: &AnyClass) -> bool
where Self: Sized + Message,

Check if the object is an instance of a specific class, without checking subclasses. Read more
Source§

fn respondsToSelector(&self, aSelector: Sel) -> bool
where Self: Sized + Message,

Check whether the object implements or inherits a method with the given selector. Read more
Source§

fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
where Self: Sized + Message,

Check whether the object conforms to a given protocol. Read more
Source§

fn description(&self) -> Retained<NSObject>
where Self: Sized + Message,

A textual representation of the object. Read more
Source§

fn debugDescription(&self) -> Retained<NSObject>
where Self: Sized + Message,

A textual representation of the object to use when debugging. Read more
Source§

fn isProxy(&self) -> bool
where Self: Sized + Message,

Check whether the receiver is a subclass of the NSProxy root class instead of the usual NSObject. Read more
Source§

fn retainCount(&self) -> usize
where Self: Sized + Message,

The reference count of the object. Read more
Source§

impl PartialEq for HKQuery

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RefEncode for HKQuery

Source§

const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF

The Objective-C type-encoding for a reference of this type. Read more
Source§

impl DowncastTarget for HKQuery

Source§

impl Eq for HKQuery

Source§

impl Send for HKQuery

Source§

impl Sync for HKQuery

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T> AnyThread for T
where T: ClassType<ThreadKind = dyn AnyThread + 'a> + ?Sized,

Source§

fn alloc() -> Allocated<Self>
where Self: Sized + ClassType,

Allocate a new instance of the class. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,