Struct header_vec::HeaderVecWeak[][src]

pub struct HeaderVecWeak<H, T> { /* fields omitted */ }

Methods from Deref<Target = HeaderVec<H, T>>

This is useful to check if two nodes are the same. Use it with HeaderVec::is.

This is used to check if this is the HeaderVec that corresponds to the given pointer. This is useful for updating weak references after HeaderVec::push returns the pointer.

Create a (dangerous) weak reference to the HeaderVec. This is useful to be able to create, for instance, graph data structures. Edges can utilize HeaderVecWeak so that they can traverse the graph immutably without needing to go to memory twice to look up first the pointer to the underlying dynamic edge store (like a Vec). The caveat is that the user is responsible for updating all HeaderVecWeak if the HeaderVec needs to reallocate when HeaderVec::push is called. HeaderVec::push returns true when it reallocates, and this indicates that the HeaderVecWeak need to be updated. Therefore, this works best for implemented undirected graphs where it is easy to find neighbor nodes. Directed graphs with an alternative method to traverse directed edges backwards should also work with this technique.

Safety

A HeaderVecWeak can only be used while its corresponding HeaderVec is still alive. HeaderVecWeak also MUST be updated manually by the user when HeaderVec::push returns true, since the pointer has now changed. As there is no reference counting mechanism, or method by which all the weak references could be updated, it is up to the user to do this. That is why this is unsafe. Make sure you update your HeaderVecWeak appropriately.

If a HeaderVec is updated through a weak reference and reallocates, you must use this method to update the internal pointer to the HeaderVec (along with any other weak references).

Safety

See the safety section in HeaderVec::weak for an explanation of why this is necessary.

Adds an item to the end of the list.

Returns true if the memory was moved to a new location. In this case, you are responsible for updating the weak nodes.

Retains only the elements specified by the predicate.

In other words, remove all elements e such that f(&e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.