Struct ElimCase

Source
pub struct ElimCase<Cases> {
    pub cases: Cases,
}
Expand description

A lazy pattern match reified as a Rust type.

expr is the expression being matched on, generally of some enum type Ty.

case represents the pattern match–it will generally be a structure with one field per constructor in Ty. The field should contain enough information to run the match arm for that constructor, given the information contained in the constructor arguments.

ty represents the return type of the match expression. It does not carry any runtime-relevant information, but is needed in order to simplify our trait definitions.

The intent is that you should not construct this structure directly, nor should you define or construct the Cases structure directly. Instead, to use this you are expected to wrap your enum declaration in a call to [make_case_elim!], as follows:

veloren_common::make_case_elim!(
    my_type_module,
    #[repr(u32)]
    #[derive(Clone,Copy)]
    pub enum MyType {
        Constr1 = 0,
        #[typed(pure)] Constr2(arg : u8) = 1,
        /* ..., */
    }
);

This macro automatically does a few things. First, it creates the enum type MyType in the current scope, as expected. Second, it creates a module named my_type_module in the current scope, into which it dumps a few things. In this case:

#[repr(u32)]
#[derive(Clone, Copy)]
pub enum MyType {
    Constr1 = 0,
    Constr2(u8) = 1,
    /* ..., */
}

mod my_type_module {
    use serde::{Deserialize, Serialize};

    /// The number of variants in this enum.
    pub const NUM_VARIANTS: usize = 2;

    /// An array of all the variant indices (in theory, this can be used by this or other
    /// macros in order to easily build up things like uniform random samplers).
    pub const ALL_INDICES: [u32; NUM_VARIANTS] = [0, 1];

    /// A convenience trait used to store a different type for each constructor in this
    /// pattern.
    pub trait PackedElim {
        type Constr1;
        type Constr2;
    }

    /// The actual *cases.*  If you think of pattern match arms as being closures that accept
    /// the constructor types as arguments, you can think of this structure as somehow
    /// representing just the data *owned* by the closure.  This is also what you will
    /// generally store in your ron file--it has a field for each constructor of your enum,
    /// with the types of all the fields specified by the implementation of [PackedElim] for
    /// the [Elim] argument.  Each field has the same name as the constructor it represents.
    #[derive(Serialize, Deserialize)]
    pub struct Cases<Elim: PackedElim> {
        pub Constr1: Elim::Constr1,
        pub Constr2: Elim::Constr2,
    }

    /// Finally, because it represents by an overwhelming margin the most common usecase, we
    /// predefine a particular pattern matching strategy--"pure"--where every arm holds data of
    /// the exact same type, T.
    impl<T> PackedElim for veloren_common::typed::Pure<T> {
        type Constr1 = T;
        type Constr2 = T;
    }

    /// Because PureCases is so convenient, we have an alias for it.  Thus, in order to
    /// represent a pattern match on an argument that returns a constant of type (u8,u8,u8) for
    /// each arm, you'd use the type `PureCases<(u8, u8, u8)>`.
    pub type PureCases<Elim> = Cases<veloren_common::typed::Pure<Elim>>;
}

Finally, a useful implementation of the Typed trait completes this story, providing a way to evaluate this lazy math statement within Rust. Unfortunately, Typed is quite complicated, and this story is still being fully evaluated, so showing teh type may not be that elucidating. Instead, we’ll just present the method you can use most easily to pattern match using the PureCases pattern we mentioned earlier:

pub fn elim_case_pure<’a, Type>(&’a self, cases: &’a $mod::PureCases) -> &’a Type

If self is expression of your defined enum type, and match data defined by PureCases, this evaluates the pattern match on self and returns the matched case.

To see how this is used in more detail, check out common/src/body/humanoid.rs; it is also used extensively in the world repository.


Limitations:

Unfortunately, due to restrictions on macro_rules, we currently always require the types defined to #[repr(inttype)] as you can see above. There are also some other current limitations that we hopefully will be able to lift at some point; struct variants are not yet supported, and neither attributes on fields.

Fields§

§cases: Cases

Trait Implementations§

Source§

impl<'de, Cases> Deserialize<'de> for ElimCase<Cases>
where Cases: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Cases> Serialize for ElimCase<Cases>
where Cases: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a, 'b, Elim: PackedElim, Context, Type, S> Typed<((&'a BlockKind,), Context), Type, S> for &'b ElimCase<Cases<Elim>>
where &'b Elim::Air: Typed<Context, Type, S>, &'b Elim::Water: Typed<Context, Type, S>, &'b Elim::Rock: Typed<Context, Type, S>, &'b Elim::WeakRock: Typed<Context, Type, S>, &'b Elim::Lava: Typed<Context, Type, S>, &'b Elim::GlowingRock: Typed<Context, Type, S>, &'b Elim::GlowingWeakRock: Typed<Context, Type, S>, &'b Elim::Grass: Typed<Context, Type, S>, &'b Elim::Snow: Typed<Context, Type, S>, &'b Elim::ArtSnow: Typed<Context, Type, S>, &'b Elim::Earth: Typed<Context, Type, S>, &'b Elim::Sand: Typed<Context, Type, S>, &'b Elim::Wood: Typed<Context, Type, S>, &'b Elim::Leaves: Typed<Context, Type, S>, &'b Elim::GlowingMushroom: Typed<Context, Type, S>, &'b Elim::Ice: Typed<Context, Type, S>, &'b Elim::ArtLeaves: Typed<Context, Type, S>, &'b Elim::Misc: Typed<Context, Type, S>,

