Note: This document covers API impact only. For more details, see the ABI compatibility page
- | init | step 1 | step 2 | step 3 | step 4 |
---|---|---|---|---|---|
fidl | link | link | link | ||
dart | link | link | |||
go | link | link | |||
hlcpp | link | link | |||
llcpp | link | link | |||
rust | link | link | link |
protocol Example { -> OnExistingEvent(); };
class Server extends fidllib.Example { final _onExistingEventStreamController = StreamController<void>(); @override Stream<void> get onExistingEvent => _onExistingEventStreamController.stream; } void expectEvents(fidllib.ExampleProxy client) async { await client.onExistingEvent.first; }
func expectEvents(c *lib.ExampleWithCtxInterface) {
_ = c.ExpectOnExistingEvent(context.Background())
}
func sendEvents(p *lib.ExampleEventProxy) {
_ = p.OnExistingEvent()
}
void expectEvents(fidl_test::ExamplePtr* client) { client->events().OnExistingEvent = []() {}; } void sendEvents(fidl::Binding<fidl_test::Example>* server) { server->events().OnExistingEvent(); }
class AsyncEventHandler : public fidl::WireAsyncEventHandler<fidl_test::Example> { void OnExistingEvent(fidl::WireResponse<fidl_test::Example::OnExistingEvent>* event) override {} }; class SyncEventHandler : public fidl::WireSyncEventHandler<fidl_test::Example> { void OnExistingEvent(fidl::WireResponse<fidl_test::Example::OnExistingEvent>* event) override {} }; void sendEvents(fidl::ServerBindingRef<fidl_test::Example> server) { server->OnExistingEvent(); }
fn send_events(stream: fidl_lib::ExampleRequestStream) -> Result<(), fidl::Error> { let control_handle = stream.control_handle(); control_handle.send_on_existing_event()?; Ok(()) } async fn receive_events(client: fidl_lib::ExampleProxy) -> Result<(), fidl::Error> { let mut event_stream = client.take_event_stream(); while let Some(event) = event_stream.try_next().await? { match event { fidl_lib::ExampleEvent::OnExistingEvent { .. } => {} } } Ok(()) }
#[allow(unreachable_patterns)]
and a catch-all arm (_
) to any client event stream match statementsfn send_events(stream: fidl_lib::ExampleRequestStream) -> Result<(), fidl::Error> { let control_handle = stream.control_handle(); control_handle.send_on_existing_event()?; Ok(()) } async fn receive_events(client: fidl_lib::ExampleProxy) -> Result<(), fidl::Error> { let mut event_stream = client.take_event_stream(); while let Some(event) = event_stream.try_next().await? { + #[allow(unreachable_patterns)] match event { fidl_lib::ExampleEvent::OnExistingEvent { .. } => {} + _ => {} } } Ok(()) }
[Transitional]
attribute.protocol Example { -> OnExistingEvent(); + @transitional + -> OnNewEvent(); };
class Server extends fidllib.Example { final _onExistingEventStreamController = StreamController<void>(); + final _onNewEventStreamController = StreamController<void>(); @override Stream<void> get onExistingEvent => _onExistingEventStreamController.stream; + + @override + Stream<void> get onNewEvent => _onNewEventStreamController.stream; } void expectEvents(fidllib.ExampleProxy client) async { await client.onExistingEvent.first; + await client.onNewEvent.first; }
func expectEvents(c *lib.ExampleWithCtxInterface) { _ = c.ExpectOnExistingEvent(context.Background()) + _ = c.ExpectOnNewEvent(context.Background()) } func sendEvents(p *lib.ExampleEventProxy) { _ = p.OnExistingEvent() + _ = p.OnNewEvent() }
void expectEvents(fidl_test::ExamplePtr* client) { client->events().OnExistingEvent = []() {}; + client->events().OnNewEvent = []() {}; } - void sendEvents(fidl::Binding<fidl_test::Example>* server) { server->events().OnExistingEvent(); } + void sendEvents(fidl::Binding<fidl_test::Example>* server) { + server->events().OnExistingEvent(); + server->events().OnNewEvent(); + }
class AsyncEventHandler : public fidl::WireAsyncEventHandler<fidl_test::Example> { void OnExistingEvent(fidl::WireResponse<fidl_test::Example::OnExistingEvent>* event) override {} + void OnNewEvent(fidl::WireResponse<fidl_test::Example::OnNewEvent>* event) override {} }; class SyncEventHandler : public fidl::WireSyncEventHandler<fidl_test::Example> { void OnExistingEvent(fidl::WireResponse<fidl_test::Example::OnExistingEvent>* event) override {} + void OnNewEvent(fidl::WireResponse<fidl_test::Example::OnNewEvent>* event) override {} }; - void sendEvents(fidl::ServerBindingRef<fidl_test::Example> server) { server->OnExistingEvent(); } + void sendEvents(fidl::ServerBindingRef<fidl_test::Example> server) { + server->OnExistingEvent(); + server->OnNewEvent(); + }
#[allow(unreachable_patterns)]
attribute and replace the catch-all arm with the new event.fn send_events(stream: fidl_lib::ExampleRequestStream) -> Result<(), fidl::Error> { let control_handle = stream.control_handle(); control_handle.send_on_existing_event()?; + control_handle.send_on_new_event()?; Ok(()) } async fn receive_events(client: fidl_lib::ExampleProxy) -> Result<(), fidl::Error> { let mut event_stream = client.take_event_stream(); while let Some(event) = event_stream.try_next().await? { - #[allow(unreachable_patterns)] match event { fidl_lib::ExampleEvent::OnExistingEvent { .. } => {} - _ => {} + fidl_lib::ExampleEvent::OnNewEvent { .. } => {} } } Ok(()) }
[Transitional]
attribute.protocol Example { -> OnExistingEvent(); - @transitional -> OnNewEvent(); };