From a9d981f2d8ae59cf370304d5012f41bd112a997d Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 19 Nov 2023 22:18:21 +0900 Subject: [PATCH] run doc test for `impl FromIterator for TextArea` --- src/textarea.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/textarea.rs b/src/textarea.rs index 230ba1c..69a399a 100644 --- a/src/textarea.rs +++ b/src/textarea.rs @@ -131,16 +131,19 @@ where /// Collect line texts from iterator as [`TextArea`]. It is useful when creating a textarea with text read from a file. /// [`Iterator::collect`] handles errors which may happen on reading each lines. The following example reads text from /// a file efficiently line-by-line. -/// ```no_run +/// ``` /// use std::fs; /// use std::io::{self, BufRead}; /// use std::path::Path; /// use tui_textarea::TextArea; /// /// fn read_from_file<'a>(path: impl AsRef) -> io::Result> { -/// let file = fs::File::open(path.as_ref())?; +/// let file = fs::File::open(path)?; /// io::BufReader::new(file).lines().collect() /// } +/// +/// let textarea = read_from_file("README.md").unwrap(); +/// assert!(!textarea.is_empty()); /// ``` impl<'a, S: Into> FromIterator for TextArea<'a> { fn from_iter>(iter: I) -> Self {