pub struct ExtensionValue { /* private fields */ }Implementations§
Source§impl Value
impl Value
Sourcepub const fn value_type(&self) -> ValueType
pub const 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
Sourcepub fn to_text_coerced(&self) -> Option<String>
pub fn to_text_coerced(&self) -> Option<String>
Returns the text value for any ValueType
pub fn is_json(&self) -> bool
Sourcepub fn to_blob(&self) -> Option<Vec<u8>>
pub fn to_blob(&self) -> Option<Vec<u8>>
Returns the blob value if the ValueType is Blob (copies the data)
Sourcepub fn blob_ref(&self) -> Option<&[u8]>
pub fn blob_ref(&self) -> Option<&[u8]>
Returns a reference to the blob data without copying.
Unlike to_blob() which returns an owned Vec<u8>, this method
returns a slice reference that borrows from the underlying storage.
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) -> Value
pub fn from_integer(i: i64) -> Value
Creates a new integer Value from an i64
Sourcepub fn from_float(value: f64) -> Value
pub fn from_float(value: f64) -> Value
Creates a new float Value from a f64
pub fn from_json(s: String) -> Value
Sourcepub fn error(code: ResultCode) -> Value
pub fn error(code: ResultCode) -> Value
Creates a new error Value from a ResultCode
Sourcepub fn error_with_message(message: String) -> Value
pub fn error_with_message(message: String) -> Value
Creates a new error Value from a ResultCode and a message
Sourcepub unsafe fn __free_internal_type(self)
pub unsafe fn __free_internal_type(self)
Extension authors should not use this function, or enable the ‘core_only’ feature
§Safety
consumes the value while freeing the underlying memory with null check. however this does assume that the type was properly constructed with the appropriate value_type and value.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more