diff options
Diffstat (limited to 'vendor/bstr/examples')
-rw-r--r-- | vendor/bstr/examples/graphemes-std.rs | 25 | ||||
-rw-r--r-- | vendor/bstr/examples/graphemes.rs | 22 | ||||
-rw-r--r-- | vendor/bstr/examples/lines-std.rs | 17 | ||||
-rw-r--r-- | vendor/bstr/examples/lines.rs | 17 | ||||
-rw-r--r-- | vendor/bstr/examples/uppercase-std.rs | 15 | ||||
-rw-r--r-- | vendor/bstr/examples/uppercase.rs | 18 | ||||
-rw-r--r-- | vendor/bstr/examples/words-std.rs | 18 | ||||
-rw-r--r-- | vendor/bstr/examples/words.rs | 15 |
8 files changed, 0 insertions, 147 deletions
diff --git a/vendor/bstr/examples/graphemes-std.rs b/vendor/bstr/examples/graphemes-std.rs deleted file mode 100644 index 647739d4a..000000000 --- a/vendor/bstr/examples/graphemes-std.rs +++ /dev/null @@ -1,25 +0,0 @@ -use std::error::Error; -use std::io::{self, BufRead, Write}; - -use unicode_segmentation::UnicodeSegmentation; - -fn main() -> Result<(), Box<dyn Error>> { - let stdin = io::stdin(); - let mut stdin = stdin.lock(); - let mut stdout = io::BufWriter::new(io::stdout()); - - let mut line = String::new(); - while stdin.read_line(&mut line)? > 0 { - let end = line - .grapheme_indices(true) - .map(|(start, g)| start + g.len()) - .take(10) - .last() - .unwrap_or(line.len()); - stdout.write_all(line[..end].trim_end().as_bytes())?; - stdout.write_all(b"\n")?; - - line.clear(); - } - Ok(()) -} diff --git a/vendor/bstr/examples/graphemes.rs b/vendor/bstr/examples/graphemes.rs deleted file mode 100644 index 6adc7019d..000000000 --- a/vendor/bstr/examples/graphemes.rs +++ /dev/null @@ -1,22 +0,0 @@ -use std::error::Error; -use std::io::{self, Write}; - -use bstr::{io::BufReadExt, ByteSlice}; - -fn main() -> Result<(), Box<dyn Error>> { - let stdin = io::stdin(); - let mut stdout = io::BufWriter::new(io::stdout()); - - stdin.lock().for_byte_line_with_terminator(|line| { - let end = line - .grapheme_indices() - .map(|(_, end, _)| end) - .take(10) - .last() - .unwrap_or(line.len()); - stdout.write_all(line[..end].trim_end())?; - stdout.write_all(b"\n")?; - Ok(true) - })?; - Ok(()) -} diff --git a/vendor/bstr/examples/lines-std.rs b/vendor/bstr/examples/lines-std.rs deleted file mode 100644 index 69fc6a586..000000000 --- a/vendor/bstr/examples/lines-std.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::error::Error; -use std::io::{self, BufRead, Write}; - -fn main() -> Result<(), Box<dyn Error>> { - let stdin = io::stdin(); - let mut stdin = stdin.lock(); - let mut stdout = io::BufWriter::new(io::stdout()); - - let mut line = String::new(); - while stdin.read_line(&mut line)? > 0 { - if line.contains("Dimension") { - stdout.write_all(line.as_bytes())?; - } - line.clear(); - } - Ok(()) -} diff --git a/vendor/bstr/examples/lines.rs b/vendor/bstr/examples/lines.rs deleted file mode 100644 index c392a2229..000000000 --- a/vendor/bstr/examples/lines.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::error::Error; -use std::io::{self, Write}; - -use bstr::{io::BufReadExt, ByteSlice}; - -fn main() -> Result<(), Box<dyn Error>> { - let stdin = io::stdin(); - let mut stdout = io::BufWriter::new(io::stdout()); - - stdin.lock().for_byte_line_with_terminator(|line| { - if line.contains_str("Dimension") { - stdout.write_all(line)?; - } - Ok(true) - })?; - Ok(()) -} diff --git a/vendor/bstr/examples/uppercase-std.rs b/vendor/bstr/examples/uppercase-std.rs deleted file mode 100644 index 672bd7171..000000000 --- a/vendor/bstr/examples/uppercase-std.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::error::Error; -use std::io::{self, BufRead, Write}; - -fn main() -> Result<(), Box<dyn Error>> { - let stdin = io::stdin(); - let mut stdin = stdin.lock(); - let mut stdout = io::BufWriter::new(io::stdout()); - - let mut line = String::new(); - while stdin.read_line(&mut line)? > 0 { - stdout.write_all(line.to_uppercase().as_bytes())?; - line.clear(); - } - Ok(()) -} diff --git a/vendor/bstr/examples/uppercase.rs b/vendor/bstr/examples/uppercase.rs deleted file mode 100644 index 1eb798a34..000000000 --- a/vendor/bstr/examples/uppercase.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::error::Error; -use std::io::{self, Write}; - -use bstr::{io::BufReadExt, ByteSlice}; - -fn main() -> Result<(), Box<dyn Error>> { - let stdin = io::stdin(); - let mut stdout = io::BufWriter::new(io::stdout()); - - let mut upper = vec![]; - stdin.lock().for_byte_line_with_terminator(|line| { - upper.clear(); - line.to_uppercase_into(&mut upper); - stdout.write_all(&upper)?; - Ok(true) - })?; - Ok(()) -} diff --git a/vendor/bstr/examples/words-std.rs b/vendor/bstr/examples/words-std.rs deleted file mode 100644 index aeeeb26ff..000000000 --- a/vendor/bstr/examples/words-std.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::error::Error; -use std::io::{self, BufRead}; - -use unicode_segmentation::UnicodeSegmentation; - -fn main() -> Result<(), Box<dyn Error>> { - let stdin = io::stdin(); - let mut stdin = stdin.lock(); - - let mut words = 0; - let mut line = String::new(); - while stdin.read_line(&mut line)? > 0 { - words += line.unicode_words().count(); - line.clear(); - } - println!("{}", words); - Ok(()) -} diff --git a/vendor/bstr/examples/words.rs b/vendor/bstr/examples/words.rs deleted file mode 100644 index db305da0d..000000000 --- a/vendor/bstr/examples/words.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::error::Error; -use std::io; - -use bstr::{io::BufReadExt, ByteSlice}; - -fn main() -> Result<(), Box<dyn Error>> { - let stdin = io::stdin(); - let mut words = 0; - stdin.lock().for_byte_line_with_terminator(|line| { - words += line.words().count(); - Ok(true) - })?; - println!("{}", words); - Ok(()) -} |