Trait LoadFrom

Source
pub trait LoadFrom<T, Args = ()>: Sized {
    type Error;
    type Context;

    // Required method
    fn load(
        ids: &[T],
        args: &Args,
        context: &Self::Context,
    ) -> Result<Vec<Self>, Self::Error>;
}
Expand description

How should associated values actually be loaded?

Normally T will be your id type but for HasMany and HasManyThrough it might also be other values.

If you’re using Diesel it is recommend that you use one of the macros to generate implementations.

Args is the type of arguments your GraphQL field takes. This is how we’re able to load things differently depending the types of arguments. You can learn more here.

Required Associated Types§

Source

type Error

The error type. This must match the error set in #[eager_loading(error_type = _)].

Source

type Context

Your Juniper context type.

This will typically contain a database connection or a connection to some external API.

Required Methods§

Source

fn load( ids: &[T], args: &Args, context: &Self::Context, ) -> Result<Vec<Self>, Self::Error>

Perform the load.

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.

Implementors§