Lines Matching defs:T

157 /// struct DTWrap<T: ?Sized> {
160 /// value: T,
163 /// impl<T> DTWrap<T> {
164 /// fn new(value: T) -> Result<ListArc<Self>> {
173 /// impl{T: ?Sized} ListArcSafe<0> for DTWrap<T> { untracked; }
263 pub struct List<T: ?Sized + ListItem<ID>, const ID: u64 = 0> {
265 _ty: PhantomData<ListArc<T, ID>>,
268 // SAFETY: This is a container of `ListArc<T, ID>`, and access to the container allows the same
269 // type of access to the `ListArc<T, ID>` elements.
270 unsafe impl<T, const ID: u64> Send for List<T, ID>
272 ListArc<T, ID>: Send,
273 T: ?Sized + ListItem<ID>,
276 // SAFETY: This is a container of `ListArc<T, ID>`, and access to the container allows the same
277 // type of access to the `ListArc<T, ID>` elements.
278 unsafe impl<T, const ID: u64> Sync for List<T, ID>
280 ListArc<T, ID>: Sync,
281 T: ?Sized + ListItem<ID>,
378 // associated `ListArc<T, ID>`. Since that type correctly implements `Send`, it is impossible to
420 pub struct ListLinksSelfPtr<T: ?Sized, const ID: u64 = 0> {
426 // `ptr::null()` doesn't work for `T: ?Sized`.
427 self_ptr: Opaque<*const T>,
431 unsafe impl<T: ?Sized + Send, const ID: u64> Send for ListLinksSelfPtr<T, ID> {}
437 unsafe impl<T: ?Sized + Sync, const ID: u64> Sync for ListLinksSelfPtr<T, ID> {}
439 impl<T: ?Sized, const ID: u64> ListLinksSelfPtr<T, ID> {
460 pub unsafe fn raw_get_self_ptr(me: *const Self) -> *const Opaque<*const T> {
466 impl<T: ?Sized + ListItem<ID>, const ID: u64> List<T, ID> {
491 item: ListArc<T, ID>,
502 let list_links = unsafe { T::prepare_to_insert(raw_item) };
534 pub fn push_back(&mut self, item: ListArc<T, ID>) {
542 pub fn push_front(&mut self, item: ListArc<T, ID>) {
553 pub fn pop_back(&mut self) -> Option<ListArc<T, ID>> {
565 pub fn pop_front(&mut self) -> Option<ListArc<T, ID>> {
582 pub unsafe fn remove(&mut self, item: &T) -> Option<ListArc<T, ID>> {
584 let mut item = unsafe { ListLinks::fields(T::view_links(item)) };
623 unsafe fn remove_internal(&mut self, item: *mut ListLinksFields) -> ListArc<T, ID> {
642 ) -> ListArc<T, ID> {
681 let raw_item = unsafe { T::post_remove(list_links) };
690 pub fn push_all_back(&mut self, other: &mut List<T, ID>) {
719 pub fn cursor_front(&mut self) -> Cursor<'_, T, ID> {
728 pub fn cursor_back(&mut self) -> Cursor<'_, T, ID> {
737 pub fn iter(&self) -> Iter<'_, T, ID> {
748 impl<T: ?Sized + ListItem<ID>, const ID: u64> Default for List<T, ID> {
754 impl<T: ?Sized + ListItem<ID>, const ID: u64> Drop for List<T, ID> {
770 pub struct Iter<'a, T: ?Sized + ListItem<ID>, const ID: u64 = 0> {
773 _ty: PhantomData<&'a ListArc<T, ID>>,
776 impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> Iterator for Iter<'a, T, ID> {
777 type Item = ArcBorrow<'a, T>;
779 fn next(&mut self) -> Option<ArcBorrow<'a, T>> {
798 let item = unsafe { T::view_value(ListLinks::from_fields(current)) };
945 pub struct Cursor<'a, T: ?Sized + ListItem<ID>, const ID: u64 = 0> {
946 list: &'a mut List<T, ID>,
951 impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> Cursor<'a, T, ID> {
976 pub fn peek_next(&mut self) -> Option<CursorPeek<'_, 'a, T, true, ID>> {
991 pub fn peek_prev(&mut self) -> Option<CursorPeek<'_, 'a, T, false, ID>> {
1044 fn insert_inner(&mut self, item: ListArc<T, ID>) -> *mut ListLinksFields {
1062 pub fn insert(mut self, item: ListArc<T, ID>) {
1073 pub fn insert_next(&mut self, item: ListArc<T, ID>) {
1080 pub fn insert_prev(&mut self, item: ListArc<T, ID>) {
1085 pub fn remove_next(&mut self) -> Option<ListArc<T, ID>> {
1090 pub fn remove_prev(&mut self) -> Option<ListArc<T, ID>> {
1101 pub struct CursorPeek<'a, 'b, T: ?Sized + ListItem<ID>, const ISNEXT: bool, const ID: u64> {
1102 cursor: &'a mut Cursor<'b, T, ID>,
1106 impl<'a, 'b, T: ?Sized + ListItem<ID>, const ISNEXT: bool, const ID: u64>
1107 CursorPeek<'a, 'b, T, ISNEXT, ID>
1110 pub fn remove(self) -> ListArc<T, ID> {
1123 pub fn arc(&self) -> ArcBorrow<'_, T> {
1125 let me = unsafe { T::view_value(ListLinks::from_fields(self.ptr)) };
1140 impl<'a, 'b, T: ?Sized + ListItem<ID>, const ISNEXT: bool, const ID: u64> core::ops::Deref
1141 for CursorPeek<'a, 'b, T, ISNEXT, ID>
1143 // If you change the `ptr` field to have type `ArcBorrow<'a, T>`, it might seem like you could
1144 // get rid of the `CursorPeek::arc` method and change the deref target to `ArcBorrow<'a, T>`.
1145 // However, that doesn't work because 'a is too long. You could obtain an `ArcBorrow<'a, T>`
1146 // and then call `CursorPeek::remove` without giving up the `ArcBorrow<'a, T>`, which would be
1148 type Target = T;
1150 fn deref(&self) -> &T {
1152 let me = unsafe { T::view_value(ListLinks::from_fields(self.ptr)) };
1155 // annotated on the returned `&T`, because removing it from the list would require mutable
1156 // access to the `CursorPeek`, the `Cursor` or the `List`. However, the `&T` holds an
1164 impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> FusedIterator for Iter<'a, T, ID> {}
1166 impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> IntoIterator for &'a List<T, ID> {
1167 type IntoIter = Iter<'a, T, ID>;
1168 type Item = ArcBorrow<'a, T>;
1170 fn into_iter(self) -> Iter<'a, T, ID> {
1176 pub struct IntoIter<T: ?Sized + ListItem<ID>, const ID: u64 = 0> {
1177 list: List<T, ID>,
1180 impl<T: ?Sized + ListItem<ID>, const ID: u64> Iterator for IntoIter<T, ID> {
1181 type Item = ListArc<T, ID>;
1183 fn next(&mut self) -> Option<ListArc<T, ID>> {
1188 impl<T: ?Sized + ListItem<ID>, const ID: u64> FusedIterator for IntoIter<T, ID> {}
1190 impl<T: ?Sized + ListItem<ID>, const ID: u64> DoubleEndedIterator for IntoIter<T, ID> {
1191 fn next_back(&mut self) -> Option<ListArc<T, ID>> {
1196 impl<T: ?Sized + ListItem<ID>, const ID: u64> IntoIterator for List<T, ID> {
1197 type IntoIter = IntoIter<T, ID>;
1198 type Item = ListArc<T, ID>;
1200 fn into_iter(self) -> IntoIter<T, ID> {