pub struct ViewRef {
pub reference: EventPair,
}
Expand description
A ViewRef is a handle to a kernel object which identifies a unique View across the system. Two ViewRefs to the same View have the same KOID.
Clients use a ViewRef to identify a View, to validate a View, and to receive a View invalidation signal.
As part of View creation, the client creates a linked ViewRef/ViewRefControl pair and hands the pair to Scenic (ViewRefControl is described below). The client must remove the ViewRef’s signal capabilities; otherwise the View is not created.
The client may freely clone its ViewRef and share it, even before sending it to Scenic.
Example 1. Accessibility accepts a ViewRef from a client to group the semantic nodes, and semantic operations, associated with a client’s View. It must validate a client’s ViewRef with Scenic.
Example 2. We use ViewRefs to create a FocusChain, which identifies Views considered as “in-focus” down the View hierarchy. When a View is destroyed, Scenic signals to all FocusChain holders that the ViewRef is now invalid.
Fields§
§reference: EventPair
Trait Implementations§
Source§impl Decode<ViewRef, DefaultFuchsiaResourceDialect> for ViewRef
impl Decode<ViewRef, DefaultFuchsiaResourceDialect> for ViewRef
Source§impl<T0: Encode<HandleType<EventPair, { _ }, 2147483648>, DefaultFuchsiaResourceDialect>> Encode<ViewRef, DefaultFuchsiaResourceDialect> for (T0,)
impl<T0: Encode<HandleType<EventPair, { _ }, 2147483648>, DefaultFuchsiaResourceDialect>> Encode<ViewRef, DefaultFuchsiaResourceDialect> for (T0,)
Source§impl Ord for ViewRef
impl Ord for ViewRef
Source§impl PartialOrd for ViewRef
impl PartialOrd for ViewRef
Source§impl ResourceTypeMarker for ViewRef
impl ResourceTypeMarker for ViewRef
Source§type Borrowed<'a> = &'a mut ViewRef
type Borrowed<'a> = &'a mut ViewRef
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 ViewRef
impl TypeMarker for ViewRef
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
.§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 more§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.