| 1 | 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/; |
| 2 | |
| 3 | use beefrust-analyzer cargo beef 0.5.2 crate/::leanrust-analyzer cargo beef 0.5.2 lean/::Cowrust-analyzer cargo beef 0.5.2 lean/Cow#; |
| 4 | use proc_macro2rust-analyzer cargo proc-macro2 1.0.95 crate/::{Spanrust-analyzer cargo proc-macro2 1.0.95 Span#, TokenStreamrust-analyzer cargo proc-macro2 1.0.95 TokenStream#}; |
| 5 | use quoterust-analyzer cargo quote 1.0.40 crate/::quoterust-analyzer cargo quote 1.0.40 quote!; |
| 6 | use quoterust-analyzer cargo quote 1.0.40 crate/::{quote_spannedrust-analyzer cargo quote 1.0.40 quote_spanned!, ToTokensrust-analyzer cargo quote 1.0.40 to_tokens/ToTokens#, TokenStreamExtrust-analyzer cargo quote 1.0.40 ext/TokenStreamExt#}; |
| 7 | |
| 8 | pub type Resultrust-analyzer cargo logos-codegen 0.15.1 error/Result#<T> = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error#>; |
| 9 | |
| 10 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 11 | pub struct Errorsrust-analyzer cargo logos-codegen 0.15.1 error/Errors# { |
| 12 | collectedrust-analyzer cargo logos-codegen 0.15.1 error/Errors#collected.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<SpannedErrorrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#>, |
| 13 | } |
| 14 | |
| 15 | impl Errorsrust-analyzer cargo logos-codegen 0.15.1 error/Errors# { |
| 16 | pub fn errrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Errors]err().<M>(&mut self, message: M, span: Spanrust-analyzer cargo proc-macro2 1.0.95 Span#) -> &mut Selfrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Errors] |
| 17 | where |
| 18 | M: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cowrust-analyzer cargo beef 0.5.2 lean/Cow#<'static, str>>, |
| 19 | { |
| 20 | self.collectedrust-analyzer cargo logos-codegen 0.15.1 error/Errors#collected..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SpannedErrorrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError# { |
| 21 | messagerust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#message.: message.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), |
| 22 | spanrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#span., |
| 23 | }); |
| 24 | |
| 25 | self |
| 26 | } |
| 27 | |
| 28 | pub fn renderrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Errors]render().(self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TokenStreamrust-analyzer cargo proc-macro2 1.0.95 TokenStream#> { |
| 29 | let errors = self.collectedrust-analyzer cargo logos-codegen 0.15.1 error/Errors#collected.; |
| 30 | |
| 31 | match errors.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() { |
| 32 | 0 => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 33 | _ => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 34 | fn _logos_derive_compile_errors() { |
| 35 | #(#errors)* |
| 36 | } |
| 37 | }), |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | pub struct Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error#(Cowrust-analyzer cargo beef 0.5.2 lean/Cow#<'static, str>); |
| 43 | |
| 44 | #[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:)] |
| 45 | pub struct SpannedErrorrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError# { |
| 46 | messagerust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#message.: Cowrust-analyzer cargo beef 0.5.2 lean/Cow#<'static, str>, |
| 47 | spanrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#span.: Spanrust-analyzer cargo proc-macro2 1.0.95 Span#, |
| 48 | } |
| 49 | |
| 50 | impl Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 51 | pub fn newrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error]new().<M>(message: M) -> Selfrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error] |
| 52 | where |
| 53 | M: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cowrust-analyzer cargo beef 0.5.2 lean/Cow#<'static, str>>, |
| 54 | { |
| 55 | Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error#(message.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()) |
| 56 | } |
| 57 | |
| 58 | pub fn spanrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error]span().(self, span: Spanrust-analyzer cargo proc-macro2 1.0.95 Span#) -> SpannedErrorrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError# { |
| 59 | SpannedErrorrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError# { |
| 60 | messagerust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#message.: self.0rust-analyzer cargo logos-codegen 0.15.1 error/Error#0., |
| 61 | spanrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#span., |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | 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 Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 67 | fn fmtrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error][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#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 68 | self.0rust-analyzer cargo logos-codegen 0.15.1 error/Error#0..fmtrust-analyzer cargo beef 0.5.2 generic/impl#[`Cow<'_, T, U>`][Display]fmt().(f) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 73 | fn fmtrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error][Debug]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#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 74 | 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#::fmtrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error][Display]fmt().(self, f) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<regex_syntaxrust-analyzer cargo regex-syntax 0.8.5 crate/::Errorrust-analyzer cargo regex-syntax 0.8.5 error/Error#> for Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 79 | fn fromrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error][`From<regex_syntax::Error>`]from().(err: regex_syntaxrust-analyzer cargo regex-syntax 0.8.5 crate/::Errorrust-analyzer cargo regex-syntax 0.8.5 error/Error#) -> Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 80 | Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error#(err.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().()) |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'static str> for Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 85 | fn fromrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error][`From<&'static str>`]from().(err: &'static str) -> Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 86 | Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error#(err.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 91 | fn fromrust-analyzer cargo logos-codegen 0.15.1 error/impl#[Error][`From<String>`]from().(err: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error# { |
| 92 | Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error#(err.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error#> for Cowrust-analyzer cargo beef 0.5.2 lean/Cow#<'static, str> { |
| 97 | fn fromrust-analyzer cargo logos-codegen 0.15.1 error/impl#[`Cow<'static, str, Lean>`][`From<Error>`]from().(err: Errorrust-analyzer cargo logos-codegen 0.15.1 error/Error#) -> Selfrust-analyzer cargo logos-codegen 0.15.1 error/impl#[`Cow<'static, str, Lean>`][`From<Error>`] { |
| 98 | err.0rust-analyzer cargo logos-codegen 0.15.1 error/Error#0. |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | impl ToTokensrust-analyzer cargo quote 1.0.40 to_tokens/ToTokens# for SpannedErrorrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError# { |
| 103 | fn to_tokensrust-analyzer cargo logos-codegen 0.15.1 error/impl#[SpannedError][ToTokens]to_tokens().(&self, tokens: &mut TokenStreamrust-analyzer cargo proc-macro2 1.0.95 TokenStream#) { |
| 104 | let message = &*rust-analyzer cargo beef 0.5.2 generic/impl#[`Cow<'_, T, U>`][Deref]deref().self.messagerust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#message.; |
| 105 | |
| 106 | tokens.append_allrust-analyzer cargo quote 1.0.40 ext/impl#[TokenStream][TokenStreamExt]append_all().(quote_spannedrust-analyzer cargo quote 1.0.40 quote_spanned!!(self.spanrust-analyzer cargo logos-codegen 0.15.1 error/SpannedError#span. => { |
| 107 | compile_error!(#message) |
| 108 | })) |
| 109 | } |
| 110 | } |