diff options
| author | Teddy Wing | 2020-06-27 20:07:22 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2020-06-27 20:07:22 +0200 | 
| commit | 81402cc311ae075d036759cabab829f61fd216be (patch) | |
| tree | 1e219d89fbfbddd1d9df0993a79392f5bf94f28b /examples | |
| parent | b8ac72f1fb4b6e3e0575e212bf6138e20bd9bdff (diff) | |
| download | fastcgi-conduit-81402cc311ae075d036759cabab829f61fd216be.tar.bz2 | |
FastCgiRequest: Start implementing `conduit::RequestExt`
Was getting this error about the lifetimes in the trait impl:
    error[E0308]: method not compatible with trait
       --> src/lib.rs:137:4
        |
    137 |    fn host(&'a self) -> conduit::Host<'a> {
        |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
        |
        = note: expected fn pointer `fn(&'a FastCgiRequest<'static>) -> conduit::Host<'a>`
                   found fn pointer `fn(&'a FastCgiRequest<'static>) -> conduit::Host<'a>`
    note: the lifetime `'a` as defined on the method body at 137:4...
       --> src/lib.rs:137:4
        |
    137 |    fn host(&'a self) -> conduit::Host<'a> {
        |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 124:6
       --> src/lib.rs:124:6
        |
    124 | impl<'a> conduit::RequestExt for FastCgiRequest {
        |      ^^
    error[E0308]: method not compatible with trait
       --> src/lib.rs:137:4
        |
    137 |    fn host(&'a self) -> conduit::Host<'a> {
        |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
        |
        = note: expected fn pointer `fn(&'a FastCgiRequest<'static>) -> conduit::Host<'a>`
                   found fn pointer `fn(&'a FastCgiRequest<'static>) -> conduit::Host<'a>`
    note: the lifetime `'a` as defined on the impl at 124:6...
       --> src/lib.rs:124:6
        |
    124 | impl<'a> conduit::RequestExt for FastCgiRequest {
        |      ^^
    note: ...does not necessarily outlive the lifetime `'a` as defined on the method body at 137:4
       --> src/lib.rs:137:4
        |
    137 |    fn host(&'a self) -> conduit::Host<'a> {
        |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Learned from these resources that the problem arose because the `impl`
uses an `'a` lifetime, but the lifetime on the `host()` method need to
be a different one:
https://github.com/rust-lang/rust/issues/56423
https://stackoverflow.com/questions/24847331/rust-lifetime-error-expected-concrete-lifetime-but-found-bound-lifetime/24848424#24848424
Diffstat (limited to 'examples')
0 files changed, 0 insertions, 0 deletions
