don't
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

style(atproto): rename module `serde::cowdid` -> `serde::cow_did`

Also improve the documentation

Signed-off-by: tjh <x@tjh.dev>

tjh 835b1660 5774be8e

+22 -18
+3 -3
crates/atproto/src/did.rs
··· 551 551 552 552 #[derive(serde::Deserialize, serde::Serialize)] 553 553 struct Test<'a> { 554 - #[serde(borrow, with = "crate::serde::cowdid")] 554 + #[serde(borrow, with = "crate::serde::cow_did")] 555 555 did: Cow<'a, Did>, 556 556 } 557 557 ··· 574 574 575 575 #[derive(serde::Deserialize, serde::Serialize)] 576 576 struct Test<'a> { 577 - #[serde(borrow, with = "crate::serde::cowdid")] 577 + #[serde(borrow, with = "crate::serde::cow_did")] 578 578 did: Cow<'a, Did>, 579 579 } 580 580 ··· 599 599 600 600 #[derive(serde::Deserialize, serde::Serialize)] 601 601 struct Test<'a> { 602 - #[serde(borrow, with = "crate::serde::cowdid")] 602 + #[serde(borrow, with = "crate::serde::cow_did")] 603 603 did: Cow<'a, Did>, 604 604 } 605 605
+19 -15
crates/atproto/src/serde.rs
··· 1 - /// Helper module to correctly serialize and deserialize a `Cow<'_, Did>` with serde. 2 - /// 3 - /// # Example 4 - /// 5 - /// ```rust,no_run 6 - /// use atproto::Did; 7 - /// 8 - /// #[derive(Debug, serde::Deserialize, serde::Serialize)] 9 - /// struct SomeStruct<'a> { 10 - /// #[serde(borrow, with = "atproto::serde::cowdid")] 11 - /// did: Cow<'a, Did>, 12 - /// } 13 - /// ``` 14 - /// 15 - pub mod cowdid { 1 + pub mod cow_did { 2 + //! Correctly deserialize a `Cow<'_, Did>` with serde. 3 + //! 4 + //! Use this module in combination with serde's [`#[with]`][with] attribute. 5 + //! 6 + //! # Example 7 + //! 8 + //! ```rust,no_run 9 + //! use std::borrow::Cow; 10 + //! 11 + //! #[derive(Debug, serde::Deserialize, serde::Serialize)] 12 + //! struct SomeStruct<'a> { 13 + //! #[serde(borrow, with = "atproto::serde::cow_did")] 14 + //! did: Cow<'a, atproto::Did>, 15 + //! } 16 + //! ``` 17 + //! 18 + //! [with]: https://serde.rs/field-attrs.html#with 19 + //! 16 20 use std::borrow::Cow; 17 21 18 22 use serde::{Deserializer, Serializer};