Data is typed based so you can always use new type for uniqueness. Like PgConnection1<PgConnection> and PgConnection2<PgConnection>. After that you can impl Deref and DerefMut for auto dereference to the inner type
Indeed! If we add the same types via .app_data(...), the most recently inserted one overrides the rest. Here's a relevant chapter from The Rust Programming Language book that @fakeshadow
is talking about:
Data is typed based so you can always use new type for uniqueness. Like
PgConnection1<PgConnection>
andPgConnection2<PgConnection>
. After that you can implDeref
andDerefMut
for auto dereference to the inner typeIndeed! If we add the same types via
.app_data(...)
, the most recently inserted one overrides the rest. Here's a relevant chapter from The Rust Programming Language book that @fakeshadow is talking about:doc.rust-lang.org/stable/book/ch15...