Skip to content

Commit

Permalink
Merge pull request #49 from topenkoff/docs-features
Browse files Browse the repository at this point in the history
Docs features
  • Loading branch information
singulared committed Mar 15, 2022
2 parents c3eea33 + b9c5569 commit 3fd47de
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.51.0, stable]
rust: [1.54.0, stable]
steps:
- uses: actions/checkout@main
- uses: actions-rs/toolchain@v1
Expand All @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.51.0, stable, beta]
rust: [1.54.0, stable, beta]
redis-version: [6]
steps:
- uses: actions/checkout@main
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ thiserror = "1"
prometheus = { version = "0.13" }
env_logger = "0.9"
actix_derive = "0.6"
actix-web = "4.0.0-beta"
actix-web = "4.0"
tracing = "0.1"
tracing-subscriber = "0.2"
4 changes: 4 additions & 0 deletions hitbox-actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ default = ["redis", "derive"]

redis = ["hitbox-redis"]
derive = ["hitbox/derive"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
4 changes: 4 additions & 0 deletions hitbox-actix/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]
//! # Hitbox-Actix
//!
//! [![Build status](https://github.com/hit-box/hitbox/actions/workflows/CI.yml/badge.svg)](https://github.com/hit-box/hitbox/actions?query=workflow)
Expand Down Expand Up @@ -140,16 +141,19 @@ pub use messages::{IntoCache, QueryCache};
pub use runtime::ActixAdapter;

#[cfg(feature = "redis")]
#[cfg_attr(docsrs, doc(cfg(feature = "redis")))]
pub use hitbox_redis::RedisBackend;

/// Default type alias with RedisBackend.
/// You can disable it or define it manually in your code.
#[cfg(feature = "redis")]
#[cfg_attr(docsrs, doc(cfg(feature = "redis")))]
pub type Cache = CacheActor<RedisBackend>;

/// Prelude for hitbox_actix.
pub mod prelude {
#[cfg(feature = "redis")]
#[cfg_attr(docsrs, doc(cfg(feature = "redis")))]
pub use crate::{Cache, RedisBackend};
pub use crate::{CacheActor, CacheBuilder, CacheError, Cacheable, IntoCache, QueryCache};
pub use hitbox::hitbox_serializer;
Expand Down
4 changes: 4 additions & 0 deletions hitbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ default = []

derive = ["hitbox-derive", "serde_qs", "actix/macros"]
metrics = ["prometheus", "lazy_static"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions hitbox/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use crate::CacheError;
#[cfg(feature = "derive")]
#[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
pub use hitbox_derive::Cacheable;

/// Trait describes cache configuration per type that implements this trait.
Expand Down
2 changes: 2 additions & 0 deletions hitbox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@
//! [hitbox-actix]: https://docs.rs/hitbox_actix/
//! [dogpile effect]: https://www.sobstel.org/blog/preventing-dogpile-effect/
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]

pub mod cache;
pub mod dev;
pub mod error;
#[cfg(feature = "metrics")]
#[cfg_attr(docsrs, doc(cfg(feature = "metrics")))]
pub mod metrics;
pub mod response;
pub mod runtime;
Expand Down
1 change: 1 addition & 0 deletions hitbox/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use serde::{de::DeserializeOwned, Serialize};

#[cfg(feature = "derive")]
#[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
pub use hitbox_derive::CacheableResponse;

/// This trait determines which types should be cached or not.
Expand Down

0 comments on commit 3fd47de

Please sign in to comment.