smol-bytes 0.1.8

High-performance, clone-efficient byte buffers optimized for small data.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::utf8_bytes_mut::Utf8BytesMut;

use super::*;

impl<S, T> FromIterator<T> for Utf8Bytes<S>
where
  RawBytes<S>: ImmutableStorage,
  Utf8BytesMut: Extend<T>,
{
  fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
    let mut bytes = Utf8BytesMut::new();
    bytes.extend(iter);
    Self {
      inner: bytes.inner.freeze::<S>(),
    }
  }
}