{"id":58395,"library":"vec1","title":"vec1","description":"A wrapper around std::Vec that guarantees at least one element.","status":"active","version":"1.12.1","language":"rust","source_language":null,"source_url":"https://github.com/rustonaut/vec1","tags":["vec","non-empty","wrapper","type-safety"],"install":[{"cmd":"# Cargo.toml\n[dependencies]\nvec1 = \"1.12.1\"","lang":"toml","label":"Cargo.toml"},{"cmd":"cargo add vec1","lang":"bash","label":"cargo add"}],"dependencies":[],"imports":[{"symbol":"Vec1","correct":"use vec1::Vec1;"}],"quickstart":{"code":"use vec1::Vec1;\n\nlet v = Vec1::try_from_vec(vec![1, 2, 3]).unwrap();\nprintln!(\"First element: {}\", v[0]);","lang":"rust","description":"Creates a Vec1 from a Vec, returning an error if the Vec is empty."},"warnings":[{"fix":"Ensure the Vec has at least one element before calling try_from_vec, or handle the error.","message":"try_from_vec returns an error if the input Vec is empty; using unwrap may panic.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'around':4 'element':12 'empti':16 'guarante':8 'least':10 'non':15 'non-empti':14 'one':11 'safeti':20 'std':5 'type':19 'type-safeti':18 'vec':6,13 'vec1':1 'wrapper':3,17","created_at":"2026-06-16T16:22:17.697212+00:00","updated_at":"2026-06-16T16:22:17.697212+00:00","problems":[],"ecosystem":"crates","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/rustonaut/vec1","github":"https://github.com/rustonaut/vec1","docs":"https://docs.rs/vec1/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["utility"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-16","next_check":"2026-12-13","install_tag":null}}