1#[cfg(feature = "chumsky")]
4use chumsky::{prelude::Simple, Parser};
5
6#[derive(Debug, Clone, Hash, PartialEq, Eq, strum::FromRepr, strum::EnumIs)]
10#[repr(i8)]
11pub enum PathfindingType {
12 Other = -1,
14 LegacyLinkset = 0,
16 Avatar = 1,
18 Character = 2,
20 Walkable = 3,
22 StaticObstacle = 4,
24 MaterialVolume = 5,
26 ExclusionVolume = 6,
28}
29
30#[cfg(feature = "chumsky")]
37#[must_use]
38pub fn int_as_pathfinding_type_parser() -> impl Parser<char, PathfindingType, Error = Simple<char>>
39{
40 crate::utils::i8_parser().try_map(|repr, span| {
41 crate::pathfinding::PathfindingType::from_repr(repr).ok_or(Simple::custom(
42 span,
43 "Could not convert parsed pathfinding type i8 into PathfindingType enum",
44 ))
45 })
46}