fn vec_externalptr_to_list<T: TypedExternal>(items: Vec<ExternalPtr<T>>) -> SEXPExpand description
Allocate a VECSXP and populate it with the external pointers in items.
Each element is rooted in the process-wide ProtectPool for as long as its
ExternalPtr handle lives, and items owns those handles across the
Rf_allocVector below — so allocating the list cannot collect them and no
pre-protection is required. Storing into the freshly allocated list never
allocates, so the list itself stays live until it becomes the .Call
result, which R protects. (Before #841 the handles were unprotected, which
forced a pre-protect of every element here.)
This receives already-built handles, so it can’t use the faster
ExternalPtr::collect_into_r_list — that builds fresh EXTPTRSXPs from
owned T values and is the path to prefer when you start from a Vec<T>
rather than a Vec<ExternalPtr<T>>.