-
Notifications
You must be signed in to change notification settings - Fork 59
[serde_multipart] new crate: multipart codec for serde #831
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
base: gh/mariusae/34/base
Are you sure you want to change the base?
Conversation
Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. Differential Revision: [D80108937](https://our.internmc.facebook.com/intern/diff/D80108937/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D80108937 |
Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. Differential Revision: [D80108937](https://our.internmc.facebook.com/intern/diff/D80108937/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D80108937 |
Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. Differential Revision: [D80108937](https://our.internmc.facebook.com/intern/diff/D80108937/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D80108937 |
Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. Differential Revision: [D80108937](https://our.internmc.facebook.com/intern/diff/D80108937/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D80108937 |
Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. Differential Revision: [D80108937](https://our.internmc.facebook.com/intern/diff/D80108937/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D80108937 |
Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. Differential Revision: [D80108937](https://our.internmc.facebook.com/intern/diff/D80108937/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D80108937 |
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303723935 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303723935 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. Differential Revision: [D80108937](https://our.internmc.facebook.com/intern/diff/D80108937/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D80108937 |
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Summary: Serde codec for multipart messages. //! Using [`serialize`] / [`deserialize`], fields typed [`Part`] are extracted //! from the main payload and appended to a list of `parts`. Each part is backed by //! [`bytes::Bytes`] for cheap, zero-copy sharing. //! //! On decode, the body and its parts are reassembled into the original value //! without copying. //! //! The on-the-wire form is a [`Message`] (body + parts). Your transport sends //! and receives [`Message`]s; the codec reconstructs the value, enabling //! efficient network I/O without compacting data into a single buffer. //! //! Implementation note: this crate uses Rust's min_specialization feature to enable //! the use of [`Part`]s with any Serde serializer or deserializer. This feature //! is fairly restrictive, and thus the API offered by [`serialize`] / [`deserialize`] //! is not customizable. If customization is needed, you need to add specialization //! implementations for these codecs. See [`part::PartSerializer`] and [`part::PartDeserializer`] //! for details. This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer. The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type). The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed. ghstack-source-id: 303813996 exported-using-ghexport Reviewed By: vidhyav, shayne-fletcher Differential Revision: D80108937
Stack from ghstack (oldest at bottom):
Message
#852Serde codec for multipart messages.
//! Using [
serialize
] / [deserialize
], fields typed [Part
] are extracted//! from the main payload and appended to a list of
parts
. Each part is backed by//! [
bytes::Bytes
] for cheap, zero-copy sharing.//!
//! On decode, the body and its parts are reassembled into the original value
//! without copying.
//!
//! The on-the-wire form is a [
Message
] (body + parts). Your transport sends//! and receives [
Message
]s; the codec reconstructs the value, enabling//! efficient network I/O without compacting data into a single buffer.
//!
//! Implementation note: this crate uses Rust's min_specialization feature to enable
//! the use of [
Part
]s with any Serde serializer or deserializer. This feature//! is fairly restrictive, and thus the API offered by [
serialize
] / [deserialize
]//! is not customizable. If customization is needed, you need to add specialization
//! implementations for these codecs. See [
part::PartSerializer
] and [part::PartDeserializer
]//! for details.
This will be the foundation for doing zero-copy I/O through our networking stack. With serde_multipart, we can avoid copying byte buffers, and delegate their efficient transmission to the network layer.
The representation -- a multipart message comprising a body and zero or more contiguous byte buffers -- lends itself to other optimizations as well. For example, we could perform transparent RDMA for large parts, and even control the allocation of the received bytes (through the Bytes data type).
The implementation relies on Rust's "min_specialization" feature, which provides a limited form of specialization. This is what allows us to override the serializer for "serde_multipart::Part" when using our multipart-aware encoder. This was quite finnicky to get to work right (the feature accepts only a limited subset of known-to-be-sound specializations), but appears to work well, at the expense of being slightly less generic than we might otherwise have managed.
Differential Revision: D80108937