Skip to main content

reflectapi/
infallible.rs

1#[cfg(feature = "builder")]
2use crate::StatusCode;
3
4#[derive(
5    Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, serde::Deserialize, serde::Serialize,
6)]
7pub enum Infallible {}
8
9#[cfg(feature = "builder")]
10impl StatusCode for Infallible {
11    fn status_code(&self) -> http::StatusCode {
12        http::StatusCode::INTERNAL_SERVER_ERROR
13    }
14}
15
16impl std::fmt::Display for Infallible {
17    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18        write!(f, "internal error: not expected to fail")
19    }
20}
21
22impl crate::Input for Infallible {
23    fn reflectapi_input_type(schema: &mut crate::Typespace) -> crate::TypeReference {
24        crate::reflectapi_type_empty(
25            schema,
26            "reflectapi::Infallible",
27            "Error object which is expected to be never returned",
28        )
29    }
30}
31
32impl crate::Output for Infallible {
33    fn reflectapi_output_type(schema: &mut crate::Typespace) -> crate::TypeReference {
34        crate::reflectapi_type_empty(
35            schema,
36            "reflectapi::Infallible",
37            "Error object which is expected to be never returned",
38        )
39    }
40}