Lines Matching defs:T
37 #[diagnostic::on_unimplemented(message = "`{Self}` cannot be used to index `{T}`")]
39 pub unsafe trait ProjectIndex<T: ?Sized>: Sized {
43 fn get(self, slice: *mut T) -> Option<*mut Self::Output>;
46 fn index(self, slice: *mut T) -> *mut Self::Output;
50 fn build_index(self, slice: *mut T) -> *mut Self::Output {
61 unsafe impl<T, I, const N: usize> ProjectIndex<[T; N]> for I
63 I: ProjectIndex<[T]>,
65 type Output = <I as ProjectIndex<[T]>>::Output;
68 fn get(self, slice: *mut [T; N]) -> Option<*mut Self::Output> {
69 <I as ProjectIndex<[T]>>::get(self, slice)
73 fn index(self, slice: *mut [T; N]) -> *mut Self::Output {
74 <I as ProjectIndex<[T]>>::index(self, slice)
78 fn build_index(self, slice: *mut [T; N]) -> *mut Self::Output {
79 <I as ProjectIndex<[T]>>::build_index(self, slice)
85 unsafe impl<T> ProjectIndex<[T]> for usize {
86 type Output = T;
89 fn get(self, slice: *mut [T]) -> Option<*mut T> {
93 Some(slice.cast::<T>().wrapping_add(self))
98 fn index(self, slice: *mut [T]) -> *mut T {
104 slice.cast::<T>().wrapping_add(self)
110 unsafe impl<T> ProjectIndex<[T]> for core::ops::Range<usize> {
111 type Output = [T];
114 fn get(self, slice: *mut [T]) -> Option<*mut [T]> {
120 slice.cast::<T>().wrapping_add(self.start),
126 fn index(self, slice: *mut [T]) -> *mut [T] {
139 unsafe impl<T> ProjectIndex<[T]> for core::ops::RangeTo<usize> {
140 type Output = [T];
143 fn get(self, slice: *mut [T]) -> Option<*mut [T]> {
148 fn index(self, slice: *mut [T]) -> *mut [T] {
154 unsafe impl<T> ProjectIndex<[T]> for core::ops::RangeFrom<usize> {
155 type Output = [T];
158 fn get(self, slice: *mut [T]) -> Option<*mut [T]> {
163 fn index(self, slice: *mut [T]) -> *mut [T] {
169 unsafe impl<T> ProjectIndex<[T]> for core::ops::RangeFull {
170 type Output = [T];
173 fn get(self, slice: *mut [T]) -> Option<*mut [T]> {
178 fn index(self, slice: *mut [T]) -> *mut [T] {
210 // NOTE: in theory, this API should work for `T: ?Sized` and `F: ?Sized`, too. However, we cannot
214 unsafe impl<T> ProjectField<false> for T {
219 // very large `T` (`memoffset` crate also relies on this). To be extra certain, we also
232 unsafe impl<T: Deref> ProjectField<true> for T {