Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Changelog

## [0.5.0] - 2024-01-11

### Breaking Changes
- Migrated to native async traits with the following changes:
- Removed `#[async_trait]` attribute from `FromRequestParts` implementation to support Axum 0.8+ compatibility
- Refactored `SessionStore` trait to use explicit `Future` returns instead of `async fn`
- If you're using Axum < 0.8, please continue using ruts version 0.4.3

### Added
- Support for Axum 0.8+

### Dependencies
- Updated minimum supported Axum version to 0.8.0

### Migration Guide
If you're upgrading to Axum 0.8+ and using ruts:
1. Update your Axum dependency to 0.8.0 or higher
2. Update ruts to the latest version
3. No additional code changes are required for session handling

The session middleware and extractors will continue to work as before:
```rust
// Your code will continue to work unchanged
async fn handler(
session: Session<RedisStore<Pool>>,
// ... other parameters
) -> Result<(), Error> {
// ... your code
}
```

## [0.4.2] - 2024-12-14
### Fixed
- Match Cargo.toml version and install version in the README.md
Expand Down
83 changes: 37 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "ruts"
description = "A middleware for tower sessions"
version = "0.4.2"
version = "0.5.0"
edition = "2021"
rust-version = "1.75.0"
authors = ["Jimmie Lovell <[email protected]>"]
license = "MIT"
homepage = "https://github.com/jimmielovell/ruts"
Expand All @@ -18,25 +19,24 @@ axum = ["dep:axum-core"]
redis-store = ["dep:fred", "dep:rmp-serde"]

[dependencies]
async-trait = "0.1.83"
axum-core = { version = "0.4.5", optional = true }
axum-core = { version = "0.5.0", optional = true }
base64 = "0.22.1"
cookie = "0.18.1"
fred = { version = "10.0.1", optional = true }
http = "1.1.0"
http = "1.2.0"
parking_lot = { version = "0.12.3", features = ["serde"] }
pin-project-lite = "0.2.14"
rand = "0.8.5"
rmp-serde = { version = "1.3.0", optional = true }
serde = { version = "1.0.210", features = ["derive"] }
thiserror = "2.0.6"
tokio = { version = "1.40.0", features = ["full"] }
tower = "0.5.1"
tower-cookies = "0.10.0"
tracing = { version = "0.1.40", features = ["log"] }
serde = { version = "1.0.217", features = ["derive"] }
thiserror = "2.0.11"
tokio = { version = "1.43.0", features = ["full"] }
tower = "0.5.2"
tower-cookies = "0.11.0"
tracing = { version = "0.1.41", features = ["log"] }

[dev-dependencies]
axum = "0.7.7"
axum = "0.8.1"
http-body-util = "0.1.2"
hyper = "1.5.1"

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Ruts: Rust Tower Session for HTTP Applications

[![Documentation](https://docs.rs/ruts/badge.svg)](https://docs.rs/ruts)
[![Crates.io](https://img.shields.io/crates/v/ruts.svg)](https://crates.io/crates/ruts)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Rust](https://img.shields.io/badge/rust-1.75.0%2B-blue.svg?maxAge=3600)](
github.com/jimmielovell/ruts)

Ruts is a robust, flexible session management library for Rust web applications. It provides a seamless way to handle cookie sessions in tower-based web frameworks, with a focus on security, performance, and ease of use.

## Features
Expand Down
2 changes: 0 additions & 2 deletions src/extract/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::sync::Arc;

use async_trait::async_trait;
use axum_core::extract::FromRequestParts;
use http::{request::Parts, StatusCode};
use tower_cookies::Cookies;
Expand All @@ -10,7 +9,6 @@ use crate::store::SessionStore;
use crate::{Id, Session};

/// axum extractor for [`Session`].
#[async_trait]
impl<S, T> FromRequestParts<S> for Session<T>
where
S: Sync + Send,
Expand Down
2 changes: 0 additions & 2 deletions src/store/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::HashMap;
use std::sync::Arc;
use std::time::{Duration, Instant};
use parking_lot::RwLock;
use async_trait::async_trait;
use serde::{de::DeserializeOwned, Serialize};

use crate::store::{Error, SessionStore};
Expand Down Expand Up @@ -53,7 +52,6 @@ impl MemoryStore {
}
}

#[async_trait]
impl SessionStore for MemoryStore {
async fn get<T>(&self, session_id: &Id, field: &str) -> Result<Option<T>, Error>
where
Expand Down
2 changes: 0 additions & 2 deletions src/store/redis.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use async_trait::async_trait;
use fred::clients::Pool;
use fred::interfaces::{HashesInterface, KeysInterface};
use fred::types::{Key, Value};
Expand Down Expand Up @@ -78,7 +77,6 @@ where
}
}

#[async_trait]
impl<C> SessionStore for RedisStore<C>
where
C: HashesInterface + KeysInterface + Clone + Send + Sync + 'static,
Expand Down
Loading