These might be places where we've chosen not to expose an init, but
they might also be places where we forgot. (It's only structs because
classes don't synthesize initializers by default, other than
inheriting them.)
As a regex-based check, this isn't perfect; it's specifically looking
for "public" followed by "struct" followed by "{" followed by "}" with
no "init(" (or a few other variations) between the two braces. This
does not at all handle nesting, so if a struct has other, non-stored
members, they must come after at least one initializer.
- All public Swift-defined structs except CdsiLookupResponse,
which wraps LookupResponseEntryList, which can *probably* be made
Sendable but I didn't spend time on it.
- All public Swift-defined enums except those being used purely as
namespaces.
- All zkgroup types, since they are immutable and can be serialized
and deserialized to send them anyway
- ServiceId and its subclasses, an immutable class hierarchy
- ProtocolAddress, PinHash, SenderCertificate and ServerCertificate,
and all public and private Key types, immutable wrappers around
immutable Rust objects
More of our wrapper types could be made Sendable as well if there's a
need to. See CODING_GUIDELINES for more info.
At this point, the only special behavior of bridge_fn_buffer is to
support multiple return values for the C bridge (a pointer/length
pair), and that doesn't pull its weight. Remove it in favor of a plain
bridge_fn.
This did reveal that Username_Hash was using bridge_fn_buffer and now
produces a fixed-size array, imported into Swift as a tuple, so this
commit also factors out a new helper invokeFnReturningFixedLengthArray.