rspc_legacy/
config.rs

1use std::path::PathBuf;
2
3/// TODO
4#[derive(Default)]
5pub struct Config {
6    pub(crate) export_bindings_on_build: Option<PathBuf>,
7    pub(crate) bindings_header: Option<&'static str>,
8}
9
10impl Config {
11    pub fn new() -> Self {
12        Default::default()
13    }
14
15    /// will export the bindings of the generated router to a folder every time the router is built.
16    /// Note: The bindings are only exported when `debug_assertions` are enabled (Rust is in debug mode).
17    pub fn export_ts_bindings<TPath>(mut self, export_path: TPath) -> Self
18    where
19        PathBuf: From<TPath>,
20    {
21        self.export_bindings_on_build = Some(PathBuf::from(export_path));
22        self
23    }
24
25    /// allows you to add a custom string to the top of the exported Typescript bindings file.
26    /// This is useful if you want to disable ESLint or Prettier.
27    pub fn set_ts_bindings_header(mut self, custom: &'static str) -> Self {
28        self.bindings_header = Some(custom);
29        self
30    }
31}