Skip to content

Conversation

@NoelStephensUnity
Copy link
Collaborator

Up port of #3320

This PR resolves the issue where FastBufferReader did not provide constructors that would automatically use an ArraySegment's configuration (Count and Offset) to define the FastBufferReader.

MTTB-34

fix: #2885

Changelog

  • Added FastBufferReader(ArraySegment<byte> buffer, Allocator copyAllocator) constructor that uses the ArraySegment.Offset as the FastBufferReader offset and the ArraySegment.Count as the FastBufferReader length.
  • Added FastBufferReader(ArraySegment<byte> buffer, Allocator copyAllocator, int length = -1) constructor that uses the ArraySegment.Offset as the FastBufferReader offset.

Testing and Documentation

  • Includes unit test.
  • Includes public API documentation.

Fixing issue where FastBufferReader did not provide constructors to honor an ArraySegment's configuration.
Adding unit test to run a simple validation for this update.
adding change log entries.
EmandM pushed a commit that referenced this pull request Feb 25, 2025
This PR resolves the issue where `FastBufferReader` did not provide
constructors that would automatically use an `ArraySegment`'s
configuration (Count and Offset) to define the `FastBufferReader`.

[MTTB-34](https://jira.unity3d.com/browse/MTTB-34)

fix: #2885

up-port: #3321

## Changelog

- Added `FastBufferReader(ArraySegment<byte> buffer, Allocator
copyAllocator)` constructor that uses the `ArraySegment.Offset` as the
`FastBufferReader` offset and the `ArraySegment.Count` as the
`FastBufferReader` length.
- Added `FastBufferReader(ArraySegment<byte> buffer, Allocator
copyAllocator, int length = -1)` constructor that uses the
`ArraySegment.Offset` as the `FastBufferReader` offset.

## Testing and Documentation

- Includes unit test.
- Includes public API documentation.

<!-- Uncomment and mark items off with a * if this PR deprecates any
API:
### Deprecated API
- [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter
yyyy-mm-dd)` entry.
- [ ] An [api updater] was added.
- [ ] Deprecation of the API is explained in the CHANGELOG.
- [ ] The users can understand why this API was removed and what they
should use instead.
-->
@EmandM EmandM enabled auto-merge (squash) February 25, 2025 14:48
@EmandM EmandM merged commit 1ac59f0 into develop-2.0.0 Feb 25, 2025
27 checks passed
@EmandM EmandM deleted the fix/fastbufferreader-does-not-honor-arraysegment-configuration-up-port branch February 25, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants