-#![warn(noop_method_call)]
-#![deny(unreachable_pub)]
-#![deny(clippy::all)]
-#![deny(clippy::await_holding_lock)]
-#![deny(clippy::cast_lossless)]
-#![deny(clippy::checked_conversions)]
-#![warn(clippy::clone_on_ref_ptr)]
-#![warn(clippy::cognitive_complexity)]
-#![deny(clippy::debug_assert_with_mut_call)]
-#![deny(clippy::exhaustive_enums)]
-#![deny(clippy::exhaustive_structs)]
-#![deny(clippy::expl_impl_clone_on_copy)]
-#![deny(clippy::fallible_impl_from)]
-#![deny(clippy::implicit_clone)]
-#![deny(clippy::large_stack_arrays)]
-#![warn(clippy::manual_ok_or)]
-#![warn(clippy::needless_borrow)]
-#![warn(clippy::needless_pass_by_value)]
-#![warn(clippy::option_option)]
-#![warn(clippy::rc_buffer)]
-#![deny(clippy::ref_option_ref)]
-#![warn(clippy::semicolon_if_nothing_returned)]
-#![warn(clippy::trait_duplication_in_bounds)]
-#![deny(clippy::unnecessary_wraps)]
-#![warn(clippy::unseparated_literal_suffix)]
-#![deny(clippy::unwrap_used)]
-
-
-/// Internal: traits in common different cell bodies.
pub trait Body: Sized {
- /// Convert this type into a RelayMsg, wrapped appropriate.
- fn into_message(self) -> RelayMsg;
- /// Decode a relay cell body from a provided reader.
- fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>;
- /// Encode the body of this cell into the end of a vec.
fn encode_onto(self, w: &mut Vec<u8>);
}
+struct Wombat;
-
-fn mutate(w: &mut Vec<u8>) {
- w.push(0);
+impl Body for Wombat {
+ fn encode_onto(self, w: &mut Vec<u8>) {
+ w.push(0);
+ }
}
-
fn main() {
let mut w = vec![42];
- mutate(&mut w);
+ Wombat.encode_onto(&mut w);
println!("{:?}", &w);
}