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§
sourcetype Decoder: Decoder<Result = Self>
type Decoder: Decoder<Result = Self>
Decoder
returned by Patch::select
which decodes this patch from a row
Required Associated Constants§
Required Methods§
sourcefn select<P: Path>(ctx: &mut QueryContext) -> Self::Decoder
fn select<P: Path>(ctx: &mut QueryContext) -> Self::Decoder
Constructs a Self::Decoder
and configures a QueryContext
to query the required columns
(Cmp Selector
)
sourcefn push_values(self, values: &mut Vec<Value<'_>>)
fn push_values(self, values: &mut Vec<Value<'_>>)
Push the patch’s condition values onto a Vec
sourcefn push_references<'a>(&'a self, values: &mut Vec<Value<'a>>)
fn push_references<'a>(&'a self, values: &mut Vec<Value<'a>>)
Push the patch’s condition values onto a Vec
Provided Methods§
sourcefn references(&self) -> Vec<Value<'_>>
fn references(&self) -> Vec<Value<'_>>
Create a Vec
borrowing the patch’s condition values
Object Safety§
This trait is not object safe.