pub struct OperationContext { /* private fields */ }Implementations§
Source§impl OperationContext
impl OperationContext
pub fn context(&self) -> &CallContext
pub fn result(&self) -> &OperationResult
pub fn exit_log(&self) -> &bool
pub fn mod_path(&self) -> &String
pub fn target(&self) -> &Option<String>
pub fn action(&self) -> &Option<String>
pub fn locator(&self) -> &Option<String>
pub fn path(&self) -> &[String]
pub fn metadata(&self) -> &ErrorMetadata
pub fn new() -> Self
pub fn want<S: Into<String>>(target: S) -> Self
👎Deprecated since 0.7.0:
use doing(…) for action contexts; use at(…) for locator/resource contexts
pub fn doing<S: Into<String>>(action: S) -> Self
pub fn at<S: Into<String>>(locator: S) -> Self
pub fn with_exit_log(self) -> Self
👎Deprecated since 0.5.4:
use with_auto_log
pub fn with_auto_log(self) -> Self
pub fn with_mod_path<S: Into<String>>(self, path: S) -> Self
pub fn with<S1: Into<String>, S2: Into<String>>(&mut self, key: S1, val: S2)
👎Deprecated since 0.5.4:
use record
pub fn with_path<S1: Into<String>, S2: Into<PathBuf>>( &mut self, key: S1, val: S2, )
👎Deprecated since 0.5.4:
use record
pub fn with_want<S: Into<String>>(&mut self, target: S)
👎Deprecated since 0.7.0:
use with_doing(…) for action path segments; use with_at(…) for locator segments
pub fn with_doing<S: Into<String>>(&mut self, action: S)
pub fn with_at<S: Into<String>>(&mut self, locator: S)
Sourcepub fn set_target<S: Into<String>>(&mut self, target: S)
pub fn set_target<S: Into<String>>(&mut self, target: S)
别名:设置目标资源/操作名;首次设置根 want,后续调用仅追加 path
pub fn path_string(&self) -> Option<String>
pub fn record_field<S1, S2>(&mut self, key: S1, val: S2)where
Self: ContextRecord<S1, S2>,
pub fn with_field<S1, S2>(self, key: S1, val: S2) -> Selfwhere
Self: ContextRecord<S1, S2>,
pub fn record_meta<K, V>(&mut self, key: K, value: V)
pub fn with_meta<K, V>(self, key: K, value: V) -> Self
pub fn mark_suc(&mut self)
pub fn mark_cancel(&mut self)
Sourcepub fn scope(&mut self) -> OperationScope<'_>
pub fn scope(&mut self) -> OperationScope<'_>
创建作用域 guard,默认为失败状态,需显式 mark_success()
Sourcepub fn scoped_success(&mut self) -> OperationScope<'_>
pub fn scoped_success(&mut self) -> OperationScope<'_>
创建作用域 guard,在作用域结束时自动标记成功
pub fn info<S: AsRef<str>>(&self, message: S)
pub fn debug<S: AsRef<str>>(&self, message: S)
pub fn warn<S: AsRef<str>>(&self, message: S)
pub fn error<S: AsRef<str>>(&self, message: S)
pub fn trace<S: AsRef<str>>(&self, message: S)
pub fn log_debug<S: AsRef<str>>(&self, message: S)
pub fn log_warn<S: AsRef<str>>(&self, message: S)
pub fn log_error<S: AsRef<str>>(&self, message: S)
pub fn log_trace<S: AsRef<str>>(&self, message: S)
Trait Implementations§
Source§impl Clone for OperationContext
impl Clone for OperationContext
Source§fn clone(&self) -> OperationContext
fn clone(&self) -> OperationContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S1> ContextRecord<S1, &Path> for OperationContext
impl<S1> ContextRecord<S1, &Path> for OperationContext
Source§impl<S1> ContextRecord<S1, &PathBuf> for OperationContext
impl<S1> ContextRecord<S1, &PathBuf> for OperationContext
Source§impl<S1> ContextRecord<S1, &str> for OperationContext
impl<S1> ContextRecord<S1, &str> for OperationContext
Source§impl<S1> ContextRecord<S1, String> for OperationContext
impl<S1> ContextRecord<S1, String> for OperationContext
Source§impl Debug for OperationContext
impl Debug for OperationContext
Source§impl Default for OperationContext
impl Default for OperationContext
Source§impl Display for OperationContext
impl Display for OperationContext
Source§impl Drop for OperationContext
impl Drop for OperationContext
Source§impl From<&OperationContext> for OperationContext
impl From<&OperationContext> for OperationContext
Source§fn from(value: &OperationContext) -> Self
fn from(value: &OperationContext) -> Self
Converts to this type from the input type.
Source§impl From<&Path> for OperationContext
impl From<&Path> for OperationContext
Source§impl From<&PathBuf> for OperationContext
impl From<&PathBuf> for OperationContext
Source§impl From<&StableSnapshotContextFrame> for OperationContext
impl From<&StableSnapshotContextFrame> for OperationContext
Source§fn from(value: &StableSnapshotContextFrame) -> Self
fn from(value: &StableSnapshotContextFrame) -> Self
Converts to this type from the input type.
Source§impl From<&str> for OperationContext
impl From<&str> for OperationContext
Source§impl<V> From<(&str, V)> for OperationContext
impl<V> From<(&str, V)> for OperationContext
Source§impl From<OperationContext> for SnapshotContextFrame
impl From<OperationContext> for SnapshotContextFrame
Source§fn from(value: OperationContext) -> Self
fn from(value: OperationContext) -> Self
Converts to this type from the input type.
Source§impl From<SnapshotContextFrame> for OperationContext
impl From<SnapshotContextFrame> for OperationContext
Source§fn from(value: SnapshotContextFrame) -> Self
fn from(value: SnapshotContextFrame) -> Self
Converts to this type from the input type.
Source§impl From<StableSnapshotContextFrame> for OperationContext
impl From<StableSnapshotContextFrame> for OperationContext
Source§fn from(value: StableSnapshotContextFrame) -> Self
fn from(value: StableSnapshotContextFrame) -> Self
Converts to this type from the input type.
Source§impl From<String> for OperationContext
impl From<String> for OperationContext
Source§impl PartialEq for OperationContext
impl PartialEq for OperationContext
impl StructuralPartialEq for OperationContext
Auto Trait Implementations§
impl Freeze for OperationContext
impl RefUnwindSafe for OperationContext
impl Send for OperationContext
impl Sync for OperationContext
impl Unpin for OperationContext
impl UnsafeUnpin for OperationContext
impl UnwindSafe for OperationContext
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