From 87753b5227816aff54584101e05409a98fa04321 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 2 Feb 2022 17:57:55 +0000 Subject: [PATCH] X --- Cargo.lock | 7 +++++++ Cargo.toml | 8 ++++++++ src/main.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..0e5399e --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "foo" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..1d9cfe3 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "foo" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..a1b0ad0 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,51 @@ + +#![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; + /// Encode the body of this cell into the end of a vec. + fn encode_onto(self, w: &mut Vec); +} + + + +fn mutate(w: &mut Vec) { + w.push(0); +} + + +fn main() { + let mut w = vec![42]; + mutate(&mut w); + println!("{:?}", &w); +} -- 2.30.2