diff --git a/CHANGELOG.md b/CHANGELOG.md index fdb2ec9..f0255ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Unreleased +- Rename plural methods + - src/actor.rs set_streams -> set_stream, add_streams -> add_stream + - src/collections.rs set_items -> set_item, add_items -> add_item + - src/object.rs set_replies -> set_reply, add_replies -> add_reply # 0.7.0-alpha.3 - Add `.into_parts()` for some types where it makes sense diff --git a/src/actor.rs b/src/actor.rs index f7eeef8..0f49e19 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -581,7 +581,7 @@ pub trait ApActorExt: AsApActor { /// # let mut person = ApActor::new(context(), Person::new()); /// use activitystreams::prelude::*; /// - /// person.set_streams(uri!("https://example.com/liked")); + /// person.set_stream(uri!("https://example.com/liked")); /// # Ok(()) /// # } /// ``` @@ -632,7 +632,7 @@ pub trait ApActorExt: AsApActor { /// # fn main() -> Result<(), anyhow::Error> { /// # use activitystreams::{actor::{ApActor, Person}, context}; /// # let mut person = ApActor::new(context(), Person::new()); - /// # person.set_id(context()).add_streams(context()).add_streams(context()); + /// # person.set_id(context()).add_stream(context()).add_stream(context()); /// use activitystreams::prelude::*; /// /// if let Some(streams) = person.streams()? { @@ -719,11 +719,11 @@ pub trait ApActorExt: AsApActor { /// # let mut person = ApActor::new(context(), Person::new()); /// use activitystreams::prelude::*; /// - /// person.set_streams(uri!("https://example.com/streams")); + /// person.set_stream(uri!("https://example.com/streams")); /// # Ok(()) /// # } /// ``` - fn set_streams(&mut self, streams: Url) -> &mut Self { + fn set_stream(&mut self, streams: Url) -> &mut Self { self.ap_actor_mut().streams = Some(streams.into()); self } @@ -762,12 +762,12 @@ pub trait ApActorExt: AsApActor { /// use activitystreams::prelude::*; /// /// person - /// .add_streams(uri!("https://example.com/streams1")) - /// .add_streams(uri!("https://example.com/streams2")); + /// .add_stream(uri!("https://example.com/streams1")) + /// .add_stream(uri!("https://example.com/streams2")); /// # Ok(()) /// # } /// ``` - fn add_streams(&mut self, stream: Url) -> &mut Self { + fn add_stream(&mut self, stream: Url) -> &mut Self { let v = match self.ap_actor_mut().streams.take() { Some(mut v) => { v.add(stream); @@ -800,7 +800,7 @@ pub trait ApActorExt: AsApActor { /// # fn main() -> Result<(), anyhow::Error> { /// # use activitystreams::{actor::{ApActor, Person}, context, uri}; /// # let mut person = ApActor::new(context(), Person::new()); - /// # person.set_streams(uri!("https://example.com/streams")); + /// # person.set_stream(uri!("https://example.com/streams")); /// use activitystreams::prelude::*; /// /// assert!(person.streams_unchecked().is_some()); diff --git a/src/collection.rs b/src/collection.rs index 46f5c55..6511d12 100644 --- a/src/collection.rs +++ b/src/collection.rs @@ -12,7 +12,7 @@ //! let mut collection = OrderedCollection::new(); //! //! collection -//! .set_items(uri!("https://example.com/notes/1234")) +//! .set_item(uri!("https://example.com/notes/1234")) //! .set_total_items(1u64) //! .set_current(uri!("https://example.com/notes/1234")) //! .set_first(uri!("https://example.com/notes/1234")) @@ -107,11 +107,11 @@ pub trait CollectionExt: AsCollection { /// # use activitystreams::{collection::UnorderedCollection, uri}; /// # let mut collection = UnorderedCollection::new(); /// - /// collection.set_items(uri!("https://example.com")); + /// collection.set_item(uri!("https://example.com")); /// # Ok(()) /// # } /// ``` - fn set_items(&mut self, item: T) -> &mut Self + fn set_item(&mut self, item: T) -> &mut Self where T: Into, { @@ -157,12 +157,12 @@ pub trait CollectionExt: AsCollection { /// # let mut collection = UnorderedCollection::new(); /// /// collection - /// .add_items(uri!("https://example.com/one")) - /// .add_items(uri!("https://example.com/two")); + /// .add_item(uri!("https://example.com/one")) + /// .add_item(uri!("https://example.com/two")); /// # Ok(()) /// # } /// ``` - fn add_items(&mut self, item: T) -> &mut Self + fn add_item(&mut self, item: T) -> &mut Self where T: Into, { @@ -196,7 +196,7 @@ pub trait CollectionExt: AsCollection { /// ```rust /// # use activitystreams::{context, collection::UnorderedCollection}; /// # let mut collection = UnorderedCollection::new(); - /// # collection.set_items(context()); + /// # collection.set_item(context()); /// use activitystreams::prelude::*; /// /// assert!(collection.items().is_some()); diff --git a/src/object.rs b/src/object.rs index 9831e16..76cedd4 100644 --- a/src/object.rs +++ b/src/object.rs @@ -2147,11 +2147,11 @@ pub trait ObjectExt: AsObject { /// # use activitystreams::{object::Video, uri}; /// # let mut video = Video::new(); /// - /// video.set_replies(uri!("https://example.com")); + /// video.set_reply(uri!("https://example.com")); /// # Ok(()) /// # } /// ``` - fn set_replies(&mut self, replies: T) -> &mut Self + fn set_reply(&mut self, replies: T) -> &mut Self where T: Into, { @@ -2197,12 +2197,12 @@ pub trait ObjectExt: AsObject { /// # let mut video = Video::new(); /// /// video - /// .add_replies(uri!("https://example.com/one")) - /// .add_replies(uri!("https://example.com/two")); + /// .add_reply(uri!("https://example.com/one")) + /// .add_reply(uri!("https://example.com/two")); /// # Ok(()) /// # } /// ``` - fn add_replies(&mut self, replies: T) -> &mut Self + fn add_reply(&mut self, replies: T) -> &mut Self where T: Into, { @@ -2239,7 +2239,7 @@ pub trait ObjectExt: AsObject { /// # fn main() -> Result<(), anyhow::Error> { /// # use activitystreams::{object::Video, uri}; /// # let mut video = Video::new(); - /// # video.set_replies(uri!("https://example.com")); + /// # video.set_reply(uri!("https://example.com")); /// # /// use activitystreams::prelude::*; ///