#[repr(transparent)]pub struct RawAttachmentRef<'a> {
ptr: NonNull<AttachmentData<Erased>>,
_marker: PhantomData<&'a AttachmentData<Erased>>,
}Expand description
A lifetime-bound pointer to an AttachmentData that is guaranteed to point
to an initialized instance of an AttachmentData<A> for some specific A, though
we do not know which actual A it is.
We cannot use a &'a AttachmentData<A> directly, because that would require
us to know the actual type of the attachment, which we do not.
Fields§
§ptr: NonNull<AttachmentData<Erased>>§_marker: PhantomData<&'a AttachmentData<Erased>>Implementations§
Source§impl<'a> RawAttachmentRef<'a>
impl<'a> RawAttachmentRef<'a>
Sourcepub(super) fn vtable(self) -> &'static AttachmentVtable
pub(super) fn vtable(self) -> &'static AttachmentVtable
Returns a reference to the AttachmentVtable of the AttachmentData instance.
Sourcepub unsafe fn attachment_downcast_unchecked<A: 'static>(self) -> &'a A
pub unsafe fn attachment_downcast_unchecked<A: 'static>(self) -> &'a A
Accesses the inner attachment of the AttachmentData instance as a reference to the specified type.
§Safety
The caller must ensure that the type A matches the actual attachment type stored in the AttachmentData.
Source§impl<'a> RawAttachmentRef<'a>
impl<'a> RawAttachmentRef<'a>
Sourcepub(super) unsafe fn cast_inner<A: CastTo>(
self,
) -> &'a AttachmentData<A::Target>
pub(super) unsafe fn cast_inner<A: CastTo>( self, ) -> &'a AttachmentData<A::Target>
Casts the RawAttachmentRef to an AttachmentData<A> reference.
§Safety
The caller must ensure that the type A matches the actual attachment type stored in the AttachmentData.
Sourcepub(super) fn as_ptr(self) -> *const AttachmentData<Erased>
pub(super) fn as_ptr(self) -> *const AttachmentData<Erased>
Returns a NonNull pointer to the AttachmentData instance.
Sourcepub fn attachment_type_id(self) -> TypeId
pub fn attachment_type_id(self) -> TypeId
Returns the TypeId of the attachment.
Sourcepub fn attachment_handler_type_id(self) -> TypeId
pub fn attachment_handler_type_id(self) -> TypeId
Returns the TypeId of the attachment.
Sourcepub fn attachment_downcast<A: 'static>(self) -> Option<&'a A>
pub fn attachment_downcast<A: 'static>(self) -> Option<&'a A>
Checks if the type of the attachment matches the specified type and returns a reference to it if it does.
Sourcepub fn attachment_display(self, formatter: &mut Formatter<'_>) -> Result
pub fn attachment_display(self, formatter: &mut Formatter<'_>) -> Result
Formats the attachment by using the AttachmentHandler::display method
specified by the handler used to create the AttachmentData.
Sourcepub fn attachment_debug(self, formatter: &mut Formatter<'_>) -> Result
pub fn attachment_debug(self, formatter: &mut Formatter<'_>) -> Result
Formats the attachment by using the AttachmentHandler::debug method
specified by the handler used to create the AttachmentData.
Sourcepub fn preferred_formatting_style(
self,
report_formatting_function: FormattingFunction,
report_formatting_alternate: bool,
) -> AttachmentFormattingStyle
pub fn preferred_formatting_style( self, report_formatting_function: FormattingFunction, report_formatting_alternate: bool, ) -> AttachmentFormattingStyle
The formatting style preferred by the attachment when formatted as part of a report.
§Arguments
Trait Implementations§
Source§impl<'a> Clone for RawAttachmentRef<'a>
impl<'a> Clone for RawAttachmentRef<'a>
Source§fn clone(&self) -> RawAttachmentRef<'a>
fn clone(&self) -> RawAttachmentRef<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more