borrow 2.0.0

Zero-overhead, safe implementation of partial borrows. This crate allows you to borrow selected fields from a struct and split structs into non-overlapping sets of borrowed fields.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! # 🪢 Partial Self Borrows
//!
//! One of the biggest advantages of partial borrowing is the ability to partially borrow `self` in
//! methods. This is especially useful when some fields are private, as there's no way to work
//! around partial borrowing of `self` by splitting it into multiple parameters if certain fields
//! are private. Special thanks to
//! [@bleachisback](https://www.reddit.com/r/rust/comments/1gr5tqd/comment/lx4wip2) for pointing
//! this out.
//!
//! Refer to the following example to see how partial self-borrows can be used:
//!
//! ```
#![doc = include_str!("../../tests/self_borrow.rs")]
//! # fn main() {}
//! ```