LineEditor

Struct LineEditor 

Source
pub struct LineEditor { /* private fields */ }
Expand description

Line Editor Engine

Implementations§

Source§

impl LineEditor

Source

pub fn new(prompt: Box<dyn Prompt>) -> Self

Create new instance of LineEditor with Prompt

Examples found in repository?
examples/custom_prompt.rs (line 23)
21fn main() {
22    let prompt = CurrentPathPrompt {};
23    let mut line_editor = LineEditor::new(Box::new(prompt));
24
25    let bindings = line_editor.keybinding();
26    bindings.register_common_control_bindings();
27
28    match line_editor.read_line() {
29        Ok(LineEditorResult::Success(line)) => {
30            println!("Line {}", line);
31        }
32        _ => {}
33    }
34}
More examples
Hide additional examples
examples/text_prompt.rs (line 7)
5fn main() {
6    let prompt = StringPrompt::new("prompt> ".to_string());
7    let mut line_editor = LineEditor::new(Box::new(prompt));
8
9    let bindings = line_editor.keybinding();
10    bindings.register_common_control_bindings();
11
12    match line_editor.read_line() {
13        Ok(LineEditorResult::Success(line)) => {
14            println!("Line {}", line);
15        }
16        _ => {}
17    }
18}
examples/keyword_hinter.rs (line 39)
37fn main() {
38    let prompt = StringPrompt::new("prompt> ".to_string());
39    let mut line_editor = LineEditor::new(Box::new(prompt));
40    line_editor.add_hinter(Box::<GitQLHinter>::default());
41
42    let bindings = line_editor.keybinding();
43    bindings.register_common_control_bindings();
44
45    match line_editor.read_line() {
46        Ok(LineEditorResult::Success(line)) => {
47            println!("Line {}", line);
48        }
49        _ => {}
50    }
51}
examples/keyword_highlighter.rs (line 75)
73fn main() {
74    let prompt = StringPrompt::new("prompt> ".to_string());
75    let mut line_editor = LineEditor::new(Box::new(prompt));
76
77    let bindings = line_editor.keybinding();
78    bindings.register_common_control_bindings();
79
80    line_editor.add_highlighter(Box::<GitQLHighlighter>::default());
81
82    match line_editor.read_line() {
83        Ok(LineEditorResult::Success(line)) => {
84            println!("Line {}", line);
85        }
86        _ => {}
87    }
88}
examples/cursor_style.rs (line 8)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9    line_editor.set_cursor_style(Some(SetCursorStyle::BlinkingBlock));
10
11    let bindings = line_editor.keybinding();
12    bindings.register_common_control_bindings();
13
14    match line_editor.read_line() {
15        Ok(LineEditorResult::Success(line)) => {
16            println!("Line {}", line);
17        }
18        _ => {}
19    }
20}
examples/auto_pair.rs (line 8)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9    line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
10
11    let bindings = line_editor.keybinding();
12    bindings.register_common_control_bindings();
13
14    match line_editor.read_line() {
15        Ok(LineEditorResult::Success(line)) => {
16            println!("Line {}", line);
17        }
18        _ => {}
19    }
20}
Source

pub fn read_line(&mut self) -> Result<LineEditorResult>

Wait for input and provide the user

Returns a std::io::Result in which the Err type is std::io::Result and the Ok variant wraps a LineEditorResult which handles user inputs.

Examples found in repository?
examples/custom_prompt.rs (line 28)
21fn main() {
22    let prompt = CurrentPathPrompt {};
23    let mut line_editor = LineEditor::new(Box::new(prompt));
24
25    let bindings = line_editor.keybinding();
26    bindings.register_common_control_bindings();
27
28    match line_editor.read_line() {
29        Ok(LineEditorResult::Success(line)) => {
30            println!("Line {}", line);
31        }
32        _ => {}
33    }
34}
More examples
Hide additional examples
examples/debug.rs (line 225)
221fn main() {
222    let mut line_editor = create_new_line_editor();
223
224    loop {
225        match line_editor.read_line() {
226            Ok(LineEditorResult::Success(line)) => {
227                println!();
228
229                if line == "exit" {
230                    break;
231                }
232
233                println!("Result {}", line.len());
234            }
235            _ => {}
236        }
237    }
238}
examples/text_prompt.rs (line 12)
5fn main() {
6    let prompt = StringPrompt::new("prompt> ".to_string());
7    let mut line_editor = LineEditor::new(Box::new(prompt));
8
9    let bindings = line_editor.keybinding();
10    bindings.register_common_control_bindings();
11
12    match line_editor.read_line() {
13        Ok(LineEditorResult::Success(line)) => {
14            println!("Line {}", line);
15        }
16        _ => {}
17    }
18}
examples/keyword_hinter.rs (line 45)
37fn main() {
38    let prompt = StringPrompt::new("prompt> ".to_string());
39    let mut line_editor = LineEditor::new(Box::new(prompt));
40    line_editor.add_hinter(Box::<GitQLHinter>::default());
41
42    let bindings = line_editor.keybinding();
43    bindings.register_common_control_bindings();
44
45    match line_editor.read_line() {
46        Ok(LineEditorResult::Success(line)) => {
47            println!("Line {}", line);
48        }
49        _ => {}
50    }
51}
examples/keyword_highlighter.rs (line 82)
73fn main() {
74    let prompt = StringPrompt::new("prompt> ".to_string());
75    let mut line_editor = LineEditor::new(Box::new(prompt));
76
77    let bindings = line_editor.keybinding();
78    bindings.register_common_control_bindings();
79
80    line_editor.add_highlighter(Box::<GitQLHighlighter>::default());
81
82    match line_editor.read_line() {
83        Ok(LineEditorResult::Success(line)) => {
84            println!("Line {}", line);
85        }
86        _ => {}
87    }
88}
examples/cursor_style.rs (line 14)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9    line_editor.set_cursor_style(Some(SetCursorStyle::BlinkingBlock));
10
11    let bindings = line_editor.keybinding();
12    bindings.register_common_control_bindings();
13
14    match line_editor.read_line() {
15        Ok(LineEditorResult::Success(line)) => {
16            println!("Line {}", line);
17        }
18        _ => {}
19    }
20}
Source

pub fn set_visual_selection_style(&mut self, style: Option<Style>)

Set style for visual selection or NONE to clear it

Examples found in repository?
examples/visual_selection.rs (line 12)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9
10    let mut style = Style::default();
11    style.set_background_color(lineeditor::Color::Cyan);
12    line_editor.set_visual_selection_style(Some(style));
13
14    let bindings = line_editor.keybinding();
15    bindings.register_common_control_bindings();
16    bindings.register_common_navigation_bindings();
17    bindings.register_common_edit_bindings();
18    bindings.register_common_selection_bindings();
19
20    match line_editor.read_line() {
21        Ok(LineEditorResult::Success(line)) => {
22            println!("Line {}", line);
23        }
24        _ => {}
25    }
26}
More examples
Hide additional examples
examples/surround_selection.rs (line 12)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9
10    let mut style = Style::default();
11    style.set_background_color(lineeditor::Color::Cyan);
12    line_editor.set_visual_selection_style(Some(style));
13    line_editor.enable_surround_selection(true);
14
15    let bindings = line_editor.keybinding();
16    bindings.register_common_control_bindings();
17    bindings.register_common_navigation_bindings();
18    bindings.register_common_edit_bindings();
19    bindings.register_common_selection_bindings();
20
21    match line_editor.read_line() {
22        Ok(LineEditorResult::Success(line)) => {
23            println!("Line {}", line);
24        }
25        _ => {}
26    }
27}
Source

pub fn editor(&mut self) -> &mut Editor

Get the current Editor

Source

pub fn keybinding(&mut self) -> &mut Keybindings

Get the current Keybindings

