pub struct OSActivity { /* private fields */ }Expand description
Safe wrapper around os_activity_t.
Implementations§
Source§impl OSActivity
impl OSActivity
Sourcepub fn new(
description: &str,
parent: Option<&OSActivity>,
flags: OSActivityFlags,
) -> Result<Self, LogError>
pub fn new( description: &str, parent: Option<&OSActivity>, flags: OSActivityFlags, ) -> Result<Self, LogError>
Creates a new activity.
Pass None to use OS_ACTIVITY_CURRENT, or Some(&OSActivity::null())
to pass the explicit OS_ACTIVITY_NULL sentinel.
§Errors
Returns an error if the description contains a NUL byte or the bridge fails.
Sourcepub fn start(
description: &str,
flags: OSActivityFlags,
) -> Result<Self, LogError>
pub fn start( description: &str, flags: OSActivityFlags, ) -> Result<Self, LogError>
Creates a deprecated started activity.
§Errors
Returns an error if the description contains a NUL byte or the bridge fails.
Sourcepub fn initiate<F>(
description: &str,
flags: OSActivityFlags,
closure: F,
) -> Result<(), LogError>where
F: FnOnce(),
pub fn initiate<F>(
description: &str,
flags: OSActivityFlags,
closure: F,
) -> Result<(), LogError>where
F: FnOnce(),
Synchronously initiates an activity around a closure.
§Errors
Returns an error if the description contains a NUL byte.
Sourcepub fn initiate_f<C, F>(
description: &str,
flags: OSActivityFlags,
context: &mut C,
function: F,
) -> Result<(), LogError>
pub fn initiate_f<C, F>( description: &str, flags: OSActivityFlags, context: &mut C, function: F, ) -> Result<(), LogError>
Synchronously initiates an activity and passes a mutable context value to the callback.
§Errors
Returns an error if the description contains a NUL byte.
pub fn current() -> Self
pub fn none() -> Self
pub fn null() -> Self
pub fn identifiers(&self) -> ActivityIds
pub fn identifier(&self) -> u64
pub fn apply<F>(&self, closure: F)where
F: FnOnce(),
Sourcepub fn enter(&self) -> Result<OSActivityScope, LogError>
pub fn enter(&self) -> Result<OSActivityScope, LogError>
Enters the activity for the current scope.
§Errors
Returns an error if the bridge cannot allocate scope state.
pub fn end(&self)
pub fn label_user_action(label: &str)
Trait Implementations§
Source§impl Drop for OSActivity
impl Drop for OSActivity
Auto Trait Implementations§
impl Freeze for OSActivity
impl RefUnwindSafe for OSActivity
impl !Send for OSActivity
impl !Sync for OSActivity
impl Unpin for OSActivity
impl UnsafeUnpin for OSActivity
impl UnwindSafe for OSActivity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more