mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-07 09:14:26 +01:00
add as int method in Value
This commit is contained in:
@@ -329,6 +329,13 @@ impl Value {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_int(&self) -> i64 {
|
||||
match self {
|
||||
Value::Integer(i) => *i,
|
||||
_ => panic!("as_int must be called only for Value::Int"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_text(text: &str) -> Self {
|
||||
Value::Text(Text::new(text))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user