pub struct LocateGuard(/* private fields */);Expand description
RAII guard that unlocks a session on drop.
Methods from Deref<Target = Session>§
Sourcepub fn remove_media_bug(&self, bug: MediaBugHandle) -> Result<()>
pub fn remove_media_bug(&self, bug: MediaBugHandle) -> Result<()>
Remove a media bug from the session. See: switch_core_media_bug_remove.
Sourcepub fn add_media_bug<F>(
&self,
function: Option<CString>,
target: Option<CString>,
flags: MediaBugFlags,
callback: F,
) -> Result<MediaBugHandle>
pub fn add_media_bug<F>( &self, function: Option<CString>, target: Option<CString>, flags: MediaBugFlags, callback: F, ) -> Result<MediaBugHandle>
Add a media bug to the session. See: switch_core_media_bug_add.
§Examples
use freeswitch_rs::{Session, MediaBugFlags};
use freeswitch_sys::{switch_abc_type_t, switch_media_bug_flag_t};
use std::ffi::CString;
let session = Session::locate("uuid").unwrap();
let handle = session.add_media_bug(
Some(CString::new("my_function").unwrap()),
None,
switch_media_bug_flag_t(switch_media_bug_flag_t::SWITCH_MEDIA_BUG_FLAG_READ),
|bug, abc_type| {
match abc_type {
switch_abc_type_t::SWITCH_ABC_TYPE_INIT => {
// Initialize
}
switch_abc_type_t::SWITCH_ABC_TYPE_READ => {
// Read media
}
switch_abc_type_t::SWITCH_ABC_TYPE_CLOSE => {
// Cleanup
}
_ => {}
}
true
}
).unwrap();Trait Implementations§
Source§impl Deref for LocateGuard
impl Deref for LocateGuard
Auto Trait Implementations§
impl Freeze for LocateGuard
impl RefUnwindSafe for LocateGuard
impl !Send for LocateGuard
impl !Sync for LocateGuard
impl Unpin for LocateGuard
impl UnwindSafe for LocateGuard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more