pub async fn close(&self) -> Result<()> {
        if self.ready_state() == RTCDataChannelState::Closed {
            return Ok(());
        }

        self.set_ready_state(RTCDataChannelState::Closing);
        self.notify_tx.notify_waiters();

        let data_channel = self.data_channel.lock().await;
        if let Some(dc) = &*data_channel {
            Ok(dc.close().await?)
        } else {
            Ok(())
        }
    }
/// Close Closes the DataChannel. It may be called regardless of whether
/// the DataChannel object was created by this peer or the remote peer.
Close Closes the DataChannel. It may be called regardless of whether
the DataChannel object was created by this peer or the remote peer.
Close Closes the DataChannel . It may be called regardless of whether the DataChannel object was created by this peer or the remote peer .
pub async fn close(&self) -> Result<()> {
        if self.ready_state() == RTCDataChannelState::Closed {
            return Ok(());
        }
        self.set_ready_state(RTCDataChannelState::Closing);
        self.notify_tx.notify_waiters();
        let data_channel = self.data_channel.lock().await;
        if let Some(dc) = &*data_channel {
            Ok(dc.close().await?)
        } else {
            Ok(())
        }
    }
pub async fn close ( & self ) -> Result < ( ) > { if self . ready_state ( ) == RTCDataChannelState :: Closed { return Ok ( ( ) ) ; } self . set_ready_state ( RTCDataChannelState :: Closing ) ; self . notify_tx . notify_waiters ( ) ; let data_channel = self . data_channel . lock ( ) . await ; if let Some ( dc ) = & * data_channel { Ok ( dc . close ( ) . await ? ) } else { Ok ( ( ) ) } }
Close Closes the DataChannel.
Close Closes the DataChannel .
&self