mirror of https://github.com/fafhrd91/actix-net
make service no_std
This commit is contained in:
parent
00c4a3ac08
commit
663dfd35de
|
@ -1,8 +1,11 @@
|
||||||
use std::future::Future;
|
use alloc::rc::Rc;
|
||||||
use std::pin::Pin;
|
use core::{
|
||||||
use std::rc::Rc;
|
cell::RefCell,
|
||||||
use std::task::{Context, Poll};
|
future::Future,
|
||||||
use std::{cell::RefCell, marker::PhantomData};
|
marker::PhantomData,
|
||||||
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use super::{Service, ServiceFactory};
|
use super::{Service, ServiceFactory};
|
||||||
|
|
||||||
|
@ -254,9 +257,11 @@ where
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::cell::Cell;
|
use alloc::rc::Rc;
|
||||||
use std::rc::Rc;
|
use core::{
|
||||||
use std::task::{Context, Poll};
|
cell::Cell,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use futures_util::future::{lazy, ok, ready, Ready};
|
use futures_util::future::{lazy, ok, ready, Ready};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::cell::RefCell;
|
use alloc::rc::Rc;
|
||||||
use std::future::Future;
|
use core::{
|
||||||
use std::marker::PhantomData;
|
cell::RefCell,
|
||||||
use std::pin::Pin;
|
future::Future,
|
||||||
use std::rc::Rc;
|
marker::PhantomData,
|
||||||
use std::task::{Context, Poll};
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{Service, ServiceFactory};
|
use crate::{Service, ServiceFactory};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{
|
use core::{
|
||||||
future::Future,
|
future::Future,
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
|
@ -207,7 +207,7 @@ where
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::task::Poll;
|
use core::task::Poll;
|
||||||
|
|
||||||
use futures_util::future::{lazy, ok, Ready};
|
use futures_util::future::{lazy, ok, Ready};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::cell::RefCell;
|
use alloc::rc::Rc;
|
||||||
use std::future::Future;
|
use core::{
|
||||||
use std::marker::PhantomData;
|
cell::RefCell,
|
||||||
use std::pin::Pin;
|
future::Future,
|
||||||
use std::rc::Rc;
|
marker::PhantomData,
|
||||||
use std::task::{Context, Poll};
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{Service, ServiceFactory};
|
use crate::{Service, ServiceFactory};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
use std::pin::Pin;
|
use alloc::boxed::Box;
|
||||||
use std::task::{Context, Poll};
|
use core::{
|
||||||
use std::{future::Future, marker::PhantomData};
|
future::Future,
|
||||||
|
marker::PhantomData,
|
||||||
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use futures_util::future::FutureExt;
|
use futures_util::future::FutureExt;
|
||||||
|
|
||||||
|
@ -28,7 +32,7 @@ where
|
||||||
{
|
{
|
||||||
BoxServiceFactory(Box::new(FactoryWrapper {
|
BoxServiceFactory(Box::new(FactoryWrapper {
|
||||||
factory,
|
factory,
|
||||||
_t: std::marker::PhantomData,
|
_t: PhantomData,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use std::future::Future;
|
use core::{future::Future, marker::PhantomData, task::Poll};
|
||||||
use std::marker::PhantomData;
|
|
||||||
use std::task::Poll;
|
|
||||||
|
|
||||||
use futures_util::future::{ok, Ready};
|
use futures_util::future::{ok, Ready};
|
||||||
|
|
||||||
|
@ -357,7 +355,7 @@ where
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::task::Poll;
|
use core::task::Poll;
|
||||||
|
|
||||||
use futures_util::future::{lazy, ok};
|
use futures_util::future::{lazy, ok};
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
//! See [`Service`] docs for information on this crate's foundational trait.
|
//! See [`Service`] docs for information on this crate's foundational trait.
|
||||||
|
|
||||||
|
#![no_std]
|
||||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||||
#![allow(clippy::type_complexity)]
|
#![allow(clippy::type_complexity)]
|
||||||
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
|
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
|
||||||
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
|
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
|
||||||
|
|
||||||
use std::cell::RefCell;
|
extern crate alloc;
|
||||||
use std::future::Future;
|
|
||||||
use std::rc::Rc;
|
use alloc::{boxed::Box, rc::Rc, sync::Arc};
|
||||||
use std::sync::Arc;
|
use core::{
|
||||||
use std::task::{self, Context, Poll};
|
cell::RefCell,
|
||||||
|
future::Future,
|
||||||
|
task::{self, Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
mod and_then;
|
mod and_then;
|
||||||
mod and_then_apply_fn;
|
mod and_then_apply_fn;
|
||||||
|
@ -365,8 +369,8 @@ macro_rules! always_ready {
|
||||||
() => {
|
() => {
|
||||||
fn poll_ready(
|
fn poll_ready(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: &mut ::std::task::Context<'_>,
|
_: &mut ::core::task::Context<'_>,
|
||||||
) -> ::std::task::Poll<Result<(), Self::Error>> {
|
) -> ::core::task::Poll<Result<(), Self::Error>> {
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -377,8 +381,8 @@ macro_rules! forward_ready {
|
||||||
($field:ident) => {
|
($field:ident) => {
|
||||||
fn poll_ready(
|
fn poll_ready(
|
||||||
&mut self,
|
&mut self,
|
||||||
cx: &mut ::std::task::Context<'_>,
|
cx: &mut ::core::task::Context<'_>,
|
||||||
) -> ::std::task::Poll<Result<(), Self::Error>> {
|
) -> ::core::task::Poll<Result<(), Self::Error>> {
|
||||||
self.$field.poll_ready(cx)
|
self.$field.poll_ready(cx)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use std::future::Future;
|
use core::{
|
||||||
use std::marker::PhantomData;
|
future::Future,
|
||||||
use std::pin::Pin;
|
marker::PhantomData,
|
||||||
use std::task::{Context, Poll};
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use super::{Service, ServiceFactory};
|
use super::{Service, ServiceFactory};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
use super::{IntoServiceFactory, ServiceFactory};
|
use super::{IntoServiceFactory, ServiceFactory};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use std::future::Future;
|
use core::{
|
||||||
use std::marker::PhantomData;
|
future::Future,
|
||||||
use std::pin::Pin;
|
marker::PhantomData,
|
||||||
use std::task::{Context, Poll};
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use super::{Service, ServiceFactory};
|
use super::{Service, ServiceFactory};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use std::future::Future;
|
use core::{
|
||||||
use std::marker::PhantomData;
|
future::Future,
|
||||||
use std::pin::Pin;
|
marker::PhantomData,
|
||||||
use std::task::{Context, Poll};
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use super::ServiceFactory;
|
use super::ServiceFactory;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use std::task::{Context, Poll};
|
use core::{
|
||||||
use std::{future::Future, marker::PhantomData};
|
future::Future,
|
||||||
|
marker::PhantomData,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::and_then::{AndThenService, AndThenServiceFactory};
|
use crate::and_then::{AndThenService, AndThenServiceFactory};
|
||||||
use crate::and_then_apply_fn::{AndThenApplyFn, AndThenApplyFnFactory};
|
use crate::and_then_apply_fn::{AndThenApplyFn, AndThenApplyFnFactory};
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
use std::future::Future;
|
use alloc::rc::Rc;
|
||||||
use std::pin::Pin;
|
use core::{
|
||||||
use std::rc::Rc;
|
cell::RefCell,
|
||||||
use std::task::{Context, Poll};
|
future::Future,
|
||||||
use std::{cell::RefCell, marker::PhantomData};
|
marker::PhantomData,
|
||||||
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use super::{Service, ServiceFactory};
|
use super::{Service, ServiceFactory};
|
||||||
|
|
||||||
|
@ -236,9 +239,11 @@ where
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::cell::Cell;
|
use alloc::rc::Rc;
|
||||||
use std::rc::Rc;
|
use core::{
|
||||||
use std::task::{Context, Poll};
|
cell::Cell,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use futures_util::future::{err, lazy, ok, ready, Ready};
|
use futures_util::future::{err, lazy, ok, ready, Ready};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use std::pin::Pin;
|
use alloc::{rc::Rc, sync::Arc};
|
||||||
use std::rc::Rc;
|
use core::{
|
||||||
use std::sync::Arc;
|
future::Future,
|
||||||
use std::task::{Context, Poll};
|
marker::PhantomData,
|
||||||
use std::{future::Future, marker::PhantomData};
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::transform_err::TransformMapInitErr;
|
use crate::transform_err::TransformMapInitErr;
|
||||||
use crate::{IntoServiceFactory, Service, ServiceFactory};
|
use crate::{IntoServiceFactory, Service, ServiceFactory};
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use std::future::Future;
|
use core::{
|
||||||
use std::marker::PhantomData;
|
future::Future,
|
||||||
use std::pin::Pin;
|
marker::PhantomData,
|
||||||
use std::task::{Context, Poll};
|
pin::Pin,
|
||||||
|
task::{Context, Poll},
|
||||||
|
};
|
||||||
|
|
||||||
use super::Transform;
|
use super::Transform;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
|
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
|
||||||
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
|
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
use actix_service::{
|
use actix_service::{
|
||||||
apply, dev::ApplyTransform, IntoServiceFactory, Service, ServiceFactory, Transform,
|
apply, dev::ApplyTransform, IntoServiceFactory, Service, ServiceFactory, Transform,
|
||||||
|
|
Loading…
Reference in New Issue