Skip to content

Instantly share code, notes, and snippets.

fn testttt() {
let mut archetype = Archetype::new::<(u32, u64)>();
archetype.add((10_u32, 12_u64)).unwrap();
archetype.add((15_u32, 14_u64)).unwrap();
archetype.add((20_u32, 16_u64)).unwrap();
let mut query_borrow = QueryBorrow::<'_, (&mut u32, &u64)> {
lock_guards: vec![
RwLockEitherGuard::WriteGuard(archetype.data.get_mut::<Vec<u32>>().unwrap().guard),
RwLockEitherGuard::ReadGuard(archetype.data.get::<Vec<u64>>().unwrap().guard),
fn main() {
// This wont work if the T for Wrap::<T> comes from a generic
match (Wrap::<&str>::new()).status() {
Status::Owned => println!("Owned"),
Status::Shared => println!("Shared"),
Status::Exclusive => println!("Exclusive"),
}
}
enum Status {
fn main() {
let mut my_vec = vec![0, 1, 2, 3, 4, 5];
let mut my_iter = MyIterator::new(&mut my_vec);
// this prints out (0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, None), None
while let Some((ref mut left, ref mut right)) = my_iter.next() {
println!("{:?}, {:?}", left, right);
}
}
pub fn delete_entites(mut all_storages: AllStoragesViewMut) {
let mut to_kill = vec![];
all_storages.run(|healths: View<Health>,| {
for (id, (health)) in (&healths).iter().with_id() {
if health.0 < 0 {
to_kill.push(id);
}
}
});
internal class AStarPos
{
public int X;
public int Y;
public int G = int.MaxValue;
public int F = int.MaxValue;
public AStarPos CameFrom;
}
public class AStar
public static class ParticleManager
{
const int InitialPoolCapacity = 32;
public static ulong EndIndex = 0;
public static Particle[] Particles = new Particle[InitialPoolCapacity * 64];
public static int CreateParticle(string texture, float x = 0, float y = 0, float deltaRotation = 0, float velocity = 0, float scale = 1, float depth = 1, float transparency = 0, float rotation = 0)
{