Skip to main content

object_rainbow/impls/
bytes.rs

1use bytes::{Bytes, BytesMut};
2
3use crate::*;
4
5impl ToOutput for Bytes {
6    fn to_output(&self, output: &mut impl Output) {
7        (**self).to_output(output);
8    }
9}
10
11impl ToOutput for BytesMut {
12    fn to_output(&self, output: &mut impl Output) {
13        (**self).to_output(output);
14    }
15}
16
17impl<I: ParseInput> Parse<I> for Bytes {
18    fn parse(input: I) -> crate::Result<Self> {
19        input.parse_all().map(Into::into).map(Vec::into)
20    }
21}
22
23impl<I: ParseInput> Parse<I> for BytesMut {
24    fn parse(input: I) -> crate::Result<Self> {
25        input
26            .parse_all()
27            .map(Into::into)
28            .map(Vec::into)
29            .map(Bytes::into)
30    }
31}
32
33impl Tagged for Bytes {}
34impl Tagged for BytesMut {}
35impl ListHashes for Bytes {}
36impl ListHashes for BytesMut {}
37impl Topological for Bytes {}
38impl Topological for BytesMut {}
39impl MaybeHasNiche for Bytes {
40    type MnArray = NoNiche<NicheForUnsized>;
41}
42impl MaybeHasNiche for BytesMut {
43    type MnArray = NoNiche<NicheForUnsized>;
44}