pgcentralfoundation / pgrx

Build Postgres Extensions with Rust!
Other
3.56k stars 240 forks source link

Add `List::new_in` #1597

Open workingjubilee opened 6 months ago

workingjubilee commented 6 months ago

Okay, I tried wrangling some List code. Before we say au revoir to PgList, List needs to have a few convenience functions, and one of those needs to be List::new_in. I shouldn't have to specify how to make a nullptr! Also, you shouldn't need to use the memcx as an argument for the push after just naming the memcx a line ago, but I'm less certain of how to design that. I'll think about the API a bit, since I think Postgres code will never expect, and thus never correctly handle, a 0-length, N-capacity List, so it needs to prevent the simplest mistake of reserving such.

workingjubilee commented 6 months ago

silly thought: drop-guarded type after List::with_capacity_in?