Skip to main content

sl_types/
radar.rs

1//! Types related to SL nearby avatar radar and enter/leave messages
2
3#[cfg(feature = "chumsky")]
4use chumsky::{Parser, prelude::just};
5
6/// represents a Second Life area of significance
7#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, strum::EnumIs)]
8pub enum Area {
9    /// chat range
10    ChatRange,
11    /// draw distance
12    DrawDistance,
13    /// region
14    Region,
15}
16
17/// parse a SecondLifeArea
18///
19/// # Errors
20///
21/// returns and error if the string could not be parsed
22#[cfg(feature = "chumsky")]
23#[must_use]
24pub fn area_parser<'src>()
25-> impl Parser<'src, &'src str, Area, chumsky::extra::Err<chumsky::error::Rich<'src, char>>> {
26    just("chat range")
27        .to(Area::ChatRange)
28        .or(just("draw distance").to(Area::DrawDistance))
29        .or(just("region").to(Area::Region))
30        .or(just("the region").to(Area::Region))
31}