MCPcopy Create free account
hub / github.com/bajrangCoder/setu / set_from_hashmap

Method set_from_hashmap

src/components/form_data_editor.rs:166–194  ·  view source on GitHub ↗
(
        &mut self,
        data: &std::collections::HashMap<String, String>,
        window: &mut Window,
        cx: &mut Context<Self>,
    )

Source from the content-addressed store, hash-verified

164
165 self.rows.push(FormDataRow {
166 key_input,
167 value_input,
168 enabled: true,
169 });
170
171 cx.notify();
172 }
173
174 pub fn remove_row(&mut self, index: usize, cx: &mut Context<Self>) {
175 if index < self.rows.len() {
176 self.rows.remove(index);
177 cx.notify();
178 }
179 }
180
181 pub fn clear_all(&mut self, cx: &mut Context<Self>) {
182 self.rows.clear();
183 cx.notify();
184 }
185
186 pub fn toggle_row(&mut self, index: usize, cx: &mut Context<Self>) {
187 if let Some(row) = self.rows.get_mut(index) {
188 row.enabled = !row.enabled;
189 cx.notify();
190 }
191 }
192
193 pub fn move_row(&mut self, from: usize, to: usize, cx: &mut Context<Self>) {
194 if from == to || from >= self.rows.len() || to >= self.rows.len() {
195 return;
196 }
197 let row = self.rows.remove(from);

Callers 1

Calls 2

clearMethod · 0.45
newMethod · 0.45

Tested by

no test coverage detected