Skip to content

Commit

Permalink
Improve function names
Browse files Browse the repository at this point in the history
A Tuple struct is called a Tuple struct, not an unnamed field struct, so
it makes more sense for the function to be called `make_tuple`, in line
with `make_ZST`.
  • Loading branch information
SlayerOfTheBad committed Jan 14, 2024
1 parent 5458fa0 commit 7643a70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/generate/gen_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::Result;
/// .add_value("Unnamed")
/// .add_field("", "u16")
/// .add_field("baz", "String")
/// .make_fields_unnamed();
/// .make_tuple();
/// }
/// # generator.assert_eq("enum Foo { ZST , Named { bar : u16 , baz : String , } , Unnamed (u16 , String ,) , }");
/// # Ok::<_, virtue::Error>(())
Expand Down Expand Up @@ -193,7 +193,7 @@ impl EnumValue {
/// Make the struct fields unnamed
///
/// The names of any field will be ignored
pub fn make_fields_unnamed(&mut self) -> &mut Self {
pub fn make_tuple(&mut self) -> &mut Self {
self.value_type = ValueType::Unnamed;
self
}
Expand Down
4 changes: 2 additions & 2 deletions src/generate/gen_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<'a, P: Parent> GenStruct<'a, P> {
/// # let mut generator = Generator::with_name("Fooz");
/// generator
/// .generate_struct("Foo")
/// .make_fields_unnamed()
/// .make_tuple()
/// .add_field("bar", "u16")
/// .add_field("baz", "String");
/// # generator.assert_eq("struct Foo (u16 , String ,) ;");
Expand All @@ -70,7 +70,7 @@ impl<'a, P: Parent> GenStruct<'a, P> {
/// ```
/// struct Foo(u16, String);
/// ```
pub fn make_fields_unnamed(&mut self) -> &mut Self {
pub fn make_tuple(&mut self) -> &mut Self {
self.struct_type = StructType::Unnamed;
self
}
Expand Down

0 comments on commit 7643a70

Please sign in to comment.