Struct index_ext::tag::Len[][src]

pub struct Len<Tag> { /* fields omitted */ }
Expand description

The length of a particular slice (or a number of slices).

The encapsulated length field is guaranteed to be at most the length of each of the slices with the exact same tag. In other words, all indices strictly smaller than this number are safe.

This allows this instance to construct indices that are validated to be able to soundly access the slices without required any particular slice instance. In particular, the construct might happen by a numerical algorithm independent of the slices and across method bounds where the compiler’s optimizer and inline pass is no longer aware of the connection and would otherwise insert another check when the slice is indexed later.

Implementations

Interpret this with the tag of a set of potentially longer slices.

The proof of inequality was performed in any of the possible constructors that allow the instance of LessEq to exist in the first place.

Returns the stored length.

Construct an index to a single element.

This method return Some when the index is smaller than the length.

Construct an index to a range of element.

This method return Some when the indices are ordered and to does not exceed the length.

Construct an index to a range from an element.

This method return Some when from does not exceed the length.

Construct an index to a range starting at this length.

This method might return an index for an empty range.

Construct an index to a range up to an element.

This method return Some when to does not exceed the length.

Construct an index to a range up, exclusive, to this length.

This method might return an index for an empty range.

Construct an index referring to the unordered range from one element to another.

This method might return an empty range. The order of arguments does not matter.

Construct an index to all elements.

This method exists mostly for completeness sake. There is no bounds check when accessing a complete slice with ...

Create a smaller length.

Bound the length from above.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Performs the conversion.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.