Crate bumpref

Crate bumpref 

Source
Expand description

Explicit reference count bumping for Arc, Rc, and their weak variants.

This crate provides the Bump trait, which adds a .bump() method to reference-counted types as an explicit alias for .clone(). This makes it clear that cloning is cheap—just incrementing a reference count, not copying data.

§Example

use std::sync::Arc;
use bumpref::Bump;

let arc = Arc::new(42);
let arc_bumped = arc.bump(); // equivalent to Arc::clone(&arc)
assert_eq!(*arc, *arc_bumped);

Traits§

Bump
A trait that provides a bump() method for reference-counted pointers.