fidl_constants/
lib.rs

1// Copyright 2019 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
5//! This is a simple Rust crate to hold some constants so that they can easily
6//! be shared between various different FIDL bindings that are implemented in
7//! Rust.
8//!
9//! It's in some ways the moral equivalent of //zircon/system/public/zircon/fidl.h
10
11/// The maximum recursion depth of encoding and decoding. Each pointer to an
12/// out-of-line object counts as one step in the recursion depth.
13pub const MAX_RECURSION: usize = 32;
14
15/// The maximum number of handles allowed in a FIDL message.
16///
17/// Note that this number is one less for large messages for the time being. See
18/// (https://fxbug.dev/42068341) for progress, or to report problems caused by
19/// this specific limitation.
20pub const MAX_HANDLES: usize = 64;
21
22/// Indicates that an optional value is present.
23pub const ALLOC_PRESENT_U64: u64 = u64::MAX;
24/// Indicates that an optional value is present.
25pub const ALLOC_PRESENT_U32: u32 = u32::MAX;
26/// Indicates that an optional value is absent.
27pub const ALLOC_ABSENT_U64: u64 = 0;
28/// Indicates that an optional value is absent.
29pub const ALLOC_ABSENT_U32: u32 = 0;
30
31/// Special ordinal signifying an epitaph message.
32pub const EPITAPH_ORDINAL: u64 = 0xffffffffffffffffu64;
33
34/// The current wire format magic number
35pub const MAGIC_NUMBER_INITIAL: u8 = 1;