Skip to content

Commit

Permalink
fix docs (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavrax authored Jun 7, 2023
1 parent 205f0b9 commit fd1e4f7
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 67 deletions.
11 changes: 10 additions & 1 deletion .pubnub.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pubnub"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
license = "MIT"
authors = ["PubNub <support@pubnub.com>"]
Expand Down
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div align = "center">

![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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -74,7 +74,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```

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

Expand All @@ -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
Expand Down Expand Up @@ -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"] }
```

Expand Down Expand Up @@ -151,15 +151,12 @@ 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

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).
7 changes: 5 additions & 2 deletions src/core/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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<T, PubNubError>`.
///
Expand Down
1 change: 1 addition & 0 deletions src/dx/access/builders/grant_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/dx/access/builders/revoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, D>
where
D: for<'de> Deserializer<'de, RevokeTokenResponseBody>,
Expand Down
3 changes: 0 additions & 3 deletions src/dx/publish/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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<T, M>
Expand Down Expand Up @@ -214,7 +212,6 @@ where
/// # }
/// ```
///
/// [`PublishMessageViaChannelBuilder`]: struct.PublishMessageViaChannelBuilder
/// [`publish_message`]: crate::dx::PubNubClient::publish_message
/// [`PubNub`]:https://www.pubnub.com/
/// [`PubNubClient`]: crate::dx::PubNubClient
Expand Down
2 changes: 1 addition & 1 deletion src/dx/publish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<T> PubNubClientInstance<T> {
/// # }
/// ```
///
/// [`PublishMessageBuilder`]: crate::dx::publish::PublishMessageBuilder]
/// [`PublishMessageBuilder`]: crate::dx::publish::PublishMessageBuilder
pub fn publish_message<M>(&self, message: M) -> PublishMessageBuilder<T, M>
where
M: Serialize,
Expand Down
36 changes: 13 additions & 23 deletions src/dx/pubnub_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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};
Expand Down Expand Up @@ -94,23 +95,24 @@ 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<T> = PubNubClientInstance<PubNubMiddleware<T>>;

/// PubNub client
///
/// 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};
Expand Down Expand Up @@ -181,7 +183,7 @@ pub type PubNubGenericClient<T> = PubNubClientInstance<PubNubMiddleware<T>>;
/// [`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<crate::transport::TransportReqwest>;

Expand Down Expand Up @@ -216,8 +218,6 @@ impl<T> Clone for PubNubClientInstance<T> {
/// 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",
Expand Down Expand Up @@ -291,8 +291,6 @@ impl<T> PubNubClientInstance<T> {
/// # Ok(())
/// # }
/// ```
///
/// [`PubNubClient`]: struct.PubNubClient.html
#[cfg(feature = "blocking")]
pub fn with_blocking_transport(transport: T) -> PubNubClientBuilder<T>
where
Expand Down Expand Up @@ -382,8 +380,6 @@ impl<T> PubNubClientConfigBuilder<T> {
}

/// Build a [`PubNubClient`] from the builder
///
/// [`PubNubClient`]: struct.PubNubClient.html
pub fn build(self) -> Result<PubNubClientInstance<PubNubMiddleware<T>>, PubNubError> {
self.build_internal()
.map_err(|err| PubNubError::ClientInitialization {
Expand Down Expand Up @@ -417,8 +413,6 @@ impl<T> PubNubClientConfigBuilder<T> {
///
/// 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
Expand Down Expand Up @@ -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<T> {
pub(crate) transport: Option<T>,
Expand Down Expand Up @@ -628,11 +620,10 @@ impl<T> PubNubClientBuilder<T> {
/// ```
///
/// # 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<T, S>
Expand All @@ -653,7 +644,6 @@ where
/// the PubNubClientConfigBuilder.
///
/// [`PubNubClientConfigBuilder`]: struct.PubNubClientConfigBuilder.html
/// [`PubNubClient`]: struct.PubNubClient.html
pub fn with_user_id<U>(self, user_id: U) -> PubNubClientConfigBuilder<T>
where
U: Into<String>,
Expand Down
22 changes: 10 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! <div align = "center">
//!
//! ![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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
//!
Expand All @@ -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
Expand Down Expand Up @@ -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"] }
//! ```
//!
Expand Down Expand Up @@ -154,18 +154,15 @@
//! 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
//!
//! 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).
#[cfg(feature = "access")]
#[doc(inline)]
Expand All @@ -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;
Expand Down
Loading

0 comments on commit fd1e4f7

Please sign in to comment.