1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-13 04:58:21 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Nikolay Kim
9d1b428b34 undeprecate framed transport 2019-07-17 13:31:00 +06:00
Nikolay Kim
42d526bced mark some fn as unsafe 2019-07-17 11:16:38 +06:00
Nikolay Kim
23a230a83b deprecate ClonableService and FramedTransport 2019-07-17 10:57:52 +06:00
7 changed files with 36 additions and 15 deletions

View File

@@ -10,9 +10,9 @@ matrix:
include:
- rust: stable
- rust: beta
- rust: nightly-2019-03-02
- rust: nightly-2019-06-15
allow_failures:
- rust: nightly-2019-03-02
- rust: nightly-2019-06-15
env:
global:
@@ -25,8 +25,8 @@ before_install:
- sudo apt-get install -y openssl libssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev
before_cache: |
if [[ "$TRAVIS_RUST_VERSION" == "nightly-2019-03-02" ]]; then
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin
if [[ "$TRAVIS_RUST_VERSION" == "nightly-2019-06-15" ]]; then
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install --version 0.6.11 cargo-tarpaulin
fi
# Add clippy
@@ -35,14 +35,14 @@ before_script:
script:
- |
if [[ "$TRAVIS_RUST_VERSION" != "nightly-2019-03-02" ]]; then
if [[ "$TRAVIS_RUST_VERSION" != "nightly-2019-06-15" ]]; then
cargo clean
cargo test --all --all-features -- --nocapture
fi
after_success:
- |
if [[ "$TRAVIS_RUST_VERSION" == "nightly-2019-03-02" ]]; then
if [[ "$TRAVIS_RUST_VERSION" == "nightly-2019-06-15" ]]; then
taskset -c 0 cargo tarpaulin --all --all-features --out Xml
echo "Uploaded code coverage"
bash <(curl -s https://codecov.io/bash)

View File

@@ -1,5 +1,5 @@
# Changes
## [0.1.0] - 2019-xx-xx
## [0.1.0] - 2019-07-17
* Initial release

View File

@@ -29,7 +29,7 @@ impl<T> Cell<T> {
}
}
pub fn get_mut(&mut self) -> &mut T {
unsafe { &mut *self.inner.as_ref().get() }
pub(crate) unsafe fn get_mut(&mut self) -> &mut T {
&mut *self.inner.as_ref().get()
}
}

View File

@@ -153,7 +153,7 @@ where
};
let mut cell = self.inner.clone();
cell.get_mut().task.register();
unsafe { cell.get_mut().task.register() };
tokio_current_thread::spawn(
self.service
.call(Item::new(self.state.clone(), self.sink.clone(), item))
@@ -163,9 +163,11 @@ where
Ok(None) => return Ok(()),
Err(err) => Err(err),
};
let inner = cell.get_mut();
inner.buf.push_back(item);
inner.task.notify();
unsafe {
let inner = cell.get_mut();
inner.buf.push_back(item);
inner.task.notify();
}
Ok(())
}),
);
@@ -181,7 +183,7 @@ where
/// write to framed object
fn poll_write(&mut self) -> bool {
let inner = self.inner.get_mut();
let inner = unsafe { self.inner.get_mut() };
let mut rx_done = self.rx.is_none();
let mut buf_empty = inner.buf.is_empty();
loop {

View File

@@ -1,5 +1,21 @@
# Changes
## [0.4.4] - 2019-07-17
### Changed
* Undeprecate `FramedTransport` as it is actually useful
## [0.4.3] - 2019-07-17
### Deprecated
* Deprecate `CloneableService` as it is not safe and in general not very useful
* Deprecate `FramedTransport` in favor of `actix-ioframe`
## [0.4.2] - 2019-06-26
### Fixed

View File

@@ -1,6 +1,6 @@
[package]
name = "actix-utils"
version = "0.4.2"
version = "0.4.4"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix utils - various actix net related services"
keywords = ["network", "framework", "async", "futures"]

View File

@@ -1,3 +1,4 @@
#![allow(deprecated)]
use std::marker::PhantomData;
use std::rc::Rc;
@@ -6,6 +7,8 @@ use futures::Poll;
use super::cell::Cell;
#[doc(hidden)]
#[deprecated(since = "0.4.3", note = "support will be removed in actix-utils 0.4.5")]
/// Service that allows to turn non-clone service to a service with `Clone` impl
pub struct CloneableService<T> {
service: Cell<T>,