append inline always
This commit is contained in:
@@ -25,9 +25,11 @@ fn derive_struct(name: Ident, data: &DataStruct) -> Result<TokenStream, std::fmt
|
||||
|
||||
writeln!(&mut output, "#[automatically_derived]")?;
|
||||
writeln!(&mut output, "impl otw::OverTheWire for {name} {{")?;
|
||||
writeln!(&mut output, " #[inline(always)]")?;
|
||||
writeln!(&mut output, " fn serialize<T: otw::Writer>(&self, writer: &mut T) -> e::Result<()> {{")?;
|
||||
wsf(&mut output, " ", Some("self"), &data.fields)?;
|
||||
writeln!(&mut output, " }}")?;
|
||||
writeln!(&mut output, " #[inline(always)]")?;
|
||||
writeln!(&mut output, " fn deserialize<T: otw::Reader>(reader: &mut T) -> e::Result<Self> {{")?;
|
||||
wdf(&mut output, " ", tname.as_str(), &data.fields)?;
|
||||
writeln!(&mut output, " }}")?;
|
||||
@@ -47,6 +49,7 @@ fn derive_enum(name: Ident, data: &DataEnum) -> Result<TokenStream, std::fmt::Er
|
||||
|
||||
writeln!(&mut output, "#[automatically_derived]")?;
|
||||
writeln!(&mut output, "impl otw::OverTheWire for {name} {{")?;
|
||||
writeln!(&mut output, " #[inline(always)]")?;
|
||||
writeln!(&mut output, " fn serialize<T: otw::Writer>(&self, writer: &mut T) -> e::Result<()> {{")?;
|
||||
writeln!(&mut output, " match self {{")?;
|
||||
|
||||
@@ -91,6 +94,7 @@ fn derive_enum(name: Ident, data: &DataEnum) -> Result<TokenStream, std::fmt::Er
|
||||
writeln!(&mut output, " }}")?;
|
||||
|
||||
//╶───╴Deserialize╶──────────────────────────────────────────────────────────╴
|
||||
writeln!(&mut output, " #[inline(always)]")?;
|
||||
writeln!(&mut output, " fn deserialize<T: otw::Reader>(reader: &mut T) -> e::Result<Self> {{")?;
|
||||
writeln!(&mut output, " match <u8 as otw::OverTheWire>::deserialize(reader)? {{")?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user