diff --git a/garnet/public/lib/fidl/rust/fidl/src/encoding.rs b/garnet/public/lib/fidl/rust/fidl/src/encoding.rs index ed04812c0bc2da9bd79e7c0514a13c43a68573d9..f1c2c1fb25ba4589a117ff942aed43411dcde082 100644 --- a/garnet/public/lib/fidl/rust/fidl/src/encoding.rs +++ b/garnet/public/lib/fidl/rust/fidl/src/encoding.rs @@ -1387,6 +1387,7 @@ type ZxInterrupt = zx::Interrupt; type ZxJob = zx::Job; type ZxLog = zx::Log; type ZxProcess = zx::Process; +type ZxResource = zx::Resource; type ZxSocket = zx::Socket; type ZxThread = zx::Thread; type ZxTimer = zx::Timer; @@ -1403,6 +1404,7 @@ handle_based_codable![ ZxJob, ZxLog, ZxProcess, + ZxResource, ZxSocket, ZxThread, ZxTimer, diff --git a/garnet/public/rust/fuchsia-zircon/src/lib.rs b/garnet/public/rust/fuchsia-zircon/src/lib.rs index 06279813d1c3c40b19969e3c7bf2ed3381b8e68f..7f45e34e3e19b23ced205066ca3382fae9e561aa 100644 --- a/garnet/public/rust/fuchsia-zircon/src/lib.rs +++ b/garnet/public/rust/fuchsia-zircon/src/lib.rs @@ -152,6 +152,7 @@ mod log; mod port; mod process; mod property; +mod resource; mod rights; mod socket; mod signals; @@ -175,6 +176,7 @@ pub use self::log::*; pub use self::port::*; pub use self::process::*; pub use self::property::*; +pub use self::resource::*; pub use self::rights::*; pub use self::socket::*; pub use self::signals::*; diff --git a/garnet/public/rust/fuchsia-zircon/src/resource.rs b/garnet/public/rust/fuchsia-zircon/src/resource.rs new file mode 100644 index 0000000000000000000000000000000000000000..8224a034a03eedd4f28688bf9c6bd23396dcbdec --- /dev/null +++ b/garnet/public/rust/fuchsia-zircon/src/resource.rs @@ -0,0 +1,15 @@ +// Copyright 2019 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Type-safe bindings for Zircon resources. + +use crate::{AsHandleRef, HandleBased, HandleRef, Handle}; + +/// An object representing a Zircon resource. +/// +/// As essentially a subtype of `Handle`, it can be freely interconverted. +#[derive(Debug, Eq, PartialEq)] +#[repr(transparent)] +pub struct Resource(Handle); +impl_handle_based!(Resource);