From 1e46970989da83dd50a052cc1d023c70d5ed127f Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 16 Jun 2025 14:45:12 -0400 Subject: [Rust] Add a comment about cleaning up the `BinaryView` object --- rust/src/binary_view.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'rust/src/binary_view.rs') diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs index 394dda16..417b30ef 100644 --- a/rust/src/binary_view.rs +++ b/rust/src/binary_view.rs @@ -1962,6 +1962,12 @@ pub trait BinaryViewExt: BinaryViewBase { impl BinaryViewExt for T {} +/// # Cleaning up +/// +/// [`BinaryView`] has a cyclic relationship with the associated [`FileMetadata`], each holds a strong +/// reference to one another, so to properly clean up/free the [`BinaryView`], you must manually close the +/// file using [`FileMetadata::close`], this is not fixable in the general case, until [`FileMetadata`] +/// has only a weak reference to the [`BinaryView`]. #[derive(PartialEq, Eq, Hash)] pub struct BinaryView { pub(crate) handle: *mut BNBinaryView, -- cgit v1.3.1