-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use r# syntax for keywords instead of appending _ (#153)
This is more faithful to the input and guarantees that there can't be a collision. Also included is a fix for reflection since the munged names shouldn't be used at runtime. This also adds a couple missing keywords from Rust 2018.
- Loading branch information
Showing
10 changed files
with
565 additions
and
135 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
extern crate lazy_static; | ||
|
||
pub mod bench; | ||
pub mod r#mod; | ||
pub mod pbtest2; | ||
pub mod pbtest3; | ||
pub mod servicepb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// @generated, do not edit | ||
|
||
pub mod r#struct; |
61 changes: 61 additions & 0 deletions
61
pb-test/gen/pb-jelly/proto_pbtest/src/mod/struct.rs.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// @generated, do not edit | ||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] | ||
pub struct Message { | ||
} | ||
impl ::std::default::Default for Message { | ||
fn default() -> Self { | ||
Message { | ||
} | ||
} | ||
} | ||
lazy_static! { | ||
pub static ref Message_default: Message = Message::default(); | ||
} | ||
impl ::pb_jelly::Message for Message { | ||
fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { | ||
Some(::pb_jelly::MessageDescriptor { | ||
name: "Message", | ||
full_name: "pbtest.mod.Message", | ||
fields: &[ | ||
], | ||
oneofs: &[ | ||
], | ||
}) | ||
} | ||
fn compute_size(&self) -> usize { | ||
0 | ||
} | ||
fn compute_grpc_slices_size(&self) -> usize { | ||
0 | ||
} | ||
fn serialize<W: ::pb_jelly::PbBufferWriter>(&self, w: &mut W) -> ::std::io::Result<()> { | ||
Ok(()) | ||
} | ||
fn deserialize<B: ::pb_jelly::PbBufferReader>(&mut self, mut buf: &mut B) -> ::std::io::Result<()> { | ||
while let Some((field_number, typ)) = ::pb_jelly::wire_format::read(&mut buf)? { | ||
match field_number { | ||
_ => { | ||
::pb_jelly::skip(typ, &mut buf)?; | ||
} | ||
} | ||
} | ||
Ok(()) | ||
} | ||
} | ||
impl ::pb_jelly::Reflection for Message { | ||
fn which_one_of(&self, oneof_name: &str) -> ::std::option::Option<&'static str> { | ||
match oneof_name { | ||
_ => { | ||
panic!("unknown oneof name given"); | ||
} | ||
} | ||
} | ||
fn get_field_mut(&mut self, field_name: &str) -> ::pb_jelly::reflection::FieldMut<'_> { | ||
match field_name { | ||
_ => { | ||
panic!("unknown field name given") | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.