pub struct SealingSlice<'s, T: 's> { /* private fields */ }
Expand description

A slice that can seal parts of itself off from mutability, and hand out the sealed parts as immutable references.

The slice grows immutable from start to end in a contiguous way, is initially mutable as a whole. The seal is moved forward using the .seal(n) method. The sealed and unsealed parts can be accessed with the .sealed() and .mutable() methods, respectively.

Implementations§

Create a new SealingSlice. The slice is initially fully mutable.

Seal off n more items in the slice.

Like out-of-bounds slice access, this panics if n is less than .mutable().len() – thus ensuring that .sealed() and .mutable() will not.

Obtain the unsealed part of the slice. This is an immutable view on the original slice, starts at its beginning, and always as long as the sum of all previous .seal(n) arguments.

Obtain the sealed part of the slice. That is a mutable view on the original slice, ends at its end, and always has the length of the original slice minus the sum of all sealed parts.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.