#4 Tests?

Mở
%! (template.HTML=1 tuần trước cách đây)đang mở bởi stevet · 1 ý kiến

I don't see any tests.

Does this handle Vec<Vec<String>>?

I don't see any tests. Does this handle ```Vec<Vec<String>>```?
David Thielemann đã nhận xét 1 tuần trước cách đây
Chủ sở hữu

Ah ha! Tests... I'm missing tests.

No (not directly), it handles Vec<Data>... to have a Vec<Vec<String>> you'd have Vec<Data> with each Data being Vec<Data> of Data::String variant.

use data::Data;

fn main() {
  // outer is Data::Vec or Vec<Data>
  let outer: Data = Data::from(vec![
    // This is also Data::Vec or Vec<Data>
    Data::from(vec![
        // And finally our strings
        Data::from("Hello".to_string()),
        Data::from("World".to_string())
    ])
  ]);
  println!("outer = {}", outer);
}

This is more of a dynamic type, of select types. (String, i8 to i128, u8 to u128, f32 and 64, bool, Vec and HashMap allow for collections, with the ability of nesting)

Ah ha! Tests... I'm missing tests. No (not directly), it handles `Vec<Data>`... to have a `Vec<Vec<String>>` you'd have `Vec<Data>` with each Data being `Vec<Data>` of `Data::String` variant. ```rust use data::Data; fn main() { // outer is Data::Vec or Vec<Data> let outer: Data = Data::from(vec![ // This is also Data::Vec or Vec<Data> Data::from(vec![ // And finally our strings Data::from("Hello".to_string()), Data::from("World".to_string()) ]) ]); println!("outer = {}", outer); } ``` This is more of a dynamic type, of select types. (String, i8 to i128, u8 to u128, f32 and 64, bool, Vec<Data> and HashMap<String, Data> allow for collections, with the ability of nesting)
Đăng nhập để tham gia bình luận.
Không có Milestone
Không có người được phân công
2 tham gia
Đang tải...
Hủy bỏ
Lưu
Ở đây vẫn chưa có nội dung nào.