pgrx icon indicating copy to clipboard operation
pgrx copied to clipboard

A safe ArrayBuilder atop RawArray

Open workingjubilee opened this issue 2 years ago • 2 comments

Or more like ArrayValidator, perhaps: a builder that accomplishes the correct steps to construct a fully safe handle on RawArray, validating all the various assumptions that we have embedded in our code before actually yielding the handle for the type.

Such a thing is part of why most of the existing functions on RawArray for getting slices are &mut: I intend to use them in such a pattern, where the ArrayBuilder's functions return &mut ArrayBuilder.

workingjubilee avatar Sep 13 '22 02:09 workingjubilee

If such a builder was made, would it be the only way to construct a RawArray? Or would it come with an asterisks of "You can do this directly if you know what you're doing. If you dont, then use the builder"?

BradyBonnette avatar Sep 13 '22 15:09 BradyBonnette

It would be a RawArray -> ArrayBuilder -> SomeOtherType (possibly current Array, possibly something else).

workingjubilee avatar Sep 13 '22 16:09 workingjubilee