pub struct SendSync;Expand description
Marker type indicating that a report and all its contents are Send + Sync.
This is the default thread-safety marker for reports. When all the context
objects and attachments in a report implement Send + Sync, the report
itself can be safely sent to other threads and shared between threads.
§When to Use
Most standard types in Rust are Send + Sync, including:
- Primitive types (
i32,String,Vec, etc.) - Most standard library types
- Types explicitly designed for concurrent use
Use SendSync (the default) unless you have a specific need for
thread-local data.
§Examples
use std::thread;
use rootcause::prelude::*;
// String is Send + Sync, so the report is too
let report: Report<String, markers::Mutable, markers::SendSync> =
report!("Thread-safe error".to_string());
// Can send to another thread
thread::spawn(move || {
println!("Error in thread: {}", report);
})
.join()
.unwrap();Trait Implementations§
Source§impl<C, O> IntoReportCollection<SendSync> for Report<C, O, SendSync>where
C: ?Sized,
O: ReportOwnershipMarker,
impl<C, O> IntoReportCollection<SendSync> for Report<C, O, SendSync>where
C: ?Sized,
O: ReportOwnershipMarker,
Source§fn into_report_collection(self) -> ReportCollection<Self::Context, SendSync>
fn into_report_collection(self) -> ReportCollection<Self::Context, SendSync>
Source§impl<C> IntoReportCollection<SendSync> for ReportCollection<C, SendSync>where
C: ?Sized,
impl<C> IntoReportCollection<SendSync> for ReportCollection<C, SendSync>where
C: ?Sized,
Source§fn into_report_collection(self) -> ReportCollection<Self::Context, SendSync>
fn into_report_collection(self) -> ReportCollection<Self::Context, SendSync>
Source§impl Ord for SendSync
impl Ord for SendSync
Source§impl PartialOrd for SendSync
impl PartialOrd for SendSync
impl Copy for SendSync
impl Eq for SendSync
impl StructuralPartialEq for SendSync
Auto Trait Implementations§
impl Freeze for SendSync
impl RefUnwindSafe for SendSync
impl Send for SendSync
impl Sync for SendSync
impl Unpin for SendSync
impl UnwindSafe for SendSync
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.