minor changes to text_input's use of iterators
This commit is contained in:
parent
d568d05df4
commit
b9398d2df8
1 changed files with 3 additions and 8 deletions
|
|
@ -125,17 +125,12 @@ impl Value {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn until(&self, index: usize) -> Self {
|
pub fn until(&self, index: usize) -> Self {
|
||||||
Self(self.0[..index.min(self.len())].iter().cloned().collect())
|
Self(self.0[..index.min(self.len())].to_vec())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_string(&self) -> String {
|
pub fn to_string(&self) -> String {
|
||||||
let mut string = String::new();
|
use std::iter::FromIterator;
|
||||||
|
String::from_iter(self.0.iter())
|
||||||
for c in self.0.iter() {
|
|
||||||
string.push(*c);
|
|
||||||
}
|
|
||||||
|
|
||||||
string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert(&mut self, index: usize, c: char) {
|
pub fn insert(&mut self, index: usize, c: char) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue