1#[cfg(feature = "chumsky")]
4use chumsky::Parser;
5
6#[derive(
10 Debug,
11 Clone,
12 Hash,
13 PartialEq,
14 Eq,
15 strum::FromRepr,
16 strum::EnumIs,
17 serde::Serialize,
18 serde::Deserialize,
19)]
20#[repr(i8)]
21#[expect(
22 clippy::module_name_repetitions,
23 reason = "the type is used outside this module"
24)]
25pub enum PathfindingType {
26 Other = -1,
28 LegacyLinkset = 0,
30 Avatar = 1,
32 Character = 2,
34 Walkable = 3,
36 StaticObstacle = 4,
38 MaterialVolume = 5,
40 ExclusionVolume = 6,
42}
43
44#[cfg(feature = "chumsky")]
51#[must_use]
52pub fn int_as_pathfinding_type_parser<'src>()
53-> impl Parser<'src, &'src str, PathfindingType, chumsky::extra::Err<chumsky::error::Rich<'src, char>>>
54{
55 crate::utils::i8_parser().try_map(|repr, span| {
56 crate::pathfinding::PathfindingType::from_repr(repr).ok_or_else(|| {
57 chumsky::error::Rich::custom(
58 span,
59 "Could not convert parsed pathfinding type i8 into PathfindingType enum",
60 )
61 })
62 })
63}