Skip to content

Commit

Permalink
appservice: Drop actix
Browse files Browse the repository at this point in the history
  • Loading branch information
johannescpk committed Jun 29, 2021
1 parent df71de5 commit f454d40
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 283 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,10 @@ jobs:
strategy:
matrix:
name:
- linux / appservice / stable / actix
- macOS / appservice / stable / actix
- linux / appservice / stable / warp
- macOS / appservice / stable / warp

include:
- name: linux / appservice / stable / actix
cargo_args: --no-default-features --features actix

- name: macOS / appservice / stable / actix
os: macOS-latest
cargo_args: --no-default-features --features actix

- name: linux / appservice / stable / warp
cargo_args: --features warp

Expand Down
5 changes: 1 addition & 4 deletions matrix_sdk_appservice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ version = "0.1.0"

[features]
default = ["warp"]
actix = ["actix-rt", "actix-web"]

docs = ["actix", "warp"]
docs = ["warp"]

[dependencies]
actix-rt = { version = "2", optional = true }
actix-web = { version = "4.0.0-beta.6", optional = true }
dashmap = "4"
futures = "0.3"
futures-util = "0.3"
Expand Down
11 changes: 0 additions & 11 deletions matrix_sdk_appservice/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,8 @@ pub enum Error {
#[cfg(feature = "warp")]
#[error("warp rejection: {0}")]
WarpRejection(String),

#[cfg(feature = "actix")]
#[error(transparent)]
Actix(#[from] actix_web::Error),

#[cfg(feature = "actix")]
#[error(transparent)]
ActixPayload(#[from] actix_web::error::PayloadError),
}

#[cfg(feature = "actix")]
impl actix_web::error::ResponseError for Error {}

#[cfg(feature = "warp")]
impl warp::reject::Reject for Error {}

Expand Down
30 changes: 3 additions & 27 deletions matrix_sdk_appservice/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
//! [matrix-org/matrix-rust-sdk#228]: https://github.com/matrix-org/matrix-rust-sdk/issues/228
//! [examples directory]: https://github.com/matrix-org/matrix-rust-sdk/tree/master/matrix_sdk_appservice/examples

#[cfg(not(any(feature = "actix", feature = "warp")))]
compile_error!("one webserver feature must be enabled. available ones: `actix`, `warp`");
#[cfg(not(any(feature = "warp")))]
compile_error!("one webserver feature must be enabled. available ones: `warp`");

use std::{
convert::{TryFrom, TryInto},
Expand Down Expand Up @@ -441,24 +441,6 @@ impl AppService {
Ok(false)
}

/// Returns a closure to be used with [`actix_web::App::configure()`]
///
/// Note that if you handle any of the [application-service-specific
/// routes], including the legacy routes, you will break the appservice
/// functionality.
///
/// [application-service-specific routes]: https://spec.matrix.org/unstable/application-service-api/#legacy-routes
#[cfg(feature = "actix")]
#[cfg_attr(docs, doc(cfg(feature = "actix")))]
pub fn actix_configure(&self) -> impl FnOnce(&mut actix_web::web::ServiceConfig) {
let appservice = self.clone();

move |config| {
config.data(appservice);
webserver::actix::configure(config);
}
}

/// Returns a [`warp::Filter`] to be used as [`warp::serve()`] route
///
/// Note that if you handle any of the [application-service-specific
Expand All @@ -482,19 +464,13 @@ impl AppService {
let port = port.into();
info!("Starting AppService on {}:{}", &host, &port);

#[cfg(feature = "actix")]
{
webserver::actix::run_server(self.clone(), host, port).await?;
Ok(())
}

#[cfg(feature = "warp")]
{
webserver::warp::run_server(self.clone(), host, port).await?;
Ok(())
}

#[cfg(not(any(feature = "actix", feature = "warp",)))]
#[cfg(not(any(feature = "warp",)))]
unreachable!()
}
}
Expand Down
149 changes: 0 additions & 149 deletions matrix_sdk_appservice/src/webserver/actix.rs

This file was deleted.

2 changes: 0 additions & 2 deletions matrix_sdk_appservice/src/webserver/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#[cfg(feature = "actix")]
pub mod actix;
#[cfg(feature = "warp")]
pub mod warp;
Loading

0 comments on commit f454d40

Please sign in to comment.