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 | link | ||
hlcpp | link | link | |||
llcpp | link | link | |||
rust | link | link | link |
protocol Example {
ExistingMethod();
};
class Server extends fidllib.Example {
@override
Future<void> existingMethod() async {}
}
void client(fidllib.ExampleProxy client) async {
await client.existingMethod();
}
type client struct {
addMethod *lib.ExampleWithCtxInterface
}
func (c client) test() {
c.addMethod.ExistingMethod(context.Background())
}
type server struct{}
// Assert that server implements the Example interface
var _ lib.ExampleWithCtx = &server{}
func (*server) ExistingMethod(fidl.Context) error {
return nil
}
class Server : public fidl_test::Example {
void ExistingMethod() final {}
};
void client(fidl_test::ExamplePtr client) { client->ExistingMethod(); }
class Server final : public fidl::WireServer<fidl_test::Example> {
public:
void ExistingMethod(ExistingMethodRequestView request,
ExistingMethodCompleter::Sync& completer) final {}
};
void client(fidl::WireClient<fidl_test::Example> client) { client->ExistingMethod(); }
struct ExampleFakeProxy;
impl fidl_lib::ExampleProxyInterface for ExampleFakeProxy {
fn existing_method(&self) -> Result<(), fidl::Error> {
Ok(())
}
}
async fn example_service(chan: fasync::Channel) -> Result<(), fidl::Error> {
let mut stream = fidl_lib::ExampleRequestStream::from_channel(chan);
while let Some(req) = stream.try_next().await? {
match req {
fidl_lib::ExampleRequest::ExistingMethod { .. } => {}
}
}
Ok(())
}
- Embed the protocol's
WithCtxTransitionBase
struct into the server type.
type client struct {
addMethod *lib.ExampleWithCtxInterface
}
func (c client) test() {
c.addMethod.ExistingMethod(context.Background())
}
- type server struct{}
+ type server struct {
+ lib.ExampleWithCtxTransitionalBase
+ }
// Assert that server implements the Example interface
var _ lib.ExampleWithCtx = &server{}
func (*server) ExistingMethod(fidl.Context) error {
return nil
}
- Add
#[allow(unreachable_patterns)]
to the server's request stream match. - Add an underscore arm to the server's request stream match.
struct ExampleFakeProxy;
impl fidl_lib::ExampleProxyInterface for ExampleFakeProxy {
fn existing_method(&self) -> Result<(), fidl::Error> {
Ok(())
}
}
async fn example_service(chan: fasync::Channel) -> Result<(), fidl::Error> {
let mut stream = fidl_lib::ExampleRequestStream::from_channel(chan);
while let Some(req) = stream.try_next().await? {
+ #[allow(unreachable_patterns)]
match req {
fidl_lib::ExampleRequest::ExistingMethod { .. } => {}
+ _ => {}
}
}
Ok(())
}
- Add the new method and mark it with the
[Transitional]
attribute.
protocol Example {
ExistingMethod();
+ @transitional
+ NewMethod();
};
- Add the new method to protocol implementations.
- Start using the new method in client code.
class Server extends fidllib.Example {
@override
Future<void> existingMethod() async {}
+
+ @override
+ Future<void> newMethod() async {}
}
void client(fidllib.ExampleProxy client) async {
await client.existingMethod();
+ await client.newMethod();
}
- Implement the new method for the server type.
- Remove the protocol's
WithCtxTransitionBase
struct from the server type. - Start using the new method in client code.
type client struct {
addMethod *lib.ExampleWithCtxInterface
}
func (c client) test() {
c.addMethod.ExistingMethod(context.Background())
+ c.addMethod.NewMethod(context.Background())
}
- type server struct {
- lib.ExampleWithCtxTransitionalBase
- }
+ type server struct{}
// Assert that server implements the Example interface
var _ lib.ExampleWithCtx = &server{}
func (*server) ExistingMethod(fidl.Context) error {
return nil
}
+ func (*server) NewMethod(fidl.Context) error {
+ return nil
+ }
+
- Add the new method to protocol implementations.
- Start using the new method in client code.
class Server : public fidl_test::Example {
void ExistingMethod() final {}
+ void NewMethod() final {}
};
- void client(fidl_test::ExamplePtr client) { client->ExistingMethod(); }
+ void client(fidl_test::ExamplePtr client) {
+ client->ExistingMethod();
+ client->NewMethod();
+ }
- Add the new method to protocol implementations.
- Start using the new method in client code.
class Server final : public fidl::WireServer<fidl_test::Example> {
public:
void ExistingMethod(ExistingMethodRequestView request,
ExistingMethodCompleter::Sync& completer) final {}
+ void NewMethod(NewMethodRequestView request, NewMethodCompleter::Sync& completer) final {}
};
- void client(fidl::WireClient<fidl_test::Example> client) { client->ExistingMethod(); }
+ void client(fidl::WireClient<fidl_test::Example> client) {
+ client->ExistingMethod();
+ client->NewMethod();
+ }
- Add the new method to the protocol's
ProxyInterface
implementation. - Remove
#[allow(unreachable_patterns)]
from the server's request stream match. - Replace the underscore arm in the server's request stream match with one that handles the new method.
struct ExampleFakeProxy;
impl fidl_lib::ExampleProxyInterface for ExampleFakeProxy {
fn existing_method(&self) -> Result<(), fidl::Error> {
+ Ok(())
+ }
+ fn new_method(&self) -> Result<(), fidl::Error> {
Ok(())
}
}
async fn example_service(chan: fasync::Channel) -> Result<(), fidl::Error> {
let mut stream = fidl_lib::ExampleRequestStream::from_channel(chan);
while let Some(req) = stream.try_next().await? {
- #[allow(unreachable_patterns)]
match req {
fidl_lib::ExampleRequest::ExistingMethod { .. } => {}
- _ => {}
+ fidl_lib::ExampleRequest::NewMethod { .. } => {}
}
}
Ok(())
}
- Remove the
[Transitional]
attribute from the new method.
protocol Example {
ExistingMethod();
- @transitional
NewMethod();
};