From e0545616d83b18abb61bb75579a7783826126d5d Mon Sep 17 00:00:00 2001 From: Richard Kosegi Date: Thu, 4 Jul 2024 21:41:30 +0200 Subject: [PATCH] Path: Add MustParse function to parser interface Signed-off-by: Richard Kosegi --- path/types.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/path/types.go b/path/types.go index 34dfd38..b712ddc 100644 --- a/path/types.go +++ b/path/types.go @@ -66,8 +66,12 @@ type AppendOpt func(*component) // Parser interface is implemented by different Path syntax parsers. type Parser interface { - // Parse parses source string into Path + // Parse parses source string into Path. + // Any error encountered during parse is returned to caller. Parse(string) (Path, error) + // MustParse parses source string into Path. + // Any error encountered during parse will cause panic. + MustParse(string) Path } // Serializer is interface that allows to serialize Path into lexical form