Skip to main content

SlotFace

Trait SlotFace 

Source
pub trait SlotFace<K>: FilterSlot<K> {
    type Wire: InputType;

    // Required methods
    fn read<F>(
        object: &IndexMap<Name, Value>,
        name: &str,
    ) -> Result<Self, InputValueError<F>>
       where F: InputType;
    fn write(&self) -> Value;

    // Provided method
    fn slot_type(registry: &mut Registry) -> String { ... }
}
Available on crate feature async-graphql only.
Expand description

The DELEGATION TRAIT a nullable column’s wire face is written over — the seam a downstream filter joins Nullable<F> through, since neither side can write the impl itself — and the SHORTHAND LAW’s own reading, which every filter face in every crate answers by asking it.

SlotFace rides here beside them: it is the WIRE half of the composed mode’s slot seam, and the emptiness half — FilterSlot and its three kind markers — is above, where a build with no binding still has it.

FlattenFace is the same mode’s other field kind — the component a #[ingraph(flatten)] field SPLICES into its host — and it is here for NullableFace’s own reason: it is a reading OF that row, so a face that satisfies one satisfies both and neither is written by hand. The DELEGATION TRAIT a nullable column’s wire face is written over — the seam a downstream filter joins Nullable<F> through, since neither side can write the impl itself — and the SHORTHAND LAW’s own reading, which every filter face in every crate answers by asking it.

SlotFace rides here beside them: it is the WIRE half of the composed mode’s slot seam, and the emptiness half — FilterSlot and its three kind markers — is above, where a build with no binding still has it.

FlattenFace is the same mode’s other field kind — the component a #[ingraph(flatten)] field SPLICES into its host — and it is here for NullableFace’s own reason: it is a reading OF that row, so a face that satisfies one satisfies both and neither is written by hand. The DELEGATION TRAIT a nullable column’s wire face is written over — the seam a downstream filter joins Nullable<F> through, since neither side can write the impl itself — and the SHORTHAND LAW’s own reading, which every filter face in every crate answers by asking it.

SlotFace rides here beside them: it is the WIRE half of the composed mode’s slot seam, and the emptiness half — FilterSlot and its three kind markers — is above, where a build with no binding still has it.

FlattenFace is the same mode’s other field kind — the component a #[ingraph(flatten)] field SPLICES into its host — and it is here for NullableFace’s own reason: it is a reading OF that row, so a face that satisfies one satisfies both and neither is written by hand. The WIRE half of a slot: what it registers, how it is read off a parsed object, and how it is written back.

Behind the binding gate, all three methods naming an async-graphql type. The supertrait is what keeps a slot ONE decision — a shape that crosses one way and empties another would be two rulings filed under one name.

Required Associated Types§

Source

type Wire: InputType

The type this slot CROSSES AS — what a client’s document is checked against and what the SDL prints.

Not always the slot’s own type: an operand slot crosses on its element’s carrier, so a Option<Rate> field publishes RateOperand and a Option<Utf8Bytes> field publishes String.

Required Methods§

Source

fn read<F>( object: &IndexMap<Name, Value>, name: &str, ) -> Result<Self, InputValueError<F>>
where F: InputType,

One slot, read off the parsed object under name.

F is the OWNER — the composed filter being parsed — because an InputValueError carries the type it is about, so a slot’s refusal has to be re-pointed at the face a client was writing.

§Errors

Whatever the crossing refuses: a wrong wire form is async-graphql’s own refusal, PROPAGATED, and an operand the element’s crossing declines becomes that crossing’s own sentence.

Source

fn write(&self) -> Value

One slot, written back onto the wire.

Provided Methods§

Source

fn slot_type(registry: &mut Registry) -> String

This slot’s entry in the registry, as the type name a field’s MetaInputValue carries.

Provided, and every row takes it: the wire type is the only thing that differs, and it is already named above. A row that overrode this would be a slot whose registration and whose parse could disagree.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<F> SlotFace<NestedFilter> for Option<F>

The NESTED row’s read is the component face’s OWN parse, handed the value under this name — so a composed filter reading a composed filter spends exactly one parser per face however deep the nesting runs.

Source§

type Wire = Option<F>

Source§

fn read<O>( object: &IndexMap<Name, Value>, name: &str, ) -> Result<Self, InputValueError<O>>
where O: InputType,

Source§

fn write(&self) -> Value

Source§

impl<T> SlotFace<ManyOperands> for Option<Box<[T]>>

Source§

type Wire = Option<Box<[<T as ToGraphqlInput>::Input]>>

Source§

fn read<F>( object: &IndexMap<Name, Value>, name: &str, ) -> Result<Self, InputValueError<F>>
where F: InputType,

Source§

fn write(&self) -> Value

Source§

impl<T> SlotFace<OneOperand> for Option<T>

Source§

type Wire = Option<<T as ToGraphqlInput>::Input>

Source§

fn read<F>( object: &IndexMap<Name, Value>, name: &str, ) -> Result<Self, InputValueError<F>>
where F: InputType,

Source§

fn write(&self) -> Value

Implementors§