[][src]Struct extremedb::sql::value::Ref

pub struct Ref<'a> { /* fields omitted */ }

An SQL value reference.

In addition to the value itself, a value reference holds a reference to the value's allocator, making it possible to release the value when the reference goes out of scope.

Methods from Deref<Target = Value<'a>>

pub fn value_type(&self) -> Result<Type>[src]

Returns the type of the contained value.

pub fn size(&self) -> Result<usize>[src]

For non-scalar types, returns the size of the data.

Depending on the contained type, returns:

  • String and Binary: length of the string or binary string;
  • Array: number of elements.

pub fn is_null(&self) -> bool[src]

Returns true if the value is an SQL null value.

pub fn is_true(&self) -> bool[src]

Returns true if the value is a boolean true value, or a non-zero integer.

pub fn to_i64(&self) -> Result<i64>[src]

Casts the value to i64.

Strings are parsed and converted, if possible; otherwise an error is returned.

pub fn to_real(&self) -> Result<f64>[src]

Casts the value to f64.

Strings are parsed and converted, if possible; otherwise an error is returned.

pub fn to_date_time(&self) -> Result<u64>[src]

Casts the value to the number of system ticks elapsed since the beginning of the epoch.

String values are parsed using strptime() where available, or a compatible custom function.

pub fn to_system_time(&self) -> Result<SystemTime>[src]

Casts the value to the number of system ticks elapsed since the beginning of the epoch, and converts the resulting value to std::time::SystemTime.

pub fn to_numeric(&self) -> Result<Numeric>[src]

Returns the contained fixed-width numeric value, if any, or an error.

pub fn to_string(&self) -> Result<String>[src]

Converts the value to the string representation.

pub fn as_str(&self) -> Result<&str>[src]

Returns a string slice pointing to the contents of a String value, or an error if the value is not a String.

pub fn to_binary(&self) -> Result<Vec<u8>>[src]

Returns a copy of the bytes of a string or a binary value.

pub fn as_bytes(&self) -> Result<&[u8]>[src]

Returns a byte slice pointing to the contents of a Binary value, or an error if the value is not a Binary.

pub fn as_array(&self) -> Result<&Array<'_>>[src]

Casts the value to Array if it has the Array type; returns an error otherwise.

pub fn as_sequence(&self) -> Result<&Sequence<'_>>[src]

Casts the value to Sequence if it has the Sequence type; returns an error otherwise.

pub fn as_blob(&self) -> Result<&Blob<'_>>[src]

Casts the value to Blob if it has the Blob type; returns an error otherwise.

Trait Implementations

impl<'a> Deref for Ref<'a>[src]

type Target = Value<'a>

The resulting type after dereferencing.

impl<'a> Drop for Ref<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Ref<'a>

impl<'a> !Send for Ref<'a>

impl<'a> !Sync for Ref<'a>

impl<'a> Unpin for Ref<'a>

impl<'a> UnwindSafe for Ref<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.