Trait rorm::model::Patch

source ·
pub trait Patch: Sized + 'static {
    type Model: Model;
    type Decoder: Decoder<Result = Self>;

    const COLUMNS: &'static [&'static str];

    // Required methods
    fn select<P: Path>(ctx: &mut QueryContext) -> Self::Decoder;
    fn push_values(self, values: &mut Vec<Value<'_>>);
    fn push_references<'a>(&'a self, values: &mut Vec<Value<'a>>);

    // Provided methods
    fn values(self) -> Vec<Value<'static>> { ... }
    fn references(&self) -> Vec<Value<'_>> { ... }
}
Expand description

Trait implemented on Patches i.e. a subset of a model’s fields.

Implemented by [derive(Patch)] as well as [derive(Model)].

Required Associated Types§

source

type Model: Model

The model this patch is for

source

type Decoder: Decoder<Result = Self>

Decoder returned by Patch::select which decodes this patch from a row

Required Associated Constants§

source

const COLUMNS: &'static [&'static str]

List of columns i.e. fields this patch contains

Required Methods§

source

fn select<P: Path>(ctx: &mut QueryContext) -> Self::Decoder

Constructs a Self::Decoder and configures a QueryContext to query the required columns

(Cmp Selector)

source

fn push_values(self, values: &mut Vec<Value<'_>>)

Push the patch’s condition values onto a Vec

source

fn push_references<'a>(&'a self, values: &mut Vec<Value<'a>>)

Push the patch’s condition values onto a Vec

Provided Methods§

source

fn values(self) -> Vec<Value<'static>>

Create a Vec moving the patch’s condition values

source

fn references(&self) -> Vec<Value<'_>>

Create a Vec borrowing the patch’s condition values

Object Safety§

This trait is not object safe.

Implementors§