RawReportRef

Struct RawReportRef 

Source
#[repr(transparent)]
pub struct RawReportRef<'a> { ptr: NonNull<ReportData<Erased>>, _marker: PhantomData<&'a ReportData<Erased>>, }
Expand description

A 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 ReportData<C> directly, because that would require us to know the actual type of the context, which we do not.

Fields§

§ptr: NonNull<ReportData<Erased>>

Pointer to the inner report data

§_marker: PhantomData<&'a ReportData<Erased>>

Marker to tell the compiler that we should behave the same as a &'a ReportData<Erased>

Implementations§

Source§

impl<'a> RawReportRef<'a>

Source

pub(super) fn vtable(self) -> &'static ReportVtable

Returns a reference to the ReportVtable of the ReportData instance.

Source

pub fn children(self) -> &'a Vec<RawReport>

Returns the child reports of this report.

Source

pub fn attachments(self) -> &'a Vec<RawAttachment>

Returns the attachments of this report.

Source

pub unsafe fn context_downcast_unchecked<C: 'static>(self) -> &'a C

Accesses the inner context of the ReportData instance as a reference to the specified type.

§Safety

The caller must ensure that the type C matches the actual context type stored in the ReportData.

Source§

impl<'a> RawReportRef<'a>

Source

pub(super) unsafe fn cast_inner<C: CastTo>(self) -> &'a ReportData<C::Target>

Casts the RawReportRef to a ReportData<C> reference.

§Safety

The caller must ensure that the type C matches the actual context type stored in the ReportData.

Source

pub(super) fn as_ptr(self) -> *const ReportData<Erased>

Returns a NonNull pointer to the ReportData instance.

Source

pub fn context_type_id(self) -> TypeId

Returns the TypeId of the context.

Source

pub fn context_handler_type_id(self) -> TypeId

Returns the TypeId of the context.

Source

pub fn context_downcast<C: 'static>(self) -> Option<&'a C>

Checks if the type of the context matches the specified type and returns a reference to it if it does.

Source

pub fn context_source(self) -> Option<&'a (dyn Error + 'static)>

Returns the source of the context using the ContextHandler::source method specified when the ReportData was created.

Source

pub fn context_display(self, formatter: &mut Formatter<'_>) -> Result

Formats the context by using the ContextHandler::display method specified by the handler used to create the ReportData.

Source

pub fn context_debug(self, formatter: &mut Formatter<'_>) -> Result

Formats the context by using the ContextHandler::debug method specified by the handler used to create the ReportData.

Source

pub fn preferred_context_formatting_style( self, report_formatting_function: FormattingFunction, ) -> ContextFormattingStyle

The formatting style preferred by the context when formatted as part of a report.

§Arguments
  • report_formatting_function: Whether the report in which this attachment will be embedded is being formatted using Display formatting or Debug
Source

pub unsafe fn clone_arc(self) -> RawReport

Clones the inner triomphe::Arc and returns a new RawReport pointing to the same data.

§Safety

There must be no external assumptions that there is unique ownership of the triomphe::Arc.

Source

pub fn strong_count(self) -> usize

Gets the strong_count of the inner triomphe::Arc.

Trait Implementations§

Source§

impl<'a> Clone for RawReportRef<'a>

Source§

fn clone(&self) -> RawReportRef<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for RawReportRef<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RawReportRef<'a>

§

impl<'a> RefUnwindSafe for RawReportRef<'a>

§

impl<'a> !Send for RawReportRef<'a>

§

impl<'a> !Sync for RawReportRef<'a>

§

impl<'a> Unpin for RawReportRef<'a>

§

impl<'a> UnwindSafe for RawReportRef<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.