NSFileProviderChangeObserver

Trait NSFileProviderChangeObserver 

Source
pub unsafe trait NSFileProviderChangeObserver: NSObjectProtocol {
    // Provided methods
    unsafe fn didUpdateItems(
        &self,
        updated_items: &NSArray<ProtocolObject<dyn NSFileProviderItemProtocol>>,
    )
       where Self: Sized + Message { ... }
    unsafe fn didDeleteItemsWithIdentifiers(
        &self,
        deleted_item_identifiers: &NSArray<NSFileProviderItemIdentifier>,
    )
       where Self: Sized + Message { ... }
    unsafe fn finishEnumeratingChangesUpToSyncAnchor_moreComing(
        &self,
        anchor: &NSFileProviderSyncAnchor,
        more_coming: bool,
    )
       where Self: Sized + Message { ... }
    unsafe fn finishEnumeratingWithError(&self, error: &NSError)
       where Self: Sized + Message { ... }
    unsafe fn suggestedBatchSize(&self) -> NSInteger
       where Self: Sized + Message { ... }
}
Available on crate feature NSFileProviderEnumerating only.
Expand description

Provided Methods§

Source

unsafe fn didUpdateItems( &self, updated_items: &NSArray<ProtocolObject<dyn NSFileProviderItemProtocol>>, )
where Self: Sized + Message,

Available on crate feature NSFileProviderItem only.

Send updates to existing items, or insert new items.

Source

unsafe fn didDeleteItemsWithIdentifiers( &self, deleted_item_identifiers: &NSArray<NSFileProviderItemIdentifier>, )
where Self: Sized + Message,

Available on crate feature NSFileProviderItem only.

Delete existing items. No-op if the item was unknown.

Source

unsafe fn finishEnumeratingChangesUpToSyncAnchor_moreComing( &self, anchor: &NSFileProviderSyncAnchor, more_coming: bool, )
where Self: Sized + Message,

This method is used to complete a batch of changes. Follow the advice in -[NSFileProviderChangeObserver suggestedBatchSize] to determine when to call this method.

It is expected that the sync anchor passed here be different than the sync anchor that the enumeration started at, unless the client was already up to date on all the changes on the server, and didn’t have any pending updates or deletions.

Additionally, if the client is up to date on all the changes on the server it should set moreComing to NO.

Sync anchor data is limited to 500 bytes. Setting a larger anchor has the same effect as calling finishEnumeratingWithError with an expired sync anchor error.

Source

unsafe fn finishEnumeratingWithError(&self, error: &NSError)
where Self: Sized + Message,

If the enumeration fails with NSFileProviderErrorSyncAnchorExpired, we will drop all cached data and start the enumeration over starting with sync anchor nil.

Source

unsafe fn suggestedBatchSize(&self) -> NSInteger
where Self: Sized + Message,

Size of the batch suggested by the system for better performance.

The system will set that property to the value it considers is best suited for the current enumeration. The system can enumerate changes on a container in various cases (container presenter in the UI, file opened in an application, …). Each case has its own performance profile.

In case the enumerator has already more than suggestedBatchSize pending changes ready to enumerate, it is suggested it split the list of changes into several batches. If the enumerator does not have suggestedBatchSize ready to enumerator, the enumerator should finish immediately and not wait for more incoming changes to enumerate.

By taking into account the suggested size, the enumeration will guarantee the best user experience possible. Large batches can cause performance issues. And when the device reboots, enumerations will resume from the latest known sync anchor. Telling the system about the latest sync anchor more frequently will reduce the number of re-enumerations on system reboot.

The system enforces a maximum of 100 times the suggested size.

Trait Implementations§

Source§

impl ProtocolType for dyn NSFileProviderChangeObserver

Source§

const NAME: &'static str = "NSFileProviderChangeObserver"

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

fn protocol() -> Option<&'static AnyProtocol>

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

impl<T> ImplementedBy<T> for dyn NSFileProviderChangeObserver

Implementations on Foreign Types§

Source§

impl<T> NSFileProviderChangeObserver for ProtocolObject<T>

Implementors§