diff --git a/src/lib.rs b/src/lib.rs index 1b069312..16dcc3b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,13 +74,17 @@ //! //! All concrete event types in ruma-events can be serialized via the `Serialize` trait from //! [serde](https://serde.rs/) and can be deserialized from a `&str` of JSON data via the `FromStr` -//! trait from the standard library. In order to handle incoming data that may not conform to +//! trait from the standard library. (`TryFrom<&str>` is also implemented and can be used in place +//! of `FromStr` if preferred.) In order to handle incoming data that may not conform to //! ruma-events's strict definitions of event structures, deserializing from JSON will return an //! `InvalidEvent` on error. This error covers both invalid JSON data as well as valid JSON that -//! doesn't match the structure expected by ruma-events's event types. In the latter case, the -//! error exposes the deserialized `serde_json::Value` so that developers can still work with the -//! received event data. This also makes it possible to deserialize a collection of events without -//! the entire collection failing to deserialize due to a single invalid event. +//! doesn't match the structure expected by ruma-events's event types. In the latter case, the error +//! exposes the deserialized `serde_json::Value` so that developers can still work with the received +//! event data. This also makes it possible to deserialize a collection of events without the entire +//! collection failing to deserialize due to a single invalid event. The "content" type for each +//! event also implements `Serialize` and either `FromStr` (for dedicated content types) or +//! `Deserialize` (when the content is a type alias), allowing content to be converted to and from +//! JSON indepedently of the surrounding event structure, if needed. //! //! # Collections //!