Skip to main content

RcManager

Struct RcManager 

Source
pub struct RcManager { /* private fields */ }
Expand description

Manages reference counting within a scope.

The RcManager tracks all live references and their counts, applies elision hints, and collects statistics.

Implementations§

Source§

impl RcManager

Source

pub fn new() -> Self

Create a new RC manager.

Source

pub fn with_analysis(analysis: RcElisionAnalysis) -> Self

Create a new RC manager with elision analysis.

Source

pub fn inc(&mut self, var: &str)

Record an RC increment for a variable.

Source

pub fn dec(&mut self, var: &str)

Record an RC decrement for a variable.

Source

pub fn schedule_dec(&mut self, var: String)

Schedule a decrement for later (batch processing).

Source

pub fn flush_pending(&mut self)

Process all pending decrements.

Source

pub fn can_mutate_inplace(&self, var: &str) -> bool

Check if a variable can be mutated in-place.

Source

pub fn record_inplace_mutation(&mut self)

Record an in-place mutation.

Source

pub fn record_cow(&mut self)

Record a copy-on-write operation.

Source

pub fn stats(&self) -> &RcStats

Get the current statistics.

Source

pub fn analysis(&self) -> &RcElisionAnalysis

Get the elision analysis.

Source

pub fn set_enabled(&mut self, enabled: bool)

Enable or disable RC tracking.

Source

pub fn set_max_rc_threshold(&mut self, threshold: u32)

Set the maximum RC threshold.

Source

pub fn max_rc_threshold(&self) -> u32

Get the max RC threshold.

Source

pub fn reset_stats(&mut self)

Reset statistics.

Trait Implementations§

Source§

impl Default for RcManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.