mirror of
https://github.com/async-rs/async-std.git
synced 2025-04-02 06:26:41 +00:00
Merge #255
255: Update futures-preview to 0.3.0-alpha.19 r=skade a=taiki-e Depends on https://github.com/rustasync/surf/pull/74 Refs: * https://github.com/rust-lang-nursery/futures-rs/issues/1761 * https://github.com/rust-lang-nursery/futures-rs/pull/1845 cc @skade @stjepang @yoshuawuyts Co-authored-by: Taiki Endo <te316e89@gmail.com>
This commit is contained in:
commit
98c79f4ff9
5 changed files with 21 additions and 11 deletions
15
Cargo.toml
15
Cargo.toml
|
@ -30,8 +30,8 @@ async-task = "1.0.0"
|
|||
cfg-if = "0.1.9"
|
||||
crossbeam-channel = "0.3.9"
|
||||
crossbeam-deque = "0.7.1"
|
||||
futures-core-preview = "=0.3.0-alpha.18"
|
||||
futures-io-preview = "=0.3.0-alpha.18"
|
||||
futures-core-preview = "=0.3.0-alpha.19"
|
||||
futures-io-preview = "=0.3.0-alpha.19"
|
||||
futures-timer = "0.4.0"
|
||||
lazy_static = "1.4.0"
|
||||
log = { version = "0.4.8", features = ["kv_unstable"] }
|
||||
|
@ -46,13 +46,10 @@ broadcaster = { version = "0.2.6", optional = true, default-features = false, fe
|
|||
|
||||
[dev-dependencies]
|
||||
femme = "1.2.0"
|
||||
surf = "1.0.2"
|
||||
# surf = "1.0.2"
|
||||
tempdir = "0.3.7"
|
||||
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
|
||||
|
||||
# These are used by the book for examples
|
||||
futures-channel-preview = "=0.3.0-alpha.18"
|
||||
futures-util-preview = "=0.3.0-alpha.18"
|
||||
|
||||
[dev-dependencies.futures-preview]
|
||||
version = "=0.3.0-alpha.18"
|
||||
features = ["std", "nightly", "async-await"]
|
||||
futures-channel-preview = "=0.3.0-alpha.19"
|
||||
futures-util-preview = "=0.3.0-alpha.19"
|
||||
|
|
|
@ -50,6 +50,6 @@ Add the following lines to `Cargo.toml`:
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
futures-preview = { version = "0.3.0-alpha.18", features = [ "async-await", "nightly" ] }
|
||||
futures-preview = { version = "0.3.0-alpha.19", features = [ "async-await" ] }
|
||||
async-std = "0.99"
|
||||
```
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* TODO: Once the next version of surf released, re-enable this example.
|
||||
//! Sends an HTTP request to the Rust website.
|
||||
|
||||
use async_std::task;
|
||||
|
@ -17,3 +18,6 @@ fn main() -> Result<(), surf::Exception> {
|
|||
Ok(())
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -461,6 +461,15 @@ extension_trait! {
|
|||
}
|
||||
}
|
||||
|
||||
/// Initializes a buffer if necessary.
|
||||
///
|
||||
/// Currently, a buffer is always initialized because `read_initializer`
|
||||
/// feature is not stable.
|
||||
#[inline]
|
||||
unsafe fn initialize<R: futures_io::AsyncRead>(_reader: &R, buf: &mut [u8]) {
|
||||
std::ptr::write_bytes(buf.as_mut_ptr(), 0, buf.len())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::io;
|
||||
|
|
|
@ -64,7 +64,7 @@ pub fn read_to_end_internal<R: Read + ?Sized>(
|
|||
g.buf.reserve(32);
|
||||
let capacity = g.buf.capacity();
|
||||
g.buf.set_len(capacity);
|
||||
rd.initializer().initialize(&mut g.buf[g.len..]);
|
||||
super::initialize(&rd, &mut g.buf[g.len..]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue