chiark / gitweb /
X
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Feb 2022 17:57:55 +0000 (17:57 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Feb 2022 17:57:55 +0000 (17:57 +0000)
Cargo.lock [new file with mode: 0644]
Cargo.toml [new file with mode: 0644]
src/main.rs [new file with mode: 0644]

diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644 (file)
index 0000000..0e5399e
--- /dev/null
@@ -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 (file)
index 0000000..1d9cfe3
--- /dev/null
@@ -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 (file)
index 0000000..a1b0ad0
--- /dev/null
@@ -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<Self>;
+    /// Encode the body of this cell into the end of a vec.
+    fn encode_onto(self, w: &mut Vec<u8>);
+}
+
+
+
+fn mutate(w: &mut Vec<u8>) {
+    w.push(0);
+}
+
+
+fn main() {
+    let mut w = vec![42];
+    mutate(&mut w);
+    println!("{:?}", &w);
+}