Skip to content

Commit

Permalink
update(docs): mention serde support
Browse files Browse the repository at this point in the history
Signed-off-by: Grzegorz Nosek <[email protected]>
  • Loading branch information
gnosek authored and poiana committed Oct 21, 2024
1 parent adb0d9d commit 690f19b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions falco_event/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,16 @@ you're not interested in.

There is a trait ([events::EventToBytes]) that writes a serialized form of an event to a writer
(i.e. a type that implements [std::io::Write], for example `Vec<u8>`).

## Serialization and deserialization with [`serde`]

Once you enable the `serde` feature of this crate, the following types gain serialization and deserialization
support:

* all the `PT_*` field types (many are Rust stdlib built-ins and support (de)serialization regardless)
* all the [`event::types`] events (see the module documentation for details regarding owned/borrowed types)
* `Event<AnyEvent>` (but *not* other `Event<T>` types, to avoid ambiguous serialization results and subsequent
deserialization issues)

**Note**: you can serialize an event wrapping either the [borrowed](`event::types::AnyEvent`) or
[owned](`event::types::owned::AnyEvent`) variant of `AnyEvent`, but can only deserialize to the owned variant.

0 comments on commit 690f19b

Please sign in to comment.