using System.Runtime.InteropServices.Swift; using ExampleWorld.wit.imports.lyra.api; namespace LyraApi.Ecs; public class ViewResult { private List components; private IEcs.EcsDynamicView inner; internal ViewResult(List components, IEcs.EcsDynamicView inner) { this.components = components; this.inner = inner; } public IEnumerable<(Entity, T1)> Get() where T1 : IComponent { (IEcs.Entity, byte[])? row = inner.Next(); if (row is (var entity, byte[] bytes)) { byte[] compBytes = bytes.Take((int)T1.HostSize).ToArray(); var t1 = (T1?)T1.TakeFromBytes(compBytes); if (t1 != null) { yield return (new Entity(entity), t1); } } } }