From 2f041e6dbb44783fef9a3da84c38fdd5176d203f Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 29 May 2026 11:10:13 +0100 Subject: [PATCH] Add comment that common/specific fields are immutable --- rust/src/events/formats/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust/src/events/formats/mod.rs b/rust/src/events/formats/mod.rs index b7cf51f91f..10b16a5436 100644 --- a/rust/src/events/formats/mod.rs +++ b/rust/src/events/formats/mod.rs @@ -133,6 +133,11 @@ impl FormattedEvent { FormattedEvent { signatures: self.signatures.deep_copy(), unsigned: self.unsigned.deep_copy(), + // These fields can safely be shared among all of the copies as they + // are immutable (they're behind an Arc and so you can't get a + // mutable reference and they have no interior mutability) and these + // write protections extend into Python land as well (i.e. you can't + // accidentally do the wrong thing and mutate) specific_fields: Arc::clone(&self.specific_fields), common_fields: Arc::clone(&self.common_fields), }