pub struct FileHandle {
pub handle: Option<NullableHandle>,
pub flags: Option<FileFlags>,
pub fd: Option<i32>,
pub bag: Option<Vec<NullableHandle>>,
/* private fields */
}Expand description
The representation of an open file that can be transferred between the binder device driver and the client.
Fields§
§handle: Option<NullableHandle>The handle connecting to the file protocol. If not present, the file
should behave as it is was a null file: all read must succeed with empty
content and all write must succeed. See fdio_fd_create_null().
flags: Option<FileFlags>Optional. The flags associated with the opened file.
fd: Option<i32>Optional. The file descriptor to help with translation between processes.
bag: Option<Vec<NullableHandle>>Optional. An opaque bag of handles associated with the file.
If this field is set, handle must not be set.
In Fuchsia, there is an expectation that there is a 1:1 mapping between a file descriptor and a handle. In general, we do not want to violate that rule. This field is intended to used in very limited circumstances (compatibility with Linux and Binder), where we need to violate rule.
When this field is used, the composite_fd library will be used to create the file descriptor in a Fuchsia component. Such file descriptors do not support regular operations and must be handled using the composite_fd library.
Trait Implementations§
Source§impl Debug for FileHandle
impl Debug for FileHandle
Source§impl Decode<FileHandle, DefaultFuchsiaResourceDialect> for FileHandle
impl Decode<FileHandle, DefaultFuchsiaResourceDialect> for FileHandle
Source§impl Default for FileHandle
impl Default for FileHandle
Source§fn default() -> FileHandle
fn default() -> FileHandle
Source§impl Encode<FileHandle, DefaultFuchsiaResourceDialect> for &mut FileHandle
impl Encode<FileHandle, DefaultFuchsiaResourceDialect> for &mut FileHandle
Source§impl PartialEq for FileHandle
impl PartialEq for FileHandle
Source§impl ResourceTypeMarker for FileHandle
impl ResourceTypeMarker for FileHandle
Source§type Borrowed<'a> = &'a mut FileHandle
type Borrowed<'a> = &'a mut FileHandle
Encode<Self>
type cheaply obtainable from &mut Self::Owned. There are three cases: Read moreSource§fn take_or_borrow<'a>(
value: &'a mut <Self as TypeMarker>::Owned,
) -> Self::Borrowed<'a>
fn take_or_borrow<'a>( value: &'a mut <Self as TypeMarker>::Owned, ) -> Self::Borrowed<'a>
&mut Self::Owned to Self::Borrowed. For
HandleBased types this is “take” (it returns an owned handle and
replaces value with Handle::invalid), and for all other types it is
“borrow” (just converts from one reference to another).Source§impl TypeMarker for FileHandle
impl TypeMarker for FileHandle
Source§type Owned = FileHandle
type Owned = FileHandle
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align.Source§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned to a single memcpy. Read moreSource§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned to a single memcpy.