1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#![warn(missing_docs)]
#![cfg_attr(feature = "serde_derive", feature(proc_macro))]
#[cfg(feature = "serde_derive")]
#[macro_use]
extern crate serde_derive;
#[cfg(feature = "ssdp")]
extern crate ssdp;
extern crate serde;
extern crate serde_json;
extern crate hyper;
extern crate regex;
#[macro_use]
extern crate lazy_static;
pub use bridge::{discover, Bridge};
pub use hue::LightCommand;
mod clean{
use regex::Regex;
lazy_static!{
static ref REMOVE_NULL: Regex = Regex::new(r#""\w*":null,?"#).unwrap();
static ref TRAILING_COMMA: Regex = Regex::new(r",\}").unwrap();
}
pub fn clean_json(s: String) -> String{
let cleaned = REMOVE_NULL.replace_all(&s, "");
TRAILING_COMMA.replace_all(&cleaned, "}")
}
}
pub mod errors;
pub mod bridge;
pub mod hue;