summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-05 02:58:42 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-05 02:58:42 +0100
commitba470a2b2a334fa961af19ef9412ad2dfb4acbeb (patch)
tree92d4c2b7a80eb181ccc6998c7e19e049ac643ec6 /core
parent075fcf1a52fd478ec1f9451278c582f34b95fdfe (diff)
downloadiced-ba470a2b2a334fa961af19ef9412ad2dfb4acbeb.tar.gz
iced-ba470a2b2a334fa961af19ef9412ad2dfb4acbeb.tar.bz2
iced-ba470a2b2a334fa961af19ef9412ad2dfb4acbeb.zip
Remove unnecessary code in `Value`
Diffstat (limited to 'core')
-rw-r--r--core/src/widget/text_input.rs19
1 files changed, 1 insertions, 18 deletions
diff --git a/core/src/widget/text_input.rs b/core/src/widget/text_input.rs
index 6c7dff67..e5d6b70d 100644
--- a/core/src/widget/text_input.rs
+++ b/core/src/widget/text_input.rs
@@ -1,7 +1,5 @@
use crate::Length;
-use std::ops::{Index, RangeTo};
-
pub struct TextInput<'a, Message> {
pub state: &'a mut State,
pub placeholder: String,
@@ -93,13 +91,6 @@ impl State {
Self::default()
}
- pub fn focused() -> Self {
- Self {
- is_focused: true,
- ..Self::default()
- }
- }
-
pub fn move_cursor_right(&mut self, value: &Value) {
let current = self.cursor_position(value);
@@ -134,7 +125,7 @@ impl Value {
}
pub fn until(&self, index: usize) -> Self {
- Self(self.0[..index].iter().cloned().collect())
+ Self(self.0[..index.min(self.len())].iter().cloned().collect())
}
pub fn to_string(&self) -> String {
@@ -155,11 +146,3 @@ impl Value {
self.0.remove(index);
}
}
-
-impl Index<RangeTo<usize>> for Value {
- type Output = [char];
-
- fn index(&self, index: RangeTo<usize>) -> &[char] {
- &self.0[index]
- }
-}