Struct ODQueryRef

Source
#[repr(C)]
pub struct ODQueryRef { /* private fields */ }
Available on crate feature CFOpenDirectory only.
Expand description

Opaque reference for the ODQuery object

See also Apple’s documentation

Implementations§

Source§

impl ODQueryRef

Source

pub unsafe fn with_node( allocator: Option<&CFAllocator>, node: Option<&ODNodeRef>, record_type_or_list: Option<&CFType>, attribute: Option<&ODAttributeType>, match_type: ODMatchType, query_value_or_list: Option<&CFType>, return_attribute_or_list: Option<&CFType>, max_results: CFIndex, error: *mut *mut CFError, ) -> Option<CFRetained<ODQueryRef>>

Available on crate features CFODQuery and CFOpenDirectoryConstants and objc2-core-foundation only.

Creates a query with the node using the parameters provided

Creates a query with the node using the supplied query parameters. Some parameters can either be CFString or CFData or a CFArray of either CFString or CFData.

Parameter allocator: a memory allocator to use for this object

Parameter node: an ODNodeRef to use

Parameter recordTypeOrList: a CFString of a type or CFArray with a list of record types

Parameter attribute: a CFStringRef of the attribute name to query

Parameter matchType: an ODMatchType value that signifies the type of query

Parameter queryValueOrList: a CFStringRef, CFDataRef or CFArrayRef of either type for values to query in attribute

Parameter returnAttributeOrList: a CFStringRef or CFArrayRef of CFStrings with the list of attributes to be returned from the query. Passing NULL is equivalent to passing kODAttributeTypeStandardOnly.

Parameter maxResults: a CFIndex of the total number of values the caller wants to be returned

Parameter error: an optional CFErrorRef reference for error details

Returns: an ODQueryRef which should be passed into ODQueryCopyResults for immediate results or ODQueryScheduleWithRunLoop for background behavior

Source

pub unsafe fn with_node_type( allocator: Option<&CFAllocator>, node_type: ODNodeType, record_type_or_list: Option<&CFType>, attribute: Option<&ODAttributeType>, match_type: ODMatchType, query_value_or_list: Option<&CFType>, return_attribute_or_list: Option<&CFType>, max_results: CFIndex, error: *mut *mut CFError, ) -> Option<CFRetained<ODQueryRef>>

Available on crate features CFODQuery and CFOpenDirectoryConstants and objc2-core-foundation only.

Creates a query object that is initialized to a particular node type.

Creates a query object that is initialized to a particular node type using the supplied query options.

Parameter allocator: a memory allocator to use for this object

Parameter nodeType: an ODNodeType to use when doing a query

Parameter recordTypeOrList: a ODRecordType of a type or CFArray with a list of record types

Parameter attribute: a ODAttributeType or CFStringRef of the attribute name to query

Parameter matchType: an ODMatchType value that signifies the type of query

Parameter queryValueOrList: a CFStringRef, CFDataRef or CFArrayRef of either type for values to query in attribute

Parameter returnAttributeOrList: a CFStringRef or CFArrayRef of CFStrings with the list of attributes to be returned from the query. Passing NULL is equivalent to passing kODAttributeTypeStandardOnly.

Parameter maxResults: a CFIndex of the total number of values the caller wants to be returned

Parameter error: an optional CFErrorRef reference for error details

Returns: an ODQueryRef which should be passed into ODQueryCopyResults for immediate results or ODQueryScheduleWithRunLoop for background behavior, see ODQueryCallback for details on RunLoop behavior.

Source

pub unsafe fn results( self: &ODQueryRef, allow_partial_results: bool, error: *mut *mut CFError, ) -> Option<CFRetained<CFArray>>

Available on crate features CFODQuery and objc2-core-foundation only.

Returns results from a provided ODQueryRef synchronously

Returns results from a provided ODQueryRef synchronously. Passing false to inAllowPartialResults will block the call until all results are returned or an error occurs. true can be passed at any time even if previous calls were made with false.

Parameter query: an ODQueryRef to use

Parameter allowPartialResults: a bool, passing true to retrieve any currently available results, or false to wait for all results

Parameter error: an optional CFErrorRef reference for error details

Returns: a CFArrayRef comprised of ODRecord objects. If partial results were requested but are complete, then NULL will be returned with outError set to NULL. If an error occurs, NULL will be returned and outError should be checked accordingly.

Source

pub unsafe fn synchronize(self: &ODQueryRef)

Available on crate feature CFODQuery only.

Will dispose of any results and restart the query.

Will dispose of any results and restart the query for subsequent ODQueryCopyResults. If the query is currently scheduled on a RunLoop, then the callback function will be called with inResults == NULL and inError.error == kODErrorQuerySynchronize and inError.domain == kODErrorDomainFramework, signifying that all existing results should be thrown away in preparation for new results.

