Unverified Commit 007f1bfc authored by Julian Antonielli's avatar Julian Antonielli Committed by GitHub
Browse files

Use pin-utils crate instead of vendoring pin_mut (#1862)

parent 521fa8d0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ http-body = "0.4.4"
once_cell = "1.10"
percent-encoding = "2.1.0"
pin-project-lite = "0.2.9"
pin-utils = "0.1.0"
tracing = "0.1"

# We are using hyper for our streaming body implementation, but this is an internal detail.
+1 −1
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ impl<B> Inner<B> {
    {
        let mut output = SegmentedBuf::new();
        let body = self.body;
        crate::pin_mut!(body);
        pin_utils::pin_mut!(body);
        while let Some(buf) = body.data().await {
            output.push(buf?);
        }
+0 −1
Original line number Diff line number Diff line
@@ -36,5 +36,4 @@ pub mod event_stream;

pub mod byte_stream;

mod pin_util;
mod urlencode;
+1 −1
Original line number Diff line number Diff line
@@ -10,11 +10,11 @@

use crate::body::SdkBody;
use crate::operation;
use crate::pin_mut;
use crate::response::ParseHttpResponse;
use crate::result::{SdkError, SdkSuccess};
use bytes::{Buf, Bytes};
use http_body::Body;
use pin_utils::pin_mut;
use std::error::Error;
use std::future::Future;
use tracing::trace;
+0 −30
Original line number Diff line number Diff line
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

/// Pins a value on the stack.
///
/// # Examples
///
/// ```rust
/// # use core::pin::Pin;
/// # struct Foo {}
/// # use aws_smithy_http::pin_mut;
/// let foo = Foo { /* ... */ };
/// pin_mut!(foo);
/// let _: Pin<&mut Foo> = foo;
/// ```
#[macro_export]
macro_rules! pin_mut {
    ($($x:ident),* $(,)?) => { $(
        // Move the value to ensure that it is owned
        let mut $x = $x;
        // Shadow the original binding so that it can't be directly accessed
        // ever again.
        #[allow(unused_mut)]
        let mut $x = unsafe {
            core::pin::Pin::new_unchecked(&mut $x)
        };
    )* }
}