RawReport

Struct RawReport 

Source
#[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:

  1. The pointer must have been created from a triomphe::Arc<ReportData<C>> for some C using triomphe::Arc::into_raw.
  2. The pointer will point to the same ReportData<C> for the entire lifetime of this object.

Implementations§

Source§

impl RawReport

Source

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:

  1. The type C matches the actual context type stored in the ReportData
  2. This is the only existing reference pointing to the inner ReportData
Source§

impl RawReport

Source

pub(super) fn from_arc<C: 'static>(data: Arc<ReportData<C>>) -> Self

Source

pub(super) fn into_non_null(self) -> NonNull<ReportData<Erased>>

Consumes the RawReport without decrementing the reference count and returns the inner pointer.

Source

pub fn new<C, H>( context: C, children: Vec<RawReport>, attachments: Vec<RawAttachment>, ) -> Self
where 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.

Source

pub fn as_ref(&self) -> RawReportRef<'_>

Returns a reference to the ReportData instance.

Source

pub unsafe fn as_mut(&mut self) -> RawReportMut<'_>

Returns a mutable reference to the ReportData instance.

§Safety

The caller must ensure:

  1. This is the only existing reference pointing to the inner ReportData. Specifically the strong count of the inner triomphe::Arc must be 1.

Trait Implementations§

Source§

impl Drop for RawReport

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.