diff --git a/.pubnub.yml b/.pubnub.yml index 3c2d589e..009a3b5b 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,9 +1,18 @@ name: rust -version: 0.2.0 +version: 0.2.1 schema: 1 scm: github.com/pubnub/rust files: [] changelog: + - date: 2023-06-07 + version: 0.2.1 + changes: + - type: bug + text: "Fixed versions in the docs." + - type: bug + text: "Fixed broken links for `docs.rs` page." + - type: bug + text: "Fixed logo image." - date: 2023-06-05 version: 0.2.0 changes: diff --git a/Cargo.toml b/Cargo.toml index fca9b836..d12e1dd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pubnub" -version = "0.2.0" +version = "0.2.1" edition = "2021" license = "MIT" authors = ["PubNub "] diff --git a/README.md b/README.md index 31b5dd2b..fe8d2687 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
-![PubNub](https://raw.githubusercontent.com/pubnub/rust/phoenix/logo.svg) +![PubNub](https://raw.githubusercontent.com/pubnub/rust/master/logo.svg) ![Tests](https://github.com/pubnub/rust/actions/workflows/run-tests.yml/badge.svg) ![Validations](https://github.com/pubnub/rust/actions/workflows/run-validations.yml/badge.svg) @@ -35,11 +35,11 @@ Add `pubnub` to your Rust project in the `Cargo.toml` file: ```toml # default features [dependencies] -pubnub = "0.2.0" +pubnub = "0.2.1" # all features [dependencies] -pubnub = { version = "0.2.0", features = ["full"] } +pubnub = { version = "0.2.1", features = ["full"] } ``` ### Example @@ -74,7 +74,7 @@ async fn main() -> Result<(), Box> { } ``` -You can find more examples in our [examples](examples/) directory! +You can find more examples in our [examples](https://github.com/pubnub/rust/tree/master/examples) directory! ## Features @@ -83,11 +83,11 @@ The `pubnub` crate is split into multiple features. You can enable or disable th ```toml # only blocking and access + default features [dependencies] -pubnub = { version = "0.2.0", features = ["blocking", "access"] } +pubnub = { version = "0.2.1", features = ["blocking", "access"] } # only parse_token + default features [dependencies] -pubnub = { version = "0.2.0", features = ["parse_token"] } +pubnub = { version = "0.2.1", features = ["parse_token"] } ``` ### Available features @@ -121,7 +121,7 @@ features and enable the ones you need, for example: ```toml [dependencies] -pubnub = { version = "0.2.0", default-features = false, features = ["serde", "publish", +pubnub = { version = "0.2.1", default-features = false, features = ["serde", "publish", "blocking"] } ``` @@ -151,7 +151,7 @@ See more: If you're having problems compiling this crate for more exotic targets, you can try to use the `extra_platforms` feature. Be aware that this feature is **not supported** and we do not recommend using it. -For more information about this feature. refer to [Cargo.toml](Cargo.toml) in the `[features]` section. +For more information about this feature. refer to [Cargo.toml](https://github.com/pubnub/rust/blob/master/Cargo.toml) in the `[features]` section. ## Support @@ -159,7 +159,4 @@ If you **need help** or have a **general question**, contact support@pubnub.com. ## License -This project is licensed under the [MIT license]. - -[MIT license]: https://github.com/pubnub/LICENSE/blob/master/LICENSE - +This project is licensed under the [MIT license](https://github.com/pubnub/rust/blob/master/LICENSE). diff --git a/src/core/deserializer.rs b/src/core/deserializer.rs index 011565be..bce16806 100644 --- a/src/core/deserializer.rs +++ b/src/core/deserializer.rs @@ -17,7 +17,8 @@ use super::PubNubError; /// trait over the [`dx`] selected by you in the Cargo.toml file. /// /// Features and their results: -/// - `publish` - [`PublishResponse`] +/// - `publish` - [`PublishResponseBody`] +/// - `access` - [`GrantTokenResponseBody`] and [`RevokeTokenResponseBody`] /// /// More information about the response of the PubNub API can be found in the /// [PubNub API Reference](https://www.pubnub.com/docs). @@ -38,7 +39,9 @@ use super::PubNubError; /// ``` /// /// [`dx`]: ../dx/index.html -/// [`PublishResponse`]: ../publish/struct.PublishResponse.html +/// [`PublishResponseBody`]: ../../dx/publish/result/enum.PublishResponseBody.html +/// [`GrantTokenResponseBody`]: ../../dx/access/result/enum.GrantTokenResponseBody.html +/// [`RevokeTokenResponseBody`]: ../../dx/access/result/enum.RevokeTokenResponseBody.html pub trait Deserializer<'de, T> { /// Deserialize a `&[u8]` into a `Result`. /// diff --git a/src/dx/access/builders/grant_token.rs b/src/dx/access/builders/grant_token.rs index f3efddb6..9064e157 100644 --- a/src/dx/access/builders/grant_token.rs +++ b/src/dx/access/builders/grant_token.rs @@ -24,6 +24,7 @@ use derive_builder::Builder; /// The [`grant_token`] method is used to generate access token. /// /// [`PubNub`]:https://www.pubnub.com/ +/// [`PubNubClient`]: crate::PubNubClient #[derive(Builder)] #[builder( pattern = "owned", diff --git a/src/dx/access/builders/revoke.rs b/src/dx/access/builders/revoke.rs index eff973ea..6165a36a 100644 --- a/src/dx/access/builders/revoke.rs +++ b/src/dx/access/builders/revoke.rs @@ -31,6 +31,7 @@ use derive_builder::Builder; /// /// [`PubNub`]:https://www.pubnub.com/ /// [`revoke_token`]: crate::dx::PubNubClient::revoke_token +/// [`PubNubClient`]: crate::PubNubClient pub struct RevokeTokenRequest where D: for<'de> Deserializer<'de, RevokeTokenResponseBody>, diff --git a/src/dx/publish/builders.rs b/src/dx/publish/builders.rs index e371215f..41a0e31d 100644 --- a/src/dx/publish/builders.rs +++ b/src/dx/publish/builders.rs @@ -43,7 +43,6 @@ use derive_builder::Builder; /// # } /// ``` /// -/// [`PublishMessageBuilder`]: crate::dx::publish::PublishMessageBuilder] /// [`publish_message`]: crate::dx::PubNubClient::publish_message` /// [`PubNubClient`]: crate::dx::PubNubClient /// [`PubNub`]:https://www.pubnub.com/ @@ -145,7 +144,6 @@ where /// [`PublishMessageDeserializer`]: crate::dx::publish::PublishMessageDeserializer /// [`publish_message`]: crate::dx::PubNubClient::publish_message` /// [`PubNubClient`]: crate::dx::PubNubClient -/// [`PublishMessageBuilder`]: crate::dx::publish::PublishMessageBuilder /// [`Deserializer`]: crate::core::Deserializer #[cfg(not(feature = "serde"))] pub struct PublishMessageDeserializerBuilder @@ -214,7 +212,6 @@ where /// # } /// ``` /// -/// [`PublishMessageViaChannelBuilder`]: struct.PublishMessageViaChannelBuilder /// [`publish_message`]: crate::dx::PubNubClient::publish_message /// [`PubNub`]:https://www.pubnub.com/ /// [`PubNubClient`]: crate::dx::PubNubClient diff --git a/src/dx/publish/mod.rs b/src/dx/publish/mod.rs index 94c2cdab..24b9c6e2 100644 --- a/src/dx/publish/mod.rs +++ b/src/dx/publish/mod.rs @@ -71,7 +71,7 @@ impl PubNubClientInstance { /// # } /// ``` /// - /// [`PublishMessageBuilder`]: crate::dx::publish::PublishMessageBuilder] + /// [`PublishMessageBuilder`]: crate::dx::publish::PublishMessageBuilder pub fn publish_message(&self, message: M) -> PublishMessageBuilder where M: Serialize, diff --git a/src/dx/pubnub_client.rs b/src/dx/pubnub_client.rs index 1c8ef2da..4b0fcd9e 100644 --- a/src/dx/pubnub_client.rs +++ b/src/dx/pubnub_client.rs @@ -4,7 +4,6 @@ //! It's used to send requests to [`PubNub API`]. //! It's intended to be used by the [`pubnub`] crate. //! -//! [`PubNubClient`]: ./struct.PubNubClient.html] //! [`PubNub API`]: https://www.pubnub.com/docs //! [`pubnub`]: ../index.html @@ -28,9 +27,11 @@ use spin::Mutex; /// The client is transport-layer-agnostic, so you can use any transport layer /// that implements the [`Transport`] trait. /// -/// You can create clients using the [`PubNubClient::builder`] method. +/// You can create clients using the [`PubNubClient::with_transport`] /// You must provide a valid [`Keyset`] with pub/sub keys and a string User ID to identify the client. /// +/// To see available methods, please refer to the [`PubNubClientInstance`] documentation. +/// /// # Examples /// ``` /// use pubnub::{PubNubClientBuilder, Keyset}; @@ -94,13 +95,12 @@ use spin::Mutex; /// interior mutability for its internal state. /// /// # See also -/// [Keyset](struct.Keyset.html) -/// [Transport](../core/trait.Transport.html) +/// [`Keyset`] +/// [`Transport`] /// /// [`selected`]: ../index.html#features -/// [`Transport`]: ../core/trait.Transport.html /// [`Keyset`]: ../core/struct.Keyset.html -/// [`PubNubClient::builder`]: ./struct.PubNubClient.html#method.builder +/// [`PubNubClient::with_transport`]: struct.PubNubClientBuilder.html#method.with_transport`] pub type PubNubGenericClient = PubNubClientInstance>; /// PubNub client @@ -108,9 +108,11 @@ pub type PubNubGenericClient = PubNubClientInstance>; /// Client for PubNub API with support for all [`selected`] PubNub features. /// The client uses [`reqwest`] as a transport layer. /// -/// You can create clients using the [`PubNubClient::builder`] method. +/// You can create clients using the [`PubNubClient::with_reqwest_transport`] method. /// You must provide a valid [`Keyset`] with pub/sub keys and a string User ID to identify the client. /// +/// To see available methods, please refer to the [`PubNubClientInstance`] documentation. +/// /// # Examples /// ``` /// use pubnub::{PubNubClientBuilder, Keyset}; @@ -181,7 +183,7 @@ pub type PubNubGenericClient = PubNubClientInstance>; /// [`Transport`]: ../core/trait.Transport.html /// [`Keyset`]: ../core/struct.Keyset.html /// [`reqwest`]: https://crates.io/crates/reqwest -/// [`PubNubClient::builder`]: ./struct.PubNubClient.html#method.builder +/// [`PubNubClient::with_reqwest_transport`]: struct.PubNubClientBuilder.html#method.with_reqwest_transport #[cfg(feature = "reqwest")] pub type PubNubClient = PubNubGenericClient; @@ -216,8 +218,6 @@ impl Clone for PubNubClientInstance { /// It's wrapped in `Arc` by [`PubNubClient`] and uses interior mutability for its internal state. /// /// Not intended to be used directly. Use [`PubNubClient`] instead. -/// -/// [`PubNubClient`]: ./struct.PubNubClient.html #[derive(Debug, Builder)] #[builder( pattern = "owned", @@ -291,8 +291,6 @@ impl PubNubClientInstance { /// # Ok(()) /// # } /// ``` - /// - /// [`PubNubClient`]: struct.PubNubClient.html #[cfg(feature = "blocking")] pub fn with_blocking_transport(transport: T) -> PubNubClientBuilder where @@ -382,8 +380,6 @@ impl PubNubClientConfigBuilder { } /// Build a [`PubNubClient`] from the builder - /// - /// [`PubNubClient`]: struct.PubNubClient.html pub fn build(self) -> Result>, PubNubError> { self.build_internal() .map_err(|err| PubNubError::ClientInitialization { @@ -417,8 +413,6 @@ impl PubNubClientConfigBuilder { /// /// Configuration for [`PubNubClient`]. /// This struct separates the configuration from the actual client. -/// -/// [`PubNubClient`]: struct.PubNubClient.html #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PubNubConfig { /// Subscribe key @@ -472,8 +466,6 @@ impl PubNubConfig { /// of the builder with the remaining parameters. /// /// See [`PubNubClient`] for more information. -/// -/// [`PubNubClient`]: struct.PubNubClient.html #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PubNubClientBuilder { pub(crate) transport: Option, @@ -628,11 +620,10 @@ impl PubNubClientBuilder { /// ``` /// /// # See also -/// [Keyset](struct.Keyset.html) -/// [PubNubClientBuilder](struct.PubNubClientBuilder.html) -/// [PubNubClient](struct.PubNubClient.html) +/// [`Keyset`] +/// [`PubNubClientBuilder`] +/// [`PubNubClient`] /// -/// [`PubNubClient`]: struct.PubNubClient.html /// [`PubNubClientBuilder::with_keyset`]: struct.PubNubClientBuilder.html#method.with_keyset #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PubNubClientUserIdBuilder @@ -653,7 +644,6 @@ where /// the PubNubClientConfigBuilder. /// /// [`PubNubClientConfigBuilder`]: struct.PubNubClientConfigBuilder.html - /// [`PubNubClient`]: struct.PubNubClient.html pub fn with_user_id(self, user_id: U) -> PubNubClientConfigBuilder where U: Into, diff --git a/src/lib.rs b/src/lib.rs index ce177ccf..fc286d59 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ //! //!
//! -//! ![PubNub](https://raw.githubusercontent.com/pubnub/rust/phoenix/logo.svg) +//! ![PubNub](https://raw.githubusercontent.com/pubnub/rust/master/logo.svg) //! //! ![Tests](https://github.com/pubnub/rust/actions/workflows/run-tests.yml/badge.svg) //! ![Validations](https://github.com/pubnub/rust/actions/workflows/run-validations.yml/badge.svg) @@ -38,11 +38,11 @@ //! ```toml //! # default features //! [dependencies] -//! pubnub = "0.0.0" +//! pubnub = "0.2.1" //! //! # all features //! [dependencies] -//! pubnub = { version = "0.0.0", features = ["full"] } +//! pubnub = { version = "0.2.1", features = ["full"] } //! ``` //! //! ### Example @@ -77,7 +77,7 @@ //! } //! ``` //! -//! You can find more examples in our [examples](examples/) directory! +//! You can find more examples in our [examples](https://github.com/pubnub/rust/tree/master/examples) directory! //! //! ## Features //! @@ -86,11 +86,11 @@ //! ```toml //! # only blocking and access + default features //! [dependencies] -//! pubnub = { version = "0.0.0", features = ["blocking", "access"] } +//! pubnub = { version = "0.2.1", features = ["blocking", "access"] } //! //! # only parse_token + default features //! [dependencies] -//! pubnub = { version = "0.0.0", features = ["parse_token"] } +//! pubnub = { version = "0.2.1", features = ["parse_token"] } //! ``` //! //! ### Available features @@ -124,7 +124,7 @@ //! //! ```toml //! [dependencies] -//! pubnub = { version = "0.0.0", default-features = false, features = ["serde", "publish", +//! pubnub = { version = "0.2.1", default-features = false, features = ["serde", "publish", //! "blocking"] } //! ``` //! @@ -154,7 +154,7 @@ //! If you're having problems compiling this crate for more exotic targets, you can try to use the //! `extra_platforms` feature. Be aware that this feature is **not supported** and we do not recommend using it. //! -//! For more information about this feature. refer to [Cargo.toml](Cargo.toml) in the `[features]` section. +//! For more information about this feature. refer to [Cargo.toml](https://github.com/pubnub/rust/blob/master/Cargo.toml) in the `[features]` section. //! //! ## Support //! @@ -162,10 +162,7 @@ //! //! ## License //! -//! This project is licensed under the [MIT license]. -//! -//! [MIT license]: https://github.com/pubnub/LICENSE/blob/master/LICENSE -//! +//! This project is licensed under the [MIT license](https://github.com/pubnub/rust/blob/master/LICENSE). #[cfg(feature = "access")] #[doc(inline)] @@ -183,6 +180,7 @@ pub use dx::publish; pub use dx::{Keyset, PubNubClientBuilder, PubNubGenericClient}; #[cfg(feature = "reqwest")] +#[doc(inline)] pub use dx::PubNubClient; pub mod core; diff --git a/src/transport/reqwest.rs b/src/transport/reqwest.rs index d92c5d10..fe3ebbf9 100644 --- a/src/transport/reqwest.rs +++ b/src/transport/reqwest.rs @@ -10,7 +10,6 @@ //! [`PubNub API`]: https://www.pubnub.com/docs //! [`reqwest`]: https://docs.rs/reqwest //! [`pubnub`]: ../index.html -//! [`PubNubClient`]: ../pubnub_client/struct.PubNubClient.html //! [`reqwest` feature]: ../index.html#features use crate::{ @@ -40,10 +39,10 @@ use reqwest::{ /// It is used as the transport type for the [`PubNubClient`]. /// It is intended to be used by the [`pubnub`] crate. /// +/// [`PubNubClient`]: ../../dx/pubnub_client/struct.PubNubClientInstance.html /// [`PubNub API`]: https://www.pubnub.com/docs /// [`reqwest`]: https://docs.rs/reqwest /// [`pubnub`]: ../index.html -/// [`PubNubClient`]: ../pubnub_client/struct.PubNubClient.html #[derive(Clone, Debug)] pub struct TransportReqwest { reqwest_client: reqwest::Client, @@ -127,10 +126,9 @@ impl TransportReqwest { /// /// ``` /// + /// [`PubNubClient`]: ../../dx/pubnub_client/struct.PubNubClientInstance.html /// [`TransportReqwest`]: ./struct.TransportReqwest.html - /// [`PubNubClient`]: ../pubnub_client/struct.PubNubClient.html /// [`pubnub`]: ../index.html - /// [`PubNubClientBuilder`]: ../pubnub_client/struct.PubNubClientBuilder.html /// [`reqwest`]: https://docs.rs/reqwest pub fn new() -> Self { Self::default() @@ -247,11 +245,9 @@ impl PubNubClientBuilder { /// .build(); /// ``` /// - /// [`PubNubClientBuilder`]: ../pubnub_client/struct.PubNubClientBuilder.html /// [`TransportReqwest`]: ./struct.TransportReqwest.html /// [`reqwest`]: https://docs.rs/reqwest /// [`PubNub API`]: https://www.pubnub.com/docs - /// [`PubNubClient`]: ../pubnub_client/struct.PubNubClient.html pub fn with_reqwest_transport() -> PubNubClientBuilder { PubNubClientBuilder { transport: Some(TransportReqwest::new()), @@ -274,7 +270,6 @@ pub mod blocking { //! [`PubNub API`]: https://www.pubnub.com/docs //! [`reqwest`]: https://docs.rs/reqwest //! [`pubnub`]: ../index.html - //! [`PubNubClient`]: ../pubnub_client/struct.PubNubClient.html //! [`reqwest` feature]: ../index.html#features use log::info; @@ -295,10 +290,10 @@ pub mod blocking { /// /// It requires the [`reqwest` and `blocking` feature] to be enabled. /// + /// [`PubNubClient`]: ../../dx/pubnub_client/struct.PubNubClientInstance.html /// [`PubNub API`]: https://www.pubnub.com/docs /// [`reqwest`]: https://docs.rs/reqwest /// [`pubnub`]: ../index.html - /// [`PubNubClient`]: ../pubnub_client/struct.PubNubClient.html pub struct TransportReqwest { reqwest_client: reqwest::blocking::Client, /// The hostname to use for requests. @@ -375,10 +370,9 @@ pub mod blocking { /// let transport = TransportReqwest::new(); /// ``` /// + /// [`PubNubClient`]: ../../dx/pubnub_client/struct.PubNubClientInstance.html /// [`TransportReqwest`]: ./struct.TransportReqwest.html - /// [`PubNubClient`]: ../pubnub_client/struct.PubNubClient.html /// [`pubnub`]: ../index.html - /// [`PubNubClientBuilder`]: ../pubnub_client/struct.PubNubClientBuilder.html /// [`reqwest`]: https://docs.rs/reqwest pub fn new() -> Self { Self::default() @@ -435,11 +429,9 @@ pub mod blocking { /// .build(); /// ``` /// - /// [`PubNubClientBuilder`]: ../pubnub_client/struct.PubNubClientBuilder.html /// [`TransportReqwest`]: ./struct.TransportReqwest.html /// [`reqwest`]: https://docs.rs/reqwest /// [`PubNub API`]: https://www.pubnub.com/docs - /// [`PubNubClient`]: ../pubnub_client/struct.PubNubClient.html pub fn with_reqwest_blocking_transport() -> PubNubClientBuilder { PubNubClientBuilder { transport: Some(TransportReqwest::new()),