gstreamer-rs/gstreamer-rtsp-server/src/rtsp_address_pool.rs
Marijn Suijten 540062b97c Add missing doc aliases to manual code
Using the same script as [1], called with:

    python3 add_doc_alias.py gstreamer*/**/src

[1]: https://github.com/gtk-rs/gtk-rs-core/pull/83
2021-05-19 22:36:18 +02:00

46 lines
1.2 KiB
Rust

// Take a look at the license at the top of the repository in the LICENSE file.
use crate::RTSPAddress;
use crate::RTSPAddressPool;
use crate::RTSPAddressPoolResult;
use glib::prelude::*;
use glib::translate::*;
use std::ptr;
pub trait RTSPAddressPoolExtManual: 'static {
#[doc(alias = "gst_rtsp_address_pool_reserve_address")]
fn reserve_address(
&self,
ip_address: &str,
port: u32,
n_ports: u32,
ttl: u32,
) -> Result<RTSPAddress, RTSPAddressPoolResult>;
}
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {
fn reserve_address(
&self,
ip_address: &str,
port: u32,
n_ports: u32,
ttl: u32,
) -> Result<RTSPAddress, RTSPAddressPoolResult> {
unsafe {
let mut address = ptr::null_mut();
let ret = from_glib(ffi::gst_rtsp_address_pool_reserve_address(
self.as_ref().to_glib_none().0,
ip_address.to_glib_none().0,
port,
n_ports,
ttl,
&mut address,
));
match ret {
RTSPAddressPoolResult::Ok => Ok(from_glib_full(address)),
_ => Err(ret),
}
}
}
}