File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,7 @@ pub trait Diagnostic: Sized {
2121 fn labels ( & self , subject : & Self :: Subject ) -> Option < Box < dyn Iterator < Item = Label > > > ;
2222}
2323
24- /// A label for a span within a json pointer or malformed string.
25- ///
24+ /// A label for a span within a JSON Pointer or malformed string.
2625#[ derive( Debug , PartialEq , Eq , Clone ) ]
2726pub struct Label {
2827 text : String ,
@@ -32,7 +31,10 @@ pub struct Label {
3231
3332impl Label {
3433 /// Creates a new instance of a [`Label`] from its parts
35- pub ( crate ) fn new ( text : String , offset : usize , len : usize ) -> Self {
34+ // NOTE: this is deliberately public, so that users can use
35+ // the `Assign` and `Resolve` traits with custom types and errors,
36+ // and then implement `Diagnostic` for those errors.
37+ pub fn new ( text : String , offset : usize , len : usize ) -> Self {
3638 Self { text, offset, len }
3739 }
3840}
You can’t perform that action at this time.
0 commit comments