(&self, info: &TypeInfo, mode: TypeMode)
| 377 | } |
| 378 | |
| 379 | fn lifetime_for(&self, info: &TypeInfo, mode: TypeMode) -> Option<&'static str> { |
| 380 | if matches!(self.ownership(), Ownership::Owning) { |
| 381 | return None; |
| 382 | } |
| 383 | let lt = match mode { |
| 384 | TypeMode::AllBorrowed(s) => s, |
| 385 | _ => return None, |
| 386 | }; |
| 387 | // No lifetimes needed unless this has a list. |
| 388 | if !info.has_list { |
| 389 | return None; |
| 390 | } |
| 391 | // If two names are used then this type will have an owned and a |
| 392 | // borrowed copy and the borrowed copy is being used, so it needs a |
| 393 | // lifetime. Otherwise if it's only borrowed and not owned then this can |
| 394 | // also use a lifetime since it's not needed in two contexts and only |
| 395 | // the borrowed version of the structure was generated. |
| 396 | if self.uses_two_names(info) || (info.borrowed && !info.owned) { |
| 397 | Some(lt) |
| 398 | } else { |
| 399 | None |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | fn typedfunc_sig(&self, func: &Function, param_mode: TypeMode) -> String { |
| 404 | let mut out = "(".to_string(); |
no test coverage detected