mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-05-05 08:10:14 +02:00
do not make the simd stuff a requirement for Envelope.
This commit is contained in:
parent
201abf231b
commit
be2fe4a019
@ -43,7 +43,7 @@ func ParseMessageSIMD(message []byte, reuse *simdjson.ParsedJson) (Envelope, err
|
|||||||
iter.Advance()
|
iter.Advance()
|
||||||
label, _ := iter.StringBytes()
|
label, _ := iter.StringBytes()
|
||||||
|
|
||||||
var v Envelope
|
var v EnvelopeSIMD
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case bytes.Equal(label, labelEvent):
|
case bytes.Equal(label, labelEvent):
|
||||||
@ -117,12 +117,16 @@ func ParseMessage(message []byte) Envelope {
|
|||||||
|
|
||||||
type Envelope interface {
|
type Envelope interface {
|
||||||
Label() string
|
Label() string
|
||||||
UnmarshalSIMD(simdjson.Iter) error
|
|
||||||
UnmarshalJSON([]byte) error
|
UnmarshalJSON([]byte) error
|
||||||
MarshalJSON() ([]byte, error)
|
MarshalJSON() ([]byte, error)
|
||||||
String() string
|
String() string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EnvelopeSIMD interface {
|
||||||
|
Envelope
|
||||||
|
UnmarshalSIMD(simdjson.Iter) error
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ Envelope = (*EventEnvelope)(nil)
|
_ Envelope = (*EventEnvelope)(nil)
|
||||||
_ Envelope = (*ReqEnvelope)(nil)
|
_ Envelope = (*ReqEnvelope)(nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user