Skip to main content

bast3st_eval/catchable/
mod.rs

1use serde::{Deserialize, Serialize};
2
3mod generated;
4
5/// See [`bast3st.catchable.err`](https://marcel-scherzinger.github.io/bast3st/ref_caterr.html#bast3st.catchable.err)
6#[allow(non_camel_case_types)]
7#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
8pub struct cerr(u32);
9
10impl std::fmt::Debug for cerr {
11    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12        bitflags::parser::to_writer(self, f)
13    }
14}
15
16impl Serialize for cerr {
17    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18    where
19        S: serde::Serializer,
20    {
21        bitflags::serde::serialize(self, serializer)
22    }
23}
24
25impl<'de> Deserialize<'de> for cerr {
26    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27    where
28        D: serde::Deserializer<'de>,
29    {
30        bitflags::serde::deserialize(deserializer)
31    }
32}
33
34/*
35#[serde(serialize_with = "path")]
36
37Serialize this field using a function that is different from its implementation of Serialize. The given function must be callable as fn<S>(&T, S) -> Result<S::Ok, S::Error> where S: Serializer, although it may also be generic over T. Fields used with serialize_with are not required to implement Serialize.
38#[serde(deserialize_with = "path")]
39
40Deserialize this field using a function that is different from its implementation of Deserialize. The given function must be callable as fn<'de, D>(D) -> Result<T, D::Error> where D: Deserializer<'de>, although it may also be generic over T. Fields used with deserialize_with are not required to implement Deserialize.
41
42 * */