#[repr(transparent)]pub struct RawReportMut<'a> {
ptr: NonNull<ReportData<Erased>>,
_marker: PhantomData<&'a mut ReportData<Erased>>,
}Expand description
A mutable lifetime-bound pointer to a ReportData that is guaranteed to
point to an initialized instance of a ReportData<C> for some specific
C, though we do not know which actual C it is.
We cannot use a &'a mut ReportData<C> directly, because that would
require us to know the actual type of the context, which we do not.
§Safety invariants
This reference behaves like a &'a mut ReportData<C> for some unknown
C and upholds the usual safety invariants of mutable references:
- The pointee is properly initialized for the entire lifetime
'a. - The pointee is not aliased for the entire lifetime
'a. - Like a
&'a mut T, it is possible to reborrow this reference to a shorter lifetime. The borrow checker will ensure that original longer lifetime is not used while the shorter lifetime exists.
Fields§
§ptr: NonNull<ReportData<Erased>>Pointer to the inner report data
§Safety
The following safety invariants are guaranteed to be upheld as long as this struct exists:
- The pointer must have been created from a
triomphe::Arc<ReportData<C>>for someCusingtriomphe::Arc::into_raw. - The pointer will point to the same
ReportData<C>for the entire lifetime of this object.
_marker: PhantomData<&'a mut ReportData<Erased>>Marker to tell the compiler that we should
behave the same as a &'a mut ReportData<Erased>
Implementations§
Source§impl<'a> RawReportMut<'a>
impl<'a> RawReportMut<'a>
Sourcepub unsafe fn into_children_mut(self) -> &'a mut Vec<RawReport>
pub unsafe fn into_children_mut(self) -> &'a mut Vec<RawReport>
Gets a mutable reference to the child reports.
§Safety
The caller must ensure:
- In case there are other references to the same report and they make
assumptions about the report children being
Send+Sync, then those assumptions must be upheld when modifying the children.
Sourcepub unsafe fn into_attachments_mut(self) -> &'a mut Vec<RawAttachment>
pub unsafe fn into_attachments_mut(self) -> &'a mut Vec<RawAttachment>
Deconstructs the RawReportMut and returns a mutable reference to the
attachments vector.
§Safety
The caller must ensure:
- In case there are other references to the same report and they make
assumptions about the report attachments being
Send+Sync, then those assumptions must be upheld when modifying the attachments.
Sourcepub unsafe fn into_context_downcast_unchecked<C: 'static>(self) -> &'a mut C
pub unsafe fn into_context_downcast_unchecked<C: 'static>(self) -> &'a mut C
Downcasts the context to the specified type and returns a mutable reference.
§Safety
The caller must ensure:
- The type
Cmatches the actual context type stored in theReportData
Source§impl<'a> RawReportMut<'a>
impl<'a> RawReportMut<'a>
Sourcepub(super) unsafe fn cast_inner<C>(self) -> &'a mut ReportData<C>
pub(super) unsafe fn cast_inner<C>(self) -> &'a mut ReportData<C>
Casts the RawReportMut to a mutable ReportData<C> reference.
§Safety
The caller must ensure:
- The type
Cmatches the actual context type stored in theReportData
Sourcepub fn reborrow<'b>(&'b mut self) -> RawReportMut<'b>
pub fn reborrow<'b>(&'b mut self) -> RawReportMut<'b>
Reborrows the mutable reference to the ReportData with a shorter
lifetime.
Sourcepub fn as_ref(&self) -> RawReportRef<'_>
pub fn as_ref(&self) -> RawReportRef<'_>
Returns a reference to the ReportData instance.
Sourcepub fn into_ref(self) -> RawReportRef<'a>
pub fn into_ref(self) -> RawReportRef<'a>
Consumes the mutable reference and returns an immutable one with the same lifetime.
Sourcepub(super) fn into_mut_ptr(self) -> *mut ReportData<Erased>
pub(super) fn into_mut_ptr(self) -> *mut ReportData<Erased>
Consumes this RawReportMut and returns a raw mutable pointer to the
underlying ReportData.
This method is primarily used for internal operations that require direct pointer access.