From 5c81e4766087638945bfeb6b25ff0abf0b307c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Mello?= <3285133+asmello@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:29:27 +0100 Subject: [PATCH] rename SlicePointer --> PointerIndex (#92) --- src/pointer.rs | 4 ++-- src/pointer/slice.rs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pointer.rs b/src/pointer.rs index 8e04bb5..b31dccf 100644 --- a/src/pointer.rs +++ b/src/pointer.rs @@ -7,7 +7,7 @@ use alloc::{ vec::Vec, }; use core::{borrow::Borrow, cmp::Ordering, ops::Deref, str::FromStr}; -use slice::SlicePointer; +use slice::PointerIndex; mod slice; @@ -320,7 +320,7 @@ impl Pointer { /// ``` pub fn get<'p, I>(&'p self, index: I) -> Option where - I: SlicePointer<'p>, + I: PointerIndex<'p>, { index.get(self) } diff --git a/src/pointer/slice.rs b/src/pointer/slice.rs index 26f4dd6..437be6a 100644 --- a/src/pointer/slice.rs +++ b/src/pointer/slice.rs @@ -2,13 +2,13 @@ use super::Pointer; use crate::Token; use core::ops::Bound; -pub trait SlicePointer<'p>: private::Sealed { +pub trait PointerIndex<'p>: private::Sealed { type Output: 'p; fn get(self, pointer: &'p Pointer) -> Option; } -impl<'p> SlicePointer<'p> for usize { +impl<'p> PointerIndex<'p> for usize { type Output = Token<'p>; fn get(self, pointer: &'p Pointer) -> Option { @@ -16,7 +16,7 @@ impl<'p> SlicePointer<'p> for usize { } } -impl<'p> SlicePointer<'p> for core::ops::Range { +impl<'p> PointerIndex<'p> for core::ops::Range { type Output = &'p Pointer; fn get(self, pointer: &'p Pointer) -> Option { @@ -56,7 +56,7 @@ impl<'p> SlicePointer<'p> for core::ops::Range { } } -impl<'p> SlicePointer<'p> for core::ops::RangeFrom { +impl<'p> PointerIndex<'p> for core::ops::RangeFrom { type Output = &'p Pointer; fn get(self, pointer: &'p Pointer) -> Option { @@ -81,7 +81,7 @@ impl<'p> SlicePointer<'p> for core::ops::RangeFrom { } } -impl<'p> SlicePointer<'p> for core::ops::RangeTo { +impl<'p> PointerIndex<'p> for core::ops::RangeTo { type Output = &'p Pointer; fn get(self, pointer: &'p Pointer) -> Option { @@ -114,7 +114,7 @@ impl<'p> SlicePointer<'p> for core::ops::RangeTo { } } -impl<'p> SlicePointer<'p> for core::ops::RangeFull { +impl<'p> PointerIndex<'p> for core::ops::RangeFull { type Output = &'p Pointer; fn get(self, pointer: &'p Pointer) -> Option { @@ -122,7 +122,7 @@ impl<'p> SlicePointer<'p> for core::ops::RangeFull { } } -impl<'p> SlicePointer<'p> for core::ops::RangeInclusive { +impl<'p> PointerIndex<'p> for core::ops::RangeInclusive { type Output = &'p Pointer; fn get(self, pointer: &'p Pointer) -> Option { @@ -160,7 +160,7 @@ impl<'p> SlicePointer<'p> for core::ops::RangeInclusive { } } -impl<'p> SlicePointer<'p> for core::ops::RangeToInclusive { +impl<'p> PointerIndex<'p> for core::ops::RangeToInclusive { type Output = &'p Pointer; fn get(self, pointer: &'p Pointer) -> Option { @@ -190,7 +190,7 @@ impl<'p> SlicePointer<'p> for core::ops::RangeToInclusive { } } -impl<'p> SlicePointer<'p> for (Bound, Bound) { +impl<'p> PointerIndex<'p> for (Bound, Bound) { type Output = &'p Pointer; fn get(self, pointer: &'p Pointer) -> Option {