feat(random): add random-integer and random-uuid (#440)

* feat(randome): add random-integer

* feat(random): add random-uuid
This commit is contained in:
Jae-Heon Ji
2021-12-06 02:22:50 +09:00
committed by GitHub
parent 29efbee285
commit 9548e5ef5b
6 changed files with 191 additions and 0 deletions

View File

@ -214,6 +214,17 @@ impl Value {
}
}
pub fn as_integer(&self) -> Result<i64, ShellError> {
match self {
Value::Int { val, .. } => Ok(*val),
x => Err(ShellError::CantConvert(
"float".into(),
x.get_type().to_string(),
self.span()?,
)),
}
}
/// Get the span for the current value
pub fn span(&self) -> Result<Span, ShellError> {
match self {