[zx-rs] Add try_create() variants for fallible object creation.

They are marked as deprecated to limit usage to only the minimum
needed to migrate callers of create() to the infallible API.

Bug: 115383
Change-Id: I8518ad88cc305738bfc3597d8e5c94792a6e8051
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/762426
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Fuchsia-Auto-Submit: Adam Perry <adamperry@google.com>
Reviewed-by: David Koloski <dkoloski@google.com>
diff --git a/src/lib/zircon/rust/src/channel.rs b/src/lib/zircon/rust/src/channel.rs
index 4dcc6a6..ee726a8 100644
--- a/src/lib/zircon/rust/src/channel.rs
+++ b/src/lib/zircon/rust/src/channel.rs
@@ -40,7 +40,19 @@
     /// Wraps the
     /// [zx_channel_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/channel_create.md)
     /// syscall.
+    #[allow(deprecated)]
     pub fn create() -> Result<(Channel, Channel), Status> {
+        Self::try_create()
+    }
+
+    /// Create a channel, resulting in a pair of `Channel` objects representing both
+    /// sides of the channel. Messages written into one may be read from the opposite.
+    ///
+    /// Wraps the
+    /// [zx_channel_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/channel_create.md)
+    /// syscall.
+    #[deprecated = "creation APIs will no longer be fallible in the future. Users should prefer `create`"]
+    pub fn try_create() -> Result<(Channel, Channel), Status> {
         unsafe {
             let mut handle0 = 0;
             let mut handle1 = 0;
diff --git a/src/lib/zircon/rust/src/event.rs b/src/lib/zircon/rust/src/event.rs
index a7b8f79..5f475cc 100644
--- a/src/lib/zircon/rust/src/event.rs
+++ b/src/lib/zircon/rust/src/event.rs
@@ -21,7 +21,16 @@
     /// Create an event object, an object which is signalable but nothing else. Wraps the
     /// [zx_event_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/event_create.md)
     /// syscall.
+    #[allow(deprecated)]
     pub fn create() -> Result<Event, Status> {
+        Self::try_create()
+    }
+
+    /// Create an event object, an object which is signalable but nothing else. Wraps the
+    /// [zx_event_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/event_create.md)
+    /// syscall.
+    #[deprecated = "creation APIs will no longer be fallible in the future. Users should prefer `create`"]
+    pub fn try_create() -> Result<Event, Status> {
         let mut out = 0;
         let opts = 0;
         let status = unsafe { sys::zx_event_create(opts, &mut out) };
diff --git a/src/lib/zircon/rust/src/eventpair.rs b/src/lib/zircon/rust/src/eventpair.rs
index ccca32f..069eb98 100644
--- a/src/lib/zircon/rust/src/eventpair.rs
+++ b/src/lib/zircon/rust/src/eventpair.rs
@@ -22,7 +22,16 @@
     /// Create an event pair, a pair of objects which can signal each other. Wraps the
     /// [zx_eventpair_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/eventpair_create.md)
     /// syscall.
+    #[allow(deprecated)]
     pub fn create() -> Result<(EventPair, EventPair), Status> {
+        Self::try_create()
+    }
+
+    /// Create an event pair, a pair of objects which can signal each other. Wraps the
+    /// [zx_eventpair_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/eventpair_create.md)
+    /// syscall.
+    #[deprecated = "creation APIs will no longer be fallible in the future. Users should prefer `create`"]
+    pub fn try_create() -> Result<(EventPair, EventPair), Status> {
         let mut out0 = 0;
         let mut out1 = 0;
         let options = 0;
diff --git a/src/lib/zircon/rust/src/port.rs b/src/lib/zircon/rust/src/port.rs
index d154e7c..761789c 100644
--- a/src/lib/zircon/rust/src/port.rs
+++ b/src/lib/zircon/rust/src/port.rs
@@ -345,7 +345,18 @@
     /// Wraps the
     /// [zx_port_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/port_create.md)
     /// syscall.
+    #[allow(deprecated)]
     pub fn create() -> Result<Port, Status> {
+        Self::try_create()
+    }
+
+    /// Create an IO port, allowing IO packets to be read and enqueued.
+    ///
+    /// Wraps the
+    /// [zx_port_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/port_create.md)
+    /// syscall.
+    #[deprecated = "creation APIs will no longer be fallible in the future. Users should prefer `create`"]
+    pub fn try_create() -> Result<Port, Status> {
         unsafe {
             let mut handle = 0;
             let opts = 0;
diff --git a/src/lib/zircon/rust/src/time.rs b/src/lib/zircon/rust/src/time.rs
index 8737155..ed8f02b 100644
--- a/src/lib/zircon/rust/src/time.rs
+++ b/src/lib/zircon/rust/src/time.rs
@@ -345,7 +345,17 @@
     /// Wraps the
     /// [zx_timer_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/timer_create.md)
     /// syscall.
+    #[allow(deprecated)]
     pub fn create() -> Result<Timer, Status> {
+        Self::try_create()
+    }
+
+    /// Create a timer, an object that can signal when a specified point in time has been reached.
+    /// Wraps the
+    /// [zx_timer_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/timer_create.md)
+    /// syscall.
+    #[deprecated = "creation APIs will no longer be fallible in the future. Users should prefer `create`"]
+    pub fn try_create() -> Result<Timer, Status> {
         let mut out = 0;
         let opts = 0;
         let status = unsafe {