summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alan Stokes <alanstokes@google.com> 2021-09-23 10:30:47 +0100
committer Alan Stokes <alanstokes@google.com> 2021-09-23 10:31:21 +0100
commit1a49e4fd6c819c809b51e1bfc5a347daa91c3477 (patch)
treee7202617c3f1139de10796cdc348e5e828d9c149
parentabecf2e90ab29259a69bc472b6015485f9e1bc2b (diff)
Document functions that may panic.
Test: Still builds Change-Id: I17aa80ba354b739a41f21386b3c62f455ee69423
-rw-r--r--libs/binder/rust/src/native.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/binder/rust/src/native.rs b/libs/binder/rust/src/native.rs
index e7c33960e2..a91092e2d4 100644
--- a/libs/binder/rust/src/native.rs
+++ b/libs/binder/rust/src/native.rs
@@ -441,6 +441,8 @@ unsafe impl<B: Remotable> AsNative<sys::AIBinder> for Binder<B> {
///
/// Registers the given binder object with the given identifier. If successful,
/// this service can then be retrieved using that identifier.
+///
+/// This function will panic if the identifier contains a 0 byte (NUL).
pub fn add_service(identifier: &str, mut binder: SpIBinder) -> Result<()> {
let instance = CString::new(identifier).unwrap();
let status = unsafe {
@@ -462,6 +464,8 @@ pub fn add_service(identifier: &str, mut binder: SpIBinder) -> Result<()> {
///
/// If any service in the process is registered as lazy, all should be, otherwise
/// the process may be shut down while a service is in use.
+///
+/// This function will panic if the identifier contains a 0 byte (NUL).
pub fn register_lazy_service(identifier: &str, mut binder: SpIBinder) -> Result<()> {
let instance = CString::new(identifier).unwrap();
let status = unsafe {