Skip to content

Commit

Permalink
Add DiagnoseFirst to DiagMode interface.
Browse files Browse the repository at this point in the history
Signed-off-by: Yan Qing <[email protected]>
  • Loading branch information
zensh committed May 9, 2023
1 parent b701e74 commit 8d11408
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion diagnose.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import (
type DiagMode interface {
// Diagnose returns extended diagnostic notation (EDN) of CBOR data items using this DiagMode.
Diagnose([]byte) (string, error)

// DiagnoseFirst returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
DiagnoseFirst([]byte) (string, []byte, error)

// DiagOptions returns user specified options used to create this DiagMode.
DiagOptions() DiagOptions
}
Expand Down Expand Up @@ -155,7 +159,7 @@ func (dm *diagMode) Diagnose(data []byte) (string, error) {
return newDiagnose(data, dm.decMode, dm).diag(dm.cborSequence)
}

// Diagnose returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
// DiagnoseFirst returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
func (dm *diagMode) DiagnoseFirst(data []byte) (string, []byte, error) {
return newDiagnose(data, dm.decMode, dm).diagFirst()
}
Expand Down

0 comments on commit 8d11408

Please sign in to comment.