Struct dogged::DVec [] [src]

pub struct DVec<T> { /* fields omitted */ }

A persistent vector of T elements. Persistent collections change the trade-off relative to ordinary collections: they are very cheap to clone, but more expensive to update. Behind the scenes, DVec instances that are cloned from one another will share some part of their representation.

You may be accustomed to persistent APIs in other languages, where each mutation operation returns a new collection instead of modifying the collection in place. The DVec type, in contrast, behaves roughly like an ordinary vector, except that you can cheaply clone it. If you want to get a new collection with a given mutation, but leave the existing collection alone, use clone:

let mut vec1 = DVec::new();
vec1.push(22);
let mut vec2 = vec1.clone();
vec2.push(44);
assert_eq!(vec1.len(), 1);
assert_eq!(vec2.len(), 2);

Methods

impl<T: Clone + Debug> DVec<T>
[src]

[src]

[src]

[src]

[src]

[src]

Trait Implementations

impl<T: Clone> Clone for DVec<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for DVec<T>
[src]

[src]

Formats the value using the given formatter.

impl<T: Ord> Ord for DVec<T>
[src]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl<T: PartialOrd> PartialOrd for DVec<T>
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Eq> Eq for DVec<T>
[src]

impl<T: PartialEq> PartialEq for DVec<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<T: Clone + Debug> Index<usize> for DVec<T>
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<T: Clone + Debug> IndexMut<usize> for DVec<T>
[src]

[src]

Performs the mutable indexing (container[index]) operation.