Trait FSVolumeOpenCloseOperations

Source
pub unsafe trait FSVolumeOpenCloseOperations: NSObjectProtocol {
    // Provided methods
    unsafe fn isOpenCloseInhibited(&self) -> bool
       where Self: Sized + Message { ... }
    unsafe fn setOpenCloseInhibited(&self, open_close_inhibited: bool)
       where Self: Sized + Message { ... }
    unsafe fn openItem_withModes_replyHandler(
        &self,
        item: &FSItem,
        modes: FSVolumeOpenModes,
        reply: &DynBlock<dyn Fn(*mut NSError)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn closeItem_keepingModes_replyHandler(
        &self,
        item: &FSItem,
        modes: FSVolumeOpenModes,
        reply: &DynBlock<dyn Fn(*mut NSError)>,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature FSVolume only.
Expand description

Methods and properties implemented by volumes that want to receive open and close calls for each item.

When a file system volume conforms to this protocol, the kernel layer issues an open call to indicate desired access, and a close call to indicate what access to retain. A file is fully closed when the kernel layer issues a close call with no retained open nodes. When a file system receives the close call, it removes all access to the item. When all memory mappings to the item release, the kernel layer issues a final close.

If a file system volume doesn’t conform to this protocol, the kernel layer can skip making such calls to the volume.

See also Apple’s documentation

Provided Methods§

Source

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

A Boolean value that instructs FSKit not to call this protocol’s methods, even if the volume conforms to it.

FSKit reads this value after the file system replies to the loadResource message. Changing the returned value during the runtime of the volume has no effect.

Source

unsafe fn setOpenCloseInhibited(&self, open_close_inhibited: bool)
where Self: Sized + Message,

Source

unsafe fn openItem_withModes_replyHandler( &self, item: &FSItem, modes: FSVolumeOpenModes, reply: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate features FSItem and block2 only.

Opens a file for access.

  • Parameters:
  • item: The item to open.
  • modes: The set of mode flags to open the item with.
  • reply: A block or closure to indicate success or failure. If opening fails, pass an error as the one parameter to the reply handler. If opening succeeds, pass nil. For an async Swift implementation, there’s no reply handler; simply throw an error or return normally.
Source

unsafe fn closeItem_keepingModes_replyHandler( &self, item: &FSItem, modes: FSVolumeOpenModes, reply: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate features FSItem and block2 only.

Closes a file from further access.

  • Parameters:
  • item: The item to close.
  • modes: The set of mode flags to keep after this close.
  • reply: A block or closure to indicate success or failure. If closing fails, pass an error as the one parameter to the reply handler. If closing succeeds, pass nil. For an async Swift implementation, there’s no reply handler; simply throw an error or return normally.

Trait Implementations§

Source§

impl ProtocolType for dyn FSVolumeOpenCloseOperations

Source§

const NAME: &'static str = "FSVolumeOpenCloseOperations"

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 FSVolumeOpenCloseOperations

Implementations on Foreign Types§

Source§

impl<T> FSVolumeOpenCloseOperations for ProtocolObject<T>

Implementors§