MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / new

Method new

aiscript-arena/src/types.rs:95–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93impl GcBoxHeader {
94 #[inline(always)]
95 pub fn new<T: Collect>() -> Self {
96 // Helper trait to materialize vtables in static memory.
97 trait HasCollectVtable {
98 const VTABLE: CollectVtable;
99 }
100
101 impl<T: Collect> HasCollectVtable for T {
102 const VTABLE: CollectVtable = CollectVtable::vtable_for::<T>();
103 }
104
105 let vtable: &'static _ = &<T as HasCollectVtable>::VTABLE;
106 Self {
107 next: Cell::new(None),
108 tagged_vtable: Cell::new(vtable as *const _),
109 }
110 }
111
112 /// Gets a reference to the `CollectVtable` used by this box.
113 #[inline(always)]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected