mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-26 01:50:33 +00:00
sdp: Implement Borrow/BorrowMut/ToOwned for SDPMessage
This commit is contained in:
parent
af86d5745d
commit
1d2f77bb64
1 changed files with 25 additions and 1 deletions
|
@ -6,11 +6,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::borrow::{Borrow, BorrowMut, ToOwned};
|
||||
use std::ffi::CStr;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::ops;
|
||||
#[cfg(any(feature = "v1_8_1", feature = "dox"))]
|
||||
use std::ptr;
|
||||
|
||||
use ffi;
|
||||
|
@ -929,6 +929,30 @@ impl SDPMessageRef {
|
|||
}
|
||||
}
|
||||
|
||||
impl Borrow<SDPMessageRef> for SDPMessage {
|
||||
fn borrow(&self) -> &SDPMessageRef {
|
||||
&*self
|
||||
}
|
||||
}
|
||||
|
||||
impl BorrowMut<SDPMessageRef> for SDPMessage {
|
||||
fn borrow_mut(&mut self) -> &mut SDPMessageRef {
|
||||
&mut *self
|
||||
}
|
||||
}
|
||||
|
||||
impl ToOwned for SDPMessageRef {
|
||||
type Owned = SDPMessage;
|
||||
|
||||
fn to_owned(&self) -> SDPMessage {
|
||||
unsafe {
|
||||
let mut ptr = ptr::null_mut();
|
||||
ffi::gst_sdp_message_copy(&self.0, &mut ptr);
|
||||
from_glib_full(ptr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! define_iter(
|
||||
($name:ident, $typ:ty, $get_item:expr, $get_len:expr) => {
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Reference in a new issue