rpc_rs/router/
mod.rs

1//! The core router module.
2
3use serde::{Deserialize, Serialize};
4
5pub mod export;
6pub mod func;
7pub mod router;
8
9#[cfg(feature = "axum")]
10pub mod axum;
11
12#[cfg(feature = "tauri")]
13pub mod tauri;
14
15/// A request method.
16#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
17pub enum Method {
18    /// Create an object.
19    Create,
20
21    /// Read an object.
22    Read,
23
24    /// Update an object.
25    Update,
26
27    /// Delete an object.
28    Delete,
29
30    /// Only used when an error occurs.
31    Error,
32}
33
34impl Method {
35    /// Get this [`Method`] as a [`str`].
36    pub fn as_str(&self) -> &'static str {
37        match self {
38            Self::Create => "Create",
39            Self::Read => "Read",
40            Self::Update => "Update",
41            Self::Delete => "Delete",
42            Self::Error => "Error",
43        }
44    }
45}
46
47pub use router::Router;