template <class Data>

class HangingGetHelper

Defined at line 44 of file ../../src/ui/scenic/lib/flatland/hanging_get_helper.h

A helper class for managing [hanging get

semantics](https://fuchsia.dev/fuchsia-src/development/api/fidl.md#delay-responses-using-hanging-gets).

It responds with the most recently updated value.

For each hanging get method in a FIDL interface, like GetData() -> ( Data response ), create one

of these classes. Any time the response should change, call Update(Data x). Any time the client

calls GetFoo(), set the callback on this helper. Once the callback has been set and the data has

been updated, the callback will be triggered with the new data.

Each callback will only be triggered once. Each Update will only trigger, at most, a single

callback. Update(Data x) is idempotent. Calling it with the same value will not trigger a new

execution of a registered callback, nor will it remove the registered callback.

The templated Data parameter must be a FIDL type, one that supports both fidl::Clone and

fidl::Equals.

TODO(https://fxbug.dev/351845529): the reliance on fidl::Clone and fidl::Equals is a roadblock

for completing the migration from HLCPP->Natural bindings; there are no analogous operations for

natural types.

Public Methods

void HangingGetHelper<Data> ()

Defined at line 48 of file ../../src/ui/scenic/lib/flatland/hanging_get_helper.h

void Update (Data data)

Defined at line 50 of file ../../src/ui/scenic/lib/flatland/hanging_get_helper.h

void SetCallback (Callback callback)

Defined at line 61 of file ../../src/ui/scenic/lib/flatland/hanging_get_helper.h

bool HasPendingCallback ()

Defined at line 68 of file ../../src/ui/scenic/lib/flatland/hanging_get_helper.h