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