| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# as StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#}; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error# as IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#; |
| 5 | |
| 6 | use serde_jsonrust-analyzer cargo serde_json 1.0.114 crate/::errorrust-analyzer cargo serde_json 1.0.114 error/::Errorrust-analyzer cargo serde_json 1.0.114 error/Error# as SerdeErrorrust-analyzer cargo serde_json 1.0.114 error/Error#; |
| 7 | use thiserrorrust-analyzer cargo thiserror 1.0.58 crate/::Errorrust-analyzer cargo thiserror-impl 1.0.58 Error:; |
| 8 | |
| 9 | #[cfg(feature = "dir_source")] |
| 10 | use walkdirrust-analyzer cargo walkdir 2.5.0 crate/::Errorrust-analyzer cargo walkdir 2.5.0 error/Error# as WalkdirErrorrust-analyzer cargo walkdir 2.5.0 error/Error#; |
| 11 | |
| 12 | #[cfg(feature = "script_helper")] |
| 13 | use rhairust-analyzer cargo rhai 1.17.1 crate/::{EvalAltResultrust-analyzer cargo rhai 1.17.1 types/error/EvalAltResult#, ParseErrorrust-analyzer cargo rhai 1.17.1 types/parse_error/ParseError#}; |
| 14 | |
| 15 | /// Error when rendering data on template. |
| 16 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 17 | pub struct RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 18 | pub template_namerust-analyzer cargo handlebars 5.1.2 error/RenderError#template_name.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 19 | pub line_norust-analyzer cargo handlebars 5.1.2 error/RenderError#line_no.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, |
| 20 | pub column_norust-analyzer cargo handlebars 5.1.2 error/RenderError#column_no.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, |
| 21 | reasonrust-analyzer cargo handlebars 5.1.2 error/RenderError#reason.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#>, |
| 22 | unimplementedrust-analyzer cargo handlebars 5.1.2 error/RenderError#unimplemented.: bool, |
| 23 | // backtrace: Backtrace, |
| 24 | } |
| 25 | |
| 26 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 27 | fn fmtrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Error#> { |
| 28 | let desc = self.reasonrust-analyzer cargo handlebars 5.1.2 error/RenderError#reason..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 29 | |
| 30 | match (self.line_norust-analyzer cargo handlebars 5.1.2 error/RenderError#line_no., self.column_norust-analyzer cargo handlebars 5.1.2 error/RenderError#column_no.) { |
| 31 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(col)) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 32 | f, |
| 33 | "Error rendering \"{}\" line {}, col {}: {}", |
| 34 | self.template_namerust-analyzer cargo handlebars 5.1.2 error/RenderError#template_name..as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().("Unnamed template"), |
| 35 | line, |
| 36 | col, |
| 37 | desc |
| 38 | ), |
| 39 | _ => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", desc), |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> for RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 45 | fn fromrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][`From<IOError>`]from().(e: IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 46 | RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::IOErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#IOError#(e).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#> for RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 51 | fn fromrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][`From<FromUtf8Error>`]from().(e: FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#) -> Selfrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][`From<FromUtf8Error>`] { |
| 52 | RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::Utf8Errorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#Utf8Error#(e).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError#> for RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 57 | fn fromrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][`From<TemplateError>`]from().(e: TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError#) -> Selfrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][`From<TemplateError>`] { |
| 58 | RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#TemplateError#(e).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /// Template rendering error |
| 63 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Errorrust-analyzer cargo thiserror-impl 1.0.58 Error:)] |
| 64 | pub enum RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason# { |
| 65 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Template not found {0}")] |
| 66 | TemplateNotFoundrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#TemplateNotFound#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 67 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Failed to parse template {0}")] |
| 68 | TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#TemplateError#( |
| 69 | #[from] |
| 70 | #[source] |
| 71 | TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError#, |
| 72 | ), |
| 73 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Failed to access variable in strict mode {0:?}")] |
| 74 | MissingVariablerust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#MissingVariable#(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>), |
| 75 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Partial not found {0}")] |
| 76 | PartialNotFoundrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#PartialNotFound#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 77 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Helper not found {0}")] |
| 78 | HelperNotFoundrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#HelperNotFound#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 79 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Helper/Decorator {0} param at index {1} required but not found")] |
| 80 | ParamNotFoundForIndexrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#ParamNotFoundForIndex#(&'static str, usize), |
| 81 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Helper/Decorator {0} param with name {1} required but not found")] |
| 82 | ParamNotFoundForNamerust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#ParamNotFoundForName#(&'static str, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 83 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Helper/Decorator {0} param with name {1} type mismatch for {2}")] |
| 84 | ParamTypeMismatchForNamerust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#ParamTypeMismatchForName#(&'static str, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 85 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Helper/Decorator {0} hash with name {1} type mismatch for {2}")] |
| 86 | HashTypeMismatchForNamerust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#HashTypeMismatchForName#(&'static str, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 87 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Decorator not found {0}")] |
| 88 | DecoratorNotFoundrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#DecoratorNotFound#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 89 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Can not include current template in partial")] |
| 90 | CannotIncludeSelfrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#CannotIncludeSelf#, |
| 91 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Invalid logging level: {0}")] |
| 92 | InvalidLoggingLevelrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#InvalidLoggingLevel#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 93 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Invalid param type, {0} expected")] |
| 94 | InvalidParamTyperust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#InvalidParamType#(&'static str), |
| 95 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Block content required")] |
| 96 | BlockContentRequiredrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#BlockContentRequired#, |
| 97 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Invalid json path {0}")] |
| 98 | InvalidJsonPathrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#InvalidJsonPath#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 99 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Cannot access array/vector with string index, {0}")] |
| 100 | InvalidJsonIndexrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#InvalidJsonIndex#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 101 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Failed to access JSON data: {0}")] |
| 102 | SerdeErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#SerdeError#( |
| 103 | #[from] |
| 104 | #[source] |
| 105 | SerdeErrorrust-analyzer cargo serde_json 1.0.114 error/Error#, |
| 106 | ), |
| 107 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("IO Error: {0}")] |
| 108 | IOErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#IOError#( |
| 109 | #[from] |
| 110 | #[source] |
| 111 | IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#, |
| 112 | ), |
| 113 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("FromUtf8Error: {0}")] |
| 114 | Utf8Errorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#Utf8Error#( |
| 115 | #[from] |
| 116 | #[source] |
| 117 | FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#, |
| 118 | ), |
| 119 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Nested error: {0}")] |
| 120 | NestedErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#NestedError#(#[source] Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + 'static>), |
| 121 | #[cfg(feature = "script_helper")] |
| 122 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Cannot convert data to Rhai dynamic: {0}")] |
| 123 | ScriptValueErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#ScriptValueError#( |
| 124 | #[from] |
| 125 | #[source] |
| 126 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<EvalAltResultrust-analyzer cargo rhai 1.17.1 types/error/EvalAltResult#>, |
| 127 | ), |
| 128 | #[cfg(feature = "script_helper")] |
| 129 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Failed to load rhai script: {0}")] |
| 130 | ScriptLoadErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#ScriptLoadError#( |
| 131 | #[from] |
| 132 | #[source] |
| 133 | ScriptErrorrust-analyzer cargo handlebars 5.1.2 error/ScriptError#, |
| 134 | ), |
| 135 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Unimplemented")] |
| 136 | Unimplementedrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#Unimplemented#, |
| 137 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("{0}")] |
| 138 | Otherrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#Other#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 139 | } |
| 140 | |
| 141 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#> for RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 142 | fn fromrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][`From<RenderErrorReason>`]from().(e: RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#) -> RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 143 | RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 144 | template_namerust-analyzer cargo handlebars 5.1.2 error/RenderError#template_name.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 145 | line_norust-analyzer cargo handlebars 5.1.2 error/RenderError#line_no.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 146 | column_norust-analyzer cargo handlebars 5.1.2 error/RenderError#column_no.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 147 | reasonrust-analyzer cargo handlebars 5.1.2 error/RenderError#reason.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(e), |
| 148 | unimplementedrust-analyzer cargo handlebars 5.1.2 error/RenderError#unimplemented.: false, |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | impl RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 154 | #[deprecated(since = "5.0.0", note = "Use RenderErrorReason instead")] |
| 155 | pub fn newrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError]new().<T: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str>>(desc: T) -> RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 156 | RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::Otherrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#Other#(desc.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 157 | } |
| 158 | |
| 159 | pub fn strict_errorrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError]strict_error().(path: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>) -> RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 160 | RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::MissingVariablerust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#MissingVariable#(path.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|p| p.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().())).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 161 | } |
| 162 | |
| 163 | #[deprecated(since = "5.0.0", note = "Use RenderErrorReason::NestedError instead")] |
| 164 | pub fn from_errorrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError]from_error().<E>(_error_info: &str, cause: E) -> RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# |
| 165 | where |
| 166 | E: StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + 'static, |
| 167 | { |
| 168 | RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::NestedErrorrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#NestedError#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(cause)).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 169 | } |
| 170 | |
| 171 | #[inline] |
| 172 | pub(craterust-analyzer cargo handlebars 5.1.2 crate/) fn is_unimplementedrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError]is_unimplemented().(&self) -> bool { |
| 173 | matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().self.reasonrust-analyzer cargo handlebars 5.1.2 error/RenderError#reason., RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::Unimplementedrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#Unimplemented#) |
| 174 | } |
| 175 | |
| 176 | /// Get `RenderErrorReason` for this error |
| 177 | pub fn reasonrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError]reason().(&self) -> &RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason# { |
| 178 | self.reasonrust-analyzer cargo handlebars 5.1.2 error/RenderError#reason..as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][`AsRef<T>`]as_ref().() |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | impl StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError# { |
| 183 | fn sourcerust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> { |
| 184 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.reasonrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError]reason().()) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | /// Template parsing error |
| 189 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Errorrust-analyzer cargo thiserror-impl 1.0.58 Error:)] |
| 190 | pub enum TemplateErrorReasonrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason# { |
| 191 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("helper {0:?} was opened, but {1:?} is closing")] |
| 192 | MismatchingClosedHelperrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#MismatchingClosedHelper#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 193 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("decorator {0:?} was opened, but {1:?} is closing")] |
| 194 | MismatchingClosedDecoratorrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#MismatchingClosedDecorator#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 195 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("invalid handlebars syntax: {0}")] |
| 196 | InvalidSyntaxrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#InvalidSyntax#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 197 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("invalid parameter {0:?}")] |
| 198 | InvalidParamrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#InvalidParam#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 199 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("nested subexpression is not supported")] |
| 200 | NestedSubexpressionrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#NestedSubexpression#, |
| 201 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Template \"{1}\": {0}")] |
| 202 | IoErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#IoError#(IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 203 | #[cfg(feature = "dir_source")] |
| 204 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:("Walk dir error: {err}")] |
| 205 | WalkdirErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#WalkdirError# { |
| 206 | #[from] |
| 207 | errrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#WalkdirError#err.: WalkdirErrorrust-analyzer cargo walkdir 2.5.0 error/Error#, |
| 208 | }, |
| 209 | } |
| 210 | |
| 211 | /// Error on parsing template. |
| 212 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Errorrust-analyzer cargo thiserror-impl 1.0.58 Error:)] |
| 213 | pub struct TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 214 | reasonrust-analyzer cargo handlebars 5.1.2 error/TemplateError#reason.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<TemplateErrorReasonrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#>, |
| 215 | template_namerust-analyzer cargo handlebars 5.1.2 error/TemplateError#template_name.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 216 | line_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#line_no.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, |
| 217 | column_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#column_no.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, |
| 218 | segmentrust-analyzer cargo handlebars 5.1.2 error/TemplateError#segment.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 219 | } |
| 220 | |
| 221 | impl TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 222 | #[allow(deprecated)] |
| 223 | pub fn ofrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]of().(e: TemplateErrorReasonrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#) -> TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 224 | TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 225 | reasonrust-analyzer cargo handlebars 5.1.2 error/TemplateError#reason.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(e), |
| 226 | template_namerust-analyzer cargo handlebars 5.1.2 error/TemplateError#template_name.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 227 | line_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#line_no.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 228 | column_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#column_no.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 229 | segmentrust-analyzer cargo handlebars 5.1.2 error/TemplateError#segment.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | pub fn atrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]at().(mut self, template_str: &str, line_no: usize, column_no: usize) -> TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 234 | self.line_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#line_no. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line_no); |
| 235 | self.column_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#column_no. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(column_no); |
| 236 | self.segmentrust-analyzer cargo handlebars 5.1.2 error/TemplateError#segment. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(template_segmentrust-analyzer cargo handlebars 5.1.2 error/template_segment().(template_str, line_no, column_no)); |
| 237 | self |
| 238 | } |
| 239 | |
| 240 | pub fn in_templaterust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]in_template().(mut self, name: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 241 | self.template_namerust-analyzer cargo handlebars 5.1.2 error/TemplateError#template_name. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(name); |
| 242 | self |
| 243 | } |
| 244 | |
| 245 | /// Get underlying reason for the error |
| 246 | pub fn reasonrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]reason().(&self) -> &TemplateErrorReasonrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason# { |
| 247 | &self.reasonrust-analyzer cargo handlebars 5.1.2 error/TemplateError#reason. |
| 248 | } |
| 249 | |
| 250 | /// Get the line number and column number of this error |
| 251 | pub fn posrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]pos().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(usize, usize)> { |
| 252 | match (self.line_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#line_no., self.column_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#column_no.) { |
| 253 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line_no), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(column_no)) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((line_no, column_no)), |
| 254 | _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | /// Get template name of this error |
| 259 | /// Returns `None` when the template has no associated name |
| 260 | pub fn namerust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]name().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 261 | self.template_namerust-analyzer cargo handlebars 5.1.2 error/TemplateError#template_name..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<(IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)> for TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 266 | fn fromrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError][`From<(IOError, String)>`]from().(err_info: (IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)) -> TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 267 | let (e, name) = err_info; |
| 268 | TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError#::ofrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]of().(TemplateErrorReasonrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#::IoErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#IoError#(e, name)) |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | #[cfg(feature = "dir_source")] |
| 273 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<WalkdirErrorrust-analyzer cargo walkdir 2.5.0 error/Error#> for TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 274 | fn fromrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError][`From<WalkdirError>`]from().(e: WalkdirErrorrust-analyzer cargo walkdir 2.5.0 error/Error#) -> TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 275 | TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError#::ofrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]of().(TemplateErrorReasonrust-analyzer cargo handlebars 5.1.2 error/TemplateErrorReason#::fromrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateErrorReason][`From<WalkdirError>`]from().(e)) |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | fn template_segmentrust-analyzer cargo handlebars 5.1.2 error/template_segment().(template_str: &str, line: usize, col: usize) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 280 | let range = 3; |
| 281 | let line_start = if line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().range { line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().range } else { 0 }; |
| 282 | let line_end = line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().range; |
| 283 | |
| 284 | let mut buf = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 285 | for (line_count, line_content) in template_str.linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 286 | if line_count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().line_start && line_count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().line_end { |
| 287 | let _ = writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut buf, "{line_count:4} | {line_content}"); |
| 288 | if line_count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1 { |
| 289 | buf.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(" |"); |
| 290 | for c in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#line_content.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() { |
| 291 | if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().col { |
| 292 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('-'); |
| 293 | } else { |
| 294 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('^'); |
| 295 | } |
| 296 | } |
| 297 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\n'); |
| 298 | } |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | buf |
| 303 | } |
| 304 | |
| 305 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for TemplateErrorrust-analyzer cargo handlebars 5.1.2 error/TemplateError# { |
| 306 | fn fmtrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Error#> { |
| 307 | match (self.line_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#line_no., self.column_norust-analyzer cargo handlebars 5.1.2 error/TemplateError#column_no., &self.segmentrust-analyzer cargo handlebars 5.1.2 error/TemplateError#segment.) { |
| 308 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(col), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(seg)) => writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!( |
| 309 | f, |
| 310 | "Template error: {}\n --> Template error in \"{}\":{}:{}\n |\n{} |\n = reason: {}", |
| 311 | self.reasonrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]reason().(), |
| 312 | self.template_namerust-analyzer cargo handlebars 5.1.2 error/TemplateError#template_name. |
| 313 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 314 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(&"Unnamed template".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()), |
| 315 | line, |
| 316 | col, |
| 317 | seg, |
| 318 | self.reasonrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]reason().() |
| 319 | ), |
| 320 | _ => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", self.reasonrust-analyzer cargo handlebars 5.1.2 error/impl#[TemplateError]reason().()), |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | #[cfg(feature = "script_helper")] |
| 326 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Errorrust-analyzer cargo thiserror-impl 1.0.58 Error:)] |
| 327 | pub enum ScriptErrorrust-analyzer cargo handlebars 5.1.2 error/ScriptError# { |
| 328 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:(transparent)] |
| 329 | IoErrorrust-analyzer cargo handlebars 5.1.2 error/ScriptError#IoError#(#[from] IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#), |
| 330 | |
| 331 | #[errorrust-analyzer cargo thiserror-impl 1.0.58 error:(transparent)] |
| 332 | ParseErrorrust-analyzer cargo handlebars 5.1.2 error/ScriptError#ParseError#(#[from] ParseErrorrust-analyzer cargo rhai 1.17.1 types/parse_error/ParseError#), |
| 333 | } |
| 334 | |
| 335 | #[cfg(test)] |
| 336 | mod testrust-analyzer cargo handlebars 5.1.2 error/test/ { |
| 337 | use superrust-analyzer cargo handlebars 5.1.2 error/::*; |
| 338 | |
| 339 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 340 | fn test_source_errorrust-analyzer cargo handlebars 5.1.2 error/test/test_source_error().() { |
| 341 | let reason = RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::TemplateNotFoundrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#TemplateNotFound#("unnamed".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()); |
| 342 | let render_error = RenderErrorrust-analyzer cargo handlebars 5.1.2 error/RenderError#::fromrust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][`From<RenderErrorReason>`]from().(reason); |
| 343 | |
| 344 | let reason2 = render_error.sourcerust-analyzer cargo handlebars 5.1.2 error/impl#[RenderError][Error]source().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 345 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 346 | reason2.downcast_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/impl#[`dyn Error + 'static`]downcast_ref().::<RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 347 | RenderErrorReasonrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#::TemplateNotFoundrust-analyzer cargo handlebars 5.1.2 error/RenderErrorReason#TemplateNotFound#(_) |
| 348 | )); |
| 349 | } |
| 350 | } |