2021-07-12 15:55:41 +00:00
|
|
|
//! Lower-level types and re-exports.
|
2021-06-27 06:44:56 +00:00
|
|
|
//!
|
2021-07-12 15:55:41 +00:00
|
|
|
//! Most users will not have to interact with the types in this module, but it is useful for those
|
2021-12-04 19:40:47 +00:00
|
|
|
//! writing extractors, middleware, libraries, or interacting with the service API directly.
|
2022-02-25 18:46:35 +00:00
|
|
|
//!
|
|
|
|
//! # Request Extractors
|
|
|
|
//! - [`ConnectionInfo`]: Connection information
|
|
|
|
//! - [`PeerAddr`]: Connection information
|
2021-06-27 06:44:56 +00:00
|
|
|
|
2023-07-17 01:38:12 +00:00
|
|
|
#[cfg(feature = "__compress")]
|
|
|
|
pub use actix_http::encoding::Decoder as Decompress;
|
2021-12-28 02:37:13 +00:00
|
|
|
pub use actix_http::{Extensions, Payload, RequestHead, Response, ResponseHead};
|
2023-07-17 01:38:12 +00:00
|
|
|
use actix_router::Patterns;
|
2021-12-28 02:37:13 +00:00
|
|
|
pub use actix_router::{Path, ResourceDef, ResourcePath, Url};
|
|
|
|
pub use actix_server::{Server, ServerHandle};
|
|
|
|
pub use actix_service::{
|
|
|
|
always_ready, fn_factory, fn_service, forward_ready, Service, ServiceFactory, Transform,
|
|
|
|
};
|
|
|
|
|
2021-06-27 06:44:56 +00:00
|
|
|
#[doc(hidden)]
|
|
|
|
pub use crate::handler::Handler;
|
2023-07-17 01:38:12 +00:00
|
|
|
pub use crate::{
|
|
|
|
config::{AppConfig, AppService},
|
|
|
|
info::{ConnectionInfo, PeerAddr},
|
|
|
|
rmap::ResourceMap,
|
|
|
|
service::{HttpServiceFactory, ServiceRequest, ServiceResponse, WebService},
|
|
|
|
types::{JsonBody, Readlines, UrlEncoded},
|
|
|
|
};
|
2021-08-06 21:42:31 +00:00
|
|
|
|
|
|
|
pub(crate) fn ensure_leading_slash(mut patterns: Patterns) -> Patterns {
|
|
|
|
match &mut patterns {
|
|
|
|
Patterns::Single(pat) => {
|
|
|
|
if !pat.is_empty() && !pat.starts_with('/') {
|
|
|
|
pat.insert(0, '/');
|
|
|
|
};
|
|
|
|
}
|
|
|
|
Patterns::List(pats) => {
|
|
|
|
for pat in pats {
|
|
|
|
if !pat.is_empty() && !pat.starts_with('/') {
|
|
|
|
pat.insert(0, '/');
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2021-06-27 06:44:56 +00:00
|
|
|
}
|
2021-07-12 15:55:41 +00:00
|
|
|
|
2021-06-27 06:44:56 +00:00
|
|
|
patterns
|
|
|
|
}
|