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
41
42
43
//! Serialization support
//!
//! This module provides serialization support for Falco events in the form of an [`Event`]
//! wrapper struct. A reference to any [`falco_event::events::Event`] can be converted into this
//! struct, which implements [`serde::Serialize`].
use Serialize;
/// A wrapper struct for Falco events that implements `Serialize`.
///
/// # Example
/// ```ignore
/// // Take an arbitrary Falco event
/// let event: falco_event_schema::events::Event<falco_event_schema::events::types::AnyEvent> = todo!();
///
/// // Wrap a reference to it for serialization
/// let serializable_event = falco_event_serde::ser::Event::from(&event);
///
/// // Serialize the event to a JSON string
/// let json = serde_json::to_string(&serializable_event).unwrap();
/// ```