Skip to main content

nanvm_lib/vm/string/
add.rs

1use core::ops::{Add, AddAssign};
2
3use crate::vm::{IVm, String, ToString};
4
5impl<A: IVm> Add for String<A> {
6    type Output = Self;
7    fn add(self, rhs: Self) -> Self::Output {
8        self.into_iter().chain(rhs).to_string()
9    }
10}
11
12impl<A: IVm> AddAssign for String<A> {
13    fn add_assign(&mut self, other: Self) {
14        *self = self.clone() + other;
15    }
16}