From 1eba5623f7b73873386421dd3cbe0b08a2582be3 Mon Sep 17 00:00:00 2001 From: smihica Date: Fri, 12 Nov 2021 18:11:08 +0900 Subject: [PATCH] Implemented CursorType for i32/i64 --- src/types/connection/cursor.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/types/connection/cursor.rs b/src/types/connection/cursor.rs index dccd9799..fdb67319 100644 --- a/src/types/connection/cursor.rs +++ b/src/types/connection/cursor.rs @@ -31,6 +31,30 @@ impl CursorType for usize { } } +impl CursorType for i32 { + type Error = ParseIntError; + + fn decode_cursor(s: &str) -> Result { + s.parse() + } + + fn encode_cursor(&self) -> String { + self.to_string() + } +} + +impl CursorType for i64 { + type Error = ParseIntError; + + fn decode_cursor(s: &str) -> Result { + s.parse() + } + + fn encode_cursor(&self) -> String { + self.to_string() + } +} + impl CursorType for String { type Error = Infallible;