Trait veloren_common::typed::SynthTyped

source ·
pub trait SynthTyped<Context, Target> {
    type Expr;
}
Expand description

Given a head expression (Self) and a target type (Type), attempt to synthesize a term that reduces head into the target type.

How we do this depends on the type of the head expression:

  • For enums, we synthesize a match on the current head. For each match arm, we then repeat this process on the constructor arguments; if there are no constructor arguments, we synthesize a literal (Pure term). (TODO: Handle larger than 1 tuple properly–for now we just synthesize a Pure term for these cases).

  • For structs, we synthesize a projection on the current head. For each projection, we then repeat this process on the type of the projected field.

  • For other types (which currently have to opt out during the field declaration), we synthesize a literal.

TODO: Differentiate between the context and the stack at some point; for now, we only use the context as a stack.

Required Associated Types§

Implementors§

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>, WeakHead<Body, Target>: SynthTyped<((Body,), ()), Target>,

§

type Expr = ElimCase<Cases<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((EyeColor,), Context), Target> for WeakHead<EyeColor, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Skin,), Context), Target> for WeakHead<Skin, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

§

type Expr = ElimCase<Cases<WeakHead<Skin, Target>>>

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<ToolKind, Target>: SynthTyped<((ToolKind,), ()), Target>, WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>, WeakHead<ItemDropArmorKind, Target>: SynthTyped<((ItemDropArmorKind,), ()), Target>,

§

type Expr = ElimCase<Cases<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((ItemDropArmorKind,), Context), Target> for WeakHead<ItemDropArmorKind, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

§

type Expr = ElimCase<Cases<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Species,), Context), Target> for WeakHead<Species, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((BodyType,), Context), Target> for WeakHead<BodyType, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

§

type Expr = ElimCase<Cases<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((BlockKind,), Context), Target> for WeakHead<BlockKind, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((Category,), Context), Target> for WeakHead<Category, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((SpriteKind,), Context), Target> for WeakHead<SpriteKind, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target>,

source§

impl<Context, Target> SynthTyped<((StructureBlock,), Context), Target> for WeakHead<StructureBlock, Target>
where WeakHead<Pure<Target>, Target>: SynthTyped<(), Target> + SynthTyped<((BlockKind, Rgb<u8>), ()), Target> + SynthTyped<((SpriteKind, u8), ()), Target> + SynthTyped<((String, f32), ()), Target> + SynthTyped<((Content, u8), ()), Target>, WeakHead<Rgb<u8>, Target>: SynthTyped<((Rgb<u8>,), ()), Target>, WeakHead<SpriteKind, Target>: SynthTyped<((SpriteKind,), ()), Target>, WeakHead<String, Target>: SynthTyped<((String,), ()), Target>,

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>, WeakHead<Pure<Target>, Target>: SynthTyped<((u8,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<((Body,), Context), Target> for WeakHead<Body, Target>
where WeakHead<Species, Target>: SynthTyped<((Species,), ()), Target>, WeakHead<BodyType, Target>: SynthTyped<((BodyType,), ()), Target>,

§

type Expr = ElimProj<Proj<WeakHead<Body, Target>>>

source§

impl<Context, Target> SynthTyped<Context, Target> for WeakHead<Pure<Target>, Target>

§

type Expr = Pure<Target>