Crates.io | ownref |
lib.rs | ownref |
version | 0.3.1 |
source | src |
created_at | 2022-01-08 22:23:26.284325 |
updated_at | 2022-01-09 15:40:42.236791 |
description | Provide the smart pointer type that bundles the data with its owner. |
homepage | https://github.com/jerry73204/ownref |
repository | https://github.com/jerry73204/ownref.git |
max_upload_size | |
id | 510565 |
size | 66,720 |
This crate provides the smart pointer type that bundles the data with its owner. It has the folloing features:
Box
or Arc
.The following table shows Box
-based reference types. The generic O
denotes the
owner type and I
denotes the data type.
data type (I ) \ ordering |
Content ordered | Pointer address ordered |
---|---|---|
Reference | BoxRefC<O, I> |
BoxRefA<O, I> |
Owned | BoxOwnedC<O, I> |
BoxOwnedA<O, I> |
The following table shows Arc
-based reference types.
data type (I ) \ ordering |
Content ordered | Pointer address ordered |
---|---|---|
Reference | ArcRefC<O, I> |
ArcRefA<O, I> |
Owned | ArcOwnedC<O, I> |
ArcOwnedA<O, I> |
For example,
BoxRefA<Vec<str>, str>
is a reference to str
within the owner Vec<str>
, which is ordered by pointer address.ArcOwnedC<Vec<str>, Option<&str>>
stores the data type Option<&str>
, which contains a reference within the owner Vec<str>
.
The reference is ordered by the data content.MIT license. See license file.