rune_alloc/fmt/impls.rs
1use crate::alloc::Allocator;
2use crate::error::Error;
3use crate::vec::Vec;
4
5use super::TryWrite;
6
7/// [`TryWrite`] is implemented for `Vec<u8>` by appending to the vector. The
8/// vector will grow as needed.
9impl<A: Allocator> TryWrite for Vec<u8, A> {
10 #[inline]
11 fn try_write_str(&mut self, s: &str) -> Result<(), Error> {
12 self.try_extend_from_slice(s.as_bytes())
13 }
14}