Source§

fn reduce(self, ((head), context): ((&'a BlockKind,), Context)) -> (Type, S)

Source§

impl<'a, 'b, Elim: PackedElim, Context, Type, S> Typed<((&'a BodyType,), Context), Type, S> for &'b ElimCase<Cases<Elim>>
where &'b Elim::Female: Typed<Context, Type, S>, &'b Elim::Male: Typed<Context, Type, S>,

Source§

fn reduce(self, ((head), context): ((&'a BodyType,), Context)) -> (Type, S)

Source§

impl<'a, 'b, Elim: PackedElim, Context, Type, S> Typed<((&'a Category,), Context), Type, S> for &'b ElimCase<Cases<Elim>>
where &'b Elim::Void: Typed<Context, Type, S>, &'b Elim::Misc: Typed<Context, Type, S>, &'b Elim::Furniture: Typed<Context, Type, S>, &'b Elim::Plant: Typed<Context, Type, S>, &'b Elim::Resource: Typed<Context, Type, S>, &'b Elim::MineableResource: Typed<Context, Type, S>, &'b Elim::Structural: Typed<Context, Type, S>, &'b Elim::Decor: Typed<Context, Type, S>, &'b Elim::Lamp: Typed<Context, Type, S>, &'b Elim::Container: Typed<Context, Type, S>, &'b Elim::Modular: Typed<Context, Type, S>,

Source§

fn reduce(self, ((head), context): ((&'a Category,), Context)) -> (Type, S)

Source§

impl<'a, 'b, Elim: PackedElim, Context, Type, S> Typed<((&'a EyeColor,), Context), Type, S> for &'b ElimCase<Cases<Elim>>
where &'b Elim::AmberOrange: Typed<Context, Type, S>, &'b Elim::AmberYellow: Typed<Context, Type, S>, &'b Elim::BrightBrown: Typed<Context, Type, S>, &'b Elim::CornflowerBlue: Typed<Context, Type, S>, &'b Elim::CuriousGreen: Typed<Context, Type, S>, &'b Elim::EmeraldGreen: Typed<Context, Type, S>, &'b Elim::ExoticPurple: Typed<Context, Type, S>, &'b Elim::FrozenBlue: Typed<Context, Type, S>, &'b Elim::GhastlyYellow: Typed<Context, Type, S>, &'b Elim::LoyalBrown: Typed<Context, Type, S>, &'b Elim::MagicPurple: Typed<Context, Type, S>, &'b Elim::NobleBlue: Typed<Context, Type, S>, &'b Elim::PineGreen: Typed<Context, Type, S>, &'b Elim::PumpkinOrange: Typed<Context, Type, S>, &'b Elim::RubyRed: Typed<Context, Type, S>, &'b Elim::RegalPurple: Typed<Context, Type, S>, &'b Elim::RustBrown: Typed<Context, Type, S>, &'b Elim::SapphireBlue: Typed<Context, Type, S>, &'b Elim::SulfurYellow: Typed<Context, Type, S>, &'b Elim::ToxicGreen: Typed<Context, Type, S>, &'b Elim::ViciousRed: Typed<Context, Type, S>, &'b Elim::VigorousBlack: Typed<Context, Type, S>,

Source§

fn reduce(self, ((head), context): ((&'a EyeColor,), Context)) -> (Type, S)

Source§

impl<'a, 'b, Elim: PackedElim, Context, Type, S> Typed<((&'a Skin,), Context), Type, S> for &'b ElimCase<Cases<Elim>>
where &'b Elim::HumanOne: Typed<Context, Type, S>, &'b Elim::HumanTwo: Typed<Context, Type, S>, &'b Elim::HumanThree: Typed<Context, Type, S>, &'b Elim::HumanFour: Typed<Context, Type, S>, &'b Elim::HumanFive: Typed<Context, Type, S>, &'b Elim::HumanSix: Typed<Context, Type, S>, &'b Elim::HumanSeven: Typed<Context, Type, S>, &'b Elim::HumanEight: Typed<Context, Type, S>, &'b Elim::HumanNine: Typed<Context, Type, S>, &'b Elim::HumanTen: Typed<Context, Type, S>, &'b Elim::HumanEleven: Typed<Context, Type, S>, &'b Elim::HumanTwelve: Typed<Context, Type, S>, &'b Elim::HumanThirteen: Typed<Context, Type, S>, &'b Elim::HumanFourteen: Typed<Context, Type, S>, &'b Elim::HumanFifteen: Typed<Context, Type, S>, &'b Elim::HumanSixteen: Typed<Context, Type, S>, &'b Elim::HumanSeventeen: Typed<Context, Type, S>, &'b Elim::HumanEighteen: Typed<Context, Type, S>, &'b Elim::DwarfOne: Typed<Context, Type, S>, &'b Elim::DwarfTwo: Typed<Context, Type, S>, &'b Elim::DwarfThree: Typed<Context, Type, S>, &'b Elim::DwarfFour: Typed<Context, Type, S>, &'b Elim::DwarfFive: Typed<Context, Type, S>, &'b Elim::DwarfSix: Typed<Context, Type, S>, &'b Elim::DwarfSeven: Typed<Context, Type, S>, &'b Elim::DwarfEight: Typed<Context, Type, S>, &'b Elim::DwarfNine: Typed<Context, Type, S>, &'b Elim::DwarfTen: Typed<Context, Type, S>, &'b Elim::DwarfEleven: Typed<Context, Type, S>, &'b Elim::DwarfTwelve: Typed<Context, Type, S>, &'b Elim::DwarfThirteen: Typed<Context, Type, S>, &'b Elim::DwarfFourteen: Typed<Context, Type, S>, &'b Elim::ElfOne: Typed<Context, Type, S>, &'b Elim::ElfTwo: Typed<Context, Type, S>, &'b Elim::ElfThree: Typed<Context, Type, S>, &'b Elim::ElfFour: Typed<Context, Type, S>, &'b Elim::ElfFive: Typed<Context, Type, S>, &'b Elim::ElfSix: Typed<Context, Type, S>, &'b Elim::ElfSeven: Typed<Context, Type, S>, &'b Elim::ElfEight: Typed<Context, Type, S>, &'b Elim::ElfNine: Typed<Context, Type, S>, &'b Elim::ElfTen: Typed<Context, Type, S>, &'b Elim::ElfEleven: Typed<Context, Type, S>, &'b Elim::ElfTwelve: Typed<Context, Type, S>, &'b Elim::ElfThirteen: Typed<Context, Type, S>, &'b Elim::ElfFourteen: Typed<Context, Type, S>, &'b Elim::ElfFifteen: Typed<Context, Type, S>, &'b Elim::ElfSixteen: Typed<Context, Type, S>, &'b Elim::ElfSeventeen: Typed<Context, Type, S>, &'b Elim::ElfEighteen: Typed<Context, Type, S>, &'b Elim::OrcOne: Typed<Context, Type, S>, &'b Elim::OrcTwo: Typed<Context, Type, S>, &'b Elim::OrcThree: Typed<Context, Type, S>, &'b Elim::OrcFour: Typed<Context, Type, S>, &'b Elim::OrcFive: Typed<Context, Type, S>, &'b Elim::OrcSix: Typed<Context, Type, S>, &'b Elim::OrcSeven: Typed<Context, Type, S>, &'b Elim::OrcEight: Typed<Context, Type, S>, &'b Elim::DanariOne: Typed<Context, Type, S>, &'b Elim::DanariTwo: Typed<Context, Type, S>, &'b Elim::DanariThree: Typed<Context, Type, S>, &'b Elim::DanariFour: Typed<Context, Type, S>, &'b Elim::DanariFive: Typed<Context, Type, S>, &'b Elim::DanariSix: Typed<Context, Type, S>, &'b Elim::DanariSeven: Typed<Context, Type, S>, &'b Elim::DraugrOne: Typed<Context, Type, S>, &'b Elim::DraugrTwo: Typed<Context, Type, S>, &'b Elim::DraugrThree: Typed<Context, Type, S>, &'b Elim::DraugrFour: Typed<Context, Type, S>, &'b Elim::DraugrFive: Typed<Context, Type, S>, &'b Elim::DraugrSix: Typed<Context, Type, S>, &'b Elim::DraugrSeven: Typed<Context, Type, S>, &'b Elim::DraugrEight: Typed<Context, Type, S>, &'b Elim::DraugrNine: Typed<Context, Type, S>,

Source§

fn reduce(self, ((head), context): ((&'a Skin,), Context)) -> (Type, S)

Source§

impl<'a, 'b, Elim: PackedElim, Context, Type, S> Typed<((&'a Species,), Context), Type, S> for &'b ElimCase<Cases<Elim>>
where &'b Elim::Danari: Typed<Context, Type, S>, &'b Elim::Dwarf: Typed<Context, Type, S>, &'b Elim::Elf: Typed<Context, Type, S>, &'b Elim::Human: Typed<Context, Type, S>, &'b Elim::Orc: Typed<Context, Type, S>, &'b Elim::Draugr: Typed<Context, Type, S>,

Source§

fn reduce(self, ((head), context): ((&'a Species,), Context)) -> (Type, S)

Source§

impl<'a, 'b, Elim: PackedElim, Context, Type, S> Typed<((&'a SpriteKind,), Context), Type, S> for &'b ElimCase<Cases<Elim>>
where &'b Elim::Empty: Typed<Context, Type, S>, &'b Elim::Ember: Typed<Context, Type, S>, &'b Elim::SmokeDummy: Typed<Context, Type, S>, &'b Elim::Bomb: Typed<Context, Type, S>, &'b Elim::FireBlock: Typed<Context, Type, S>, &'b Elim::HotSurface: Typed<Context, Type, S>, &'b Elim::Stones2: Typed<Context, Type, S>, &'b Elim::BookshelfArabic: Typed<Context, Type, S>, &'b Elim::WallTableArabic: Typed<Context, Type, S>, &'b Elim::TableArabicLarge: Typed<Context, Type, S>, &'b Elim::TableArabicSmall: Typed<Context, Type, S>, &'b Elim::CupboardArabic: Typed<Context, Type, S>, &'b Elim::OvenArabic: Typed<Context, Type, S>, &'b Elim::CushionArabic: Typed<Context, Type, S>, &'b Elim::CanapeArabic: Typed<Context, Type, S>, &'b Elim::Shelf: Typed<Context, Type, S>, &'b Elim::Planter: Typed<Context, Type, S>, &'b Elim::BedMesa: Typed<Context, Type, S>, &'b Elim::WallTableMesa: Typed<Context, Type, S>, &'b Elim::MirrorMesa: Typed<Context, Type, S>, &'b Elim::WardrobeSingleMesa: Typed<Context, Type, S>, &'b Elim::WardrobeDoubleMesa: Typed<Context, Type, S>, &'b Elim::CupboardMesa: Typed<Context, Type, S>, &'b Elim::TableCoastalLarge: Typed<Context, Type, S>, &'b Elim::BenchCoastal: Typed<Context, Type, S>, &'b Elim::CraftingBench: Typed<Context, Type, S>, &'b Elim::Forge: Typed<Context, Type, S>, &'b Elim::Cauldron: Typed<Context, Type, S>, &'b Elim::Anvil: Typed<Context, Type, S>, &'b Elim::CookingPot: Typed<Context, Type, S>, &'b Elim::SpinningWheel: Typed<Context, Type, S>, &'b Elim::TanningRack: Typed<Context, Type, S>, &'b Elim::Loom: Typed<Context, Type, S>, &'b Elim::DismantlingBench: Typed<Context, Type, S>, &'b Elim::RepairBench: Typed<Context, Type, S>, &'b Elim::HangingBasket: Typed<Context, Type, S>, &'b Elim::HangingSign: Typed<Context, Type, S>, &'b Elim::ChristmasOrnament: Typed<Context, Type, S>, &'b Elim::ChristmasWreath: Typed<Context, Type, S>, &'b Elim::WallLampWizard: Typed<Context, Type, S>, &'b Elim::WallLamp: Typed<Context, Type, S>, &'b Elim::WallLampSmall: Typed<Context, Type, S>, &'b Elim::WallSconce: Typed<Context, Type, S>, &'b Elim::DungeonWallDecor: Typed<Context, Type, S>, &'b Elim::WallLampMesa: Typed<Context, Type, S>, &'b Elim::Tent: Typed<Context, Type, S>, &'b Elim::Bedroll: Typed<Context, Type, S>, &'b Elim::BedrollSnow: Typed<Context, Type, S>, &'b Elim::BedrollPirate: Typed<Context, Type, S>, &'b Elim::Sign: Typed<Context, Type, S>, &'b Elim::Helm: Typed<Context, Type, S>, &'b Elim::Scarecrow: Typed<Context, Type, S>, &'b Elim::FountainArabic: Typed<Context, Type, S>, &'b Elim::Hearth: Typed<Context, Type, S>, &'b Elim::ChestWoodDouble: Typed<Context, Type, S>, &'b Elim::LanternpostWoodUpper: Typed<Context, Type, S>, &'b Elim::LanternpostWoodBase: Typed<Context, Type, S>, &'b Elim::LampMetalBase: Typed<Context, Type, S>, &'b Elim::BlacksmithBellows: Typed<Context, Type, S>, &'b Elim::CarpenterTable: Typed<Context, Type, S>, &'b Elim::CarpenterCrateWoodS: Typed<Context, Type, S>, &'b Elim::CarpenterCrateWoodL: Typed<Context, Type, S>, &'b Elim::CarpenterToolsWall: Typed<Context, Type, S>, &'b Elim::CarpenterLogCutter: Typed<Context, Type, S>, &'b Elim::BarrelWoodCoal: Typed<Context, Type, S>, &'b Elim::BarrelWoodWater: Typed<Context, Type, S>, &'b Elim::BasketWovenL: Typed<Context, Type, S>, &'b Elim::BasketWovenM: Typed<Context, Type, S>, &'b Elim::BasketWovenS: Typed<Context, Type, S>, &'b Elim::BonfireMLit: Typed<Context, Type, S>, &'b Elim::BonfireMUnlit: Typed<Context, Type, S>, &'b Elim::BucketWoodM: Typed<Context, Type, S>, &'b Elim::MirrorWoodM: Typed<Context, Type, S>, &'b Elim::SackLeatherM: Typed<Context, Type, S>, &'b Elim::TrophyframeWoodBear: Typed<Context, Type, S>, &'b Elim::TrophyframeWoodDeer: Typed<Context, Type, S>, &'b Elim::JugClayM: Typed<Context, Type, S>, &'b Elim::LogsWoodBranchS: Typed<Context, Type, S>, &'b Elim::DiningtableWoodCorner: Typed<Context, Type, S>, &'b Elim::DiningtableWoodBody: Typed<Context, Type, S>, &'b Elim::BenchWoodEnd: Typed<Context, Type, S>, &'b Elim::BenchWoodMiddle: Typed<Context, Type, S>, &'b Elim::LogsWoodCoreEnd: Typed<Context, Type, S>, &'b Elim::LogsWoodCoreMiddle: Typed<Context, Type, S>, &'b Elim::LogsWoodBarkEnd: Typed<Context, Type, S>, &'b Elim::LogsWoodBarkMiddle: Typed<Context, Type, S>, &'b Elim::LogsWoodBranchEnd: Typed<Context, Type, S>, &'b Elim::LogsWoodBranchMiddle: Typed<Context, Type, S>, &'b Elim::SeatWoodBlueMiddle: Typed<Context, Type, S>, &'b Elim::SeatWoodBlueSide: Typed<Context, Type, S>, &'b Elim::RopeCoilM: Typed<Context, Type, S>, &'b Elim::BedWoodWoodlandHead: Typed<Context, Type, S>, &'b Elim::BedWoodWoodlandMiddle: Typed<Context, Type, S>, &'b Elim::BedWoodWoodlandTail: Typed<Context, Type, S>, &'b Elim::BenchWoodWoodlandGreen1: Typed<Context, Type, S>, &'b Elim::BenchWoodWoodlandGreen2: Typed<Context, Type, S>, &'b Elim::BenchWoodWoodlandGreen3: Typed<Context, Type, S>, &'b Elim::BenchWoodWoodland: Typed<Context, Type, S>, &'b Elim::ChairWoodWoodland: Typed<Context, Type, S>, &'b Elim::ChairWoodWoodland2: Typed<Context, Type, S>, &'b Elim::CoatrackMetalWoodland: Typed<Context, Type, S>, &'b Elim::CoatrackWoodWoodland: Typed<Context, Type, S>, &'b Elim::DrawerWoodWoodlandL1: Typed<Context, Type, S>, &'b Elim::DrawerWoodWoodlandL2: Typed<Context, Type, S>, &'b Elim::DrawerWoodWoodlandM1: Typed<Context, Type, S>, &'b Elim::DrawerWoodWoodlandM2: Typed<Context, Type, S>, &'b Elim::DrawerWoodWoodlandS: Typed<Context, Type, S>, &'b Elim::HandCartWoodHead: Typed<Context, Type, S>, &'b Elim::HandCartWoodMiddle: Typed<Context, Type, S>, &'b Elim::HandCartWoodTail: Typed<Context, Type, S>, &'b Elim::FlowerpotWoodWoodlandS: Typed<Context, Type, S>, &'b Elim::DiningtableWoodWoodlandRound: Typed<Context, Type, S>, &'b Elim::DiningtableWoodWoodlandSquare: Typed<Context, Type, S>, &'b Elim::TableWoodFancyWoodlandCorner: Typed<Context, Type, S>, &'b Elim::TableWoodFancyWoodlandBody: Typed<Context, Type, S>, &'b Elim::WardrobedoubleWoodWoodland: Typed<Context, Type, S>, &'b Elim::WardrobedoubleWoodWoodland2: Typed<Context, Type, S>, &'b Elim::WardrobesingleWoodWoodland: Typed<Context, Type, S>, &'b Elim::WardrobesingleWoodWoodland2: Typed<Context, Type, S>, &'b Elim::BedCliffHead: Typed<Context, Type, S>, &'b Elim::BedCliffMiddle: Typed<Context, Type, S>, &'b Elim::BedCliffTail: Typed<Context, Type, S>, &'b Elim::BedCoastalHead: Typed<Context, Type, S>, &'b Elim::BedCoastalMiddle: Typed<Context, Type, S>, &'b Elim::BedCoastalTail: Typed<Context, Type, S>, &'b Elim::BedDesertHead: Typed<Context, Type, S>, &'b Elim::BedDesertMiddle: Typed<Context, Type, S>, &'b Elim::BedDesertTail: Typed<Context, Type, S>, &'b Elim::BedSavannahHead: Typed<Context, Type, S>, &'b Elim::BedSavannahMiddle: Typed<Context, Type, S>, &'b Elim::BedSavannahTail: Typed<Context, Type, S>, &'b Elim::Ladder: Typed<Context, Type, S>, &'b Elim::BookshelfEnd: Typed<Context, Type, S>, &'b Elim::BookshelfMiddle: Typed<Context, Type, S>, &'b Elim::BarrelCactus: Typed<Context, Type, S>, &'b Elim::RoundCactus: Typed<Context, Type, S>, &'b Elim::ShortCactus: Typed<Context, Type, S>, &'b Elim::MedFlatCactus: Typed<Context, Type, S>, &'b Elim::ShortFlatCactus: Typed<Context, Type, S>, &'b Elim::LargeCactus: Typed<Context, Type, S>, &'b Elim::TallCactus: Typed<Context, Type, S>, &'b Elim::BlueFlower: Typed<Context, Type, S>, &'b Elim::PinkFlower: Typed<Context, Type, S>, &'b Elim::PurpleFlower: Typed<Context, Type, S>, &'b Elim::RedFlower: Typed<Context, Type, S>, &'b Elim::WhiteFlower: Typed<Context, Type, S>, &'b Elim::YellowFlower: Typed<Context, Type, S>, &'b Elim::Sunflower: Typed<Context, Type, S>, &'b Elim::Moonbell: Typed<Context, Type, S>, &'b Elim::Pyrebloom: Typed<Context, Type, S>, &'b Elim::LushFlower: Typed<Context, Type, S>, &'b Elim::LanternFlower: Typed<Context, Type, S>, &'b Elim::LongGrass: Typed<Context, Type, S>, &'b Elim::MediumGrass: Typed<Context, Type, S>, &'b Elim::ShortGrass: Typed<Context, Type, S>, &'b Elim::Fern: Typed<Context, Type, S>, &'b Elim::LargeGrass: Typed<Context, Type, S>, &'b Elim::Reed: Typed<Context, Type, S>, &'b Elim::TaigaGrass: Typed<Context, Type, S>, &'b Elim::GrassBlue: Typed<Context, Type, S>, &'b Elim::SavannaGrass: Typed<Context, Type, S>, &'b Elim::TallSavannaGrass: Typed<Context, Type, S>, &'b Elim::RedSavannaGrass: Typed<Context, Type, S>, &'b Elim::SavannaBush: Typed<Context, Type, S>, &'b Elim::Welwitch: Typed<Context, Type, S>, &'b Elim::LeafyPlant: Typed<Context, Type, S>, &'b Elim::DeadBush: Typed<Context, Type, S>, &'b Elim::JungleFern: Typed<Context, Type, S>, &'b Elim::GrassBlueShort: Typed<Context, Type, S>, &'b Elim::GrassBlueMedium: Typed<Context, Type, S>, &'b Elim::GrassBlueLong: Typed<Context, Type, S>, &'b Elim::CavernLillypadBlue: Typed<Context, Type, S>, &'b Elim::EnsnaringVines: Typed<Context, Type, S>, &'b Elim::LillyPads: Typed<Context, Type, S>, &'b Elim::JungleLeafyPlant: Typed<Context, Type, S>, &'b Elim::JungleRedGrass: Typed<Context, Type, S>, &'b Elim::LanternPlant: Typed<Context, Type, S>, &'b Elim::SporeReed: Typed<Context, Type, S>, &'b Elim::DeadPlant: Typed<Context, Type, S>, &'b Elim::Corn: Typed<Context, Type, S>, &'b Elim::WheatYellow: Typed<Context, Type, S>, &'b Elim::WheatGreen: Typed<Context, Type, S>, &'b Elim::LingonBerry: Typed<Context, Type, S>, &'b Elim::Blueberry: Typed<Context, Type, S>, &'b Elim::Cabbage: Typed<Context, Type, S>, &'b Elim::Pumpkin: Typed<Context, Type, S>, &'b Elim::Carrot: Typed<Context, Type, S>, &'b Elim::Tomato: Typed<Context, Type, S>, &'b Elim::Radish: Typed<Context, Type, S>, &'b Elim::Turnip: Typed<Context, Type, S>, &'b Elim::Flax: Typed<Context, Type, S>, &'b Elim::Mushroom: Typed<Context, Type, S>, &'b Elim::CaveMushroom: Typed<Context, Type, S>, &'b Elim::Cotton: Typed<Context, Type, S>, &'b Elim::WildFlax: Typed<Context, Type, S>, &'b Elim::SewerMushroom: Typed<Context, Type, S>, &'b Elim::LushMushroom: Typed<Context, Type, S>, &'b Elim::RockyMushroom: Typed<Context, Type, S>, &'b Elim::GlowMushroom: Typed<Context, Type, S>, &'b Elim::StonyCoral: Typed<Context, Type, S>, &'b Elim::SoftCoral: Typed<Context, Type, S>, &'b Elim::SeaweedTemperate: Typed<Context, Type, S>, &'b Elim::SeaweedTropical: Typed<Context, Type, S>, &'b Elim::GiantKelp: Typed<Context, Type, S>, &'b Elim::BullKelp: Typed<Context, Type, S>, &'b Elim::WavyAlgae: Typed<Context, Type, S>, &'b Elim::SeaGrapes: Typed<Context, Type, S>, &'b Elim::MermaidsFan: Typed<Context, Type, S>, &'b Elim::SeaAnemone: Typed<Context, Type, S>, &'b Elim::Seagrass: Typed<Context, Type, S>, &'b Elim::RedAlgae: Typed<Context, Type, S>, &'b Elim::Liana: Typed<Context, Type, S>, &'b Elim::MycelBlue: Typed<Context, Type, S>, &'b Elim::CeilingMushroom: Typed<Context, Type, S>, &'b Elim::Mold: Typed<Context, Type, S>, &'b Elim::Root: Typed<Context, Type, S>, &'b Elim::CeilingLanternPlant: Typed<Context, Type, S>, &'b Elim::CeilingLanternFlower: Typed<Context, Type, S>, &'b Elim::CeilingJungleLeafyPlant: Typed<Context, Type, S>, &'b Elim::Twigs: Typed<Context, Type, S>, &'b Elim::Wood: Typed<Context, Type, S>, &'b Elim::Bamboo: Typed<Context, Type, S>, &'b Elim::Hardwood: Typed<Context, Type, S>, &'b Elim::Ironwood: Typed<Context, Type, S>, &'b Elim::Frostwood: Typed<Context, Type, S>, &'b Elim::Eldwood: Typed<Context, Type, S>, &'b Elim::Apple: Typed<Context, Type, S>, &'b Elim::Coconut: Typed<Context, Type, S>, &'b Elim::Stones: Typed<Context, Type, S>, &'b Elim::Seashells: Typed<Context, Type, S>, &'b Elim::Beehive: Typed<Context, Type, S>, &'b Elim::Bowl: Typed<Context, Type, S>, &'b Elim::PotionMinor: Typed<Context, Type, S>, &'b Elim::PotionDummy: Typed<Context, Type, S>, &'b Elim::VialEmpty: Typed<Context, Type, S>, &'b Elim::Amethyst: Typed<Context, Type, S>, &'b Elim::Ruby: Typed<Context, Type, S>, &'b Elim::Sapphire: Typed<Context, Type, S>, &'b Elim::Emerald: Typed<Context, Type, S>, &'b Elim::Topaz: Typed<Context, Type, S>, &'b Elim::Diamond: Typed<Context, Type, S>, &'b Elim::Bloodstone: Typed<Context, Type, S>, &'b Elim::Coal: Typed<Context, Type, S>, &'b Elim::Cobalt: Typed<Context, Type, S>, &'b Elim::Copper: Typed<Context, Type, S>, &'b Elim::Iron: Typed<Context, Type, S>, &'b Elim::Tin: Typed<Context, Type, S>, &'b Elim::Silver: Typed<Context, Type, S>, &'b Elim::Gold: Typed<Context, Type, S>, &'b Elim::Velorite: Typed<Context, Type, S>, &'b Elim::VeloriteFrag: Typed<Context, Type, S>, &'b Elim::Mud: Typed<Context, Type, S>, &'b Elim::Grave: Typed<Context, Type, S>, &'b Elim::Door: Typed<Context, Type, S>, &'b Elim::DoorDark: Typed<Context, Type, S>, &'b Elim::DoorWide: Typed<Context, Type, S>, &'b Elim::BoneKeyhole: Typed<Context, Type, S>, &'b Elim::BoneKeyDoor: Typed<Context, Type, S>, &'b Elim::Keyhole: Typed<Context, Type, S>, &'b Elim::KeyDoor: Typed<Context, Type, S>, &'b Elim::GlassKeyhole: Typed<Context, Type, S>, &'b Elim::KeyholeBars: Typed<Context, Type, S>, &'b Elim::HaniwaKeyDoor: Typed<Context, Type, S>, &'b Elim::HaniwaKeyhole: Typed<Context, Type, S>, &'b Elim::TerracottaKeyDoor: Typed<Context, Type, S>, &'b Elim::TerracottaKeyhole: Typed<Context, Type, S>, &'b Elim::SahaginKeyhole: Typed<Context, Type, S>, &'b Elim::SahaginKeyDoor: Typed<Context, Type, S>, &'b Elim::VampireKeyDoor: Typed<Context, Type, S>, &'b Elim::VampireKeyhole: Typed<Context, Type, S>, &'b Elim::MyrmidonKeyDoor: Typed<Context, Type, S>, &'b Elim::MyrmidonKeyhole: Typed<Context, Type, S>, &'b Elim::MinotaurKeyhole: Typed<Context, Type, S>, &'b Elim::Window1: Typed<Context, Type, S>, &'b Elim::Window2: Typed<Context, Type, S>, &'b Elim::Window3: Typed<Context, Type, S>, &'b Elim::Window4: Typed<Context, Type, S>, &'b Elim::WitchWindow: Typed<Context, Type, S>, &'b Elim::WindowArabic: Typed<Context, Type, S>, &'b Elim::GlassBarrier: Typed<Context, Type, S>, &'b Elim::SeaDecorBlock: Typed<Context, Type, S>, &'b Elim::CliffDecorBlock: Typed<Context, Type, S>, &'b Elim::MagicalBarrier: Typed<Context, Type, S>, &'b Elim::OneWayWall: Typed<Context, Type, S>, &'b Elim::SeaDecorWindowHor: Typed<Context, Type, S>, &'b Elim::SeaDecorWindowVer: Typed<Context, Type, S>, &'b Elim::DropGate: Typed<Context, Type, S>, &'b Elim::DropGateBottom: Typed<Context, Type, S>, &'b Elim::WoodBarricades: Typed<Context, Type, S>, &'b Elim::Rope: Typed<Context, Type, S>, &'b Elim::SeaDecorChain: Typed<Context, Type, S>, &'b Elim::IronSpike: Typed<Context, Type, S>, &'b Elim::DoorBars: Typed<Context, Type, S>, &'b Elim::HaniwaTrap: Typed<Context, Type, S>, &'b Elim::HaniwaTrapTriggered: Typed<Context, Type, S>, &'b Elim::TerracottaStatue: Typed<Context, Type, S>, &'b Elim::TerracottaBlock: Typed<Context, Type, S>, &'b Elim::MetalChain: Typed<Context, Type, S>, &'b Elim::Bones: Typed<Context, Type, S>, &'b Elim::IceCrystal: Typed<Context, Type, S>, &'b Elim::GlowIceCrystal: Typed<Context, Type, S>, &'b Elim::CrystalHigh: Typed<Context, Type, S>, &'b Elim::CrystalLow: Typed<Context, Type, S>, &'b Elim::UnderwaterVent: Typed<Context, Type, S>, &'b Elim::SeaUrchin: Typed<Context, Type, S>, &'b Elim::IceSpike: Typed<Context, Type, S>, &'b Elim::Orb: Typed<Context, Type, S>, &'b Elim::EnsnaringWeb: Typed<Context, Type, S>, &'b Elim::DiamondLight: Typed<Context, Type, S>, &'b Elim::Gravestone: Typed<Context, Type, S>, &'b Elim::Melon: Typed<Context, Type, S>, &'b Elim::ForgeTools: Typed<Context, Type, S>, &'b Elim::JugAndBowlArabic: Typed<Context, Type, S>, &'b Elim::JugArabic: Typed<Context, Type, S>, &'b Elim::DecorSetArabic: Typed<Context, Type, S>, &'b Elim::SepareArabic: Typed<Context, Type, S>, &'b Elim::Candle: Typed<Context, Type, S>, &'b Elim::SmithingTable: Typed<Context, Type, S>, &'b Elim::Forge0: Typed<Context, Type, S>, &'b Elim::GearWheel0: Typed<Context, Type, S>, &'b Elim::Quench0: Typed<Context, Type, S>, &'b Elim::SeaDecorEmblem: Typed<Context, Type, S>, &'b Elim::SeaDecorPillar: Typed<Context, Type, S>, &'b Elim::MagicalSeal: Typed<Context, Type, S>, &'b Elim::JugAndCupsCoastal: Typed<Context, Type, S>, &'b Elim::Lantern: Typed<Context, Type, S>, &'b Elim::StreetLamp: Typed<Context, Type, S>, &'b Elim::StreetLampTall: Typed<Context, Type, S>, &'b Elim::SeashellLantern: Typed<Context, Type, S>, &'b Elim::FireBowlGround: Typed<Context, Type, S>, &'b Elim::MesaLantern: Typed<Context, Type, S>, &'b Elim::LanternpostWoodLantern: Typed<Context, Type, S>, &'b Elim::LampMetalShinglesRed: Typed<Context, Type, S>, &'b Elim::LampTerracotta: Typed<Context, Type, S>, &'b Elim::LampMetalShinglesCyan: Typed<Context, Type, S>, &'b Elim::LanternAirshipWallBlackS: Typed<Context, Type, S>, &'b Elim::LanternAirshipWallBrownS: Typed<Context, Type, S>, &'b Elim::LanternAirshipWallChestnutS: Typed<Context, Type, S>, &'b Elim::LanternAirshipWallRedS: Typed<Context, Type, S>, &'b Elim::LanternAirshipGroundBlackS: Typed<Context, Type, S>, &'b Elim::LanternAirshipGroundBrownS: Typed<Context, Type, S>, &'b Elim::LanternAirshipGroundChestnutS: Typed<Context, Type, S>, &'b Elim::LanternAirshipGroundRedS: Typed<Context, Type, S>, &'b Elim::Chest: Typed<Context, Type, S>, &'b Elim::DungeonChest0: Typed<Context, Type, S>, &'b Elim::DungeonChest1: Typed<Context, Type, S>, &'b Elim::DungeonChest2: Typed<Context, Type, S>, &'b Elim::DungeonChest3: Typed<Context, Type, S>, &'b Elim::DungeonChest4: Typed<Context, Type, S>, &'b Elim::DungeonChest5: Typed<Context, Type, S>, &'b Elim::CoralChest: Typed<Context, Type, S>, &'b Elim::HaniwaUrn: Typed<Context, Type, S>, &'b Elim::TerracottaChest: Typed<Context, Type, S>, &'b Elim::SahaginChest: Typed<Context, Type, S>, &'b Elim::CommonLockedChest: Typed<Context, Type, S>, &'b Elim::ChestBuried: Typed<Context, Type, S>, &'b Elim::Crate: Typed<Context, Type, S>, &'b Elim::Barrel: Typed<Context, Type, S>, &'b Elim::CrateBlock: Typed<Context, Type, S>, &'b Elim::Fence: Typed<Context, Type, S>,

Source§

fn reduce(self, ((head), context): ((&'a SpriteKind,), Context)) -> (Type, S)

Source§

impl<'a, 'b, Elim: PackedElim, Context, Type, S> Typed<((&'a StructureBlock,), Context), Type, S> for &'b ElimCase<Cases<Elim>>
where &'b Elim::None: Typed<Context, Type, S>, &'b Elim::Grass: Typed<Context, Type, S>, &'b Elim::TemperateLeaves: Typed<Context, Type, S>, &'b Elim::PineLeaves: Typed<Context, Type, S>, &'b Elim::Acacia: Typed<Context, Type, S>, &'b Elim::Mangrove: Typed<Context, Type, S>, &'b Elim::PalmLeavesInner: Typed<Context, Type, S>, &'b Elim::PalmLeavesOuter: Typed<Context, Type, S>, &'b Elim::Water: Typed<Context, Type, S>, &'b Elim::GreenSludge: Typed<Context, Type, S>, &'b Elim::Fruit: Typed<Context, Type, S>, &'b Elim::Coconut: Typed<Context, Type, S>, &'b Elim::MaybeChest: Typed<Context, Type, S>, &'b Elim::Hollow: Typed<Context, Type, S>, &'b Elim::Liana: Typed<Context, Type, S>, &'b Elim::Normal: Typed<((&'a Rgb<u8>,), Context), Type, S>, &'b Elim::Log: Typed<Context, Type, S>, &'b Elim::Filled: Typed<((&'a BlockKind, &'a Rgb<u8>), Context), Type, S>, &'b Elim::Sprite: Typed<((&'a StructureSprite,), Context), Type, S>, &'b Elim::Chestnut: Typed<Context, Type, S>, &'b Elim::Baobab: Typed<Context, Type, S>, &'b Elim::BirchWood: Typed<Context, Type, S>, &'b Elim::FrostpineLeaves: Typed<Context, Type, S>, &'b Elim::EntitySpawner: Typed<((&'a String, &'a f32), Context), Type, S>, &'b Elim::Keyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::BoneKeyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::GlassKeyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::Sign: Typed<((&'a Content, &'a u8), Context), Type, S>, &'b Elim::KeyholeBars: Typed<((&'a String,), Context), Type, S>, &'b Elim::HaniwaKeyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::TerracottaKeyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::SahaginKeyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::VampireKeyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::MyrmidonKeyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::MinotaurKeyhole: Typed<((&'a String,), Context), Type, S>, &'b Elim::MapleLeaves: Typed<Context, Type, S>, &'b Elim::CherryLeaves: Typed<Context, Type, S>, &'b Elim::AutumnLeaves: Typed<Context, Type, S>, &'b Elim::RedwoodWood: Typed<Context, Type, S>, &'b Elim::SpriteWithCfg: Typed<((&'a SpriteKind, &'a SpriteCfg), Context), Type, S>,

Source§

fn reduce( self, ((head), context): ((&'a StructureBlock,), Context), ) -> (Type, S)

Auto Trait Implementations§

§

impl<Cases> Freeze for ElimCase<Cases>
where Cases: Freeze,

§

impl<Cases> RefUnwindSafe for ElimCase<Cases>
where Cases: RefUnwindSafe,

§

impl<Cases> Send for ElimCase<Cases>
where Cases: Send,

§

impl<Cases> Sync for ElimCase<Cases>
where Cases: Sync,

§

impl<Cases> Unpin for ElimCase<Cases>
where Cases: Unpin,

§

impl<Cases> UnwindSafe for ElimCase<Cases>
where Cases: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Context> SubContext<Context> for Context

Source§

fn sub_context(self) -> Context

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Event for T
where T: Send + Sync + 'static,

§

impl<T> Resource for T
where T: Any + Send + Sync,

§

impl<T> Storable for T
where T: Send + Sync + 'static,