Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Expose share counts in Buffer (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Jun 14, 2022
1 parent 83082fa commit 72df09f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ impl<T: NativeType> Buffer<T> {
Either::Right(data) => data,
}
}

/// Get the strong count of underlying `Arc` data buffer.
pub fn shared_count_strong(&self) -> usize {
Arc::strong_count(&self.data)
}

/// Get the weak count of underlying `Arc` data buffer.
pub fn shared_count_weak(&self) -> usize {
Arc::weak_count(&self.data)
}
}

impl<T: NativeType> From<Vec<T>> for Buffer<T> {
Expand Down

0 comments on commit 72df09f

Please sign in to comment.