pyc_shell/utils/buffer.rs
1//! ## Buffer
2//!
3//! `buffer` contains utilities for console buffers
4
5/*
6*
7* Copyright (C) 2020 Christian Visintin - christian.visintin1997@gmail.com
8*
9* This file is part of "Pyc"
10*
11* Pyc is free software: you can redistribute it and/or modify
12* it under the terms of the GNU General Public License as published by
13* the Free Software Foundation, either version 3 of the License, or
14* (at your option) any later version.
15*
16* Pyc is distributed in the hope that it will be useful,
17* but WITHOUT ANY WARRANTY; without even the implied warranty of
18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19* GNU General Public License for more details.
20*
21* You should have received a copy of the GNU General Public License
22* along with Pyc. If not, see <http://www.gnu.org/licenses/>.
23*
24*/
25
26/// ### chars_to_string
27///
28/// Converts a characters vector to string
29pub fn chars_to_string(buff: &Vec<char>) -> String {
30 buff.iter().collect()
31}
32
33#[cfg(test)]
34mod tests {
35 use super::*;
36
37 #[test]
38 fn test_utils_buffer_chars_to_string() {
39 assert_eq!(chars_to_string(&vec!['a', 'b', 'c', 'л']), String::from("abcл"));
40 }
41}