#[repr(transparent)]pub struct RawReport {
ptr: NonNull<ReportData<Erased>>,
}Expand description
A 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.
However, the pointer is allowed to transition into a non-initialized state
inside the RawReport::drop method.
The pointer is guaranteed to have been created using
triomphe::Arc::into_raw.
We cannot use a triomphe::OffsetArc<ReportData<C>> directly, because
that does not allow us to type-erase the C.
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.
Implementations§
Source§impl RawReport
impl RawReport
Sourcepub unsafe fn into_parts<C: 'static>(
self,
) -> (C, Vec<RawReport>, Vec<RawAttachment>)
pub unsafe fn into_parts<C: 'static>( self, ) -> (C, Vec<RawReport>, Vec<RawAttachment>)
Deconstructs this report into its context, children, and attachments.
§Safety
The caller must ensure:
- The type
Cmatches the actual context type stored in theReportData - This is the only existing reference pointing to the inner
ReportData
Source§impl RawReport
impl RawReport
Sourcepub(super) fn from_arc<C: 'static>(data: Arc<ReportData<C>>) -> Self
pub(super) fn from_arc<C: 'static>(data: Arc<ReportData<C>>) -> Self
Creates a new RawReport from a triomphe::Arc<ReportData<C>>.
Sourcepub(super) fn into_non_null(self) -> NonNull<ReportData<Erased>>
pub(super) fn into_non_null(self) -> NonNull<ReportData<Erased>>
Consumes the RawReport without decrementing the reference count and returns the inner pointer.
Sourcepub fn new<C, H>(
context: C,
children: Vec<RawReport>,
attachments: Vec<RawAttachment>,
) -> Selfwhere
C: 'static,
H: ContextHandler<C>,
pub fn new<C, H>(
context: C,
children: Vec<RawReport>,
attachments: Vec<RawAttachment>,
) -> Selfwhere
C: 'static,
H: ContextHandler<C>,
Creates a new RawReport with the specified handler, context,
children, and attachments.
The created report will have the supplied context type and handler type. It will also have a strong count of 1.
Sourcepub fn as_ref(&self) -> RawReportRef<'_>
pub fn as_ref(&self) -> RawReportRef<'_>
Returns a reference to the ReportData instance.
Sourcepub unsafe fn as_mut(&mut self) -> RawReportMut<'_>
pub unsafe fn as_mut(&mut self) -> RawReportMut<'_>
Returns a mutable reference to the ReportData instance.
§Safety
The caller must ensure:
- This is the only existing reference pointing to the inner
ReportData. Specifically the strong count of the innertriomphe::Arcmust be1.