Examples found in repository?
examples/custom_prompt.rs (line 25)
21fn main() {
22    let prompt = CurrentPathPrompt {};
23    let mut line_editor = LineEditor::new(Box::new(prompt));
24
25    let bindings = line_editor.keybinding();
26    bindings.register_common_control_bindings();
27
28    match line_editor.read_line() {
29        Ok(LineEditorResult::Success(line)) => {
30            println!("Line {}", line);
31        }
32        _ => {}
33    }
34}
More examples
Hide additional examples
examples/text_prompt.rs (line 9)
5fn main() {
6    let prompt = StringPrompt::new("prompt> ".to_string());
7    let mut line_editor = LineEditor::new(Box::new(prompt));
8
9    let bindings = line_editor.keybinding();
10    bindings.register_common_control_bindings();
11
12    match line_editor.read_line() {
13        Ok(LineEditorResult::Success(line)) => {
14            println!("Line {}", line);
15        }
16        _ => {}
17    }
18}
examples/keyword_hinter.rs (line 42)
37fn main() {
38    let prompt = StringPrompt::new("prompt> ".to_string());
39    let mut line_editor = LineEditor::new(Box::new(prompt));
40    line_editor.add_hinter(Box::<GitQLHinter>::default());
41
42    let bindings = line_editor.keybinding();
43    bindings.register_common_control_bindings();
44
45    match line_editor.read_line() {
46        Ok(LineEditorResult::Success(line)) => {
47            println!("Line {}", line);
48        }
49        _ => {}
50    }
51}
examples/keyword_highlighter.rs (line 77)
73fn main() {
74    let prompt = StringPrompt::new("prompt> ".to_string());
75    let mut line_editor = LineEditor::new(Box::new(prompt));
76
77    let bindings = line_editor.keybinding();
78    bindings.register_common_control_bindings();
79
80    line_editor.add_highlighter(Box::<GitQLHighlighter>::default());
81
82    match line_editor.read_line() {
83        Ok(LineEditorResult::Success(line)) => {
84            println!("Line {}", line);
85        }
86        _ => {}
87    }
88}
examples/cursor_style.rs (line 11)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9    line_editor.set_cursor_style(Some(SetCursorStyle::BlinkingBlock));
10
11    let bindings = line_editor.keybinding();
12    bindings.register_common_control_bindings();
13
14    match line_editor.read_line() {
15        Ok(LineEditorResult::Success(line)) => {
16            println!("Line {}", line);
17        }
18        _ => {}
19    }
20}
examples/auto_pair.rs (line 11)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9    line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
10
11    let bindings = line_editor.keybinding();
12    bindings.register_common_control_bindings();
13
14    match line_editor.read_line() {
15        Ok(LineEditorResult::Success(line)) => {
16            println!("Line {}", line);
17        }
18        _ => {}
19    }
20}
Source

pub fn set_input_filter(&mut self, input_filter: InputFilter)

Set the current InputFilter type

Examples found in repository?
examples/input_filter.rs (lines 10-13)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9
10    line_editor.set_input_filter(InputFilter::Options(vec![
11        Box::new(InputFilter::Digit),
12        Box::new(InputFilter::Whitespace),
13    ]));
14
15    let bindings = line_editor.keybinding();
16    bindings.register_common_control_bindings();
17    bindings.register_common_navigation_bindings();
18    bindings.register_common_edit_bindings();
19    bindings.register_common_selection_bindings();
20
21    match line_editor.read_line() {
22        Ok(LineEditorResult::Success(line)) => {
23            println!("Line {}", line);
24        }
25        _ => {}
26    }
27}
Source

pub fn set_auto_pair(&mut self, auto_pair: Option<Box<dyn AutoPair>>)

Add Auto pair, or clear it by passing None

Examples found in repository?
examples/auto_pair.rs (line 9)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9    line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
10
11    let bindings = line_editor.keybinding();
12    bindings.register_common_control_bindings();
13
14    match line_editor.read_line() {
15        Ok(LineEditorResult::Success(line)) => {
16            println!("Line {}", line);
17        }
18        _ => {}
19    }
20}
More examples
Hide additional examples
examples/debug.rs (line 200)
194pub fn create_new_line_editor() -> LineEditor {
195    let prompt = StringPrompt::new("gitql > ".to_string());
196    let mut line_editor = LineEditor::new(Box::new(prompt));
197
198    line_editor.add_highlighter(Box::<GitQLHighlighter>::default());
199    line_editor.add_highlighter(Box::<MatchingBracketsHighlighter>::default());
200    line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
201    line_editor.add_hinter(Box::<GitQLHinter>::default());
202    line_editor.set_completer(Box::new(FixedCompleter));
203
204    let bindings = line_editor.keybinding();
205    bindings.register_common_control_bindings();
206    bindings.register_common_navigation_bindings();
207    bindings.register_common_edit_bindings();
208    bindings.register_common_selection_bindings();
209    bindings.register_binding(
210        KeyCombination {
211            key_kind: lineeditor::KeyEventKind::Press,
212            modifier: KeyModifiers::NONE,
213            key_code: lineeditor::KeyCode::Tab,
214        },
215        LineEditorEvent::ToggleAutoComplete,
216    );
217
218    line_editor
219}
Source

pub fn set_cursor_style(&mut self, style: Option<SetCursorStyle>)

Set the current cursor style Or None to reset

Examples found in repository?
examples/cursor_style.rs (line 9)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9    line_editor.set_cursor_style(Some(SetCursorStyle::BlinkingBlock));
10
11    let bindings = line_editor.keybinding();
12    bindings.register_common_control_bindings();
13
14    match line_editor.read_line() {
15        Ok(LineEditorResult::Success(line)) => {
16            println!("Line {}", line);
17        }
18        _ => {}
19    }
20}
Source

pub fn highlighters(&mut self) -> &mut Vec<Box<dyn Highlighter>>

Get the current list of highlighters

Source

pub fn add_highlighter(&mut self, highlighter: Box<dyn Highlighter>)

Add new Syntax highlighter

Examples found in repository?
examples/keyword_highlighter.rs (line 80)
73fn main() {
74    let prompt = StringPrompt::new("prompt> ".to_string());
75    let mut line_editor = LineEditor::new(Box::new(prompt));
76
77    let bindings = line_editor.keybinding();
78    bindings.register_common_control_bindings();
79
80    line_editor.add_highlighter(Box::<GitQLHighlighter>::default());
81
82    match line_editor.read_line() {
83        Ok(LineEditorResult::Success(line)) => {
84            println!("Line {}", line);
85        }
86        _ => {}
87    }
88}
More examples
Hide additional examples
examples/matching_brackets_highlighters.rs (line 76)
73fn main() {
74    let prompt = StringPrompt::new("gql> ".to_string());
75    let mut line_editor = LineEditor::new(Box::new(prompt));
76    line_editor.add_highlighter(Box::<MatchingBracketsHighlighter>::default());
77
78    let bindings = line_editor.keybinding();
79    bindings.register_common_control_bindings();
80
81    match line_editor.read_line() {
82        Ok(LineEditorResult::Success(line)) => {
83            println!("Line {}", line);
84        }
85        _ => {}
86    }
87}
examples/hex_color_highlighter.rs (line 71)
67fn main() {
68    let prompt = StringPrompt::new("prompt> ".to_string());
69    let mut line_editor = LineEditor::new(Box::new(prompt));
70
71    line_editor.add_highlighter(Box::<HexColorHighlighter>::default());
72
73    let bindings = line_editor.keybinding();
74    bindings.register_common_control_bindings();
75    bindings.register_common_navigation_bindings();
76    bindings.register_common_edit_bindings();
77    bindings.register_common_selection_bindings();
78
79    match line_editor.read_line() {
80        Ok(LineEditorResult::Success(line)) => {
81            println!("Line {}", line);
82        }
83        _ => {}
84    }
85}
examples/debug.rs (line 198)
194pub fn create_new_line_editor() -> LineEditor {
195    let prompt = StringPrompt::new("gitql > ".to_string());
196    let mut line_editor = LineEditor::new(Box::new(prompt));
197
198    line_editor.add_highlighter(Box::<GitQLHighlighter>::default());
199    line_editor.add_highlighter(Box::<MatchingBracketsHighlighter>::default());
200    line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
201    line_editor.add_hinter(Box::<GitQLHinter>::default());
202    line_editor.set_completer(Box::new(FixedCompleter));
203
204    let bindings = line_editor.keybinding();
205    bindings.register_common_control_bindings();
206    bindings.register_common_navigation_bindings();
207    bindings.register_common_edit_bindings();
208    bindings.register_common_selection_bindings();
209    bindings.register_binding(
210        KeyCombination {
211            key_kind: lineeditor::KeyEventKind::Press,
212            modifier: KeyModifiers::NONE,
213            key_code: lineeditor::KeyCode::Tab,
214        },
215        LineEditorEvent::ToggleAutoComplete,
216    );
217
218    line_editor
219}
Source

pub fn clear_highlighters(&mut self)

Clear current syntax highlighter

Source

pub fn hinters(&mut self) -> &mut Vec<Box<dyn Hinter>>

Get current hinters

Source

pub fn add_hinter(&mut self, hinter: Box<dyn Hinter>)

Add new Hinter

