From 94475bca6b26373e4d53d5045505a00258b40dc5 Mon Sep 17 00:00:00 2001 From: Croxx Date: Mon, 2 Dec 2024 17:59:51 +0800 Subject: [PATCH] feat: support intrusive_adapter! access nested field (#4) Signed-off-by: MrCroxx --- Cargo.toml | 8 ++++---- README.md | 4 +++- src/adapter.rs | 2 ++ src/key_adapter.rs | 1 + src/lib.rs | 4 ++++ src/rbtree.rs | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 68a77bd..309eeed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "intrusive-collections" -version = "0.9.7" +name = "foyer-intrusive-collections" +version = "0.10.0-dev" authors = ["Amanieu d'Antras "] description = "Intrusive collections for Rust (linked list and red-black tree)" -documentation = "https://docs.rs/intrusive-collections" +documentation = "https://docs.rs/foyer-intrusive-collections" license = "Apache-2.0/MIT" -repository = "https://github.com/Amanieu/intrusive-rs" +repository = "https://github.com/foyer-rs/intrusive-rs" readme = "README.md" keywords = ["intrusive", "no_std", "list", "rbtree"] categories = ["data-structures", "no-std"] diff --git a/README.md b/README.md index 271d304..ab91f24 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ intrusive-collections ===================== +*forked from [Amanieu/intrusive-rs](https://github.com/Amanieu/intrusive-rs)* + [![Build Status](https://travis-ci.org/Amanieu/intrusive-rs.svg?branch=master)](https://travis-ci.org/Amanieu/intrusive-rs) [![Coverage Status](https://coveralls.io/repos/github/Amanieu/intrusive-rs/badge.svg?branch=master)](https://coveralls.io/github/Amanieu/intrusive-rs?branch=master) [![Crates.io](https://img.shields.io/crates/v/intrusive-collections.svg)](https://crates.io/crates/intrusive-collections) A Rust library for creating intrusive collections. Currently supports singly-linked and doubly-linked lists, as well as red-black trees. @@ -21,7 +23,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -intrusive-collections = "0.9" +intrusive-collections = { package = "foyer-intrusive-collections", version = "0.10.0-dev" } ``` This crate has two Cargo features: diff --git a/src/adapter.rs b/src/adapter.rs index 6f112ac..fbbaa22 100644 --- a/src/adapter.rs +++ b/src/adapter.rs @@ -83,6 +83,7 @@ pub unsafe trait Adapter { /// # Examples /// /// ``` +/// # use foyer_intrusive_collections as intrusive_collections; /// use intrusive_collections::container_of; /// /// struct S { x: u32, y: u32 }; @@ -143,6 +144,7 @@ macro_rules! container_of { /// # Examples /// /// ``` +/// # use foyer_intrusive_collections as intrusive_collections; /// use intrusive_collections::{LinkedListLink, RBTreeLink}; /// use intrusive_collections::intrusive_adapter; /// diff --git a/src/key_adapter.rs b/src/key_adapter.rs index 82c325b..fb6663d 100644 --- a/src/key_adapter.rs +++ b/src/key_adapter.rs @@ -19,6 +19,7 @@ use crate::pointer_ops::PointerOps; /// # Examples /// /// ``` +/// # use foyer_intrusive_collections as intrusive_collections; /// use intrusive_collections::intrusive_adapter; /// use intrusive_collections::{RBTreeLink, KeyAdapter}; /// diff --git a/src/lib.rs b/src/lib.rs index fc3c299..68832be 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,6 +21,7 @@ //! # Example //! //! ``` +//! # use foyer_intrusive_collections as intrusive_collections; //! use intrusive_collections::intrusive_adapter; //! use intrusive_collections::{LinkedList, LinkedListLink}; //! use std::cell::Cell; @@ -89,6 +90,7 @@ //! keep all elements in the tree in ascending order. //! //! ``` +//! # use foyer_intrusive_collections as intrusive_collections; //! use intrusive_collections::intrusive_adapter; //! use intrusive_collections::{SinglyLinkedListLink, SinglyLinkedList}; //! use intrusive_collections::{LinkedListLink, LinkedList}; @@ -150,6 +152,7 @@ //! function which removes all values within a given range from a `RBTree`: //! //! ``` +//! # use foyer_intrusive_collections as intrusive_collections; //! use intrusive_collections::intrusive_adapter; //! use intrusive_collections::{RBTreeLink, RBTree, KeyAdapter, Bound}; //! @@ -186,6 +189,7 @@ //! intrusive collection will outlive the collection itself. //! //! ``` +//! # use foyer_intrusive_collections as intrusive_collections; //! use intrusive_collections::intrusive_adapter; //! use intrusive_collections::{LinkedListLink, LinkedList}; //! use typed_arena::Arena; diff --git a/src/rbtree.rs b/src/rbtree.rs index 18c9df4..f945418 100644 --- a/src/rbtree.rs +++ b/src/rbtree.rs @@ -2043,7 +2043,7 @@ where /// Panics if the new element is already linked to a different intrusive /// collection. #[inline] - pub fn insert<'a>(&'a mut self, val: ::Pointer) -> CursorMut<'_, A> + pub fn insert<'a>(&'a mut self, val: ::Pointer) -> CursorMut<'a, A> where >::Key: Ord, {