mirror of
https://github.com/actix/actix-web.git
synced 2024-11-22 17:41:11 +00:00
add feature annotations to docs
This commit is contained in:
parent
19aa14a9d6
commit
ea764b1d57
7 changed files with 16 additions and 0 deletions
|
@ -211,6 +211,7 @@ where
|
|||
|
||||
/// Finish service configuration and create a HTTP service for HTTP/2 protocol.
|
||||
#[cfg(feature = "http2")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
|
||||
pub fn h2<F, B>(self, service: F) -> crate::h2::H2Service<T, S, B>
|
||||
where
|
||||
F: IntoServiceFactory<S, Request>,
|
||||
|
|
|
@ -294,6 +294,7 @@ impl std::error::Error for PayloadError {
|
|||
PayloadError::Overflow => None,
|
||||
PayloadError::UnknownLength => None,
|
||||
#[cfg(feature = "http2")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
|
||||
PayloadError::Http2Payload(err) => Some(err),
|
||||
PayloadError::Io(err) => Some(err),
|
||||
}
|
||||
|
@ -351,6 +352,7 @@ pub enum DispatchError {
|
|||
/// HTTP/2 error.
|
||||
#[display(fmt = "{}", _0)]
|
||||
#[cfg(feature = "http2")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
|
||||
H2(h2::Error),
|
||||
|
||||
/// The first request did not complete within the specified timeout.
|
||||
|
|
|
@ -134,6 +134,7 @@ mod openssl {
|
|||
U::InitError: fmt::Debug,
|
||||
{
|
||||
/// Create OpenSSL based service.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "openssl")))]
|
||||
pub fn openssl(
|
||||
self,
|
||||
acceptor: SslAcceptor,
|
||||
|
@ -196,6 +197,7 @@ mod rustls {
|
|||
U::InitError: fmt::Debug,
|
||||
{
|
||||
/// Create Rustls based service.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "rustls")))]
|
||||
pub fn rustls(
|
||||
self,
|
||||
config: ServerConfig,
|
||||
|
|
|
@ -117,6 +117,7 @@ mod openssl {
|
|||
B: MessageBody + 'static,
|
||||
{
|
||||
/// Create OpenSSL based service.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "openssl")))]
|
||||
pub fn openssl(
|
||||
self,
|
||||
acceptor: SslAcceptor,
|
||||
|
@ -164,6 +165,7 @@ mod rustls {
|
|||
B: MessageBody + 'static,
|
||||
{
|
||||
/// Create Rustls based service.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "rustls")))]
|
||||
pub fn rustls(
|
||||
self,
|
||||
mut config: ServerConfig,
|
||||
|
|
|
@ -40,6 +40,7 @@ pub mod error;
|
|||
mod extensions;
|
||||
pub mod h1;
|
||||
#[cfg(feature = "http2")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
|
||||
pub mod h2;
|
||||
pub mod header;
|
||||
mod helpers;
|
||||
|
@ -54,6 +55,7 @@ mod responses;
|
|||
mod service;
|
||||
pub mod test;
|
||||
#[cfg(feature = "ws")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
|
||||
pub mod ws;
|
||||
|
||||
pub use self::builder::HttpServiceBuilder;
|
||||
|
@ -71,6 +73,7 @@ pub use self::requests::{Request, RequestHead, RequestHeadType};
|
|||
pub use self::responses::{Response, ResponseBuilder, ResponseHead};
|
||||
pub use self::service::HttpService;
|
||||
#[cfg(any(feature = "openssl", feature = "rustls"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "openssl", feature = "rustls"))))]
|
||||
pub use self::service::TlsAcceptorConfig;
|
||||
|
||||
/// A major HTTP protocol version.
|
||||
|
|
|
@ -239,6 +239,7 @@ mod openssl {
|
|||
U::InitError: fmt::Debug,
|
||||
{
|
||||
/// Create OpenSSL based service.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "openssl")))]
|
||||
pub fn openssl(
|
||||
self,
|
||||
acceptor: SslAcceptor,
|
||||
|
@ -253,6 +254,7 @@ mod openssl {
|
|||
}
|
||||
|
||||
/// Create OpenSSL based service with custom TLS acceptor configuration.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "openssl")))]
|
||||
pub fn openssl_with_config(
|
||||
self,
|
||||
acceptor: SslAcceptor,
|
||||
|
@ -332,6 +334,7 @@ mod rustls {
|
|||
U::InitError: fmt::Debug,
|
||||
{
|
||||
/// Create Rustls based service.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "rustls")))]
|
||||
pub fn rustls(
|
||||
self,
|
||||
config: ServerConfig,
|
||||
|
@ -346,6 +349,7 @@ mod rustls {
|
|||
}
|
||||
|
||||
/// Create Rustls based service with custom TLS acceptor configuration.
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "rustls")))]
|
||||
pub fn rustls_with_config(
|
||||
self,
|
||||
mut config: ServerConfig,
|
||||
|
|
|
@ -311,6 +311,7 @@ impl HttpRequest {
|
|||
|
||||
/// Load request cookies.
|
||||
#[cfg(feature = "cookies")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "cookies")))]
|
||||
pub fn cookies(&self) -> Result<Ref<'_, Vec<Cookie<'static>>>, CookieParseError> {
|
||||
use actix_http::header::COOKIE;
|
||||
|
||||
|
@ -334,6 +335,7 @@ impl HttpRequest {
|
|||
|
||||
/// Return request cookie.
|
||||
#[cfg(feature = "cookies")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "cookies")))]
|
||||
pub fn cookie(&self, name: &str) -> Option<Cookie<'static>> {
|
||||
if let Ok(cookies) = self.cookies() {
|
||||
for cookie in cookies.iter() {
|
||||
|
|
Loading…
Reference in a new issue