Skip to content

Commit 7611518

Browse files
authored
Merge pull request #416 from richardanaya/master
Make send_text generic for ergonomics sake
2 parents bc573b0 + 3d8b296 commit 7611518

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

webrtc/src/data_channel/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,12 @@ impl RTCDataChannel {
376376
}
377377

378378
/// send_text sends the text message to the DataChannel peer
379-
pub async fn send_text(&self, s: String) -> Result<usize> {
379+
pub async fn send_text(&self, s: impl Into<String>) -> Result<usize> {
380380
self.ensure_open()?;
381381

382382
let data_channel = self.data_channel.lock().await;
383383
if let Some(dc) = &*data_channel {
384-
Ok(dc.write_data_channel(&Bytes::from(s), true).await?)
384+
Ok(dc.write_data_channel(&Bytes::from(s.into()), true).await?)
385385
} else {
386386
Err(Error::ErrClosedPipe)
387387
}

0 commit comments

Comments
 (0)