ArrayElement

Trait ArrayElement 

Source
pub trait ArrayElement: Sized {
    type ArrayValueType: ArrayValue;

    // Required methods
    fn into_array_value(self) -> Self::ArrayValueType;
    fn try_from_value(v: Value) -> Result<Vec<Option<Self>>, ValueTypeErr>;
}
Available on crate feature postgres-array only.
Expand description

Trait for custom types that can be used as PostgreSQL array elements.

When implemented, SeaQuery will provide:

  • ValueType for Vec<T> and Vec<Option<T>>
  • From<Vec<T>> for Value / From<Vec<Option<T>>> for Value
  • From<Vec<T>> for Array / From<Vec<Option<T>>> for Array

Required Associated Types§

Source

type ArrayValueType: ArrayValue

The underlying element type stored in the array.

Usually this is a built-in type like String, i32, Uuid, …

Required Methods§

Source

fn into_array_value(self) -> Self::ArrayValueType

Convert self into the underlying array element type.

Source

fn try_from_value(v: Value) -> Result<Vec<Option<Self>>, ValueTypeErr>

Convert from a Value to Vec<Option<Self>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ArrayElement for Braced

Source§

impl ArrayElement for Hyphenated

Source§

impl ArrayElement for Simple

Source§

impl ArrayElement for Urn

Implementors§