mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
docs: deal with Result instead of using unwrap (#860)
This commit is contained in:
committed by
Toby Lawrence
parent
983e9d1b67
commit
91f20e33a4
@@ -49,11 +49,12 @@
|
|||||||
//! use bytes::Bytes;
|
//! use bytes::Bytes;
|
||||||
//! use futures::{Sink, Future};
|
//! use futures::{Sink, Future};
|
||||||
//!
|
//!
|
||||||
//! fn write_frame<T: AsyncRead + AsyncWrite>(io: T) {
|
//! fn write_frame<T: AsyncRead + AsyncWrite>(io: T) -> Result<(), Box<std::error::Error>> {
|
||||||
//! let mut transport = Framed::new(io, LengthDelimitedCodec::new());
|
//! let mut transport = Framed::new(io, LengthDelimitedCodec::new());
|
||||||
//! let frame = Bytes::from("hello world");
|
//! let frame = Bytes::from("hello world");
|
||||||
//!
|
//!
|
||||||
//! transport.send(frame).wait().unwrap();
|
//! transport.send(frame).wait()?;
|
||||||
|
//! Ok(())
|
||||||
//! }
|
//! }
|
||||||
//! #
|
//! #
|
||||||
//! # pub fn main() {}
|
//! # pub fn main() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user