Expand description
Vtable for type-erased attachment operations.
This module contains the AttachmentVtable which enables calling handler
methods on attachments when their concrete attachment type A and handler
type H have been erased. The vtable stores function pointers that dispatch
to the correct typed implementations.
This module encapsulates the fields of AttachmentVtable so they cannot
be accessed directly. This visibility restriction guarantees the safety
invariant: the vtable’s type parameters must match the actual attachment
type and handler stored in the AttachmentData.
§Safety Invariant
This invariant is maintained because vtables are created as &'static
references via AttachmentVtable::new, which pairs the function pointers
with specific types A and H at compile time.
Structs§
- Attachment
Vtable 🔒 - Vtable for type-erased attachment operations.
Functions§
- debug 🔒 ⚠
- Formats an attachment using its handler’s debug implementation.
- display 🔒 ⚠
- Formats an attachment using its handler’s display implementation.
- drop 🔒 ⚠
- Drops the
Box<AttachmentData<A>>instance pointed to by this pointer. - preferred_
formatting_ 🔒 ⚠style - Gets the preferred formatting style using the
H::preferred_formatting_stylefunction.