From de2e34ac500c17e80fe4dcf2ed1c08add8998fa3 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Sun, 9 May 2021 21:17:24 +0100 Subject: some changes :shrug: (#83) * make everything a cow * fmt + clippy --- atuin-server/src/models.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'atuin-server/src/models.rs') diff --git a/atuin-server/src/models.rs b/atuin-server/src/models.rs index fbf1897e..d493153a 100644 --- a/atuin-server/src/models.rs +++ b/atuin-server/src/models.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use chrono::prelude::*; #[derive(sqlx::FromRow)] @@ -14,12 +16,12 @@ pub struct History { } pub struct NewHistory<'a> { - pub client_id: &'a str, + pub client_id: Cow<'a, str>, pub user_id: i64, - pub hostname: &'a str, + pub hostname: Cow<'a, str>, pub timestamp: chrono::NaiveDateTime, - pub data: &'a str, + pub data: Cow<'a, str>, } #[derive(sqlx::FromRow)] @@ -37,13 +39,13 @@ pub struct Session { pub token: String, } -pub struct NewUser { - pub username: String, - pub email: String, - pub password: String, +pub struct NewUser<'a> { + pub username: Cow<'a, str>, + pub email: Cow<'a, str>, + pub password: Cow<'a, str>, } pub struct NewSession<'a> { pub user_id: i64, - pub token: &'a str, + pub token: Cow<'a, str>, } -- cgit v1.3.1