mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-17 15:53:13 +00:00
fdfed3d7db
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
15 lines
282 B
Rust
15 lines
282 B
Rust
pub use serde_json::*;
|
|
|
|
pub trait ToJson {
|
|
fn to_json(&self) -> Value;
|
|
}
|
|
|
|
impl<T: ToJson> ToJson for Option<T> {
|
|
fn to_json(&self) -> Value {
|
|
if let Some(value) = self.as_ref() {
|
|
value.to_json()
|
|
} else {
|
|
json!(null)
|
|
}
|
|
}
|
|
}
|