vec 0.2.2 copy "vec: ^0.2.2" to clipboard
vec: ^0.2.2 copied to clipboard

discontinuedreplaced by: rust_core

A zero cost growable vector type

Vec #

Pub Version Dart Package Docs License: MIT Build Status

A zero cost extension type of List, representing a contiguous growable array. Unlike List which is growable or non-growable, which may cause runtime exceptions. Vec adds new useful methods to the regular List type. It is built on rust_core and is a nice compliment to its Arr (array) type.

Usage #

import 'package:vec/vec.dart';

void main() {
  Vec<int> vec = Vec(); // or e.g. Vec([1, 2, 3, 4])
  List<int> list = vec.list; // easily translate back and forth
  Vec<int> vec = Vec(list);

  vec.push(5);

  vec.insert(2, 99);

  int removed = vec.remove(1);

  vec.resize(10, 0);

  RIterator<T> iterator = vec.extractIf((element) => element % 2 == 0);

  Vec<T> spliced = vec.splice(start, end, replaceWith);

  Slice<T> slice = vec.asSlice();
}
1
likes
130
pub points
0%
popularity

Publisher

verified publishervoyver.com

A zero cost growable vector type

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

rust_core

More

Packages that depend on vec