rust_query

Trait Dummy

Source
pub trait Dummy<'t, 'a, S>: Sized {
    type Out;

    // Provided method
    fn map_dummy<T>(
        self,
        f: impl FnMut(Self::Out) -> T + 't,
    ) -> impl Dummy<'t, 'a, S, Out = T> { ... }
}
Expand description

This trait is implemented by everything that can be retrieved from the database.

Implement it on custom structs using crate::FromDummy.

Required Associated Types§

Source

type Out

The type that results from querying this dummy.

Provided Methods§

Source

fn map_dummy<T>( self, f: impl FnMut(Self::Out) -> T + 't, ) -> impl Dummy<'t, 'a, S, Out = T>

Map a dummy to another dummy using native rust.

This is useful when retrieving a struct from the database that contains types not supported by the database. It is also useful in migrations to process rows using arbitrary rust.

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<'t, 'a, S, A: Dummy<'t, 'a, S>, B: Dummy<'t, 'a, S>> Dummy<'t, 'a, S> for (A, B)

Source§

type Out = (<A as Dummy<'t, 'a, S>>::Out, <B as Dummy<'t, 'a, S>>::Out)

Implementors§

Source§

impl<'t, 'a, S, T: IntoColumn<'t, S, Typ: MyTyp>> Dummy<'t, 'a, S> for T

Source§

type Out = <<T as Typed>::Typ as MyTyp>::Out<'a>