Fortune for parapop's current commit: Small curse − 小凶

master
Avril 2 years ago
parent 7fa9f5cce1
commit 6a4b2e918d

@ -6,4 +6,9 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
[dependencies]
[build-dependencies]
rustc_version = "0.2"

@ -152,7 +152,7 @@ impl<'a, T> ExactSizeIterator for IntoIter<'a, T>{}
#[derive(Debug)]
struct FullIterRef<'a, T>(std::slice::Iter<'a, T>);
//struct PartialIterRef<'a, T>(&)
//struct PartialIterRef<'a, T>(&) //XXX: This probably isn't possible unless it takes an exclusive reference of Populator<'a, T>. Having to pass 'a around really sucks hey.
impl<'a, T> Iterator for FullIterRef<'a, T>
{

@ -1,3 +1,4 @@
//#![cfg_attr(all(nightly, feature="nightly"), feature(never_type))]
#![allow(dead_code)]
@ -13,6 +14,14 @@ use std::ops::Drop;
pub mod iter;
/* XXX: We don't need this. We can just use `()`
#[cfg(all(nightly, feature="nightly"))]
type Void = !;
#[cfg(not(all(nightly, feature="nightly")))]
type Void = std::convert::Infallible;
*/
/// Like PhantomData but for a lifetime. Essentially PhantomData &'a ()
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Copy)]
#[repr(transparent)]
struct PhantomLifetime<'a>(std::marker::PhantomData<&'a ()>);
@ -157,6 +166,7 @@ impl<'a, T> Drop for Populator<'a, T>
unsafe impl<'a, T: 'a> Send for Populator<'a, T> where Box<T>: Send {}
unsafe impl<'a, T: 'a> Sync for Populator<'a, T>{} // Populator is always sync
//TODO: Maybe add methods with Arc<Self> receivors?
impl<'a, T> Populator<'a, T>
{
/// Checks if an item exists at this index exclusively.
@ -268,6 +278,7 @@ impl<'a, T> Populator<'a, T>
idx
}
}
//TODO: get_excusive -> RefEx
/// Try to get an exclusive, mutable reference to an item at `idx` if an item exists there.
///
@ -391,7 +402,7 @@ impl<'a, T: 'a> FromIterator<Option<T>> for Populator<'a, T>
}
}
impl<'a, T: 'a> IntoIterator for Populator<'a, T> // FUCK why do we need to make this 'static???? fuck this... dyn dispatch in rust is so jank. why can't we use 'a!!!
impl<'a, T: 'a> IntoIterator for Populator<'a, T>
{
type Item = T;
type IntoIter = iter::IntoIter<'a, T>;

Loading…
Cancel
Save