#[repr(transparent)]pub struct RawAttachment {
ptr: NonNull<AttachmentData<Erased>>,
_marker: PhantomData<AttachmentData<Erased>>,
}Expand description
A 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.
However, the pointer is allowed to transition into a non-initialized state inside the
RawAttachment::drop method.
The pointer is guaranteed to have been created using Box::into_raw.
We cannot use a Box<AttachmentData<A>> directly, because that does not allow
us to type-erase the A.
Fields§
§ptr: NonNull<AttachmentData<Erased>>§_marker: PhantomData<AttachmentData<Erased>>Implementations§
Source§impl RawAttachment
impl RawAttachment
Sourcepub fn new<A, H>(attachment: A) -> Selfwhere
A: 'static,
H: AttachmentHandler<A>,
pub fn new<A, H>(attachment: A) -> Selfwhere
A: 'static,
H: AttachmentHandler<A>,
Creates a new RawAttachment with the specified handler and attachment.
Sourcepub fn as_ref(&self) -> RawAttachmentRef<'_>
pub fn as_ref(&self) -> RawAttachmentRef<'_>
Returns a reference to the AttachmentData instance.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RawAttachment
impl RefUnwindSafe for RawAttachment
impl !Send for RawAttachment
impl !Sync for RawAttachment
impl Unpin for RawAttachment
impl UnwindSafe for RawAttachment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more