Category "lifetime"

Generic lifetime parameter and local scope

piet is a drawing library with generic backends (cairo, for example). I want to have a trait Renderable that can render to any piet backend (=context). pub trai

Deserializing a struct with custom data types

I am trying to #[derive(Deserialize, Serialize)] some structs that involve other custom structs, so I can transform them in and out of JSON, for example: #[deri

Lifetime sub-typing and impl-trait

I bumped into an interesting form of lifetime sub-typing, which I think is valid, but the compiler is skeptical of. Consider the following function, which compu

Lifetime in impl does not match method in trait

Code Playground (Stable Rust 1.45.0, 2018 edition) No external crates needed for example. type Error = Box<dyn std::error::Error>; type Result<R=()>