fetsig/
lib.rs

1#[cfg(feature = "browser")]
2mod browser;
3#[cfg(feature = "browser")]
4pub use browser::*;
5
6mod interface;
7pub use interface::*;
8
9pub use futures_signals_ext::*;
10use smol_str::SmolStrBuilder;
11
12use ufmt::uWrite;
13
14#[macro_export]
15macro_rules! uformat_smolstr {
16    ($($arg:tt)*) => {{
17        use {ufmt, smol_str};
18        let mut builder = $crate::Ufmtf(smol_str::SmolStrBuilder::new());
19        ufmt::uwrite!(&mut builder, $($arg)*).unwrap();
20        builder.0.finish()
21    }}
22}
23
24pub struct Ufmtf(pub SmolStrBuilder);
25
26impl uWrite for Ufmtf {
27    type Error = ();
28
29    fn write_str(&mut self, s: &str) -> Result<(), ()> {
30        self.0.push_str(s);
31        Ok(())
32    }
33}
34
35#[cfg(all(feature = "browser", not(feature = "json"), not(feature = "postcard")))]
36compile_error!(
37    "No serialization feature present, select at least one of 'json' or 'postcard' features."
38);