File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,17 @@ impl Error {
125125 Error :: new ( ErrorUnknownField :: with_alts ( field, alternates) . into ( ) )
126126 }
127127
128+ /// Creates a new error for a field name that appears in the input but does not correspond to
129+ /// a known attribute. The second argument is the list of known attributes; if a similar name
130+ /// is found that will be shown in the emitted error message.
131+ pub fn unknown_field_path_with_alts < ' a , T , I > ( field : & Path , alternates : I ) -> Self
132+ where
133+ T : AsRef < str > + ' a ,
134+ I : IntoIterator < Item = & ' a T > ,
135+ {
136+ Error :: new ( ErrorUnknownField :: with_alts ( & path_to_string ( field) , alternates) . into ( ) )
137+ }
138+
128139 /// Creates a new error for a struct or variant that does not adhere to the supported shape.
129140 pub fn unsupported_shape ( shape : & str ) -> Self {
130141 Error :: new ( ErrorKind :: UnsupportedShape {
You can’t perform that action at this time.
0 commit comments