docs: add missing User and Post declarations in the Generics example

pull/9112/head
Delyan Angelov 2021-03-04 15:07:13 +02:00
parent 65e888230a
commit 746fe47e94
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 12 additions and 0 deletions

View File

@ -2462,6 +2462,18 @@ struct Repo<T> {
db DB
}
struct User {
id int
name string
}
struct Post {
id int
user_id int
title string
body string
}
fn new_repo<T>(db DB) Repo<T> {
return Repo<T>{db: db}
}