#[repr(C)]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
§Safety
This function accesses the value_type field of the union. it is safe to call this function as long as the value was properly constructed with one of the provided methods
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
Sourcepub fn to_blob(&self) -> Option<Vec<u8>>
pub fn to_blob(&self) -> Option<Vec<u8>>
Returns the blob value if the Value is the proper type
Sourcepub fn to_integer(&self) -> Option<i64>
pub fn to_integer(&self) -> Option<i64>
Returns the integer value if the Value is the proper type
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
Sourcepub fn from_text(s: String) -> Self
pub fn from_text(s: String) -> Self
Creates a new text Value from a String This function allocates/leaks the string and must be free’d manually
Sourcepub fn error(code: ResultCode) -> Self
pub fn error(code: ResultCode) -> Self
Creates a new error Value from a ResultCode This function allocates/leaks the error and must be free’d manually
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 This function allocates/leaks the error, must be free’d manually