From 4e56f5a41e5224b816e9eafed145a03cbf52fd93 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Sat, 6 Jan 2024 17:19:31 +0000 Subject: refactor: String -> HistoryId (#1512) --- atuin-client/src/encryption.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'atuin-client/src/encryption.rs') diff --git a/atuin-client/src/encryption.rs b/atuin-client/src/encryption.rs index f9f8bcb3..3c9f3d06 100644 --- a/atuin-client/src/encryption.rs +++ b/atuin-client/src/encryption.rs @@ -166,7 +166,7 @@ fn encode(h: &History) -> Result> { // INFO: ensure this is updated when adding new fields encode::write_array_len(&mut output, 9)?; - encode::write_str(&mut output, &h.id)?; + encode::write_str(&mut output, &h.id.0)?; encode::write_str(&mut output, &(format_rfc3339(h.timestamp)?))?; encode::write_sint(&mut output, h.duration)?; encode::write_sint(&mut output, h.exit)?; @@ -234,7 +234,7 @@ fn decode(bytes: &[u8]) -> Result { } Ok(History { - id: id.to_owned(), + id: id.to_owned().into(), timestamp: OffsetDateTime::parse(timestamp, &Rfc3339)?, duration, exit, @@ -312,7 +312,7 @@ mod test { 108, 117, 100, 103, 97, 116, 101, 192, ]; let history = History { - id: "66d16cbee7cd47538e5c5b8b44e9006e".to_owned(), + id: "66d16cbee7cd47538e5c5b8b44e9006e".to_owned().into(), timestamp: datetime!(2023-05-28 18:35:40.633872 +00:00), duration: 49206000, exit: 0, @@ -333,7 +333,7 @@ mod test { #[test] fn test_decode_deleted() { let history = History { - id: "66d16cbee7cd47538e5c5b8b44e9006e".to_owned(), + id: "66d16cbee7cd47538e5c5b8b44e9006e".to_owned().into(), timestamp: datetime!(2023-05-28 18:35:40.633872 +00:00), duration: 49206000, exit: 0, @@ -364,7 +364,7 @@ mod test { 108, 117, 100, 103, 97, 116, 101, ]; let history = History { - id: "66d16cbee7cd47538e5c5b8b44e9006e".to_owned(), + id: "66d16cbee7cd47538e5c5b8b44e9006e".to_owned().into(), timestamp: datetime!(2023-05-28 18:35:40.633872 +00:00), duration: 49206000, exit: 0, -- cgit v1.3.1