Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Varlakov <[email protected]>
  • Loading branch information
survived committed Aug 22, 2024
1 parent 14a58eb commit 18d760f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 7 additions & 7 deletions udigest/src/as_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
//!
//! It's supposed to be used in a pair with derive proc macro and `as` attribute.
//! For instance, it can be used to digest a hash map "as a btree map":
//! ```rust
//! #[derive(udigest::Digestable)]
//! pub struct Attributes(
//! #[udigest(as = std::collections::BTreeMap<_, udigest::Bytes>)]
//! std::collections::HashMap<String, Vec<u8>>,
//! );
//! ```
//! ```rust
//! #[derive(udigest::Digestable)]
//! pub struct Attributes(
//! #[udigest(as = std::collections::BTreeMap<_, udigest::Bytes>)]
//! std::collections::HashMap<String, Vec<u8>>,
//! );
//! ```
//!
//! See more examples in [macro@Digestable] macro docs.
Expand Down
4 changes: 3 additions & 1 deletion udigest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ pub use encoding::Buffer;
/// ```
///
/// When structure is digested, the hash map is converted into btree map. `_` in `BTreeMap<_, udigest::Bytes>`
/// says that the key should be kept as it is: `String` string will be digested.
/// says that the key should be kept as it is: `String` string will be digested. The macro
/// replaces underscores (also called "infer types") with [`udigest::as_::Same`], which
/// indicates that the same digestion rules should be used as for the original type.
/// `udigest::Bytes` indicates that the value `Vec<u8>` should be digested as bytes, not as
/// list of u8 which would be a default behavior.
///
Expand Down

0 comments on commit 18d760f

Please sign in to comment.