object/handle.rs
1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use zx_types::zx_handle_t;
6
7/// A wrapper around a handle value received from userspace.
8#[repr(transparent)]
9#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)]
10pub struct HandleValue {
11 value: zx_handle_t,
12}
13
14impl HandleValue {
15 /// Constructs a new `HandleValue` from a raw handle value.
16 pub const fn new(value: zx_handle_t) -> Self {
17 Self { value }
18 }
19
20 /// Returns the underlying raw handle value.
21 pub fn raw_value(&self) -> zx_handle_t {
22 self.value
23 }
24}