Skip to content

Commit ec34576

Browse files
committed
doc: Added an example to the docs for how to use the types
1 parent 3463c9b commit ec34576

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/lib.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@
55
//! Since this library is used in the Sentry relay as well it depends on
66
//! `serde_json` with the `preserve_order` feature. As such all maps used
77
//! by the protocol are linked hash maps.
8+
//!
9+
//! Most of the types in this crate are serializable in one form or another.
10+
//! The types in the `protocol` module are generally really only serializable
11+
//! to JSON as other formats are not supported by Sentry at this date.
12+
//!
13+
//! ## Contents
14+
//!
15+
//! The crate provides a bunch of common types for working with Sentry as
16+
//! such (DSN, ProjectIDs, authentication headers) as well as types for
17+
//! the Sentry event protocol.
18+
//!
19+
//! Right now only `v7` of the protocol is implemented but it's versioned
20+
//! so later versions might be added later.
21+
//!
22+
//! ## API Concepts
23+
//!
24+
//! Most types are directly serializable or deserializable and try to implement
25+
//! the `Default` type. This means that objects can be created conviently
26+
//! and missing attributes can be filled in:
27+
//!
28+
//! ```rust
29+
//! use sentry_types::protocol::v7;
30+
//!
31+
//! let event = v7::Event {
32+
//! message: Some("Hello World!".to_string()),
33+
//! culprit: Some("foo in bar".to_string()),
34+
//! level: v7::Level::Info,
35+
//! ..Default::default()
36+
//! };
37+
//! ```
838
#![warn(missing_docs)]
939
extern crate chrono;
1040
extern crate failure;

0 commit comments

Comments
 (0)