tabled/grid/records/
records_mut.rs1use crate::grid::config::Position;
2#[cfg(feature = "std")]
3use crate::grid::records::vec_records::{Text, VecRecords};
4
5pub trait RecordsMut<Text> {
9 fn set(&mut self, pos: Position, text: Text);
11}
12
13impl<T, Text> RecordsMut<Text> for &'_ mut T
14where
15 T: RecordsMut<Text>,
16{
17 fn set(&mut self, pos: Position, text: Text) {
18 T::set(self, pos, text)
19 }
20}
21
22#[cfg(feature = "std")]
23impl RecordsMut<String> for VecRecords<Text<String>> {
24 fn set(&mut self, pos: Position, text: String) {
25 self[pos.row][pos.col] = Text::new(text);
26 }
27}
28
29#[cfg(feature = "std")]
30impl RecordsMut<&str> for VecRecords<Text<String>> {
31 fn set(&mut self, p: Position, text: &str) {
32 self[p.row][p.col] = Text::new(text.to_string());
33 }
34}