pub struct Value { /* private fields */ }Implementations§
Source§impl Value
impl Value
Sourcepub fn value_type(&self) -> ValueType
pub fn value_type(&self) -> ValueType
Returns the value type of the Value
Sourcepub fn to_float(&self) -> Option<f64>
pub fn to_float(&self) -> Option<f64>
Returns the float value or casts the relevant value to a float
pub fn is_json(&self) -> bool
Sourcepub fn to_integer(&self) -> Option<i64>
pub fn to_integer(&self) -> Option<i64>
Returns the value as an integer (casts or converts if possible)
Sourcepub fn to_error(&self) -> Option<ResultCode>
pub fn to_error(&self) -> Option<ResultCode>
Returns the error code if the value is an error
Sourcepub fn to_error_details(&self) -> Option<(ResultCode, Option<String>)>
pub fn to_error_details(&self) -> Option<(ResultCode, Option<String>)>
Returns the error code and optional message if the value is an error
pub fn as_bytes(&self) -> Vec<u8> ⓘ
Sourcepub fn from_integer(i: i64) -> Self
pub fn from_integer(i: i64) -> Self
Creates a new integer Value from an i64
Sourcepub fn from_float(value: f64) -> Self
pub fn from_float(value: f64) -> Self
Creates a new float Value from a f64
pub fn from_json(s: String) -> Self
Sourcepub fn error(code: ResultCode) -> Self
pub fn error(code: ResultCode) -> Self
Creates a new error Value from a ResultCode
Sourcepub fn error_with_message(message: String) -> Self
pub fn error_with_message(message: String) -> Self
Creates a new error Value from a ResultCode and a message
Trait Implementations§
Auto Trait Implementations§
impl !Send for Value
impl !Sync for Value
impl Freeze for Value
impl RefUnwindSafe for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more