MCPcopy Index your code
hub / github.com/endbasic/endbasic / insert

Method insert

std/src/console/linebuffer.rs:94–102  ·  view source on GitHub ↗

Inserts a char at the given position. If the position is greater than the buffer length, the character will be appended at the end ot it.

(&mut self, pos: usize, ch: char)

Source from the content-addressed store, hash-verified

92 /// If the position is greater than the buffer length, the character will be appended at the
93 /// end ot it.
94 pub fn insert(&mut self, pos: usize, ch: char) {
95 self.line = self
96 .line
97 .chars()
98 .take(pos)
99 .chain(iter::once(ch))
100 .chain(self.line.chars().skip(pos))
101 .collect();
102 }
103
104 /// Returns the underlying string.
105 pub fn into_inner(self) -> String {

Callers 15

async_execMethod · 0.45
add_callableMethod · 0.45
set_peek_pixelMethod · 0.45
expect_arrayMethod · 0.45
expect_array_simpleMethod · 0.45
expect_fileMethod · 0.45
expect_varMethod · 0.45
check_arrayMethod · 0.45
checkMethod · 0.45
set_pixelMethod · 0.45
do_charMethod · 0.45
test_insertFunction · 0.45

Calls 1

charsMethod · 0.80

Tested by 12

set_peek_pixelMethod · 0.36
expect_arrayMethod · 0.36
expect_array_simpleMethod · 0.36
expect_fileMethod · 0.36
expect_varMethod · 0.36
check_arrayMethod · 0.36
checkMethod · 0.36
test_insertFunction · 0.36
initMethod · 0.36
test_mount_mountFunction · 0.36
test_unmount_okFunction · 0.36
test_storage_mountedFunction · 0.36