Merge pull request #701 from smihica/add-i64-i32-cursor-type

Implemented CursorType for i32/i64
This commit is contained in:
Sunli 2021-11-12 18:17:45 +08:00 committed by GitHub
commit 2a49d6f75d

View File

@ -31,6 +31,30 @@ impl CursorType for usize {
}
}
impl CursorType for i32 {
type Error = ParseIntError;
fn decode_cursor(s: &str) -> Result<Self, Self::Error> {
s.parse()
}
fn encode_cursor(&self) -> String {
self.to_string()
}
}
impl CursorType for i64 {
type Error = ParseIntError;
fn decode_cursor(s: &str) -> Result<Self, Self::Error> {
s.parse()
}
fn encode_cursor(&self) -> String {
self.to_string()
}
}
impl CursorType for String {
type Error = Infallible;