mirror of
https://github.com/fafhrd91/actix-net
synced 2025-08-14 08:50:31 +02:00
Compare commits
6 Commits
router-v0.
...
connect-v0
Author | SHA1 | Date | |
---|---|---|---|
|
a4e0c71baa | ||
|
b9ea445e70 | ||
|
ba2901269d | ||
|
5cbc29306a | ||
|
810fa869ae | ||
|
33cd51aabf |
@@ -1,6 +1,10 @@
|
||||
# Changes
|
||||
|
||||
## [0.1.2] - 2019-04-xx
|
||||
## [0.1.2] - 2019-04-04
|
||||
|
||||
### Added
|
||||
|
||||
* Log error if dns system config could not be loaded.
|
||||
|
||||
### Changed
|
||||
|
||||
|
@@ -47,10 +47,12 @@ pub fn start_resolver(cfg: ResolverConfig, opts: ResolverOpts) -> AsyncResolver
|
||||
}
|
||||
|
||||
pub fn start_default_resolver() -> AsyncResolver {
|
||||
let (cfg, opts) = if let Ok((cfg, opts)) = read_system_conf() {
|
||||
(cfg, opts)
|
||||
} else {
|
||||
(ResolverConfig::default(), ResolverOpts::default())
|
||||
let (cfg, opts) = match read_system_conf() {
|
||||
Ok((cfg, opts)) => (cfg, opts),
|
||||
Err(e) => {
|
||||
log::error!("TRust-DNS can not load system config: {}", e);
|
||||
(ResolverConfig::default(), ResolverOpts::default())
|
||||
}
|
||||
};
|
||||
|
||||
let (resolver, bg) = AsyncResolver::new(cfg, opts);
|
||||
|
@@ -6,9 +6,16 @@ use futures::{Async, Future, IntoFuture, Poll};
|
||||
use crate::transform_err::{TransformFromErr, TransformMapInitErr};
|
||||
use crate::{IntoNewService, NewService, Service};
|
||||
|
||||
/// `Transform` service factory.
|
||||
/// The `Transform` trait defines the interface of a Service factory. `Transform`
|
||||
/// is often implemented for middleware, defining how to manufacture a
|
||||
/// middleware Service. A Service that is manufactured by the factory takes
|
||||
/// the Service that follows it during execution as a parameter, assuming
|
||||
/// ownership of the next Service. A Service can be a variety of types, such
|
||||
/// as (but not limited to) another middleware Service, an extractor Service,
|
||||
/// other helper Services, or the request handler endpoint Service.
|
||||
///
|
||||
/// A Service is created by the factory during server initialization.
|
||||
///
|
||||
/// Transform factory creates service that wraps other services.
|
||||
/// `Config` is a service factory configuration type.
|
||||
pub trait Transform<S> {
|
||||
/// Requests handled by the service.
|
||||
@@ -33,7 +40,7 @@ pub trait Transform<S> {
|
||||
/// The future response value.
|
||||
type Future: Future<Item = Self::Transform, Error = Self::InitError>;
|
||||
|
||||
/// Create and return a new service value asynchronously.
|
||||
/// Creates and returns a new Service component, asynchronously
|
||||
fn new_transform(&self, service: S) -> Self::Future;
|
||||
|
||||
/// Map this service's factory error to a different error,
|
||||
|
@@ -1,9 +1,16 @@
|
||||
# Changes
|
||||
|
||||
|
||||
## [0.3.5] - 2019-04-04
|
||||
|
||||
### Added
|
||||
|
||||
* Allow to send messages to `FramedTransport` via mpsc channel.
|
||||
|
||||
### Changed
|
||||
|
||||
* Remove 'static constraint from Clonable service
|
||||
|
||||
|
||||
## [0.3.4] - 2019-03-12
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "actix-utils"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix utils - various actix net related services"
|
||||
keywords = ["network", "framework", "async", "futures"]
|
||||
|
@@ -7,12 +7,12 @@ use futures::Poll;
|
||||
use super::cell::Cell;
|
||||
|
||||
/// Service that allows to turn non-clone service to a service with `Clone` impl
|
||||
pub struct CloneableService<T: 'static> {
|
||||
pub struct CloneableService<T> {
|
||||
service: Cell<T>,
|
||||
_t: PhantomData<Rc<()>>,
|
||||
}
|
||||
|
||||
impl<T: 'static> CloneableService<T> {
|
||||
impl<T> CloneableService<T> {
|
||||
pub fn new(service: T) -> Self
|
||||
where
|
||||
T: Service,
|
||||
@@ -24,7 +24,7 @@ impl<T: 'static> CloneableService<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: 'static> Clone for CloneableService<T> {
|
||||
impl<T> Clone for CloneableService<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
service: self.service.clone(),
|
||||
@@ -35,7 +35,7 @@ impl<T: 'static> Clone for CloneableService<T> {
|
||||
|
||||
impl<T> Service for CloneableService<T>
|
||||
where
|
||||
T: Service + 'static,
|
||||
T: Service,
|
||||
{
|
||||
type Request = T::Request;
|
||||
type Response = T::Response;
|
||||
|
Reference in New Issue
Block a user