rename DefaultFilter to Base

This commit is contained in:
Nikolay Kim 2021-12-20 20:39:20 +06:00
parent 6b2d664931
commit 72d14dfbcc
6 changed files with 18 additions and 16 deletions

View file

@ -6,6 +6,8 @@
* Better Io/IoRef api separation
* DefaultFilter renamed to Base
## [0.1.0-b.1] - 2021-12-19
* Remove ReadFilter/WriteFilter traits.

View file

@ -5,15 +5,15 @@ use ntex_bytes::BytesMut;
use super::io::Flags;
use super::{Filter, IoRef, WriteReadiness};
pub struct DefaultFilter(IoRef);
pub struct Base(IoRef);
impl DefaultFilter {
impl Base {
pub(crate) fn new(inner: IoRef) -> Self {
DefaultFilter(inner)
Base(inner)
}
}
impl Filter for DefaultFilter {
impl Filter for Base {
#[inline]
fn shutdown(&self, _: &IoRef) -> Poll<Result<(), io::Error>> {
let mut flags = self.0.flags();

View file

@ -6,7 +6,7 @@ use ntex_bytes::{BytesMut, PoolId, PoolRef};
use ntex_codec::{Decoder, Encoder};
use ntex_util::{future::poll_fn, future::Either, task::LocalWaker, time::Millis};
use super::filter::{DefaultFilter, NullFilter};
use super::filter::{Base, NullFilter};
use super::tasks::{ReadContext, WriteContext};
use super::{Filter, FilterFactory, Handle, IoStream};
@ -49,7 +49,7 @@ enum FilterItem<F> {
Ptr(*mut F),
}
pub struct Io<F = DefaultFilter>(pub(super) IoRef, FilterItem<F>);
pub struct Io<F = Base>(pub(super) IoRef, FilterItem<F>);
#[derive(Clone)]
pub struct IoRef(pub(super) Rc<IoState>);
@ -222,7 +222,7 @@ impl Io {
on_disconnect: RefCell::new(Vec::new()),
});
let filter = Box::new(DefaultFilter::new(IoRef(inner.clone())));
let filter = Box::new(Base::new(IoRef(inner.clone())));
let filter_ref: &'static dyn Filter = unsafe {
let filter: &dyn Filter = filter.as_ref();
std::mem::transmute(filter)

View file

@ -24,7 +24,7 @@ use ntex_codec::{Decoder, Encoder};
use ntex_util::time::Millis;
pub use self::dispatcher::Dispatcher;
pub use self::filter::DefaultFilter;
pub use self::filter::Base;
pub use self::io::{Io, IoRef, OnDisconnect};
pub use self::tasks::{ReadContext, WriteContext};
pub use self::time::Timer;