Skip to content

Commit

Permalink
Merge pull request #2 from programatik29/version-0.1
Browse files Browse the repository at this point in the history
Version 0.1.0
  • Loading branch information
programatik29 authored Aug 23, 2021
2 parents baa6ade + cadde1e commit f6ef021
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# Unreleased

None.

# 0.1.0 (23. August 2021)

- Initial release.
17 changes: 11 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
[package]
name = "axum-server"
version = "0.1.0"
authors = ["Programatik <programatik29@gmail.com>"]
edition = "2018"
categories = ["asynchronous", "network-programming", "web-programming"]
description = "High level server designed to be used with axum framework."
edition = "2018"
homepage = "https://github.com/programatik29/axum-server"
keywords = ["http", "https", "web", "server"]
license = "MIT"
name = "axum-server"
readme = "README.md"
repository = "https://github.com/programatik29/axum-server"
version = "0.1.0"

[features]
record = []
tls-rustls = ["rustls", "tokio-rustls"]

[dependencies]
futures-util = "0.3"
tokio = { version = "1", features = ["rt", "net"] }
http = "0.2"
http-body = "0.4"
hyper = { version = "0.14", features = ["runtime", "server", "http1", "http2"] }
tokio = { version = "1", features = ["rt", "net"] }
tower-service = "0.3.1"
tower-http = { version = "0.1", features = ["add-extension"] }
hyper = { version = "0.14", features = ["runtime", "server", "http1", "http2"] }

# optional dependencies

rustls = { optional = true, version = "0.19" }
tokio-rustls = { optional = true, version = "0.22" }

[dev-dependencies]
axum = "0.2"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
axum = { git = "https://github.com/tokio-rs/axum" }
6 changes: 5 additions & 1 deletion src/server/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use tower_service::Service;

use hyper::server::conn::Http;

/// Contains recorded data.
/// Type to access data that is being recorded in real-time.
#[derive(Clone)]
pub struct Recording {
sent: Arc<AtomicUsize>,
Expand All @@ -69,11 +69,15 @@ pub struct Recording {

impl Recording {
/// Get recorded outgoing bytes.
///
/// Data might be changed between function calls.
pub fn bytes_sent(&self) -> usize {
self.sent.load(Ordering::Acquire)
}

/// Get recorded incoming bytes.
///
/// Data might be changed between function calls.
pub fn bytes_received(&self) -> usize {
self.received.load(Ordering::Acquire)
}
Expand Down

0 comments on commit f6ef021

Please # to comment.