From b95c742d15cb3673dee20cebf0d95de3299135b4 Mon Sep 17 00:00:00 2001 From: Stephan Boyer Date: Fri, 8 Oct 2021 00:18:05 -0700 Subject: [PATCH] Wordsmith the README --- README.md | 141 ++-- integration_tests/rust/src/comprehensive.rs | 88 +- .../rust/src/schema_evolution.rs | 40 +- integration_tests/types/comprehensive/bar.t | 22 +- integration_tests/types/comprehensive/foo.t | 22 +- .../types/schema_evolution/after.t | 32 +- .../types/schema_evolution/before.t | 32 +- src/generate_rust.rs | 764 +++++++++--------- src/parser.rs | 36 +- src/schema.rs | 16 +- src/token.rs | 16 +- src/tokenizer.rs | 24 +- src/validator.rs | 2 +- 13 files changed, 640 insertions(+), 595 deletions(-) diff --git a/README.md b/README.md index 0df60120..e2a619f9 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,9 @@ [![Build status](https://github.com/stepchowfun/typical/workflows/Continuous%20integration/badge.svg?branch=main)](https://github.com/stepchowfun/typical/actions?query=branch%3Amain) -*Typical* is a so-called "[interface definition language](https://en.wikipedia.org/wiki/Interface_description_language)", or IDL. You define types in a language-neutral schema, then Typical generates code in various languages for serializing and deserializing data based on those types. This can be used for marshalling messages between services, storing structured data on disk, etc. Typical uses a compact binary encoding which supports forward and backward compatibility between versions of your schema to accommodate evolving requirements. +*Typical* helps you serialize data in a language-independent fashion. You define data types in a *schema*, then Typical generates code in various languages for serializing and deserializing data based on those types. This can be used for marshalling messages between services, storing structured data on disk, etc. Typical uses a compact binary encoding which supports forward and backward compatibility between different versions of your schema to accommodate evolving requirements. -The main difference between Typical and related toolchains like Protocol Buffers and Apache Thrift is that Typical has a more modern type system based on [algebraic data types](https://en.wikipedia.org/wiki/Algebraic_data_type), enabling a safer programming style with non-nullable types and pattern matching—especially in languages with those features, such as Rust, Kotlin, Haskell, etc. Typical proposes a [new solution](#required-optional-and-unstable-fields) to the classic problem of how to safely add and remove required fields in structs and the lesser-known dual problem of how to safely perform exhaustive pattern matching on sum types as cases are added and removed over time. - -Typical's design was inspired by insights from a branch of mathematics called [category theory](https://en.wikipedia.org/wiki/Category_theory), especially the duality of limits and colimits and the notions of covariance and contravariance. Happily, you don't need to know about any of that to use it. +The main difference between Typical and related toolchains like Protocol Buffers and Apache Thrift is that Typical has a more modern type system based on [algebraic data types](https://en.wikipedia.org/wiki/Algebraic_data_type), enabling a safer programming style with non-nullable types and pattern matching—especially in languages with those features, such as Rust, Swift, Kotlin, Haskell, etc. Typical proposes a [new solution](#required-optional-and-asymmetric-fields) to the classic problem of how to safely add and remove required fields in structs and the lesser-known dual problem of how to safely perform exhaustive pattern matching on sum types as cases are added and removed over time. **Currently supported languages:** @@ -16,7 +14,9 @@ Typical's design was inspired by insights from a branch of mathematics called [c Suppose you want to build an API for sending emails, and you need to decide how requests and responses will be [serialized](https://en.wikipedia.org/wiki/Serialization) for transport. You could use a self-describing format like JSON or XML, but you may prefer to have more type safety and performance. *Typical* has a great story to tell about those things. -You might start with a *schema file* called `email_api.t` with the request and response types for your email API: +### Write a schema + +You might start with a schema file called `email_api.t` with the request and response types for your email API: ```perl # This is the request type for our API. @@ -37,7 +37,9 @@ A `struct`, such as our `send_email_request` type, describes messages containing Each field in a `struct` or a `choice` has both a name (e.g., `subject`) and an integer index (e.g., `1`). The name is just for humans, as only the index is used to identify fields in the binary encoding. You can freely rename fields without worrying about binary incompatibility. -Each field also has a type, either explicitly or implicitly. The `success` field in `send_email_response` doesn't have an explicit type; that means its type implicitly defaults to `unit`, a built-in type equivalent to an empty `struct`. +Each field also has a type, either explicitly or implicitly. If the type is missing, as it is for the `success` field above, then its type implicitly defaults to a built-in type called `unit`. + +### Generate code for serialization and deserialization Now that we've defined some types, we can use Typical to generate the code for serialization and deserialization. For example, you can generate Rust code with the following: @@ -45,11 +47,11 @@ Now that we've defined some types, we can use Typical to generate the code for s $ typical generate email_api.t --rust-out-file email_api.rs ``` -The client and server can use the generated code to serialize and deserialize messages, which ensures they will understand each other. +The client and server can then use the generated code to serialize and deserialize messages for mutual communication. If the client and server are written in different languages, you can generate code for each language. Note that Typical only does serialization and deserialization. It has nothing to do with service meshes, encryption, authentication, or authorization, but it can be used together with those technologies. -## Required, optional, and unstable fields +## Required, optional, and asymmetric fields Fields are required by default. This is an unusual design decision, since required fields are typically (no pun intended) fraught with danger. Let's explore this topic in detail and see how Typical deals with it. @@ -68,41 +70,34 @@ struct send_email_request { The only safe way to roll out this change is to finish updating all clients before beginning to update any servers. Otherwise, a client still running the old code might send a request to an updated server, which promptly rejects the request because it lacks the new field. -That kind of rollout may not be feasible. You may not be in control of the order in which clients and servers are updated. Or, the clients and servers might be updated together, but not atomically. The client and the server might even be part of the same replicated service, so it's not possible to update one before the other no matter how careful you are. +That kind of rollout may not be feasible. You may not be in control of the order in which clients and servers are updated. Or, the clients and servers might be updated together, but not atomically. The client and the server might even be part of the same replicated service, so it wouldn't be possible to update one before the other no matter how careful you are. Removing a required field can present analogous difficulties. Suppose, despite the aforementioned challenges, you were able to successfully introduce `from` as a required field. Now, an unrelated issue is forcing you to roll it back. That's just as dangerous as adding it was in the first place: if a client gets updated before a server, that client may then send the server a message without the `from` field, which the server will reject since it still expects that field to be present. -### Conventional wisdom +### The conventional wisdom Due to the trouble associated with required fields, the conventional wisdom is simply to never use them; all fields should be optional. -However, this advice ignores the reality that some things really are *semantically required*, even if they aren't declared as required in the schema. An API cannot be expected to work if it doesn't have the data it needs. Having semantically required fields declared as optional can lead to the following problems: - -- A client might not set the field, either because the authors of the client weren't aware that the field is semantically required, or because they were aware of it but still forgot to set it by mistake. The outcome is that either the request fails, or the server inappropriately supplies a default value, thereby hiding the problem. -- If the server is written in a language with a null-safe type system, the code may need to be overly defensive to satisfy the type checker. It will be forced to handle the null case even though there is no way for it to proceed in that case. +However, this advice ignores the reality that some things really are *semantically required*, even if they aren't declared as required in the schema. An API cannot be expected to work if it doesn't have the data it needs. Having semantically required fields declared as optional places extra burden on both writers and readers: writers cannot rely on the type system to prevent them from accidentally forgetting to set the field, and readers must handle the case of the field missing to satisfy the type checker even though that field is always supposed to be set. -Some say it's acceptable to start with required fields, but then no required fields can be added or removed once the type is being used. This policy is commonly known by the adage ["required is forever"](https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules). However, we prefer to avoid any policy that forbids changes unilaterally. We must be able to safely adapt to changing requirements when needed. +For those of us who haven't given up on the idea of required fields, the standard process for introducing one is to (1) introduce the field as optional, (2) update all the writers to set the new field, and (3) finally promote it to required. The problem is that you can't rely on the type system to ensure you've done step (2) correctly. That step can be nontrivial in a large system. -For those of us who haven't given up on the idea of required fields, the standard process for introducing one is to first introduce the field as optional, update all the clients to set the new field, and finally promote it to required once you're confident it's always being set. But how do you gain that confidence? +### Introducing: `asymmetric` fields -### Typical's solution: `unstable` fields +Typical offers an intermediate state between optional and required: `asymmetric`. An `asymmetric` field in a struct is considered required for the writer, but optional for the reader. This state allows you to safely introduce and remove required fields. -Traditionally, before an optional field can be promoted to required, you have to rely on things like code review, testing, and instrumentation (logging, metrics, etc.) to ascertain that the field is always being set. Depending on your system, it may be non-trivial to build the required confidence. - -Typical offers a much easier solution: `unstable` fields. A field in a `struct` that is declared as `unstable` is asymmetrically considered required on the serialization side, but optional on the deserialization side. For network requests, this means clients are forced to set the field, but servers cannot rely on it being set. So `unstable` is an intermediate state between required and optional/non-existent. - -Let's make that more concrete with our email API example. Instead of directly introducing the `from` field as required, we first introduce it as `unstable`: +Let's make that more concrete with our email API example. Instead of directly introducing the `from` field as required, we first introduce it as `asymmetric`: ```perl struct send_email_request { to: string = 0 - unstable from: string = 3 # A new field! + asymmetric from: string = 3 # A new field! subject: string = 1 body: string = 2 } ``` -Let's take a look at the generated Rust code for this schema. We actually end up with two different types, one for serialization and the other for deserialization: +Let's take a look at the generated code for this schema. In Rust, for example, we actually end up with two different types, one for serialization and another for deserialization: ```rust pub struct SendEmailRequestOut { @@ -120,45 +115,95 @@ pub struct SendEmailRequestIn { } impl Serialize for SendEmailRequestOut { - // Omitted. + // Implementation omitted. } impl Deserialize for SendEmailRequestIn { - // Omitted. + // Implementation omitted. } ``` -Notice that the type of `from` is `String` in `SendEmailRequestOut`, but its type is `Option` in `SendEmailRequestIn`. Clients would use `SendEmailRequestOut` to serialize requests, and servers would use `SendEmailRequestIn` to deserializate them. +Typical also generates code (not shown above) for converting `SendEmailRequestOut` into `SendEmailRequestIn`, which is logically equivalent to serialization followed by deserialization, but faster. Conversion in the other direction, however, is up to you. + +Notice that the type of `from` is `String` in `SendEmailRequestOut`, but its type is `Option` in `SendEmailRequestIn`. Our clients use the former to construct requests, and our servers will decode them into the latter. + +Once this schema change has been rolled out, clients are setting the new field, but servers are not yet relying on it. We need to go through this intermediate state before we can safely promote the field to required. **This notion of `asymmetric` fields is what makes Typical special.** -Thanks to Rust's type system, our client and server don't even compile unless we obey the rules: clients must start setting the field, but servers can't yet rely on it. We just have to roll out that change, and then we can safely promote the new field to `required`. We've turned a difficult problem (determining whether an optional field is always being set) into an easy one (using static types to catch any violations at compile time). +It works in reverse too. Suppose we now want to remove the field. It could be unsafe to delete the field directly, since then clients might stop setting it before servers can handle its absence. But we can demote it to `asymmetric`, which forces servers to consider it optional and handle its potential absence while clients are still required to set it. Once that change has rolled out, we can confidently delete the field (or demote it to optional), as the servers no longer require it. -This works in reverse too. Suppose we now want to remove the field. We can't just delete the field directly, since then clients might stop setting it before servers can handle its absence. But we can demote it to unstable, which forces servers to consider it optional and handle its potential absence while clients are still required to set it. Once that change has rolled out, we can confidently delete the field (or demote it to optional), as the servers no longer require it. +For some kinds of changes, a field might stay in the `asymmetric` state for months, say, if you are waiting for users to update your mobile app. Typical helps immensely in that situation. -### The trouble with exhaustive pattern matching +### What about `choice`? -### Conventional wisdom +Our discussion so far has been framed around `struct`s, since they are more familiar to most programmers. However, the same kind of consideration must be given to `choice`s. -### Typical's solution: `unstable` fields—again! +The code generated for `choice`s supports case analysis, like a `switch` construct, so clients can take different actions depending on which field was set. Happily, the generated code ensures you've handled all the cases when you use it. This is called *exhaustive* pattern matching, and it's a great feature to help you write correct code. But that extra rigor can be a double-edged sword: readers will fail to deserialize a `choice` if the field is not recognized. + +That means it's unsafe, in general, to add or remove required fields—just like with `struct`s. If you add a required field, writers might start using it before readers can understand it. Conversely, if you remove a required field, readers may no longer be able to handle it while writers are still using it. + +Not to worry—Typical supports optional and asymmetric fields in `choice`s too! + +An `optional` field of a `choice` must be paired with a fallback field, which is used as a backup in case the reader doesn't recognize the optional field. So readers are not required to handle optional fields; hence, *optional*. Note that the fallback itself might be `optional`, in which case the fallback must have a fallback, etc. Eventually, the fallback chain ends with a required field. Readers will scan the fallback chain for the first field they recognize. + +An `asymmetric` field must also be paired with a fallback, but the fallback chain is not made available to readers: they must be able to handle the `asymmetric` field directly. Messages can be deserialized without any fallbacks, since readers do not use them. That may sound useless, but this arrangement is exactly what's needed to safely introduce or remove required fields from `choice`s, just as they are with `struct`s. + +Let's see what the generated code looks like for optional and asymmetric fields. Consider a more elaborate version of our API response type: + +```perl +choice send_email_response { + success = 0 + error: string = 1 + optional authentication_error: string = 2 + asymmetric please_try_again = 3 +} +``` + +As with `struct`s, the generated code for a `choice` has separate types for serialization and deserialization: + +```perl +pub enum SendEmailResponseOut { + Success, + Error(String), + AuthenticationError(String, Box), + PleaseTryAgain(Box), +} + +pub enum SendEmailResponseIn { + Success, + Error(String), + AuthenticationError(String, Box), + PleaseTryAgain, +} + +impl Serialize for SendEmailResponseOut { + // Implementation omitted. +} + +impl Deserialize for SendEmailResponseIn { + // Implementation omitted. +} +``` -Our discussion so far has been framed around `struct`s, since they are more familiar to most programmers. But the discussion applies analogously to `choice`s as well. +The required cases (`Success` and `Error`) are as you would expect in both types. -The danger with `struct`s is that a message will fail to parse due to a missing required field. The analogous danger with `choice`s is that a message will contain a choice that the receiver doesn't know how to handle. +The optional case, `AuthenticationError`, has a `String` for the error message and a second payload for the fallback field. Readers can use the fallback if they don't wish to handle this case, and readers which don't even know about this case will use the fallback automatically. -What does it mean for a field in a `choice` to be optional? +The asymmetric case, `PleaseTryAgain`, also requires writers to provide a fallback. However, readers don't get to use it. This is a safe intermediate state to use before changing the field to required (which will stop requiring writers to provide a fallback) or changing the field from required to something else (which will stop readers from having to handle it). ### Conclusion -Non-nullable types and exhaustive pattern matching are important safety features of modern type systems, but they are not well-supported by other data interchange formats. Typical's notion of unstable fields casts light on a new point in the design space that allows us to have our cake and eat it too: we get the enhanced type safety, and we can make forward and backward compatible changes. +Non-nullable types and exhaustive pattern matching are important safety features of modern type systems, but they are not well-supported by most data interchange formats. Typical embraces them. -All told, that solution can be understood as an application of the [robustness principle](https://en.wikipedia.org/wiki/Robustness_principle) to algebraic data types. +All told, the idea of asymmetric fields can be understood as an application of the [robustness principle](https://en.wikipedia.org/wiki/Robustness_principle) to algebraic data types. -## A simple naming convention +## A style guide -Typical does not require any particular naming convention for the names of types, fields, schemas, etc. However, it is valuable to establish a convention for consistency. To that end, the following simple convention is recommended: +Typical does not require any particular naming convention or formatting style. However, it is valuable to establish conventions for consistency. We recommend being consistent with the examples given in this guide. For example: -> Use `lower_snake_case` for everything. +- Use `lower_snake_case` for the names of everything: types, fields, etc. +- Indent fields with 4 spaces. -Note that Typical generates code that uses the most popular naming convention for the target programming language, regardless of what convention is used for the type definitions. For example, a `struct` named `email_address` will be called `EmailAddress` in the generated code if the target language is Rust, since idiomatic Rust uses `UpperCamelCase` for the names of user-defined types. +Note that Typical generates code that uses the most popular naming convention for the target programming language, regardless of what convention is used for the type definitions. For example, a `struct` named `email_address` will be called `EmailAddress` (or `EmailAddressOut`/`EmailAddressIn`) in the generated code if the target language is Rust, since idiomatic Rust uses `UpperCamelCase` for the names of user-defined types. ## Schema reference @@ -234,12 +279,12 @@ choice device_ip_address { struct device { hostname: string = 0 - unstable ip_address: device_ip_address = 1 + asymmetric ip_address: device_ip_address = 1 optional owner: email.address = 2 } ``` -The rule, if present, is either `optional` or `unstable`. The absence of a rule indicates that the field is required. +The rule, if present, is either `optional` or `asymmetric`. The absence of a rule indicates that the field is required. The name is a human-readable identifier for the field. It's used to refer to the field in code, but it's never encoded on the wire and can be safely renamed at will. The size of the name does not affect the size of the encoded messages, so be as descriptive as you want. @@ -323,9 +368,9 @@ xxxx x100 xxxx xxxx xxxx xxxx And so on. Notice that the number of trailing zeros in the first byte indicates how many subsequent bytes there are. -Using this encoding, the largest 64-bit integer takes 9 bytes, compared to 8 for the native encoding. Thus, the encoding has a single byte of overhead in the worst case, but for most integers encountered in practice it saves 7 bytes. This is such a good trade-off most of the time that Typical doesn't even offer fixed-width integer types. However, if you really need to store fixed-width integers, you can always encode them manually as `bytes`. +Using this encoding, the largest 64-bit integer takes 9 bytes, compared to 8 for the native encoding. Thus, the encoding has a single byte of overhead in the worst case, but for most integers encountered in practice it saves 7 bytes. This is such a good trade-off most of the time that Typical doesn't even offer fixed-width integer types. However, if you really need to store fixed-width integers, you can always encode them as `bytes` at the expense of some type safety. -The encoding is similar to the "base 128 varints" used by [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/encoding#varints) and [Thrift's *compact protocol*](https://github.com/apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md). However, Typical makes two changes to this encoding: +The encoding is similar to the "base 128 varints" used by [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/encoding#varints) and [Thrift's *compact protocol*](https://github.com/apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md). However, Typical's encoding differs in two ways: 1. Typical moves all the continuation bits to the first byte. This allows the number of bytes in an encoded integer to be determined entirely from its first byte in a single instruction on modern processors (e.g., `BSF` or `TZCNT`). This is more efficient than checking each byte for a continuation bit separately. 2. Typical's encoding uses a technique called [bijective numeration](https://en.wikipedia.org/wiki/Bijective_numeration), which uses fewer bytes in some cases and never uses more bytes than the aforementioned base 128 varint encoding. For example, the number `16,511` uses two bytes in Typical's encoding, but 3 bytes in the encoding used by Protocol Buffers and Thrift's *compact protocol*. However, the space savings is small and comes with a small runtime performance penalty, so whether this is an improvement depends on how much you value time versus space. @@ -358,10 +403,10 @@ For a `struct` with up to 32 fields, the *header* for fields of type `unit`, `f6 A `struct` must follow these rules: - Encoding rules: - - Optional fields may be missing, but required and unstable fields must be present. + - Optional fields may be missing, but required and asymmetric fields must be present. - Decoding rules: - Unrecognized fields are ignored. - - All required fields must be present, whereas optional and unstable fields may be missing. + - All required fields must be present, whereas optional and asymmetric fields may be missing. ### User-defined `choice`s @@ -371,7 +416,7 @@ A `choice` is encoded in the same way as a struct, but with different rules: - At least one required field must be present. - Decoding rules: - The first field recognized by the receiver is used. - - At least one required or unstable field must be present. + - At least one required or asymmetric field must be present. A simple enumerated type with up to 32 fields (such as `weekday` above) is encoded as a single byte. diff --git a/integration_tests/rust/src/comprehensive.rs b/integration_tests/rust/src/comprehensive.rs index 61df62b6..beb990dd 100644 --- a/integration_tests/rust/src/comprehensive.rs +++ b/integration_tests/rust/src/comprehensive.rs @@ -34,21 +34,21 @@ pub fn run() -> io::Result<()> { y_required: u64::MAX, z_required: (), - p_unstable: vec![(), (), ()], - q_unstable: vec![f64::NEG_INFINITY, f64::INFINITY, f64::NAN], - r_unstable: vec![i64::MIN, 0, i64::MAX], - s_unstable: vec![ + p_asymmetric: vec![(), (), ()], + q_asymmetric: vec![f64::NEG_INFINITY, f64::INFINITY, f64::NAN], + r_asymmetric: vec![i64::MIN, 0, i64::MAX], + s_asymmetric: vec![ vec!["Hello".to_owned(), "World".to_owned()], vec!["Hello".to_owned(), "Earth".to_owned()], vec!["Hello".to_owned(), "Planet".to_owned()], ], - t_unstable: true, - u_unstable: vec![0, 42, 255], - v_unstable: PI, - w_unstable: i64::MAX, - x_unstable: "Hello, World!".to_owned(), - y_unstable: u64::MAX, - z_unstable: (), + t_asymmetric: true, + u_asymmetric: vec![0, 42, 255], + v_asymmetric: PI, + w_asymmetric: i64::MAX, + x_asymmetric: "Hello, World!".to_owned(), + y_asymmetric: u64::MAX, + z_asymmetric: (), p_optional: None, q_optional: None, @@ -82,21 +82,21 @@ pub fn run() -> io::Result<()> { y_required: u64::MAX, z_required: (), - p_unstable: vec![(), (), ()], - q_unstable: vec![f64::NEG_INFINITY, f64::INFINITY, f64::NAN], - r_unstable: vec![i64::MIN, 0, i64::MAX], - s_unstable: vec![ + p_asymmetric: vec![(), (), ()], + q_asymmetric: vec![f64::NEG_INFINITY, f64::INFINITY, f64::NAN], + r_asymmetric: vec![i64::MIN, 0, i64::MAX], + s_asymmetric: vec![ vec!["Hello".to_owned(), "World".to_owned()], vec!["Hello".to_owned(), "Earth".to_owned()], vec!["Hello".to_owned(), "Planet".to_owned()], ], - t_unstable: true, - u_unstable: vec![0, 42, 255], - v_unstable: PI, - w_unstable: i64::MAX, - x_unstable: "Hello, World!".to_owned(), - y_unstable: u64::MAX, - z_unstable: (), + t_asymmetric: true, + u_asymmetric: vec![0, 42, 255], + v_asymmetric: PI, + w_asymmetric: i64::MAX, + x_asymmetric: "Hello, World!".to_owned(), + y_asymmetric: u64::MAX, + z_asymmetric: (), p_optional: Some(vec![(), (), ()]), q_optional: Some(vec![f64::NEG_INFINITY, f64::INFINITY, f64::NAN]), @@ -201,19 +201,19 @@ pub fn run() -> io::Result<()> { let fallback = BarOut::TRequired(true); - check_match::(BarOut::PUnstable( + check_match::(BarOut::PAsymmetric( vec![(), (), ()], Box::new(fallback.clone()), ))?; - check_match::(BarOut::QUnstable( + check_match::(BarOut::QAsymmetric( vec![f64::NEG_INFINITY, f64::INFINITY, f64::NAN], Box::new(fallback.clone()), ))?; - check_match::(BarOut::RUnstable( + check_match::(BarOut::RAsymmetric( vec![i64::MIN, 0, i64::MAX], Box::new(fallback.clone()), ))?; - check_match::(BarOut::SUnstable( + check_match::(BarOut::SAsymmetric( vec![ vec!["Hello".to_owned(), "World".to_owned()], vec!["Hello".to_owned(), "Earth".to_owned()], @@ -221,19 +221,19 @@ pub fn run() -> io::Result<()> { ], Box::new(fallback.clone()), ))?; - check_match::(BarOut::TUnstable(true, Box::new(fallback.clone())))?; - check_match::(BarOut::UUnstable( + check_match::(BarOut::TAsymmetric(true, Box::new(fallback.clone())))?; + check_match::(BarOut::UAsymmetric( vec![0, 42, 255], Box::new(fallback.clone()), ))?; - check_match::(BarOut::VUnstable(PI, Box::new(fallback.clone())))?; - check_match::(BarOut::WUnstable(i64::MAX, Box::new(fallback.clone())))?; - check_match::(BarOut::XUnstable( + check_match::(BarOut::VAsymmetric(PI, Box::new(fallback.clone())))?; + check_match::(BarOut::WAsymmetric(i64::MAX, Box::new(fallback.clone())))?; + check_match::(BarOut::XAsymmetric( "Hello, World!".to_owned(), Box::new(fallback.clone()), ))?; - check_match::(BarOut::YUnstable(u64::MAX, Box::new(fallback.clone())))?; - check_match::(BarOut::ZUnstable(Box::new(fallback.clone())))?; + check_match::(BarOut::YAsymmetric(u64::MAX, Box::new(fallback.clone())))?; + check_match::(BarOut::ZAsymmetric(Box::new(fallback.clone())))?; check_match::(BarOut::POptional( vec![(), (), ()], @@ -289,21 +289,21 @@ pub fn run() -> io::Result<()> { y_required: u64::MAX, z_required: (), - p_unstable: vec![(), (), ()], - q_unstable: vec![f64::NEG_INFINITY, f64::INFINITY, f64::NAN], - r_unstable: vec![i64::MIN, 0, i64::MAX], - s_unstable: vec![ + p_asymmetric: vec![(), (), ()], + q_asymmetric: vec![f64::NEG_INFINITY, f64::INFINITY, f64::NAN], + r_asymmetric: vec![i64::MIN, 0, i64::MAX], + s_asymmetric: vec![ vec!["Hello".to_owned(), "World".to_owned()], vec!["Hello".to_owned(), "Earth".to_owned()], vec!["Hello".to_owned(), "Planet".to_owned()], ], - t_unstable: true, - u_unstable: vec![0, 42, 255], - v_unstable: PI, - w_unstable: i64::MAX, - x_unstable: "Hello, World!".to_owned(), - y_unstable: u64::MAX, - z_unstable: (), + t_asymmetric: true, + u_asymmetric: vec![0, 42, 255], + v_asymmetric: PI, + w_asymmetric: i64::MAX, + x_asymmetric: "Hello, World!".to_owned(), + y_asymmetric: u64::MAX, + z_asymmetric: (), p_optional: None, q_optional: None, diff --git a/integration_tests/rust/src/schema_evolution.rs b/integration_tests/rust/src/schema_evolution.rs index b368662e..d343f37e 100644 --- a/integration_tests/rust/src/schema_evolution.rs +++ b/integration_tests/rust/src/schema_evolution.rs @@ -9,18 +9,18 @@ use { pub fn run() -> io::Result<()> { check_ok::(&before::ExampleStructOut { required_to_required: "required_to_required".to_owned(), - required_to_unstable: "required_to_unstable".to_owned(), + required_to_asymmetric: "required_to_asymmetric".to_owned(), required_to_optional: "required_to_optional".to_owned(), required_to_nonexistent: "required_to_nonexistent".to_owned(), - unstable_to_required: "unstable_to_required".to_owned(), - unstable_to_unstable: "unstable_to_unstable".to_owned(), - unstable_to_optional: "unstable_to_optional".to_owned(), - unstable_to_nonexistent: "unstable_to_nonexistent".to_owned(), - optional_none_to_unstable: None, + asymmetric_to_required: "asymmetric_to_required".to_owned(), + asymmetric_to_asymmetric: "asymmetric_to_asymmetric".to_owned(), + asymmetric_to_optional: "asymmetric_to_optional".to_owned(), + asymmetric_to_nonexistent: "asymmetric_to_nonexistent".to_owned(), + optional_none_to_asymmetric: None, optional_none_to_optional: None, optional_none_to_nonexistent: None, optional_some_to_required: Some("optional_some_to_required".to_owned()), - optional_some_to_unstable: Some("optional_some_to_unstable".to_owned()), + optional_some_to_asymmetric: Some("optional_some_to_asymmetric".to_owned()), optional_some_to_optional: Some("optional_some_to_optional".to_owned()), optional_some_to_nonexistent: Some("optional_some_to_nonexistent".to_owned()), })?; @@ -32,40 +32,40 @@ pub fn run() -> io::Result<()> { )?; check_ok::( - &before::ExampleChoiceOut::RequiredToUnstable("RequiredToUnstable".to_owned()), + &before::ExampleChoiceOut::RequiredToAsymmetric("RequiredToAsymmetric".to_owned()), )?; check_ok::( - &before::ExampleChoiceOut::UnstableToRequired( - "UnstableToRequired".to_owned(), + &before::ExampleChoiceOut::AsymmetricToRequired( + "AsymmetricToRequired".to_owned(), Box::new(fallback.clone()), ), )?; check_ok::( - &before::ExampleChoiceOut::UnstableToUnstable( - "UnstableToUnstable".to_owned(), + &before::ExampleChoiceOut::AsymmetricToAsymmetric( + "AsymmetricToAsymmetric".to_owned(), Box::new(fallback.clone()), ), )?; check_ok::( - &before::ExampleChoiceOut::UnstableToOptionalHandled( - "UnstableToOptionalHandled".to_owned(), + &before::ExampleChoiceOut::AsymmetricToOptionalHandled( + "AsymmetricToOptionalHandled".to_owned(), Box::new(fallback.clone()), ), )?; check_ok::( - &before::ExampleChoiceOut::UnstableToOptionalFallback( - "UnstableToOptionalFallback".to_owned(), + &before::ExampleChoiceOut::AsymmetricToOptionalFallback( + "AsymmetricToOptionalFallback".to_owned(), Box::new(fallback.clone()), ), )?; check_ok::( - &before::ExampleChoiceOut::UnstableToNonexistent( - "UnstableToNonexistent".to_owned(), + &before::ExampleChoiceOut::AsymmetricToNonexistent( + "AsymmetricToNonexistent".to_owned(), Box::new(fallback.clone()), ), )?; @@ -78,8 +78,8 @@ pub fn run() -> io::Result<()> { )?; check_ok::( - &before::ExampleChoiceOut::OptionalToUnstable( - "OptionalToUnstable".to_owned(), + &before::ExampleChoiceOut::OptionalToAsymmetric( + "OptionalToAsymmetric".to_owned(), Box::new(fallback.clone()), ), )?; diff --git a/integration_tests/types/comprehensive/bar.t b/integration_tests/types/comprehensive/bar.t index e2ff95b2..724a454f 100644 --- a/integration_tests/types/comprehensive/bar.t +++ b/integration_tests/types/comprehensive/bar.t @@ -11,17 +11,17 @@ choice bar { y_required: u64 = 9 z_required = 10 - unstable p_unstable: [unit] = 11 - unstable q_unstable: [f64] = 12 - unstable r_unstable: [s64] = 13 - unstable s_unstable: [[string]] = 14 - unstable t_unstable: bool = 15 - unstable u_unstable: bytes = 16 - unstable v_unstable: f64 = 17 - unstable w_unstable: s64 = 18 - unstable x_unstable: string = 19 - unstable y_unstable: u64 = 20 - unstable z_unstable = 21 + asymmetric p_asymmetric: [unit] = 11 + asymmetric q_asymmetric: [f64] = 12 + asymmetric r_asymmetric: [s64] = 13 + asymmetric s_asymmetric: [[string]] = 14 + asymmetric t_asymmetric: bool = 15 + asymmetric u_asymmetric: bytes = 16 + asymmetric v_asymmetric: f64 = 17 + asymmetric w_asymmetric: s64 = 18 + asymmetric x_asymmetric: string = 19 + asymmetric y_asymmetric: u64 = 20 + asymmetric z_asymmetric = 21 optional p_optional: [unit] = 22 optional q_optional: [f64] = 23 diff --git a/integration_tests/types/comprehensive/foo.t b/integration_tests/types/comprehensive/foo.t index 0d8943f5..f0e67af2 100644 --- a/integration_tests/types/comprehensive/foo.t +++ b/integration_tests/types/comprehensive/foo.t @@ -11,17 +11,17 @@ struct foo { y_required: u64 = 9 z_required = 10 - unstable p_unstable: [unit] = 11 - unstable q_unstable: [f64] = 12 - unstable r_unstable: [s64] = 13 - unstable s_unstable: [[string]] = 14 - unstable t_unstable: bool = 15 - unstable u_unstable: bytes = 16 - unstable v_unstable: f64 = 17 - unstable w_unstable: s64 = 18 - unstable x_unstable: string = 19 - unstable y_unstable: u64 = 20 - unstable z_unstable = 21 + asymmetric p_asymmetric: [unit] = 11 + asymmetric q_asymmetric: [f64] = 12 + asymmetric r_asymmetric: [s64] = 13 + asymmetric s_asymmetric: [[string]] = 14 + asymmetric t_asymmetric: bool = 15 + asymmetric u_asymmetric: bytes = 16 + asymmetric v_asymmetric: f64 = 17 + asymmetric w_asymmetric: s64 = 18 + asymmetric x_asymmetric: string = 19 + asymmetric y_asymmetric: u64 = 20 + asymmetric z_asymmetric = 21 optional p_optional: [unit] = 22 optional q_optional: [f64] = 23 diff --git a/integration_tests/types/schema_evolution/after.t b/integration_tests/types/schema_evolution/after.t index d13cb79e..d0e9afb0 100644 --- a/integration_tests/types/schema_evolution/after.t +++ b/integration_tests/types/schema_evolution/after.t @@ -1,51 +1,51 @@ struct example_struct { required_to_required: string = 0 - unstable required_to_unstable: string = 1 + asymmetric required_to_asymmetric: string = 1 optional required_to_optional: string = 2 # required_to_nonexistent: string = 3 - unstable_to_required: string = 4 - unstable unstable_to_unstable: string = 5 - optional unstable_to_optional: string = 6 - # unstable_to_nonexistent: string = 7 + asymmetric_to_required: string = 4 + asymmetric asymmetric_to_asymmetric: string = 5 + optional asymmetric_to_optional: string = 6 + # asymmetric_to_nonexistent: string = 7 # optional_none_to_required: string = 8 # This case would be an error. - unstable optional_none_to_unstable: string = 9 + asymmetric optional_none_to_asymmetric: string = 9 optional optional_none_to_optional: string = 10 # optional_none_to_nonexistent: string = 11 optional_some_to_required: string = 12 - unstable optional_some_to_unstable: string = 13 + asymmetric optional_some_to_asymmetric: string = 13 optional optional_some_to_optional: string = 14 # optional_some_to_nonexistent: string = 15 # nonexistent_to_required: string = 16 # This case would be an error. - unstable nonexistent_to_unstable: string = 17 + asymmetric nonexistent_to_asymmetric: string = 17 optional nonexistent_to_optional: string = 18 # nonexistent_to_nonexistent: string = 19 } choice example_choice { required_to_required: string = 0 - unstable required_to_unstable: string = 1 + asymmetric required_to_asymmetric: string = 1 # optional required_to_optional_handled: string = 2 # This case would be an error. # optional required_to_optional_fallback: string = 3 # This case would be an error. # required_to_nonexistent: string = 4 # This case would be an error. - unstable_to_required: string = 5 - unstable unstable_to_unstable: string = 6 - optional unstable_to_optional_handled: string = 7 - optional unstable_to_optional_fallback: string = 8 - # unstable_to_nonexistent: string = 9 + asymmetric_to_required: string = 5 + asymmetric asymmetric_to_asymmetric: string = 6 + optional asymmetric_to_optional_handled: string = 7 + optional asymmetric_to_optional_fallback: string = 8 + # asymmetric_to_nonexistent: string = 9 optional_to_required: string = 10 - unstable optional_to_unstable: string = 11 + asymmetric optional_to_asymmetric: string = 11 optional optional_to_optional_handled: string = 12 optional optional_to_optional_fallback: string = 13 # optional_to_nonexistent: string = 14 nonexistent_to_required: string = 15 - unstable nonexistent_to_unstable: string = 16 + asymmetric nonexistent_to_asymmetric: string = 16 optional nonexistent_to_optional_handled: string = 17 optional nonexistent_to_optional_fallback: string = 18 # nonexistent_to_nonexistent: string = 19 diff --git a/integration_tests/types/schema_evolution/before.t b/integration_tests/types/schema_evolution/before.t index 6ae5e8a4..048f7540 100644 --- a/integration_tests/types/schema_evolution/before.t +++ b/integration_tests/types/schema_evolution/before.t @@ -1,51 +1,51 @@ struct example_struct { required_to_required: string = 0 - required_to_unstable: string = 1 + required_to_asymmetric: string = 1 required_to_optional: string = 2 required_to_nonexistent: string = 3 - unstable unstable_to_required: string = 4 - unstable unstable_to_unstable: string = 5 - unstable unstable_to_optional: string = 6 - unstable unstable_to_nonexistent: string = 7 + asymmetric asymmetric_to_required: string = 4 + asymmetric asymmetric_to_asymmetric: string = 5 + asymmetric asymmetric_to_optional: string = 6 + asymmetric asymmetric_to_nonexistent: string = 7 # optional optional_none_to_required: string = 8 # This case would be an error. - optional optional_none_to_unstable: string = 9 + optional optional_none_to_asymmetric: string = 9 optional optional_none_to_optional: string = 10 optional optional_none_to_nonexistent: string = 11 optional optional_some_to_required: string = 12 - optional optional_some_to_unstable: string = 13 + optional optional_some_to_asymmetric: string = 13 optional optional_some_to_optional: string = 14 optional optional_some_to_nonexistent: string = 15 # nonexistent_to_required: string = 16 # This case would be an error. - # nonexistent_to_unstable: string = 17 + # nonexistent_to_asymmetric: string = 17 # nonexistent_to_optional: string = 18 # nonexistent_to_nonexistent: string = 19 } choice example_choice { required_to_required: string = 0 - required_to_unstable: string = 1 + required_to_asymmetric: string = 1 # required_to_optional_handled: string = 2 # This case would be an error. # required_to_optional_fallback: string = 3 # This case would be an error. # required_to_nonexistent: string = 4 # This case would be an error. - unstable unstable_to_required: string = 5 - unstable unstable_to_unstable: string = 6 - unstable unstable_to_optional_handled: string = 7 - unstable unstable_to_optional_fallback: string = 8 - unstable unstable_to_nonexistent: string = 9 + asymmetric asymmetric_to_required: string = 5 + asymmetric asymmetric_to_asymmetric: string = 6 + asymmetric asymmetric_to_optional_handled: string = 7 + asymmetric asymmetric_to_optional_fallback: string = 8 + asymmetric asymmetric_to_nonexistent: string = 9 optional optional_to_required: string = 10 - optional optional_to_unstable: string = 11 + optional optional_to_asymmetric: string = 11 optional optional_to_optional_handled: string = 12 optional optional_to_optional_fallback: string = 13 optional optional_to_nonexistent: string = 14 # nonexistent_to_required: string = 15 - # nonexistent_to_unstable: string = 16 + # nonexistent_to_asymmetric: string = 16 # nonexistent_to_optional_handled: string = 17 # nonexistent_to_optional_fallback: string = 18 # nonexistent_to_nonexistent: string = 19 diff --git a/src/generate_rust.rs b/src/generate_rust.rs index fd144209..d661f58b 100644 --- a/src/generate_rust.rs +++ b/src/generate_rust.rs @@ -434,7 +434,7 @@ fn write_schema( write_identifier(buffer, &field.name, Snake, None)?; writeln!(buffer, ".as_ref().map_or(0, |payload| {{")?; } - schema::Rule::Required | schema::Rule::Unstable => { + schema::Rule::Required | schema::Rule::Asymmetric => { writeln!(buffer, "({{")?; write_indentation(buffer, indentation + 3)?; write!(buffer, "let payload = &self.")?; @@ -486,7 +486,7 @@ fn write_schema( write_identifier(buffer, &field.name, Snake, None)?; writeln!(buffer, " {{")?; } - schema::Rule::Required | schema::Rule::Unstable => { + schema::Rule::Required | schema::Rule::Asymmetric => { write_indentation(buffer, indentation + 2)?; writeln!(buffer, "{{")?; write_indentation(buffer, indentation + 3)?; @@ -623,7 +623,7 @@ fn write_schema( writeln!(buffer, "}}")?; writeln!(buffer)?; if fields.iter().any(|field| match field.rule { - schema::Rule::Optional | schema::Rule::Unstable => false, + schema::Rule::Optional | schema::Rule::Asymmetric => false, schema::Rule::Required => true, }) { write_indentation(buffer, indentation + 2)?; @@ -631,7 +631,7 @@ fn write_schema( let mut first = true; for field in fields { match field.rule { - schema::Rule::Optional | schema::Rule::Unstable => {} + schema::Rule::Optional | schema::Rule::Asymmetric => {} schema::Rule::Required => { if first { first = false; @@ -664,7 +664,7 @@ fn write_schema( write_indentation(buffer, indentation + 3)?; write_identifier(buffer, &field.name, Snake, None)?; match field.rule { - schema::Rule::Optional | schema::Rule::Unstable => {} + schema::Rule::Optional | schema::Rule::Asymmetric => {} schema::Rule::Required => { write!(buffer, ": ")?; write_identifier(buffer, &field.name, Snake, None)?; @@ -711,7 +711,7 @@ fn write_schema( write_identifier(buffer, &field.name, Snake, None)?; writeln!(buffer, ".into(),")?; } - schema::Rule::Unstable => { + schema::Rule::Asymmetric => { write_indentation(buffer, indentation + 3)?; write_identifier(buffer, &field.name, Snake, None)?; write!(buffer, ": Some(message.")?; @@ -754,7 +754,7 @@ fn write_schema( write!(buffer, "::")?; write_identifier(buffer, &field.name, Pascal, None)?; match field.rule { - schema::Rule::Optional | schema::Rule::Unstable => { + schema::Rule::Optional | schema::Rule::Asymmetric => { if matches!(field.r#type.variant, schema::TypeVariant::Unit) { writeln!(buffer, "(ref fallback) => {{")?; } else { @@ -787,7 +787,7 @@ fn write_schema( write_indentation(buffer, indentation + 5)?; write!(buffer, "payload_size")?; match field.rule { - schema::Rule::Optional | schema::Rule::Unstable => { + schema::Rule::Optional | schema::Rule::Asymmetric => { writeln!(buffer, " +")?; write_indentation(buffer, indentation + 5)?; writeln!(buffer, "fallback.size()")?; @@ -818,7 +818,7 @@ fn write_schema( write!(buffer, "::")?; write_identifier(buffer, &field.name, Pascal, None)?; match field.rule { - schema::Rule::Optional | schema::Rule::Unstable => { + schema::Rule::Optional | schema::Rule::Asymmetric => { if matches!(field.r#type.variant, schema::TypeVariant::Unit) { writeln!(buffer, "(ref fallback) => {{")?; } else { @@ -857,7 +857,7 @@ fn write_schema( &field.r#type, )?; match field.rule { - schema::Rule::Optional | schema::Rule::Unstable => { + schema::Rule::Optional | schema::Rule::Asymmetric => { write_indentation(buffer, indentation + 4)?; writeln!(buffer, "fallback.serialize(writer)")?; } @@ -942,7 +942,7 @@ fn write_schema( writeln!(buffer, "(payload, fallback));")?; } } - schema::Rule::Required | schema::Rule::Unstable => { + schema::Rule::Required | schema::Rule::Asymmetric => { write_indentation(buffer, indentation + 5)?; write!(buffer, "return Ok(")?; write_identifier(buffer, name, Pascal, Some(In))?; @@ -994,7 +994,7 @@ fn write_schema( write!(buffer, "::")?; write_identifier(buffer, &field.name, Pascal, None)?; match field.rule { - schema::Rule::Optional | schema::Rule::Unstable => { + schema::Rule::Optional | schema::Rule::Asymmetric => { if matches!(field.r#type.variant, schema::TypeVariant::Unit) { write!(buffer, "(fallback) => ")?; } else { @@ -1023,7 +1023,7 @@ fn write_schema( )?; } } - schema::Rule::Required | schema::Rule::Unstable => { + schema::Rule::Required | schema::Rule::Asymmetric => { if matches!(field.r#type.variant, schema::TypeVariant::Unit) { writeln!(buffer, ",")?; } else { @@ -1076,7 +1076,7 @@ fn write_struct( write!(buffer, "Option<")?; } schema::Rule::Required => {} - schema::Rule::Unstable => match direction { + schema::Rule::Asymmetric => match direction { Direction::Out => {} Direction::In => { write!(buffer, "Option<")?; @@ -1089,7 +1089,7 @@ fn write_struct( write!(buffer, ">")?; } schema::Rule::Required => {} - schema::Rule::Unstable => match direction { + schema::Rule::Asymmetric => match direction { Direction::Out => {} Direction::In => { write!(buffer, ">")?; @@ -1128,7 +1128,7 @@ fn write_choice( let fallback = match field.rule { schema::Rule::Optional => true, schema::Rule::Required => false, - schema::Rule::Unstable => match direction { + schema::Rule::Asymmetric => match direction { Direction::Out => true, Direction::In => false, }, @@ -1985,17 +1985,17 @@ pub mod comprehensive { XRequired(String), YRequired(u64), ZRequired, - PUnstable(Vec<()>, Box), - QUnstable(Vec, Box), - RUnstable(Vec, Box), - SUnstable(Vec>, Box), - TUnstable(bool, Box), - UUnstable(Vec, Box), - VUnstable(f64, Box), - WUnstable(i64, Box), - XUnstable(String, Box), - YUnstable(u64, Box), - ZUnstable(Box), + PAsymmetric(Vec<()>, Box), + QAsymmetric(Vec, Box), + RAsymmetric(Vec, Box), + SAsymmetric(Vec>, Box), + TAsymmetric(bool, Box), + UAsymmetric(Vec, Box), + VAsymmetric(f64, Box), + WAsymmetric(i64, Box), + XAsymmetric(String, Box), + YAsymmetric(u64, Box), + ZAsymmetric(Box), POptional(Vec<()>, Box), QOptional(Vec, Box), ROptional(Vec, Box), @@ -2022,17 +2022,17 @@ pub mod comprehensive { XRequired(String), YRequired(u64), ZRequired, - PUnstable(Vec<()>), - QUnstable(Vec), - RUnstable(Vec), - SUnstable(Vec>), - TUnstable(bool), - UUnstable(Vec), - VUnstable(f64), - WUnstable(i64), - XUnstable(String), - YUnstable(u64), - ZUnstable, + PAsymmetric(Vec<()>), + QAsymmetric(Vec), + RAsymmetric(Vec), + SAsymmetric(Vec>), + TAsymmetric(bool), + UAsymmetric(Vec), + VAsymmetric(f64), + WAsymmetric(i64), + XAsymmetric(String), + YAsymmetric(u64), + ZAsymmetric, POptional(Vec<()>, Box), QOptional(Vec, Box), ROptional(Vec, Box), @@ -2114,20 +2114,20 @@ pub mod comprehensive { super::super::non_varint_field_header_size(10, payload_size) + payload_size } - BarOut::PUnstable(ref payload, ref fallback) => { + BarOut::PAsymmetric(ref payload, ref fallback) => { let payload_size = super::super::varint_size_from_value(payload.len() as \ u64); super::super::non_varint_field_header_size(11, payload_size) + payload_size + fallback.size() } - BarOut::QUnstable(ref payload, ref fallback) => { + BarOut::QAsymmetric(ref payload, ref fallback) => { let payload_size = 8_u64 * (payload.len() as u64); super::super::non_varint_field_header_size(12, payload_size) + payload_size + fallback.size() } - BarOut::RUnstable(ref payload, ref fallback) => { + BarOut::RAsymmetric(ref payload, ref fallback) => { let payload_size = payload.iter().fold(0_u64, |x, payload| x + \ super::super::varint_size_from_value(super::super::zigzag_encode(*\ payload))); @@ -2135,7 +2135,7 @@ pub mod comprehensive { payload_size + fallback.size() } - BarOut::SUnstable(ref payload, ref fallback) => { + BarOut::SAsymmetric(ref payload, ref fallback) => { let payload_size = payload.iter().fold(0_u64, |x, payload| { let \ payload_size = payload.iter().fold(0_u64, |x, payload| { let \ payload_size = payload.len() as u64; x + \ @@ -2146,25 +2146,25 @@ pub mod comprehensive { payload_size + fallback.size() } - BarOut::TUnstable(ref payload, ref fallback) => { + BarOut::TAsymmetric(ref payload, ref fallback) => { let payload_size = 1_u64; super::super::varint_field_header_size(15) + payload_size + fallback.size() } - BarOut::UUnstable(ref payload, ref fallback) => { + BarOut::UAsymmetric(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(16, payload_size) + payload_size + fallback.size() } - BarOut::VUnstable(ref payload, ref fallback) => { + BarOut::VAsymmetric(ref payload, ref fallback) => { let payload_size = 8_u64; super::super::non_varint_field_header_size(17, payload_size) + payload_size + fallback.size() } - BarOut::WUnstable(ref payload, ref fallback) => { + BarOut::WAsymmetric(ref payload, ref fallback) => { let payload_size = \ super::super::varint_size_from_value(super::super::zigzag_encode(*\ payload)); @@ -2172,19 +2172,19 @@ pub mod comprehensive { payload_size + fallback.size() } - BarOut::XUnstable(ref payload, ref fallback) => { + BarOut::XAsymmetric(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(19, payload_size) + payload_size + fallback.size() } - BarOut::YUnstable(ref payload, ref fallback) => { + BarOut::YAsymmetric(ref payload, ref fallback) => { let payload_size = super::super::varint_size_from_value(*payload); super::super::varint_field_header_size(20) + payload_size + fallback.size() } - BarOut::ZUnstable(ref fallback) => { + BarOut::ZAsymmetric(ref fallback) => { let payload_size = 0_u64; super::super::non_varint_field_header_size(21, payload_size) + payload_size + @@ -2354,13 +2354,13 @@ pub mod comprehensive { (); Ok(()) } - BarOut::PUnstable(ref payload, ref fallback) => { + BarOut::PAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 11, \ super::super::varint_size_from_value(payload.len() as u64))?; super::super::serialize_varint(payload.len() as u64, writer)?; fallback.serialize(writer) } - BarOut::QUnstable(ref payload, ref fallback) => { + BarOut::QAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 12, 8_u64 * \ (payload.len() as u64))?; for payload in payload { @@ -2368,7 +2368,7 @@ pub mod comprehensive { } fallback.serialize(writer) } - BarOut::RUnstable(ref payload, ref fallback) => { + BarOut::RAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 13, \ payload.iter().fold(0_u64, |x, payload| x + \ super::super::varint_size_from_value(super::super::zigzag_encode(*\ @@ -2379,7 +2379,7 @@ pub mod comprehensive { } fallback.serialize(writer) } - BarOut::SUnstable(ref payload, ref fallback) => { + BarOut::SAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 14, \ payload.iter().fold(0_u64, |x, payload| { let payload_size = \ payload.iter().fold(0_u64, |x, payload| { let payload_size = \ @@ -2399,40 +2399,40 @@ pub mod comprehensive { } fallback.serialize(writer) } - BarOut::TUnstable(ref payload, ref fallback) => { + BarOut::TAsymmetric(ref payload, ref fallback) => { super::super::serialize_varint_field_header(writer, 15)?; super::super::serialize_varint(*payload as u64, writer)?; fallback.serialize(writer) } - BarOut::UUnstable(ref payload, ref fallback) => { + BarOut::UAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 16, payload.len() \ as u64)?; writer.write_all(payload)?; fallback.serialize(writer) } - BarOut::VUnstable(ref payload, ref fallback) => { + BarOut::VAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 17, 8_u64)?; writer.write_all(&payload.to_le_bytes())?; fallback.serialize(writer) } - BarOut::WUnstable(ref payload, ref fallback) => { + BarOut::WAsymmetric(ref payload, ref fallback) => { super::super::serialize_varint_field_header(writer, 18)?; super::super::serialize_varint(super::super::zigzag_encode(*payload), \ writer)?; fallback.serialize(writer) } - BarOut::XUnstable(ref payload, ref fallback) => { + BarOut::XAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 19, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - BarOut::YUnstable(ref payload, ref fallback) => { + BarOut::YAsymmetric(ref payload, ref fallback) => { super::super::serialize_varint_field_header(writer, 20)?; super::super::serialize_varint(*payload, writer)?; fallback.serialize(writer) } - BarOut::ZUnstable(ref fallback) => { + BarOut::ZAsymmetric(ref fallback) => { super::super::serialize_non_varint_field_header(writer, 21, 0_u64)?; (); fallback.serialize(writer) @@ -2690,7 +2690,7 @@ pub mod comprehensive { 11 => { let payload = vec![(); super::super::deserialize_varint(&mut \ sub_reader)? as usize]; - return Ok(BarIn::PUnstable(payload)); + return Ok(BarIn::PAsymmetric(payload)); } 12 => { fn deserialize_element(mut sub_reader: &mut \ @@ -2716,7 +2716,7 @@ pub mod comprehensive { } }); } - return Ok(BarIn::QUnstable(payload)); + return Ok(BarIn::QAsymmetric(payload)); } 13 => { fn deserialize_element(mut sub_reader: &mut \ @@ -2742,7 +2742,7 @@ pub mod comprehensive { } }); } - return Ok(BarIn::RUnstable(payload)); + return Ok(BarIn::RAsymmetric(payload)); } 14 => { let mut payload = Vec::new(); @@ -2796,30 +2796,30 @@ pub mod comprehensive { payload }); } - return Ok(BarIn::SUnstable(payload)); + return Ok(BarIn::SAsymmetric(payload)); } 15 => { let mut buffer = [0_u8]; ::std::io::Read::read_exact(&mut sub_reader, &mut buffer[..])?; let payload = buffer[0] != 0b0000_0001; - return Ok(BarIn::TUnstable(payload)); + return Ok(BarIn::TAsymmetric(payload)); } 16 => { let mut payload = vec![]; ::std::io::Read::read_to_end(&mut sub_reader, &mut payload)?; - return Ok(BarIn::UUnstable(payload)); + return Ok(BarIn::UAsymmetric(payload)); } 17 => { let mut buffer = [0; 8]; ::std::io::Read::read_exact(&mut sub_reader, &mut buffer)?; let payload = f64::from_le_bytes(buffer); - return Ok(BarIn::VUnstable(payload)); + return Ok(BarIn::VAsymmetric(payload)); } 18 => { let payload = \ super::super::zigzag_decode(super::super::deserialize_varint(&mut \ sub_reader)?); - return Ok(BarIn::WUnstable(payload)); + return Ok(BarIn::WAsymmetric(payload)); } 19 => { let mut buffer = vec![]; @@ -2828,15 +2828,15 @@ pub mod comprehensive { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(BarIn::XUnstable(payload)); + return Ok(BarIn::XAsymmetric(payload)); } 20 => { let payload = super::super::deserialize_varint(&mut sub_reader)?; - return Ok(BarIn::YUnstable(payload)); + return Ok(BarIn::YAsymmetric(payload)); } 21 => { let payload = (); - return Ok(BarIn::ZUnstable); + return Ok(BarIn::ZAsymmetric); } 22 => { let payload = vec![(); super::super::deserialize_varint(&mut \ @@ -3033,17 +3033,17 @@ pub mod comprehensive { BarOut::XRequired(payload) => BarIn::XRequired(payload.into()), BarOut::YRequired(payload) => BarIn::YRequired(payload.into()), BarOut::ZRequired => BarIn::ZRequired, - BarOut::PUnstable(payload, fallback) => BarIn::PUnstable(payload.into()), - BarOut::QUnstable(payload, fallback) => BarIn::QUnstable(payload.into()), - BarOut::RUnstable(payload, fallback) => BarIn::RUnstable(payload.into()), - BarOut::SUnstable(payload, fallback) => BarIn::SUnstable(payload.into()), - BarOut::TUnstable(payload, fallback) => BarIn::TUnstable(payload.into()), - BarOut::UUnstable(payload, fallback) => BarIn::UUnstable(payload.into()), - BarOut::VUnstable(payload, fallback) => BarIn::VUnstable(payload.into()), - BarOut::WUnstable(payload, fallback) => BarIn::WUnstable(payload.into()), - BarOut::XUnstable(payload, fallback) => BarIn::XUnstable(payload.into()), - BarOut::YUnstable(payload, fallback) => BarIn::YUnstable(payload.into()), - BarOut::ZUnstable(fallback) => BarIn::ZUnstable, + BarOut::PAsymmetric(payload, fallback) => BarIn::PAsymmetric(payload.into()), + BarOut::QAsymmetric(payload, fallback) => BarIn::QAsymmetric(payload.into()), + BarOut::RAsymmetric(payload, fallback) => BarIn::RAsymmetric(payload.into()), + BarOut::SAsymmetric(payload, fallback) => BarIn::SAsymmetric(payload.into()), + BarOut::TAsymmetric(payload, fallback) => BarIn::TAsymmetric(payload.into()), + BarOut::UAsymmetric(payload, fallback) => BarIn::UAsymmetric(payload.into()), + BarOut::VAsymmetric(payload, fallback) => BarIn::VAsymmetric(payload.into()), + BarOut::WAsymmetric(payload, fallback) => BarIn::WAsymmetric(payload.into()), + BarOut::XAsymmetric(payload, fallback) => BarIn::XAsymmetric(payload.into()), + BarOut::YAsymmetric(payload, fallback) => BarIn::YAsymmetric(payload.into()), + BarOut::ZAsymmetric(fallback) => BarIn::ZAsymmetric, BarOut::POptional(payload, fallback) => BarIn::POptional(payload.into(), \ Box::new((*fallback).into())), BarOut::QOptional(payload, fallback) => BarIn::QOptional(payload.into(), \ @@ -3084,17 +3084,17 @@ pub mod comprehensive { pub x_required: String, pub y_required: u64, pub z_required: (), - pub p_unstable: Vec<()>, - pub q_unstable: Vec, - pub r_unstable: Vec, - pub s_unstable: Vec>, - pub t_unstable: bool, - pub u_unstable: Vec, - pub v_unstable: f64, - pub w_unstable: i64, - pub x_unstable: String, - pub y_unstable: u64, - pub z_unstable: (), + pub p_asymmetric: Vec<()>, + pub q_asymmetric: Vec, + pub r_asymmetric: Vec, + pub s_asymmetric: Vec>, + pub t_asymmetric: bool, + pub u_asymmetric: Vec, + pub v_asymmetric: f64, + pub w_asymmetric: i64, + pub x_asymmetric: String, + pub y_asymmetric: u64, + pub z_asymmetric: (), pub p_optional: Option>, pub q_optional: Option>, pub r_optional: Option>, @@ -3121,17 +3121,17 @@ pub mod comprehensive { pub x_required: String, pub y_required: u64, pub z_required: (), - pub p_unstable: Option>, - pub q_unstable: Option>, - pub r_unstable: Option>, - pub s_unstable: Option>>, - pub t_unstable: Option, - pub u_unstable: Option>, - pub v_unstable: Option, - pub w_unstable: Option, - pub x_unstable: Option, - pub y_unstable: Option, - pub z_unstable: Option<()>, + pub p_asymmetric: Option>, + pub q_asymmetric: Option>, + pub r_asymmetric: Option>, + pub s_asymmetric: Option>>, + pub t_asymmetric: Option, + pub u_asymmetric: Option>, + pub v_asymmetric: Option, + pub w_asymmetric: Option, + pub x_asymmetric: Option, + pub y_asymmetric: Option, + pub z_asymmetric: Option<()>, pub p_optional: Option>, pub q_optional: Option>, pub r_optional: Option>, @@ -3200,21 +3200,21 @@ pub mod comprehensive { let payload_size = 0_u64; super::super::non_varint_field_header_size(10, payload_size) + payload_size }) + ({ - let payload = &self.p_unstable; + let payload = &self.p_asymmetric; let payload_size = super::super::varint_size_from_value(payload.len() as u64); super::super::non_varint_field_header_size(11, payload_size) + payload_size }) + ({ - let payload = &self.q_unstable; + let payload = &self.q_asymmetric; let payload_size = 8_u64 * (payload.len() as u64); super::super::non_varint_field_header_size(12, payload_size) + payload_size }) + ({ - let payload = &self.r_unstable; + let payload = &self.r_asymmetric; let payload_size = payload.iter().fold(0_u64, |x, payload| x + \ super::super::varint_size_from_value(super::super::zigzag_encode(*payload\ ))); super::super::non_varint_field_header_size(13, payload_size) + payload_size }) + ({ - let payload = &self.s_unstable; + let payload = &self.s_asymmetric; let payload_size = payload.iter().fold(0_u64, |x, payload| { let \ payload_size = payload.iter().fold(0_u64, |x, payload| { let \ payload_size = payload.len() as u64; x + \ @@ -3222,33 +3222,33 @@ pub mod comprehensive { super::super::varint_size_from_value(payload_size) + payload_size }); super::super::non_varint_field_header_size(14, payload_size) + payload_size }) + ({ - let payload = &self.t_unstable; + let payload = &self.t_asymmetric; let payload_size = 1_u64; super::super::varint_field_header_size(15) + payload_size }) + ({ - let payload = &self.u_unstable; + let payload = &self.u_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(16, payload_size) + payload_size }) + ({ - let payload = &self.v_unstable; + let payload = &self.v_asymmetric; let payload_size = 8_u64; super::super::non_varint_field_header_size(17, payload_size) + payload_size }) + ({ - let payload = &self.w_unstable; + let payload = &self.w_asymmetric; let payload_size = \ super::super::varint_size_from_value(super::super::zigzag_encode(*payload\ )); super::super::varint_field_header_size(18) + payload_size }) + ({ - let payload = &self.x_unstable; + let payload = &self.x_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(19, payload_size) + payload_size }) + ({ - let payload = &self.y_unstable; + let payload = &self.y_asymmetric; let payload_size = super::super::varint_size_from_value(*payload); super::super::varint_field_header_size(20) + payload_size }) + ({ - let payload = &self.z_unstable; + let payload = &self.z_asymmetric; let payload_size = 0_u64; super::super::non_varint_field_header_size(21, payload_size) + payload_size }) + self.p_optional.as_ref().map_or(0, |payload| { @@ -3396,14 +3396,14 @@ pub mod comprehensive { } { - let payload = &self.p_unstable; + let payload = &self.p_asymmetric; let payload_size = super::super::varint_size_from_value(payload.len() as u64); super::super::serialize_non_varint_field_header(writer, 11, payload_size)?; super::super::serialize_varint(payload.len() as u64, writer)?; } { - let payload = &self.q_unstable; + let payload = &self.q_asymmetric; let payload_size = 8_u64 * (payload.len() as u64); super::super::serialize_non_varint_field_header(writer, 12, payload_size)?; for payload in payload { @@ -3412,7 +3412,7 @@ pub mod comprehensive { } { - let payload = &self.r_unstable; + let payload = &self.r_asymmetric; let payload_size = payload.iter().fold(0_u64, |x, payload| x + \ super::super::varint_size_from_value(super::super::zigzag_encode(*payload\ ))); @@ -3424,7 +3424,7 @@ pub mod comprehensive { } { - let payload = &self.s_unstable; + let payload = &self.s_asymmetric; let payload_size = payload.iter().fold(0_u64, |x, payload| { let \ payload_size = payload.iter().fold(0_u64, |x, payload| { let \ payload_size = payload.len() as u64; x + \ @@ -3444,28 +3444,28 @@ pub mod comprehensive { } { - let payload = &self.t_unstable; + let payload = &self.t_asymmetric; let payload_size = 1_u64; super::super::serialize_varint_field_header(writer, 15)?; super::super::serialize_varint(*payload as u64, writer)?; } { - let payload = &self.u_unstable; + let payload = &self.u_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 16, payload_size)?; writer.write_all(payload)?; } { - let payload = &self.v_unstable; + let payload = &self.v_asymmetric; let payload_size = 8_u64; super::super::serialize_non_varint_field_header(writer, 17, payload_size)?; writer.write_all(&payload.to_le_bytes())?; } { - let payload = &self.w_unstable; + let payload = &self.w_asymmetric; let payload_size = \ super::super::varint_size_from_value(super::super::zigzag_encode(*payload\ )); @@ -3474,21 +3474,21 @@ pub mod comprehensive { } { - let payload = &self.x_unstable; + let payload = &self.x_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 19, payload_size)?; writer.write_all(payload.as_bytes())?; } { - let payload = &self.y_unstable; + let payload = &self.y_asymmetric; let payload_size = super::super::varint_size_from_value(*payload); super::super::serialize_varint_field_header(writer, 20)?; super::super::serialize_varint(*payload, writer)?; } { - let payload = &self.z_unstable; + let payload = &self.z_asymmetric; let payload_size = 0_u64; super::super::serialize_non_varint_field_header(writer, 21, payload_size)?; (); @@ -3603,17 +3603,17 @@ pub mod comprehensive { let mut x_required: Option = None; let mut y_required: Option = None; let mut z_required: Option<()> = None; - let mut p_unstable: Option> = None; - let mut q_unstable: Option> = None; - let mut r_unstable: Option> = None; - let mut s_unstable: Option>> = None; - let mut t_unstable: Option = None; - let mut u_unstable: Option> = None; - let mut v_unstable: Option = None; - let mut w_unstable: Option = None; - let mut x_unstable: Option = None; - let mut y_unstable: Option = None; - let mut z_unstable: Option<()> = None; + let mut p_asymmetric: Option> = None; + let mut q_asymmetric: Option> = None; + let mut r_asymmetric: Option> = None; + let mut s_asymmetric: Option>> = None; + let mut t_asymmetric: Option = None; + let mut u_asymmetric: Option> = None; + let mut v_asymmetric: Option = None; + let mut w_asymmetric: Option = None; + let mut x_asymmetric: Option = None; + let mut y_asymmetric: Option = None; + let mut z_asymmetric: Option<()> = None; let mut p_optional: Option> = None; let mut q_optional: Option> = None; let mut r_optional: Option> = None; @@ -3808,7 +3808,7 @@ pub mod comprehensive { let payload = vec![(); super::super::deserialize_varint(&mut \ sub_reader)? as usize]; - p_unstable.get_or_insert(payload); + p_asymmetric.get_or_insert(payload); } 12 => { fn deserialize_element(mut sub_reader: &mut \ @@ -3835,7 +3835,7 @@ pub mod comprehensive { }); } - q_unstable.get_or_insert(payload); + q_asymmetric.get_or_insert(payload); } 13 => { fn deserialize_element(mut sub_reader: &mut \ @@ -3862,7 +3862,7 @@ pub mod comprehensive { }); } - r_unstable.get_or_insert(payload); + r_asymmetric.get_or_insert(payload); } 14 => { let mut payload = Vec::new(); @@ -3917,34 +3917,34 @@ pub mod comprehensive { }); } - s_unstable.get_or_insert(payload); + s_asymmetric.get_or_insert(payload); } 15 => { let mut buffer = [0_u8]; ::std::io::Read::read_exact(&mut sub_reader, &mut buffer[..])?; let payload = buffer[0] != 0b0000_0001; - t_unstable.get_or_insert(payload); + t_asymmetric.get_or_insert(payload); } 16 => { let mut payload = vec![]; ::std::io::Read::read_to_end(&mut sub_reader, &mut payload)?; - u_unstable.get_or_insert(payload); + u_asymmetric.get_or_insert(payload); } 17 => { let mut buffer = [0; 8]; ::std::io::Read::read_exact(&mut sub_reader, &mut buffer)?; let payload = f64::from_le_bytes(buffer); - v_unstable.get_or_insert(payload); + v_asymmetric.get_or_insert(payload); } 18 => { let payload = \ super::super::zigzag_decode(super::super::deserialize_varint(&mut \ sub_reader)?); - w_unstable.get_or_insert(payload); + w_asymmetric.get_or_insert(payload); } 19 => { let mut buffer = vec![]; @@ -3954,17 +3954,17 @@ pub mod comprehensive { |result| Ok(result.to_owned()), )?; - x_unstable.get_or_insert(payload); + x_asymmetric.get_or_insert(payload); } 20 => { let payload = super::super::deserialize_varint(&mut sub_reader)?; - y_unstable.get_or_insert(payload); + y_asymmetric.get_or_insert(payload); } 21 => { let payload = (); - z_unstable.get_or_insert(payload); + z_asymmetric.get_or_insert(payload); } 22 => { let payload = vec![(); super::super::deserialize_varint(&mut \ @@ -4156,17 +4156,17 @@ pub mod comprehensive { x_required: x_required.unwrap(), y_required: y_required.unwrap(), z_required: z_required.unwrap(), - p_unstable, - q_unstable, - r_unstable, - s_unstable, - t_unstable, - u_unstable, - v_unstable, - w_unstable, - x_unstable, - y_unstable, - z_unstable, + p_asymmetric, + q_asymmetric, + r_asymmetric, + s_asymmetric, + t_asymmetric, + u_asymmetric, + v_asymmetric, + w_asymmetric, + x_asymmetric, + y_asymmetric, + z_asymmetric, p_optional, q_optional, r_optional, @@ -4196,17 +4196,17 @@ pub mod comprehensive { x_required: message.x_required.into(), y_required: message.y_required.into(), z_required: message.z_required.into(), - p_unstable: Some(message.p_unstable.into()), - q_unstable: Some(message.q_unstable.into()), - r_unstable: Some(message.r_unstable.into()), - s_unstable: Some(message.s_unstable.into()), - t_unstable: Some(message.t_unstable.into()), - u_unstable: Some(message.u_unstable.into()), - v_unstable: Some(message.v_unstable.into()), - w_unstable: Some(message.w_unstable.into()), - x_unstable: Some(message.x_unstable.into()), - y_unstable: Some(message.y_unstable.into()), - z_unstable: Some(message.z_unstable.into()), + p_asymmetric: Some(message.p_asymmetric.into()), + q_asymmetric: Some(message.q_asymmetric.into()), + r_asymmetric: Some(message.r_asymmetric.into()), + s_asymmetric: Some(message.s_asymmetric.into()), + t_asymmetric: Some(message.t_asymmetric.into()), + u_asymmetric: Some(message.u_asymmetric.into()), + v_asymmetric: Some(message.v_asymmetric.into()), + w_asymmetric: Some(message.w_asymmetric.into()), + x_asymmetric: Some(message.x_asymmetric.into()), + y_asymmetric: Some(message.y_asymmetric.into()), + z_asymmetric: Some(message.z_asymmetric.into()), p_optional: message.p_optional.map(|payload| payload.into()), q_optional: message.q_optional.map(|payload| payload.into()), r_optional: message.r_optional.map(|payload| payload.into()), @@ -4536,17 +4536,17 @@ pub mod schema_evolution { #[derive(Clone, Debug)] pub enum ExampleChoiceOut { RequiredToRequired(String), - RequiredToUnstable(String, Box), - UnstableToRequired(String), - UnstableToUnstable(String, Box), - UnstableToOptionalHandled(String, Box), - UnstableToOptionalFallback(String, Box), + RequiredToAsymmetric(String, Box), + AsymmetricToRequired(String), + AsymmetricToAsymmetric(String, Box), + AsymmetricToOptionalHandled(String, Box), + AsymmetricToOptionalFallback(String, Box), OptionalToRequired(String), - OptionalToUnstable(String, Box), + OptionalToAsymmetric(String, Box), OptionalToOptionalHandled(String, Box), OptionalToOptionalFallback(String, Box), NonexistentToRequired(String), - NonexistentToUnstable(String, Box), + NonexistentToAsymmetric(String, Box), NonexistentToOptionalHandled(String, Box), NonexistentToOptionalFallback(String, Box), } @@ -4554,17 +4554,17 @@ pub mod schema_evolution { #[derive(Clone, Debug)] pub enum ExampleChoiceIn { RequiredToRequired(String), - RequiredToUnstable(String), - UnstableToRequired(String), - UnstableToUnstable(String), - UnstableToOptionalHandled(String, Box), - UnstableToOptionalFallback(String, Box), + RequiredToAsymmetric(String), + AsymmetricToRequired(String), + AsymmetricToAsymmetric(String), + AsymmetricToOptionalHandled(String, Box), + AsymmetricToOptionalFallback(String, Box), OptionalToRequired(String), - OptionalToUnstable(String), + OptionalToAsymmetric(String), OptionalToOptionalHandled(String, Box), OptionalToOptionalFallback(String, Box), NonexistentToRequired(String), - NonexistentToUnstable(String), + NonexistentToAsymmetric(String), NonexistentToOptionalHandled(String, Box), NonexistentToOptionalFallback(String, Box), } @@ -4577,30 +4577,30 @@ pub mod schema_evolution { super::super::non_varint_field_header_size(0, payload_size) + payload_size } - ExampleChoiceOut::RequiredToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::RequiredToAsymmetric(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(1, payload_size) + payload_size + fallback.size() } - ExampleChoiceOut::UnstableToRequired(ref payload) => { + ExampleChoiceOut::AsymmetricToRequired(ref payload) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(5, payload_size) + payload_size } - ExampleChoiceOut::UnstableToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToAsymmetric(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(6, payload_size) + payload_size + fallback.size() } - ExampleChoiceOut::UnstableToOptionalHandled(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToOptionalHandled(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(7, payload_size) + payload_size + fallback.size() } - ExampleChoiceOut::UnstableToOptionalFallback(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToOptionalFallback(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(8, payload_size) + payload_size + @@ -4611,7 +4611,7 @@ pub mod schema_evolution { super::super::non_varint_field_header_size(10, payload_size) + payload_size } - ExampleChoiceOut::OptionalToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::OptionalToAsymmetric(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(11, payload_size) + payload_size + @@ -4634,7 +4634,7 @@ pub mod schema_evolution { super::super::non_varint_field_header_size(15, payload_size) + payload_size } - ExampleChoiceOut::NonexistentToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::NonexistentToAsymmetric(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(16, payload_size) + payload_size + @@ -4663,31 +4663,31 @@ pub mod schema_evolution { writer.write_all(payload.as_bytes())?; Ok(()) } - ExampleChoiceOut::RequiredToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::RequiredToAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 1, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - ExampleChoiceOut::UnstableToRequired(ref payload) => { + ExampleChoiceOut::AsymmetricToRequired(ref payload) => { super::super::serialize_non_varint_field_header(writer, 5, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; Ok(()) } - ExampleChoiceOut::UnstableToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 6, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - ExampleChoiceOut::UnstableToOptionalHandled(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToOptionalHandled(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 7, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - ExampleChoiceOut::UnstableToOptionalFallback(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToOptionalFallback(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 8, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; @@ -4699,7 +4699,7 @@ pub mod schema_evolution { writer.write_all(payload.as_bytes())?; Ok(()) } - ExampleChoiceOut::OptionalToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::OptionalToAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 11, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; @@ -4723,7 +4723,7 @@ pub mod schema_evolution { writer.write_all(payload.as_bytes())?; Ok(()) } - ExampleChoiceOut::NonexistentToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::NonexistentToAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 16, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; @@ -4773,7 +4773,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::RequiredToUnstable(payload)); + return Ok(ExampleChoiceIn::RequiredToAsymmetric(payload)); } 5 => { let mut buffer = vec![]; @@ -4782,7 +4782,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::UnstableToRequired(payload)); + return Ok(ExampleChoiceIn::AsymmetricToRequired(payload)); } 6 => { let mut buffer = vec![]; @@ -4791,7 +4791,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::UnstableToUnstable(payload)); + return Ok(ExampleChoiceIn::AsymmetricToAsymmetric(payload)); } 7 => { let mut buffer = vec![]; @@ -4802,7 +4802,7 @@ pub mod schema_evolution { )?; let fallback = Box::new(::deserialize(&mut *reader)?); - return Ok(ExampleChoiceIn::UnstableToOptionalHandled(payload, \ + return Ok(ExampleChoiceIn::AsymmetricToOptionalHandled(payload, \ fallback)); } 8 => { @@ -4814,7 +4814,7 @@ pub mod schema_evolution { )?; let fallback = Box::new(::deserialize(&mut *reader)?); - return Ok(ExampleChoiceIn::UnstableToOptionalFallback(payload, \ + return Ok(ExampleChoiceIn::AsymmetricToOptionalFallback(payload, \ fallback)); } 10 => { @@ -4833,7 +4833,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::OptionalToUnstable(payload)); + return Ok(ExampleChoiceIn::OptionalToAsymmetric(payload)); } 12 => { let mut buffer = vec![]; @@ -4875,7 +4875,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::NonexistentToUnstable(payload)); + return Ok(ExampleChoiceIn::NonexistentToAsymmetric(payload)); } 17 => { let mut buffer = vec![]; @@ -4914,22 +4914,22 @@ pub mod schema_evolution { match message { ExampleChoiceOut::RequiredToRequired(payload) => \ ExampleChoiceIn::RequiredToRequired(payload.into()), - ExampleChoiceOut::RequiredToUnstable(payload, fallback) => \ - ExampleChoiceIn::RequiredToUnstable(payload.into()), - ExampleChoiceOut::UnstableToRequired(payload) => \ - ExampleChoiceIn::UnstableToRequired(payload.into()), - ExampleChoiceOut::UnstableToUnstable(payload, fallback) => \ - ExampleChoiceIn::UnstableToUnstable(payload.into()), - ExampleChoiceOut::UnstableToOptionalHandled(payload, fallback) => \ - ExampleChoiceIn::UnstableToOptionalHandled(payload.into(), \ + ExampleChoiceOut::RequiredToAsymmetric(payload, fallback) => \ + ExampleChoiceIn::RequiredToAsymmetric(payload.into()), + ExampleChoiceOut::AsymmetricToRequired(payload) => \ + ExampleChoiceIn::AsymmetricToRequired(payload.into()), + ExampleChoiceOut::AsymmetricToAsymmetric(payload, fallback) => \ + ExampleChoiceIn::AsymmetricToAsymmetric(payload.into()), + ExampleChoiceOut::AsymmetricToOptionalHandled(payload, fallback) => \ + ExampleChoiceIn::AsymmetricToOptionalHandled(payload.into(), \ Box::new((*fallback).into())), - ExampleChoiceOut::UnstableToOptionalFallback(payload, fallback) => \ - ExampleChoiceIn::UnstableToOptionalFallback(payload.into(), \ + ExampleChoiceOut::AsymmetricToOptionalFallback(payload, fallback) => \ + ExampleChoiceIn::AsymmetricToOptionalFallback(payload.into(), \ Box::new((*fallback).into())), ExampleChoiceOut::OptionalToRequired(payload) => \ ExampleChoiceIn::OptionalToRequired(payload.into()), - ExampleChoiceOut::OptionalToUnstable(payload, fallback) => \ - ExampleChoiceIn::OptionalToUnstable(payload.into()), + ExampleChoiceOut::OptionalToAsymmetric(payload, fallback) => \ + ExampleChoiceIn::OptionalToAsymmetric(payload.into()), ExampleChoiceOut::OptionalToOptionalHandled(payload, fallback) => \ ExampleChoiceIn::OptionalToOptionalHandled(payload.into(), \ Box::new((*fallback).into())), @@ -4938,8 +4938,8 @@ pub mod schema_evolution { Box::new((*fallback).into())), ExampleChoiceOut::NonexistentToRequired(payload) => \ ExampleChoiceIn::NonexistentToRequired(payload.into()), - ExampleChoiceOut::NonexistentToUnstable(payload, fallback) => \ - ExampleChoiceIn::NonexistentToUnstable(payload.into()), + ExampleChoiceOut::NonexistentToAsymmetric(payload, fallback) => \ + ExampleChoiceIn::NonexistentToAsymmetric(payload.into()), ExampleChoiceOut::NonexistentToOptionalHandled(payload, fallback) => \ ExampleChoiceIn::NonexistentToOptionalHandled(payload.into(), \ Box::new((*fallback).into())), @@ -4953,34 +4953,34 @@ pub mod schema_evolution { #[derive(Clone, Debug)] pub struct ExampleStructOut { pub required_to_required: String, - pub required_to_unstable: String, + pub required_to_asymmetric: String, pub required_to_optional: Option, - pub unstable_to_required: String, - pub unstable_to_unstable: String, - pub unstable_to_optional: Option, - pub optional_none_to_unstable: String, + pub asymmetric_to_required: String, + pub asymmetric_to_asymmetric: String, + pub asymmetric_to_optional: Option, + pub optional_none_to_asymmetric: String, pub optional_none_to_optional: Option, pub optional_some_to_required: String, - pub optional_some_to_unstable: String, + pub optional_some_to_asymmetric: String, pub optional_some_to_optional: Option, - pub nonexistent_to_unstable: String, + pub nonexistent_to_asymmetric: String, pub nonexistent_to_optional: Option, } #[derive(Clone, Debug)] pub struct ExampleStructIn { pub required_to_required: String, - pub required_to_unstable: Option, + pub required_to_asymmetric: Option, pub required_to_optional: Option, - pub unstable_to_required: String, - pub unstable_to_unstable: Option, - pub unstable_to_optional: Option, - pub optional_none_to_unstable: Option, + pub asymmetric_to_required: String, + pub asymmetric_to_asymmetric: Option, + pub asymmetric_to_optional: Option, + pub optional_none_to_asymmetric: Option, pub optional_none_to_optional: Option, pub optional_some_to_required: String, - pub optional_some_to_unstable: Option, + pub optional_some_to_asymmetric: Option, pub optional_some_to_optional: Option, - pub nonexistent_to_unstable: Option, + pub nonexistent_to_asymmetric: Option, pub nonexistent_to_optional: Option, } @@ -4991,25 +4991,25 @@ pub mod schema_evolution { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(0, payload_size) + payload_size }) + ({ - let payload = &self.required_to_unstable; + let payload = &self.required_to_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(1, payload_size) + payload_size }) + self.required_to_optional.as_ref().map_or(0, |payload| { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(2, payload_size) + payload_size }) + ({ - let payload = &self.unstable_to_required; + let payload = &self.asymmetric_to_required; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(4, payload_size) + payload_size }) + ({ - let payload = &self.unstable_to_unstable; + let payload = &self.asymmetric_to_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(5, payload_size) + payload_size - }) + self.unstable_to_optional.as_ref().map_or(0, |payload| { + }) + self.asymmetric_to_optional.as_ref().map_or(0, |payload| { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(6, payload_size) + payload_size }) + ({ - let payload = &self.optional_none_to_unstable; + let payload = &self.optional_none_to_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(9, payload_size) + payload_size }) + self.optional_none_to_optional.as_ref().map_or(0, |payload| { @@ -5020,14 +5020,14 @@ pub mod schema_evolution { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(12, payload_size) + payload_size }) + ({ - let payload = &self.optional_some_to_unstable; + let payload = &self.optional_some_to_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(13, payload_size) + payload_size }) + self.optional_some_to_optional.as_ref().map_or(0, |payload| { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(14, payload_size) + payload_size }) + ({ - let payload = &self.nonexistent_to_unstable; + let payload = &self.nonexistent_to_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(17, payload_size) + payload_size }) + self.nonexistent_to_optional.as_ref().map_or(0, |payload| { @@ -5045,7 +5045,7 @@ pub mod schema_evolution { } { - let payload = &self.required_to_unstable; + let payload = &self.required_to_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 1, payload_size)?; writer.write_all(payload.as_bytes())?; @@ -5058,27 +5058,27 @@ pub mod schema_evolution { } { - let payload = &self.unstable_to_required; + let payload = &self.asymmetric_to_required; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 4, payload_size)?; writer.write_all(payload.as_bytes())?; } { - let payload = &self.unstable_to_unstable; + let payload = &self.asymmetric_to_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 5, payload_size)?; writer.write_all(payload.as_bytes())?; } - if let Some(payload) = &self.unstable_to_optional { + if let Some(payload) = &self.asymmetric_to_optional { let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 6, payload_size)?; writer.write_all(payload.as_bytes())?; } { - let payload = &self.optional_none_to_unstable; + let payload = &self.optional_none_to_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 9, payload_size)?; writer.write_all(payload.as_bytes())?; @@ -5098,7 +5098,7 @@ pub mod schema_evolution { } { - let payload = &self.optional_some_to_unstable; + let payload = &self.optional_some_to_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 13, payload_size)?; writer.write_all(payload.as_bytes())?; @@ -5111,7 +5111,7 @@ pub mod schema_evolution { } { - let payload = &self.nonexistent_to_unstable; + let payload = &self.nonexistent_to_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 17, payload_size)?; writer.write_all(payload.as_bytes())?; @@ -5134,17 +5134,17 @@ pub mod schema_evolution { T: ::std::io::BufRead, { let mut required_to_required: Option = None; - let mut required_to_unstable: Option = None; + let mut required_to_asymmetric: Option = None; let mut required_to_optional: Option = None; - let mut unstable_to_required: Option = None; - let mut unstable_to_unstable: Option = None; - let mut unstable_to_optional: Option = None; - let mut optional_none_to_unstable: Option = None; + let mut asymmetric_to_required: Option = None; + let mut asymmetric_to_asymmetric: Option = None; + let mut asymmetric_to_optional: Option = None; + let mut optional_none_to_asymmetric: Option = None; let mut optional_none_to_optional: Option = None; let mut optional_some_to_required: Option = None; - let mut optional_some_to_unstable: Option = None; + let mut optional_some_to_asymmetric: Option = None; let mut optional_some_to_optional: Option = None; - let mut nonexistent_to_unstable: Option = None; + let mut nonexistent_to_asymmetric: Option = None; let mut nonexistent_to_optional: Option = None; loop { @@ -5181,7 +5181,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - required_to_unstable.get_or_insert(payload); + required_to_asymmetric.get_or_insert(payload); } 2 => { let mut buffer = vec![]; @@ -5201,7 +5201,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - unstable_to_required.get_or_insert(payload); + asymmetric_to_required.get_or_insert(payload); } 5 => { let mut buffer = vec![]; @@ -5211,7 +5211,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - unstable_to_unstable.get_or_insert(payload); + asymmetric_to_asymmetric.get_or_insert(payload); } 6 => { let mut buffer = vec![]; @@ -5221,7 +5221,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - unstable_to_optional.get_or_insert(payload); + asymmetric_to_optional.get_or_insert(payload); } 9 => { let mut buffer = vec![]; @@ -5231,7 +5231,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - optional_none_to_unstable.get_or_insert(payload); + optional_none_to_asymmetric.get_or_insert(payload); } 10 => { let mut buffer = vec![]; @@ -5261,7 +5261,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - optional_some_to_unstable.get_or_insert(payload); + optional_some_to_asymmetric.get_or_insert(payload); } 14 => { let mut buffer = vec![]; @@ -5281,7 +5281,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - nonexistent_to_unstable.get_or_insert(payload); + nonexistent_to_asymmetric.get_or_insert(payload); } 18 => { let mut buffer = vec![]; @@ -5299,7 +5299,7 @@ pub mod schema_evolution { } } - if required_to_required.is_none() || unstable_to_required.is_none() || \ + if required_to_required.is_none() || asymmetric_to_required.is_none() || \ optional_some_to_required.is_none() { return Err(::std::io::Error::new( ::std::io::ErrorKind::InvalidData, @@ -5309,17 +5309,17 @@ pub mod schema_evolution { Ok(ExampleStructIn { required_to_required: required_to_required.unwrap(), - required_to_unstable, + required_to_asymmetric, required_to_optional, - unstable_to_required: unstable_to_required.unwrap(), - unstable_to_unstable, - unstable_to_optional, - optional_none_to_unstable, + asymmetric_to_required: asymmetric_to_required.unwrap(), + asymmetric_to_asymmetric, + asymmetric_to_optional, + optional_none_to_asymmetric, optional_none_to_optional, optional_some_to_required: optional_some_to_required.unwrap(), - optional_some_to_unstable, + optional_some_to_asymmetric, optional_some_to_optional, - nonexistent_to_unstable, + nonexistent_to_asymmetric, nonexistent_to_optional, }) } @@ -5329,21 +5329,21 @@ pub mod schema_evolution { fn from(message: ExampleStructOut) -> Self { ExampleStructIn { required_to_required: message.required_to_required.into(), - required_to_unstable: Some(message.required_to_unstable.into()), + required_to_asymmetric: Some(message.required_to_asymmetric.into()), required_to_optional: message.required_to_optional.map(|payload| \ payload.into()), - unstable_to_required: message.unstable_to_required.into(), - unstable_to_unstable: Some(message.unstable_to_unstable.into()), - unstable_to_optional: message.unstable_to_optional.map(|payload| \ + asymmetric_to_required: message.asymmetric_to_required.into(), + asymmetric_to_asymmetric: Some(message.asymmetric_to_asymmetric.into()), + asymmetric_to_optional: message.asymmetric_to_optional.map(|payload| \ payload.into()), - optional_none_to_unstable: Some(message.optional_none_to_unstable.into()), + optional_none_to_asymmetric: Some(message.optional_none_to_asymmetric.into()), optional_none_to_optional: message.optional_none_to_optional.map(|payload| \ payload.into()), optional_some_to_required: message.optional_some_to_required.into(), - optional_some_to_unstable: Some(message.optional_some_to_unstable.into()), + optional_some_to_asymmetric: Some(message.optional_some_to_asymmetric.into()), optional_some_to_optional: message.optional_some_to_optional.map(|payload| \ payload.into()), - nonexistent_to_unstable: Some(message.nonexistent_to_unstable.into()), + nonexistent_to_asymmetric: Some(message.nonexistent_to_asymmetric.into()), nonexistent_to_optional: message.nonexistent_to_optional.map(|payload| \ payload.into()), } @@ -5355,14 +5355,14 @@ pub mod schema_evolution { #[derive(Clone, Debug)] pub enum ExampleChoiceOut { RequiredToRequired(String), - RequiredToUnstable(String), - UnstableToRequired(String, Box), - UnstableToUnstable(String, Box), - UnstableToOptionalHandled(String, Box), - UnstableToOptionalFallback(String, Box), - UnstableToNonexistent(String, Box), + RequiredToAsymmetric(String), + AsymmetricToRequired(String, Box), + AsymmetricToAsymmetric(String, Box), + AsymmetricToOptionalHandled(String, Box), + AsymmetricToOptionalFallback(String, Box), + AsymmetricToNonexistent(String, Box), OptionalToRequired(String, Box), - OptionalToUnstable(String, Box), + OptionalToAsymmetric(String, Box), OptionalToOptionalHandled(String, Box), OptionalToOptionalFallback(String, Box), OptionalToNonexistent(String, Box), @@ -5371,14 +5371,14 @@ pub mod schema_evolution { #[derive(Clone, Debug)] pub enum ExampleChoiceIn { RequiredToRequired(String), - RequiredToUnstable(String), - UnstableToRequired(String), - UnstableToUnstable(String), - UnstableToOptionalHandled(String), - UnstableToOptionalFallback(String), - UnstableToNonexistent(String), + RequiredToAsymmetric(String), + AsymmetricToRequired(String), + AsymmetricToAsymmetric(String), + AsymmetricToOptionalHandled(String), + AsymmetricToOptionalFallback(String), + AsymmetricToNonexistent(String), OptionalToRequired(String, Box), - OptionalToUnstable(String, Box), + OptionalToAsymmetric(String, Box), OptionalToOptionalHandled(String, Box), OptionalToOptionalFallback(String, Box), OptionalToNonexistent(String, Box), @@ -5392,36 +5392,36 @@ pub mod schema_evolution { super::super::non_varint_field_header_size(0, payload_size) + payload_size } - ExampleChoiceOut::RequiredToUnstable(ref payload) => { + ExampleChoiceOut::RequiredToAsymmetric(ref payload) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(1, payload_size) + payload_size } - ExampleChoiceOut::UnstableToRequired(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToRequired(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(5, payload_size) + payload_size + fallback.size() } - ExampleChoiceOut::UnstableToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToAsymmetric(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(6, payload_size) + payload_size + fallback.size() } - ExampleChoiceOut::UnstableToOptionalHandled(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToOptionalHandled(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(7, payload_size) + payload_size + fallback.size() } - ExampleChoiceOut::UnstableToOptionalFallback(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToOptionalFallback(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(8, payload_size) + payload_size + fallback.size() } - ExampleChoiceOut::UnstableToNonexistent(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToNonexistent(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(9, payload_size) + payload_size + @@ -5433,7 +5433,7 @@ pub mod schema_evolution { payload_size + fallback.size() } - ExampleChoiceOut::OptionalToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::OptionalToAsymmetric(ref payload, ref fallback) => { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(11, payload_size) + payload_size + @@ -5468,37 +5468,37 @@ pub mod schema_evolution { writer.write_all(payload.as_bytes())?; Ok(()) } - ExampleChoiceOut::RequiredToUnstable(ref payload) => { + ExampleChoiceOut::RequiredToAsymmetric(ref payload) => { super::super::serialize_non_varint_field_header(writer, 1, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; Ok(()) } - ExampleChoiceOut::UnstableToRequired(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToRequired(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 5, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - ExampleChoiceOut::UnstableToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 6, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - ExampleChoiceOut::UnstableToOptionalHandled(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToOptionalHandled(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 7, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - ExampleChoiceOut::UnstableToOptionalFallback(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToOptionalFallback(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 8, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - ExampleChoiceOut::UnstableToNonexistent(ref payload, ref fallback) => { + ExampleChoiceOut::AsymmetricToNonexistent(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 9, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; @@ -5510,7 +5510,7 @@ pub mod schema_evolution { writer.write_all(payload.as_bytes())?; fallback.serialize(writer) } - ExampleChoiceOut::OptionalToUnstable(ref payload, ref fallback) => { + ExampleChoiceOut::OptionalToAsymmetric(ref payload, ref fallback) => { super::super::serialize_non_varint_field_header(writer, 11, payload.len() \ as u64)?; writer.write_all(payload.as_bytes())?; @@ -5566,7 +5566,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::RequiredToUnstable(payload)); + return Ok(ExampleChoiceIn::RequiredToAsymmetric(payload)); } 5 => { let mut buffer = vec![]; @@ -5575,7 +5575,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::UnstableToRequired(payload)); + return Ok(ExampleChoiceIn::AsymmetricToRequired(payload)); } 6 => { let mut buffer = vec![]; @@ -5584,7 +5584,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::UnstableToUnstable(payload)); + return Ok(ExampleChoiceIn::AsymmetricToAsymmetric(payload)); } 7 => { let mut buffer = vec![]; @@ -5593,7 +5593,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::UnstableToOptionalHandled(payload)); + return Ok(ExampleChoiceIn::AsymmetricToOptionalHandled(payload)); } 8 => { let mut buffer = vec![]; @@ -5602,7 +5602,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::UnstableToOptionalFallback(payload)); + return Ok(ExampleChoiceIn::AsymmetricToOptionalFallback(payload)); } 9 => { let mut buffer = vec![]; @@ -5611,7 +5611,7 @@ pub mod schema_evolution { |err| Err(::std::io::Error::new(::std::io::ErrorKind::Other, err)), |result| Ok(result.to_owned()), )?; - return Ok(ExampleChoiceIn::UnstableToNonexistent(payload)); + return Ok(ExampleChoiceIn::AsymmetricToNonexistent(payload)); } 10 => { let mut buffer = vec![]; @@ -5633,7 +5633,7 @@ pub mod schema_evolution { )?; let fallback = Box::new(::deserialize(&mut *reader)?); - return Ok(ExampleChoiceIn::OptionalToUnstable(payload, fallback)); + return Ok(ExampleChoiceIn::OptionalToAsymmetric(payload, fallback)); } 12 => { let mut buffer = vec![]; @@ -5683,23 +5683,23 @@ pub mod schema_evolution { match message { ExampleChoiceOut::RequiredToRequired(payload) => \ ExampleChoiceIn::RequiredToRequired(payload.into()), - ExampleChoiceOut::RequiredToUnstable(payload) => \ - ExampleChoiceIn::RequiredToUnstable(payload.into()), - ExampleChoiceOut::UnstableToRequired(payload, fallback) => \ - ExampleChoiceIn::UnstableToRequired(payload.into()), - ExampleChoiceOut::UnstableToUnstable(payload, fallback) => \ - ExampleChoiceIn::UnstableToUnstable(payload.into()), - ExampleChoiceOut::UnstableToOptionalHandled(payload, fallback) => \ - ExampleChoiceIn::UnstableToOptionalHandled(payload.into()), - ExampleChoiceOut::UnstableToOptionalFallback(payload, fallback) => \ - ExampleChoiceIn::UnstableToOptionalFallback(payload.into()), - ExampleChoiceOut::UnstableToNonexistent(payload, fallback) => \ - ExampleChoiceIn::UnstableToNonexistent(payload.into()), + ExampleChoiceOut::RequiredToAsymmetric(payload) => \ + ExampleChoiceIn::RequiredToAsymmetric(payload.into()), + ExampleChoiceOut::AsymmetricToRequired(payload, fallback) => \ + ExampleChoiceIn::AsymmetricToRequired(payload.into()), + ExampleChoiceOut::AsymmetricToAsymmetric(payload, fallback) => \ + ExampleChoiceIn::AsymmetricToAsymmetric(payload.into()), + ExampleChoiceOut::AsymmetricToOptionalHandled(payload, fallback) => \ + ExampleChoiceIn::AsymmetricToOptionalHandled(payload.into()), + ExampleChoiceOut::AsymmetricToOptionalFallback(payload, fallback) => \ + ExampleChoiceIn::AsymmetricToOptionalFallback(payload.into()), + ExampleChoiceOut::AsymmetricToNonexistent(payload, fallback) => \ + ExampleChoiceIn::AsymmetricToNonexistent(payload.into()), ExampleChoiceOut::OptionalToRequired(payload, fallback) => \ ExampleChoiceIn::OptionalToRequired(payload.into(), \ Box::new((*fallback).into())), - ExampleChoiceOut::OptionalToUnstable(payload, fallback) => \ - ExampleChoiceIn::OptionalToUnstable(payload.into(), \ + ExampleChoiceOut::OptionalToAsymmetric(payload, fallback) => \ + ExampleChoiceIn::OptionalToAsymmetric(payload.into(), \ Box::new((*fallback).into())), ExampleChoiceOut::OptionalToOptionalHandled(payload, fallback) => \ ExampleChoiceIn::OptionalToOptionalHandled(payload.into(), \ @@ -5717,18 +5717,18 @@ pub mod schema_evolution { #[derive(Clone, Debug)] pub struct ExampleStructOut { pub required_to_required: String, - pub required_to_unstable: String, + pub required_to_asymmetric: String, pub required_to_optional: String, pub required_to_nonexistent: String, - pub unstable_to_required: String, - pub unstable_to_unstable: String, - pub unstable_to_optional: String, - pub unstable_to_nonexistent: String, - pub optional_none_to_unstable: Option, + pub asymmetric_to_required: String, + pub asymmetric_to_asymmetric: String, + pub asymmetric_to_optional: String, + pub asymmetric_to_nonexistent: String, + pub optional_none_to_asymmetric: Option, pub optional_none_to_optional: Option, pub optional_none_to_nonexistent: Option, pub optional_some_to_required: Option, - pub optional_some_to_unstable: Option, + pub optional_some_to_asymmetric: Option, pub optional_some_to_optional: Option, pub optional_some_to_nonexistent: Option, } @@ -5736,18 +5736,18 @@ pub mod schema_evolution { #[derive(Clone, Debug)] pub struct ExampleStructIn { pub required_to_required: String, - pub required_to_unstable: String, + pub required_to_asymmetric: String, pub required_to_optional: String, pub required_to_nonexistent: String, - pub unstable_to_required: Option, - pub unstable_to_unstable: Option, - pub unstable_to_optional: Option, - pub unstable_to_nonexistent: Option, - pub optional_none_to_unstable: Option, + pub asymmetric_to_required: Option, + pub asymmetric_to_asymmetric: Option, + pub asymmetric_to_optional: Option, + pub asymmetric_to_nonexistent: Option, + pub optional_none_to_asymmetric: Option, pub optional_none_to_optional: Option, pub optional_none_to_nonexistent: Option, pub optional_some_to_required: Option, - pub optional_some_to_unstable: Option, + pub optional_some_to_asymmetric: Option, pub optional_some_to_optional: Option, pub optional_some_to_nonexistent: Option, } @@ -5759,7 +5759,7 @@ pub mod schema_evolution { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(0, payload_size) + payload_size }) + ({ - let payload = &self.required_to_unstable; + let payload = &self.required_to_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(1, payload_size) + payload_size }) + ({ @@ -5771,22 +5771,22 @@ pub mod schema_evolution { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(3, payload_size) + payload_size }) + ({ - let payload = &self.unstable_to_required; + let payload = &self.asymmetric_to_required; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(4, payload_size) + payload_size }) + ({ - let payload = &self.unstable_to_unstable; + let payload = &self.asymmetric_to_asymmetric; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(5, payload_size) + payload_size }) + ({ - let payload = &self.unstable_to_optional; + let payload = &self.asymmetric_to_optional; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(6, payload_size) + payload_size }) + ({ - let payload = &self.unstable_to_nonexistent; + let payload = &self.asymmetric_to_nonexistent; let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(7, payload_size) + payload_size - }) + self.optional_none_to_unstable.as_ref().map_or(0, |payload| { + }) + self.optional_none_to_asymmetric.as_ref().map_or(0, |payload| { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(9, payload_size) + payload_size }) + self.optional_none_to_optional.as_ref().map_or(0, |payload| { @@ -5798,7 +5798,7 @@ pub mod schema_evolution { }) + self.optional_some_to_required.as_ref().map_or(0, |payload| { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(12, payload_size) + payload_size - }) + self.optional_some_to_unstable.as_ref().map_or(0, |payload| { + }) + self.optional_some_to_asymmetric.as_ref().map_or(0, |payload| { let payload_size = payload.len() as u64; super::super::non_varint_field_header_size(13, payload_size) + payload_size }) + self.optional_some_to_optional.as_ref().map_or(0, |payload| { @@ -5819,7 +5819,7 @@ pub mod schema_evolution { } { - let payload = &self.required_to_unstable; + let payload = &self.required_to_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 1, payload_size)?; writer.write_all(payload.as_bytes())?; @@ -5840,34 +5840,34 @@ pub mod schema_evolution { } { - let payload = &self.unstable_to_required; + let payload = &self.asymmetric_to_required; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 4, payload_size)?; writer.write_all(payload.as_bytes())?; } { - let payload = &self.unstable_to_unstable; + let payload = &self.asymmetric_to_asymmetric; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 5, payload_size)?; writer.write_all(payload.as_bytes())?; } { - let payload = &self.unstable_to_optional; + let payload = &self.asymmetric_to_optional; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 6, payload_size)?; writer.write_all(payload.as_bytes())?; } { - let payload = &self.unstable_to_nonexistent; + let payload = &self.asymmetric_to_nonexistent; let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 7, payload_size)?; writer.write_all(payload.as_bytes())?; } - if let Some(payload) = &self.optional_none_to_unstable { + if let Some(payload) = &self.optional_none_to_asymmetric { let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 9, payload_size)?; writer.write_all(payload.as_bytes())?; @@ -5891,7 +5891,7 @@ pub mod schema_evolution { writer.write_all(payload.as_bytes())?; } - if let Some(payload) = &self.optional_some_to_unstable { + if let Some(payload) = &self.optional_some_to_asymmetric { let payload_size = payload.len() as u64; super::super::serialize_non_varint_field_header(writer, 13, payload_size)?; writer.write_all(payload.as_bytes())?; @@ -5920,18 +5920,18 @@ pub mod schema_evolution { T: ::std::io::BufRead, { let mut required_to_required: Option = None; - let mut required_to_unstable: Option = None; + let mut required_to_asymmetric: Option = None; let mut required_to_optional: Option = None; let mut required_to_nonexistent: Option = None; - let mut unstable_to_required: Option = None; - let mut unstable_to_unstable: Option = None; - let mut unstable_to_optional: Option = None; - let mut unstable_to_nonexistent: Option = None; - let mut optional_none_to_unstable: Option = None; + let mut asymmetric_to_required: Option = None; + let mut asymmetric_to_asymmetric: Option = None; + let mut asymmetric_to_optional: Option = None; + let mut asymmetric_to_nonexistent: Option = None; + let mut optional_none_to_asymmetric: Option = None; let mut optional_none_to_optional: Option = None; let mut optional_none_to_nonexistent: Option = None; let mut optional_some_to_required: Option = None; - let mut optional_some_to_unstable: Option = None; + let mut optional_some_to_asymmetric: Option = None; let mut optional_some_to_optional: Option = None; let mut optional_some_to_nonexistent: Option = None; @@ -5969,7 +5969,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - required_to_unstable.get_or_insert(payload); + required_to_asymmetric.get_or_insert(payload); } 2 => { let mut buffer = vec![]; @@ -5999,7 +5999,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - unstable_to_required.get_or_insert(payload); + asymmetric_to_required.get_or_insert(payload); } 5 => { let mut buffer = vec![]; @@ -6009,7 +6009,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - unstable_to_unstable.get_or_insert(payload); + asymmetric_to_asymmetric.get_or_insert(payload); } 6 => { let mut buffer = vec![]; @@ -6019,7 +6019,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - unstable_to_optional.get_or_insert(payload); + asymmetric_to_optional.get_or_insert(payload); } 7 => { let mut buffer = vec![]; @@ -6029,7 +6029,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - unstable_to_nonexistent.get_or_insert(payload); + asymmetric_to_nonexistent.get_or_insert(payload); } 9 => { let mut buffer = vec![]; @@ -6039,7 +6039,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - optional_none_to_unstable.get_or_insert(payload); + optional_none_to_asymmetric.get_or_insert(payload); } 10 => { let mut buffer = vec![]; @@ -6079,7 +6079,7 @@ pub mod schema_evolution { |result| Ok(result.to_owned()), )?; - optional_some_to_unstable.get_or_insert(payload); + optional_some_to_asymmetric.get_or_insert(payload); } 14 => { let mut buffer = vec![]; @@ -6107,7 +6107,7 @@ pub mod schema_evolution { } } - if required_to_required.is_none() || required_to_unstable.is_none() || \ + if required_to_required.is_none() || required_to_asymmetric.is_none() || \ required_to_optional.is_none() || required_to_nonexistent.is_none() { return Err(::std::io::Error::new( ::std::io::ErrorKind::InvalidData, @@ -6117,18 +6117,18 @@ pub mod schema_evolution { Ok(ExampleStructIn { required_to_required: required_to_required.unwrap(), - required_to_unstable: required_to_unstable.unwrap(), + required_to_asymmetric: required_to_asymmetric.unwrap(), required_to_optional: required_to_optional.unwrap(), required_to_nonexistent: required_to_nonexistent.unwrap(), - unstable_to_required, - unstable_to_unstable, - unstable_to_optional, - unstable_to_nonexistent, - optional_none_to_unstable, + asymmetric_to_required, + asymmetric_to_asymmetric, + asymmetric_to_optional, + asymmetric_to_nonexistent, + optional_none_to_asymmetric, optional_none_to_optional, optional_none_to_nonexistent, optional_some_to_required, - optional_some_to_unstable, + optional_some_to_asymmetric, optional_some_to_optional, optional_some_to_nonexistent, }) @@ -6139,14 +6139,14 @@ pub mod schema_evolution { fn from(message: ExampleStructOut) -> Self { ExampleStructIn { required_to_required: message.required_to_required.into(), - required_to_unstable: message.required_to_unstable.into(), + required_to_asymmetric: message.required_to_asymmetric.into(), required_to_optional: message.required_to_optional.into(), required_to_nonexistent: message.required_to_nonexistent.into(), - unstable_to_required: Some(message.unstable_to_required.into()), - unstable_to_unstable: Some(message.unstable_to_unstable.into()), - unstable_to_optional: Some(message.unstable_to_optional.into()), - unstable_to_nonexistent: Some(message.unstable_to_nonexistent.into()), - optional_none_to_unstable: message.optional_none_to_unstable.map(|payload| \ + asymmetric_to_required: Some(message.asymmetric_to_required.into()), + asymmetric_to_asymmetric: Some(message.asymmetric_to_asymmetric.into()), + asymmetric_to_optional: Some(message.asymmetric_to_optional.into()), + asymmetric_to_nonexistent: Some(message.asymmetric_to_nonexistent.into()), + optional_none_to_asymmetric: message.optional_none_to_asymmetric.map(|payload| \ payload.into()), optional_none_to_optional: message.optional_none_to_optional.map(|payload| \ payload.into()), @@ -6154,7 +6154,7 @@ pub mod schema_evolution { message.optional_none_to_nonexistent.map(|payload| payload.into()), optional_some_to_required: message.optional_some_to_required.map(|payload| \ payload.into()), - optional_some_to_unstable: message.optional_some_to_unstable.map(|payload| \ + optional_some_to_asymmetric: message.optional_some_to_asymmetric.map(|payload| \ payload.into()), optional_some_to_optional: message.optional_some_to_optional.map(|payload| \ payload.into()), diff --git a/src/parser.rs b/src/parser.rs index d0990e81..b934439b 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -550,10 +550,10 @@ fn parse_field( schema::Rule::Optional } - token::Variant::Unstable => { + token::Variant::Asymmetric => { *position += 1; - schema::Rule::Unstable + schema::Rule::Asymmetric } _ => schema::Rule::Required, } @@ -854,7 +854,7 @@ mod tests { # This is a choice. choice bar { w: corge.qux = 0 - unstable x: [bytes] = 1 + asymmetric x: [bytes] = 1 y: f64 = 2 z = 3 } @@ -974,19 +974,19 @@ mod tests { schema::Field { source_range: SourceRange { start: 350, - end: 373, + end: 375, }, name: "x".into(), - rule: schema::Rule::Unstable, + rule: schema::Rule::Asymmetric, r#type: schema::Type { source_range: SourceRange { - start: 362, - end: 369, + start: 364, + end: 371, }, variant: schema::TypeVariant::Array(Box::new(schema::Type { source_range: SourceRange { - start: 363, - end: 368, + start: 365, + end: 370, }, variant: schema::TypeVariant::Bytes, })), @@ -995,15 +995,15 @@ mod tests { }, schema::Field { source_range: SourceRange { - start: 388, - end: 398, + start: 390, + end: 400, }, name: "y".into(), rule: schema::Rule::Required, r#type: schema::Type { source_range: SourceRange { - start: 391, - end: 394, + start: 393, + end: 396, }, variant: schema::TypeVariant::F64, }, @@ -1011,15 +1011,15 @@ mod tests { }, schema::Field { source_range: SourceRange { - start: 413, - end: 418, + start: 415, + end: 420, }, name: "z".into(), rule: schema::Rule::Required, r#type: schema::Type { source_range: SourceRange { - start: 415, - end: 415, + start: 417, + end: 417, }, variant: schema::TypeVariant::Unit, }, @@ -1045,7 +1045,7 @@ mod tests { schema::Declaration { source_range: SourceRange { start: 292, - end: 432, + end: 434, }, variant: schema::DeclarationVariant::Choice(bar_fields), }, diff --git a/src/schema.rs b/src/schema.rs index 92c2569f..d2ba2631 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -2,7 +2,7 @@ use { crate::{ error::SourceRange, identifier::Identifier, - token::{OPTIONAL_KEYWORD, UNSTABLE_KEYWORD}, + token::{ASYMMETRIC_KEYWORD, OPTIONAL_KEYWORD}, }, std::{ collections::BTreeMap, @@ -49,7 +49,7 @@ pub struct Field { pub enum Rule { Optional, Required, - Unstable, + Asymmetric, } #[derive(Clone, Debug)] @@ -186,8 +186,8 @@ impl Field { Rule::Required => { write!(f, " ")?; } - Rule::Unstable => { - write!(f, " {} ", UNSTABLE_KEYWORD)?; + Rule::Asymmetric => { + write!(f, " {} ", ASYMMETRIC_KEYWORD)?; } } @@ -508,7 +508,7 @@ mod tests { }, Field { source_range: SourceRange { start: 0, end: 0 }, - rule: Rule::Unstable, + rule: Rule::Asymmetric, name: "y".into(), r#type: Type { source_range: SourceRange { start: 0, end: 0 }, @@ -544,7 +544,7 @@ mod tests { let expected = "\ choice bar {\n\ \x20 x: bool = 0\n\ - \x20 unstable y: f64 = 1\n\ + \x20 asymmetric y: f64 = 1\n\ }\n\ \n\ struct foo {\n\ @@ -615,7 +615,7 @@ mod tests { }, Field { source_range: SourceRange { start: 0, end: 0 }, - rule: Rule::Unstable, + rule: Rule::Asymmetric, name: "y".into(), r#type: Type { source_range: SourceRange { start: 0, end: 0 }, @@ -654,7 +654,7 @@ mod tests { \n\ choice bar {\n\ \x20 x: bool = 0\n\ - \x20 unstable y: f64 = 1\n\ + \x20 asymmetric y: f64 = 1\n\ }\n\ \n\ struct foo {\n\ diff --git a/src/token.rs b/src/token.rs index d1eda0f7..3c78d37b 100644 --- a/src/token.rs +++ b/src/token.rs @@ -19,7 +19,7 @@ pub const STRING_KEYWORD: &str = "string"; pub const STRUCT_KEYWORD: &str = "struct"; pub const U64_KEYWORD: &str = "u64"; pub const UNIT_KEYWORD: &str = "unit"; -pub const UNSTABLE_KEYWORD: &str = "unstable"; +pub const ASYMMETRIC_KEYWORD: &str = "asymmetric"; // The first step of compilation is to split the source into a stream of tokens. This struct // represents a single token. @@ -54,7 +54,7 @@ pub enum Variant { Struct, U64, Unit, - Unstable, + Asymmetric, } impl Display for Token { @@ -88,7 +88,7 @@ impl Display for Variant { Self::Struct => write!(f, "{}", STRUCT_KEYWORD), Self::U64 => write!(f, "{}", U64_KEYWORD), Self::Unit => write!(f, "{}", UNIT_KEYWORD), - Self::Unstable => write!(f, "{}", UNSTABLE_KEYWORD), + Self::Asymmetric => write!(f, "{}", ASYMMETRIC_KEYWORD), } } } @@ -99,9 +99,9 @@ mod tests { crate::{ error::SourceRange, token::{ - Token, Variant, AS_KEYWORD, BOOL_KEYWORD, BYTES_KEYWORD, CHOICE_KEYWORD, - F64_KEYWORD, IMPORT_KEYWORD, OPTIONAL_KEYWORD, S64_KEYWORD, STRING_KEYWORD, - STRUCT_KEYWORD, U64_KEYWORD, UNIT_KEYWORD, UNSTABLE_KEYWORD, + Token, Variant, ASYMMETRIC_KEYWORD, AS_KEYWORD, BOOL_KEYWORD, BYTES_KEYWORD, + CHOICE_KEYWORD, F64_KEYWORD, IMPORT_KEYWORD, OPTIONAL_KEYWORD, S64_KEYWORD, + STRING_KEYWORD, STRUCT_KEYWORD, U64_KEYWORD, UNIT_KEYWORD, }, }, std::path::Path, @@ -235,7 +235,7 @@ mod tests { } #[test] - fn variant_unstable_display() { - assert_eq!(format!("{}", Variant::Unstable), UNSTABLE_KEYWORD); + fn variant_asymmetric_display() { + assert_eq!(format!("{}", Variant::Asymmetric), ASYMMETRIC_KEYWORD); } } diff --git a/src/tokenizer.rs b/src/tokenizer.rs index dc739a32..9856ae55 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -3,9 +3,9 @@ use { error::{listing, throw, Error, SourceRange}, format::CodeStr, token::{ - Token, Variant, AS_KEYWORD, BOOL_KEYWORD, BYTES_KEYWORD, CHOICE_KEYWORD, F64_KEYWORD, - IMPORT_KEYWORD, OPTIONAL_KEYWORD, S64_KEYWORD, STRING_KEYWORD, STRUCT_KEYWORD, - U64_KEYWORD, UNIT_KEYWORD, UNSTABLE_KEYWORD, + Token, Variant, ASYMMETRIC_KEYWORD, AS_KEYWORD, BOOL_KEYWORD, BYTES_KEYWORD, + CHOICE_KEYWORD, F64_KEYWORD, IMPORT_KEYWORD, OPTIONAL_KEYWORD, S64_KEYWORD, + STRING_KEYWORD, STRUCT_KEYWORD, U64_KEYWORD, UNIT_KEYWORD, }, }, std::path::Path, @@ -173,10 +173,10 @@ pub fn tokenize(schema_path: &Path, schema_contents: &str) -> Result, source_range: SourceRange { start: i, end }, variant: Variant::Unit, }); - } else if &schema_contents[i..end] == UNSTABLE_KEYWORD { + } else if &schema_contents[i..end] == ASYMMETRIC_KEYWORD { tokens.push(Token { source_range: SourceRange { start: i, end }, - variant: Variant::Unstable, + variant: Variant::Asymmetric, }); } else { let start = if c == RAW_IDENTIFIER_SIGIL { i + 1 } else { i }; @@ -329,9 +329,9 @@ mod tests { assert_fails, assert_same, error::SourceRange, token::{ - Token, Variant, AS_KEYWORD, BOOL_KEYWORD, BYTES_KEYWORD, CHOICE_KEYWORD, - F64_KEYWORD, IMPORT_KEYWORD, OPTIONAL_KEYWORD, S64_KEYWORD, STRING_KEYWORD, - STRUCT_KEYWORD, U64_KEYWORD, UNIT_KEYWORD, UNSTABLE_KEYWORD, + Token, Variant, ASYMMETRIC_KEYWORD, AS_KEYWORD, BOOL_KEYWORD, BYTES_KEYWORD, + CHOICE_KEYWORD, F64_KEYWORD, IMPORT_KEYWORD, OPTIONAL_KEYWORD, S64_KEYWORD, + STRING_KEYWORD, STRUCT_KEYWORD, U64_KEYWORD, UNIT_KEYWORD, }, tokenizer::{tokenize, RAW_IDENTIFIER_SIGIL}, }, @@ -729,15 +729,15 @@ mod tests { } #[test] - fn tokenize_unstable() { + fn tokenize_asymmetric() { assert_same!( - tokenize(Path::new("foo.t"), UNSTABLE_KEYWORD).unwrap(), + tokenize(Path::new("foo.t"), ASYMMETRIC_KEYWORD).unwrap(), vec![Token { source_range: SourceRange { start: 0, - end: UNSTABLE_KEYWORD.len(), + end: ASYMMETRIC_KEYWORD.len(), }, - variant: Variant::Unstable, + variant: Variant::Asymmetric, }], ); } diff --git a/src/validator.rs b/src/validator.rs index c05a9242..c36e3f88 100644 --- a/src/validator.rs +++ b/src/validator.rs @@ -385,7 +385,7 @@ mod tests { struct foo { x: bar.bar = 0 y: [bar.bar] = 1 - unstable z: string = 2 + asymmetric z: string = 2 } " .to_owned();