From 8a5131febb1bf8b3f9b64c35379a467b86e9ab31 Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Sun, 12 May 2019 14:14:58 +0900 Subject: [PATCH] Add initialize_with_name to SBListener --- src/listener.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/listener.rs b/src/listener.rs index e0598982..2b79ac1f 100644 --- a/src/listener.rs +++ b/src/listener.rs @@ -23,6 +23,12 @@ impl SBListener { SBListener::wrap(unsafe { sys::CreateSBListener() }) } + /// Construct a new `SBListener` with name. + pub fn new_with_name(name: &str) -> SBListener { + let name = CString::new(name).unwrap(); + SBListener::wrap(unsafe { sys::CreateSBListener2(name.as_ptr()) }) + } + /// Construct a new `SBListener`. pub fn wrap(raw: sys::SBListenerRef) -> SBListener { SBListener { raw }