Example #1
0
        // bytes already populated with a event record to read
        public EventRecord(ReadOnlyMemory <byte> bytes)
        {
            var slicer = bytes.Slicer();

            _headerMemory = slicer.Slice(Raw.EventHeader.Size);

            ref readonly var header = ref MemoryMarshal.AsRef <Raw.EventHeader>(_headerMemory.Span);
        public static ReadOnlySlicedRecord Create(ReadOnlyMemory <byte> bytes)
        {
            var slicer = bytes.Slicer();

            return(new ReadOnlySlicedRecord {
                Bytes = slicer.Remaining,
                HeaderMemory = slicer.Slice(Raw.RecordHeader.Size),
                SubHeaderMemory = slicer.Slice <TSubHeader>(),
                PayloadMemory = slicer.Remaining,
            });
        }