fix doctest
This commit is contained in:
parent
a77c3d89c8
commit
44d7461ea2
1 changed files with 4 additions and 1 deletions
|
@ -33,14 +33,17 @@ impl<IO: AsyncReadExt + Unpin> Response<IO> {
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # async fn req(client: tokio_gemini::Client) -> Result<(), tokio_gemini::LibError> {
|
||||||
/// match client.request("gemini://dc09.ru").await?.ensure_ok() {
|
/// match client.request("gemini://dc09.ru").await?.ensure_ok() {
|
||||||
/// Ok(resp) => {
|
/// Ok(mut resp) => {
|
||||||
/// println!("{}", resp.text().await?);
|
/// println!("{}", resp.text().await?);
|
||||||
/// }
|
/// }
|
||||||
/// Err(resp) => {
|
/// Err(resp) => {
|
||||||
/// println!("{}", resp.message());
|
/// println!("{}", resp.message());
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
|
/// # Ok(())
|
||||||
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn ensure_ok(self) -> Result<Self, Self> {
|
pub fn ensure_ok(self) -> Result<Self, Self> {
|
||||||
if self.status.reply_type() == ReplyType::Success {
|
if self.status.reply_type() == ReplyType::Success {
|
||||||
|
|
Loading…
Reference in a new issue