+impl_feature_len_prefixed_write!(BlindedHopFeatures);
+
+// Some features only appear inside of TLVs, so they don't have a length prefix when serialized.
+macro_rules! impl_feature_tlv_write {
+ ($features: ident) => {
+ impl Writeable for $features {
+ fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
+ WithoutLength(self).write(w)
+ }
+ }
+ impl Readable for $features {
+ fn read<R: io::Read>(r: &mut R) -> Result<Self, DecodeError> {
+ Ok(WithoutLength::<Self>::read(r)?.0)
+ }
+ }
+ }
+}
+
+impl_feature_tlv_write!(ChannelTypeFeatures);
+
+// Some features may appear both in a TLV record and as part of a TLV subtype sequence. The latter
+// requires a length but the former does not.