Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MatrixWriter overload for sequences of unmanaged types #2110

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

glopesdev
Copy link
Member

@glopesdev glopesdev commented Jan 15, 2025

This PR expands the compatibility of MatrixWriter to any arbitrary sequence of unmanaged types by taking advantage of Buffer.MemoryCopy to directly marshal the value type into a binary stream.

The new overload signature is:

public IObservable<TElement> Process<TElement>(IObservable<TElement> source) where TElement : unmanaged

Buffer.MemoryCopy is compatible across both .NET Framework and .NET 5+ but we might consider later improving the implementation for .NET 5+ by taking advantage of new memory copy performance primitives.

Fixes #1578

@glopesdev glopesdev added the feature New planned feature label Jan 15, 2025
@glopesdev glopesdev added this to the 2.9 milestone Jan 15, 2025
@jonnew
Copy link

jonnew commented Jan 15, 2025

yay!!!!

@glopesdev glopesdev merged commit b253870 into bonsai-rx:main Jan 15, 2025
10 checks passed
@glopesdev glopesdev deleted the issue-1578 branch January 15, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New planned feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider allowing binary serialization of arbitrary struct types
3 participants