Examples found in repository?
examples/keyword_hinter.rs (line 40)
37fn main() {
38    let prompt = StringPrompt::new("prompt> ".to_string());
39    let mut line_editor = LineEditor::new(Box::new(prompt));
40    line_editor.add_hinter(Box::<GitQLHinter>::default());
41
42    let bindings = line_editor.keybinding();
43    bindings.register_common_control_bindings();
44
45    match line_editor.read_line() {
46        Ok(LineEditorResult::Success(line)) => {
47            println!("Line {}", line);
48        }
49        _ => {}
50    }
51}
More examples
Hide additional examples
examples/debug.rs (line 201)
194pub fn create_new_line_editor() -> LineEditor {
195    let prompt = StringPrompt::new("gitql > ".to_string());
196    let mut line_editor = LineEditor::new(Box::new(prompt));
197
198    line_editor.add_highlighter(Box::<GitQLHighlighter>::default());
199    line_editor.add_highlighter(Box::<MatchingBracketsHighlighter>::default());
200    line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
201    line_editor.add_hinter(Box::<GitQLHinter>::default());
202    line_editor.set_completer(Box::new(FixedCompleter));
203
204    let bindings = line_editor.keybinding();
205    bindings.register_common_control_bindings();
206    bindings.register_common_navigation_bindings();
207    bindings.register_common_edit_bindings();
208    bindings.register_common_selection_bindings();
209    bindings.register_binding(
210        KeyCombination {
211            key_kind: lineeditor::KeyEventKind::Press,
212            modifier: KeyModifiers::NONE,
213            key_code: lineeditor::KeyCode::Tab,
214        },
215        LineEditorEvent::ToggleAutoComplete,
216    );
217
218    line_editor
219}
Source

pub fn clear_hinters(&mut self)

Clear current hinters

Source

pub fn set_completer(&mut self, completer: Box<dyn Completer>)

Set the current Auto completer

Examples found in repository?
examples/drop_down_auto_complete.rs (line 49)
45fn main() {
46    let prompt = StringPrompt::new("prompt> ".to_string());
47    let mut line_editor = LineEditor::new(Box::new(prompt));
48
49    line_editor.set_completer(Box::new(FixedCompleter {}));
50
51    let bindings = line_editor.keybinding();
52
53    bindings.register_binding(
54        KeyCombination {
55            key_kind: lineeditor::KeyEventKind::Press,
56            modifier: KeyModifiers::NONE,
57            key_code: lineeditor::KeyCode::Tab,
58        },
59        LineEditorEvent::ToggleAutoComplete,
60    );
61    bindings.register_common_control_bindings();
62    bindings.register_common_navigation_bindings();
63    bindings.register_common_edit_bindings();
64    bindings.register_common_selection_bindings();
65
66    match line_editor.read_line() {
67        Ok(LineEditorResult::Success(line)) => {
68            println!("Line {}", line);
69        }
70        _ => {}
71    }
72}
More examples
Hide additional examples
examples/debug.rs (line 202)
194pub fn create_new_line_editor() -> LineEditor {
195    let prompt = StringPrompt::new("gitql > ".to_string());
196    let mut line_editor = LineEditor::new(Box::new(prompt));
197
198    line_editor.add_highlighter(Box::<GitQLHighlighter>::default());
199    line_editor.add_highlighter(Box::<MatchingBracketsHighlighter>::default());
200    line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
201    line_editor.add_hinter(Box::<GitQLHinter>::default());
202    line_editor.set_completer(Box::new(FixedCompleter));
203
204    let bindings = line_editor.keybinding();
205    bindings.register_common_control_bindings();
206    bindings.register_common_navigation_bindings();
207    bindings.register_common_edit_bindings();
208    bindings.register_common_selection_bindings();
209    bindings.register_binding(
210        KeyCombination {
211            key_kind: lineeditor::KeyEventKind::Press,
212            modifier: KeyModifiers::NONE,
213            key_code: lineeditor::KeyCode::Tab,
214        },
215        LineEditorEvent::ToggleAutoComplete,
216    );
217
218    line_editor
219}
Source

pub fn clear_completer(&mut self)

Clear current auto completer

Source

pub fn set_auto_complete_view( &mut self, auto_complete_view: Box<dyn ListView<Suggestion>>, )

Set the current Auto Complete View

Source

pub fn enable_surround_selection(&mut self, enable: bool)

Enable or Disable surround selection feature

Examples found in repository?
examples/surround_selection.rs (line 13)
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9
10    let mut style = Style::default();
11    style.set_background_color(lineeditor::Color::Cyan);
12    line_editor.set_visual_selection_style(Some(style));
13    line_editor.enable_surround_selection(true);
14
15    let bindings = line_editor.keybinding();
16    bindings.register_common_control_bindings();
17    bindings.register_common_navigation_bindings();
18    bindings.register_common_edit_bindings();
19    bindings.register_common_selection_bindings();
20
21    match line_editor.read_line() {
22        Ok(LineEditorResult::Success(line)) => {
23            println!("Line {}", line);
24        }
25        _ => {}
26    }
27}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.