Re: [PATCH 04/14] rust: add a ObjectID struct
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Oct 29, 2025, 00:36 UTC
- Message-ID
- <aQFhpAinB6HLC-Tw@fruit.crustytoothpaste.net>
- In-Reply-To
- <aQCKD--ZmKnwBWs9@pks.im>
On 2025-10-28 at 09:17:03, Patrick Steinhardt wrote:
> We typically don't have these headers for our C code, so why have it > over here?
This is explained in the cover letter.
Show 9 quoted lines
> An alternative to represent this type would be to use an enum:
>
> pub enum ObjectID {
> SHA1([u8; GIT_SHA1_RAWSZ]),
> SHA256([u8; GIT_SHA256_RAWSZ]),
> }
>
> That would give us some type safety going forward, but it might be
> harder to work with for us?I agree that would be a nicer end state, but that can't be cast from C, which we do later in the series. The goal is to have a type that is suitable for FFI between C and Rust and we will be able to switch once we have no more C code using this type.
-- brian m. carlson (they/them) Toronto, Ontario, CA