| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#; |
| 2 | |
| 3 | #[cfg(feature = "unstable-tagged-offsets")] |
| 4 | const TAG_MASKrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_MASK.: u32 = 0xE0000000; |
| 5 | #[cfg(feature = "unstable-tagged-offsets")] |
| 6 | const OFFSET_MASKrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/OFFSET_MASK.: u32 = 0x1FFFFFFF; |
| 7 | const TAG_NULLrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_NULL.: u32 = 0; |
| 8 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const TAG_BYTESrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_BYTES.: u32 = 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().29; |
| 9 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const TAG_NODErust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_NODE.: u32 = 2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().29; |
| 10 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const TAG_STATErust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_STATE.: u32 = 3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().29; |
| 11 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const TAG_CONTEXTrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_CONTEXT.: u32 = 4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().29; |
| 12 | |
| 13 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) trait Pointeerust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee# { |
| 14 | const TAGrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee#TAG.: u32; |
| 15 | } |
| 16 | |
| 17 | impl Pointeerust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee# for u8 { |
| 18 | const TAGrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[u8][Pointee]TAG.: u32 = TAG_BYTESrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_BYTES.; |
| 19 | } |
| 20 | |
| 21 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) trait MemoryAllocatorrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator# { |
| 22 | fn base_memory_ptrrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#base_memory_ptr().(&self) -> NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<u8>; |
| 23 | #[cfg(not(feature = "unstable-tagged-offsets"))] |
| 24 | fn units_start(&self) -> NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<u8>; |
| 25 | #[cfg(feature = "unstable-tagged-offsets")] |
| 26 | fn sizerust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#size().(&self) -> u32; |
| 27 | } |
| 28 | |
| 29 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 30 | #[repr(transparent)] |
| 31 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) struct TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#(u32); |
| 32 | |
| 33 | #[cfg(feature = "unstable-tagged-offsets")] |
| 34 | impl TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset# { |
| 35 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const fn nullrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]null().() -> TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset# { |
| 36 | TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#(TAG_NULLrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_NULL.) |
| 37 | } |
| 38 | |
| 39 | #[inline(always)] |
| 40 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const fn from_rawrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]from_raw().(raw: u32) -> Selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset] { |
| 41 | Selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset](raw) |
| 42 | } |
| 43 | |
| 44 | #[inline(always)] |
| 45 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const fn from_bytes_offsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]from_bytes_offset().(raw: u32) -> Selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset] { |
| 46 | TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#::from_rawrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]from_raw().((raw rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().OFFSET_MASKrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/OFFSET_MASK.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().TAG_BYTESrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_BYTES.) |
| 47 | } |
| 48 | |
| 49 | #[inline(always)] |
| 50 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) unsafe fn from_ptrrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]from_ptr().<T: Pointeerust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee#, A: MemoryAllocatorrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#>( |
| 51 | allocator: &A, |
| 52 | ptr: NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<T>, |
| 53 | ) -> TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset# { |
| 54 | let offset = ptr.castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]cast().().offset_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]offset_from().(allocator.base_memory_ptrrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#base_memory_ptr().()); |
| 55 | let offset = u32::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[u32][`TryFrom<isize>`]try_from().(offset).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Failed to convert ptr to offset"); |
| 56 | let val = (offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().OFFSET_MASKrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/OFFSET_MASK.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().T::TAGrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee#TAG.; |
| 57 | Selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset](val) |
| 58 | } |
| 59 | |
| 60 | #[inline(always)] |
| 61 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn is_nullrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]is_null().(&self) -> bool { |
| 62 | self.0rust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().TAG_NULLrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_NULL. |
| 63 | } |
| 64 | |
| 65 | #[inline(always)] |
| 66 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn is_not_nullrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]is_not_null().(&self) -> bool { |
| 67 | self.0rust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().TAG_NULLrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_NULL. |
| 68 | } |
| 69 | |
| 70 | #[inline(always)] |
| 71 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn get_offsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]get_offset().(&self) -> u32 { |
| 72 | self.0rust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().OFFSET_MASKrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/OFFSET_MASK. |
| 73 | } |
| 74 | |
| 75 | #[inline(always)] |
| 76 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn as_rawrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]as_raw().(&self) -> u32 { |
| 77 | self.0rust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#0. |
| 78 | } |
| 79 | |
| 80 | #[inline(always)] |
| 81 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) unsafe fn as_ptrrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]as_ptr().<T: Pointeerust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee#, A: MemoryAllocatorrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#>( |
| 82 | &self, |
| 83 | allocator: &A, |
| 84 | ) -> NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<T> { |
| 85 | let offset = self.get_offsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]get_offset().(); |
| 86 | |
| 87 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(self.0rust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#0. &rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). TAG_MASKrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_MASK., T::TAGrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee#TAG., "Mismatched pointer type tag"); |
| 88 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(offset <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt(). allocator.sizerust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#size().(), "Out of bound access"); |
| 89 | |
| 90 | allocator.base_memory_ptrrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#base_memory_ptr().().offsetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]offset().(offset as isize).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/impl#[`NonNull<T>`]cast().() |
| 91 | } |
| 92 | |
| 93 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn is_real_contextrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/impl#[TaggedOffset]is_real_context().<A: MemoryAllocatorrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#>(&self, _allocator: &A) -> bool { |
| 94 | (self.0rust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().TAG_MASKrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_MASK.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().TAG_CONTEXTrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_CONTEXT. |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | #[cfg(not(feature = "unstable-tagged-offsets"))] |
| 99 | impl TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset# { |
| 100 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const fn null() -> TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset# { |
| 101 | TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#(TAG_NULLrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_NULL.) |
| 102 | } |
| 103 | |
| 104 | #[inline(always)] |
| 105 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const fn from_raw(raw: u32) -> Self { |
| 106 | Self(raw) |
| 107 | } |
| 108 | |
| 109 | #[inline(always)] |
| 110 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) const fn from_bytes_offset(raw: u32) -> Self { |
| 111 | TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset#::from_raw(raw) |
| 112 | } |
| 113 | |
| 114 | #[inline(always)] |
| 115 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) unsafe fn from_ptr<T: Pointeerust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee#, A: MemoryAllocatorrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#>( |
| 116 | allocator: &A, |
| 117 | ptr: NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<T>, |
| 118 | ) -> TaggedOffsetrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TaggedOffset# { |
| 119 | let offset = ptr.cast().offset_from(allocator.base_memory_ptr()); |
| 120 | let offset = u32::try_from(offset).expect("Failed to convert ptr to offset"); |
| 121 | Self(offset) |
| 122 | } |
| 123 | |
| 124 | #[inline(always)] |
| 125 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn is_null(&self) -> bool { |
| 126 | selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/.0 == TAG_NULLrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_NULL. |
| 127 | } |
| 128 | |
| 129 | #[inline(always)] |
| 130 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn is_not_null(&self) -> bool { |
| 131 | selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/.0 != TAG_NULLrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/TAG_NULL. |
| 132 | } |
| 133 | |
| 134 | #[inline(always)] |
| 135 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn get_offset(&self) -> u32 { |
| 136 | selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/.0 |
| 137 | } |
| 138 | |
| 139 | #[inline(always)] |
| 140 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) fn as_raw(&self) -> u32 { |
| 141 | selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/.0 |
| 142 | } |
| 143 | |
| 144 | #[inline(always)] |
| 145 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) unsafe fn as_ptr<T: Pointeerust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/Pointee#, A: MemoryAllocatorrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#>( |
| 146 | &self, |
| 147 | allocator: &A, |
| 148 | ) -> NonNullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/non_null/NonNull#<T> { |
| 149 | let offset = selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/.get_offset(); |
| 150 | allocator.base_memory_ptr().offset(offset as isize).cast() |
| 151 | } |
| 152 | |
| 153 | pub(craterust-analyzer cargo ppmd-rust 1.2.1 crate/) unsafe fn is_real_context<A: MemoryAllocatorrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/MemoryAllocator#>(&self, allocator: &A) -> bool { |
| 154 | // A "real" context must be in the unit area and not in the text buffer area. |
| 155 | let ptr = allocator |
| 156 | .base_memory_ptr() |
| 157 | .offset(selfrust-analyzer cargo ppmd-rust 1.2.1 internal/tagged_offset/.get_offset() as isize) |
| 158 | .cast(); |
| 159 | ptr >= allocator.units_start() |
| 160 | } |
| 161 | } |