1#[cfg(feature = "chumsky")]
4use chumsky::Parser;
5
6#[derive(Debug, Clone, Hash, PartialEq, Eq, strum::FromRepr, strum::EnumIs)]
10#[repr(i8)]
11#[expect(
12 clippy::module_name_repetitions,
13 reason = "the type is used outside this module"
14)]
15pub enum PathfindingType {
16 Other = -1,
18 LegacyLinkset = 0,
20 Avatar = 1,
22 Character = 2,
24 Walkable = 3,
26 StaticObstacle = 4,
28 MaterialVolume = 5,
30 ExclusionVolume = 6,
32}
33
34#[cfg(feature = "chumsky")]
41#[must_use]
42pub fn int_as_pathfinding_type_parser<'src>()
43-> impl Parser<'src, &'src str, PathfindingType, chumsky::extra::Err<chumsky::error::Rich<'src, char>>>
44{
45 crate::utils::i8_parser().try_map(|repr, span| {
46 crate::pathfinding::PathfindingType::from_repr(repr).ok_or_else(|| {
47 chumsky::error::Rich::custom(
48 span,
49 "Could not convert parsed pathfinding type i8 into PathfindingType enum",
50 )
51 })
52 })
53}