Parameter query: an ODQueryRef to use

Source

pub unsafe fn set_callback( self: &ODQueryRef, callback: ODQueryCallback, user_info: *mut c_void, )

Available on crate features CFODQuery and objc2-core-foundation only.

This call is used to set the callback function for an asynchronous query

This call is used to set the callback function for an asynchronous query, using a CFRunLoop or a dispatch queue.

Parameter query: an ODQueryRef to use

Parameter callback: a function to call when a query has results to return

Parameter userInfo: a user-defined pointer to be passed back to the Query callback function

Source

pub unsafe fn schedule_with_run_loop( self: &ODQueryRef, run_loop: Option<&CFRunLoop>, run_loop_mode: Option<&CFString>, )

Available on crate features CFODQuery and objc2-core-foundation only.

Allows a query to run off of a runloop, though it will spawn a thread to handle the work

Allows a query to run off of a runloop, though it will spawn a thread to handle the work. When query is complete or stopped the callback function will be called with NULL results and inError set to NULL. ODQueryUnscheduleFromRunLoop() must be called to remove this query from Runloops if necessary.

Parameter query: an ODQueryRef to put on the runloop

Parameter runLoop: a CFRunLoopRef to put the ODQueryRef source onto

Parameter runLoopMode: a CFStringRef with the runloop mode to add the ODQueryRef to

Source

pub unsafe fn unschedule_from_run_loop( self: &ODQueryRef, run_loop: Option<&CFRunLoop>, run_loop_mode: Option<&CFString>, )

Available on crate features CFODQuery and objc2-core-foundation only.

Removes the ODQueryRef from the provided runloop

Removes the ODQueryRef from the provided runloop

Parameter query: an ODQueryRef to remove from the runloop

Parameter runLoop: a CFRunLoopRef to remove the ODQuery source from

Parameter runLoopMode: a CFStringRef of the mode to remove the ODQuery from

Source

pub unsafe fn set_dispatch_queue( self: &ODQueryRef, queue: Option<&DispatchQueue>, )

Available on crate features CFODQuery and dispatch2 only.

Performs the query and sends the results using the specified dispatch queue

Schedule the query to run and deliver its results using the specified dispatch queue. The previously set callback will be called using the same semantics as ODQueryScheduleWithRunLoop

Parameter query: an ODQueryRef to perform

Parameter queue: a dispatch queue to receive the query results

Methods from Deref<Target = CFType>§

Source

pub fn downcast_ref<T>(&self) -> Option<&T>
where T: ConcreteType,

Attempt to downcast the type to that of type T.

This is the reference-variant. Use CFRetained::downcast if you want to convert a retained type. See also ConcreteType for more details on which types support being converted to.

Source

pub fn retain_count(&self) -> usize

Get the reference count of the object.

This function may be useful for debugging. You normally do not use this function otherwise.

Beware that some things (like CFNumbers, small CFStrings etc.) may not have a normal retain count for optimization purposes, and can return usize::MAX in that case.

Trait Implementations§

Source§

impl AsRef<AnyObject> for ODQueryRef

Source§

fn as_ref(&self) -> &AnyObject

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

impl AsRef<CFType> for ODQueryRef

Source§

fn as_ref(&self) -> &CFType

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

impl AsRef<ODQueryRef> for ODQueryRef

Source§

fn as_ref(&self) -> &Self

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

impl Borrow<AnyObject> for ODQueryRef

Source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
Source§

impl Borrow<CFType> for ODQueryRef

Source§

fn borrow(&self) -> &CFType

Immutably borrows from an owned value. Read more
Source§

impl ConcreteType for ODQueryRef

Available on crate features CFODQuery and objc2-core-foundation only.
Source§

fn type_id() -> CFTypeID

Standard GetTypeID function support for CF-based objects

Returns the typeID for the ODQuery object

Returns: a valid CFTypeID for the ODQuery object

Source§

impl Debug for ODQueryRef

Source§

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

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

impl Deref for ODQueryRef

Source§

type Target = CFType

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl Hash for ODQueryRef

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 ODQueryRef

Source§

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

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

impl PartialEq for ODQueryRef

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 ODQueryRef

Source§

const ENCODING_REF: Encoding

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

impl Type for ODQueryRef

Source§

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

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

fn as_concrete_TypeRef(&self) -> &Self

👎Deprecated: this is redundant
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::retain
Helper for easier transition from the core-foundation crate. Read more
Source§

fn as_CFTypeRef(&self) -> &CFType
where Self: AsRef<CFType>,

👎Deprecated: this is redundant (CF types deref to CFType)
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::from_raw
Helper for easier transition from the core-foundation crate. Read more
Source§

impl Eq for ODQueryRef

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<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,