do not make the simd stuff a requirement for Envelope.

This commit is contained in:
fiatjaf 2025-02-25 18:23:38 -03:00
parent 201abf231b
commit be2fe4a019

View File

@ -43,7 +43,7 @@ func ParseMessageSIMD(message []byte, reuse *simdjson.ParsedJson) (Envelope, err
iter.Advance()
label, _ := iter.StringBytes()
var v Envelope
var v EnvelopeSIMD
switch {
case bytes.Equal(label, labelEvent):
@ -117,12 +117,16 @@ func ParseMessage(message []byte) Envelope {
type Envelope interface {
Label() string
UnmarshalSIMD(simdjson.Iter) error
UnmarshalJSON([]byte) error
MarshalJSON() ([]byte, error)
String() string
}
type EnvelopeSIMD interface {
Envelope
UnmarshalSIMD(simdjson.Iter) error
}
var (
_ Envelope = (*EventEnvelope)(nil)
_ Envelope = (*ReqEnvelope)(nil)