What's the difference between alloc :: rc :: Rc and std :: rc :: Rc?
std::rc::Rc
is just a re-export alloc::rc::Rc
. You can see in src / std / lib.rs that the entire module is rc
re-exported:pub use alloc::rc;
The box alloc
is for any memory allocation. Link counted, boxed, original allocators and shared to the underlying allocator (often jemalloc
in Rust). Since the type rc
is such a common type that it must exist in the standard library, but the box alloc
must not be part of the standard library, only the module is relayed rc
alloc
to the standard library. This saves the user from having to worry about the box alloc
and instead offers a clean standard library without unnecessary things that might be awkward to use.
source to share