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();
OldMethod();
};
class Server extends fidllib.Example {
@override
Future<void> existingMethod() async {}
@override
Future<void> oldMethod() async {}
}
void client(fidllib.ExampleProxy client) async {
await client.existingMethod();
await client.oldMethod();
}
type client struct {
removeMethod *lib.ExampleWithCtxInterface
}
func (c client) test() {
c.removeMethod.ExistingMethod(context.Background())
c.removeMethod.OldMethod(context.Background())
}
type server struct{}
// Assert that server implements the Example interface
var _ lib.ExampleWithCtx = &server{}
func (*server) ExistingMethod(fidl.Context) error {
return nil
}
func (*server) OldMethod(fidl.Context) error {
return nil
}
class Server : public fidl_test::Example {
void ExistingMethod() final {}
void OldMethod() final {}
};
void client(fidl_test::ExamplePtr client) {
client->ExistingMethod();
client->OldMethod();
}
class Server final : public fidl::WireServer<fidl_test::Example> {
public:
void ExistingMethod(ExistingMethodRequestView request,
ExistingMethodCompleter::Sync& completer) final {}
void OldMethod(OldMethodRequestView request, OldMethodCompleter::Sync& completer) final {}
};
void client(fidl::WireClient<fidl_test::Example> client) {
client->ExistingMethod();
client->OldMethod();
}
struct ExampleFakeProxy;
impl fidl_lib::ExampleProxyInterface for ExampleFakeProxy {
fn existing_method(&self) -> Result<(), fidl::Error> {
Ok(())
}
fn old_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 { .. } => {}
fidl_lib::ExampleRequest::OldMethod { .. } => {}
}
}
Ok(())
}
- Mark the method that is being removed with the
[Transitional]
attribute.
protocol Example {
ExistingMethod();
+ @transitional
OldMethod();
};
- Remove references to the method in client code and server code.
class Server extends fidllib.Example {
@override
Future<void> existingMethod() async {}
-
- @override
- Future<void> oldMethod() async {}
}
void client(fidllib.ExampleProxy client) async {
await client.existingMethod();
- await client.oldMethod();
}
- Embed the protocol's
WithCtxTransitionBase
struct into the server type. - Remove the implementation for the method being removed from the server.
- Remove any references to the method in client code (e.g. request calls being made)
type client struct {
removeMethod *lib.ExampleWithCtxInterface
}
func (c client) test() {
c.removeMethod.ExistingMethod(context.Background())
- c.removeMethod.OldMethod(context.Background())
}
- type server struct{}
+ type server struct {
+ lib.ExampleWithCtxInterface
+ }
// Assert that server implements the Example interface
var _ lib.ExampleWithCtx = &server{}
func (*server) ExistingMethod(fidl.Context) error {
return nil
}
- func (*server) OldMethod(fidl.Context) error {
- return nil
- }
-
- Remove references to the method in client code and server code.
class Server : public fidl_test::Example {
void ExistingMethod() final {}
- void OldMethod() final {}
};
- void client(fidl_test::ExamplePtr client) {
- client->ExistingMethod();
- client->OldMethod();
- }
+ void client(fidl_test::ExamplePtr client) { client->ExistingMethod(); }
- Remove references to the method in client code and server code.
class Server final : public fidl::WireServer<fidl_test::Example> {
public:
void ExistingMethod(ExistingMethodRequestView request,
ExistingMethodCompleter::Sync& completer) final {}
- void OldMethod(OldMethodRequestView request, OldMethodCompleter::Sync& completer) final {}
};
- void client(fidl::WireClient<fidl_test::Example> client) {
- client->ExistingMethod();
- client->OldMethod();
- }
+ void client(fidl::WireClient<fidl_test::Example> client) { client->ExistingMethod(); }
- Add #[allow(unreachable_patterns)] to the server's request stream match.
- Replace the match arm for the method that is being removed with a catchall (
_
) arm. - Remove any references to the method in client code (e.g. as part of implementations of the
ProxyInterface
).
struct ExampleFakeProxy;
impl fidl_lib::ExampleProxyInterface for ExampleFakeProxy {
fn existing_method(&self) -> Result<(), fidl::Error> {
- Ok(())
- }
- fn old_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::OldMethod { .. } => {}
+ _ => {}
}
}
Ok(())
}
- Remove the method.
protocol Example {
ExistingMethod();
- @transitional
- OldMethod();
};
- Remove the embedded
WithCtxInterface
struct.
type client struct {
removeMethod *lib.ExampleWithCtxInterface
}
func (c client) test() {
c.removeMethod.ExistingMethod(context.Background())
}
- type server struct {
- lib.ExampleWithCtxInterface
- }
+ type server struct{}
// Assert that server implements the Example interface
var _ lib.ExampleWithCtx = &server{}
func (*server) ExistingMethod(fidl.Context) error {
return nil
}
- Remove the
#[allow(unreachable_patterns)]
attribute and the catch-all match arm.
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(())
}