1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
//! Implementations for types in the standard `alloc` crate //! //! These can be used in `#![no_std]` crates without requiring //! the entire standard library. use alloc::rc::Rc; use alloc::sync::Arc; use alloc::vec::Vec; use alloc::boxed::Box; use alloc::string::String; use crate::prelude::*; // NOTE: Delegate to slice to avoid code duplication unsafe_trace_deref!(Vec, target = { [T] }; T); unsafe_trace_deref!(Box, target = T); // We can only trace `Rc` and `Arc` if the inner type implements `TraceImmutable` unsafe_trace_deref!(Rc, T; immut = required; |rc| &**rc); unsafe_trace_deref!(Arc, T; immut = required; |arc| &**arc); // String is a primitive with no internal references unsafe_trace_primitive!(String);