pub trait MpMutUIntSlice: MpMutUIntSlicePriv + MpMutUInt {
// Required method
fn coerce_lifetime(&mut self) -> Self::SelfT<'_>;
// Provided method
fn shrink_to(&mut self, nbytes: usize) -> Self::SelfT<'_> { ... }
}Expand description
Interface to mutable multiprecision integers backed by a single buffer slice.
Implemented by the mutable representation-specific types, i.e.
MpMutBigEndianUIntByteSlice, MpMutLittleEndianUIntByteSlice and
MpMutNativeEndianUIntLimbsSlice. In addition to what’s provided through
the MpMutUInt and MpUIntSliceCommon supertraits, MpMutUIntSlice
provides for deriving new mutable views of the same representation on the
backing buffer slice. See MpUIntSlice for the read-only counterpart.
The trait is sealed, i.e. it cannot be implemented outside of this crate.
Required Methods§
Sourcefn coerce_lifetime(&mut self) -> Self::SelfT<'_>
fn coerce_lifetime(&mut self) -> Self::SelfT<'_>
Reborrow the multiprecision integer with a lifetime bound to self.
Returns a mutable view of the same representation on the same backing
buffer slice, but with its lifetime shortened to that of the self
borrow. This makes it the same type as other views derived from
self, like the ones returned by shrink_to(), so
that these can be used interchangeably. self remains mutably borrowed
for as long as the view is alive.
Provided Methods§
Sourcefn shrink_to(&mut self, nbytes: usize) -> Self::SelfT<'_>
fn shrink_to(&mut self, nbytes: usize) -> Self::SelfT<'_>
Get a mutable view on the multiprecision integer’s low part.
Returns a mutable view of the same representation on the part of the
backing buffer slice holding the nbytes least significant bytes, with
nbytes aligned upwards if the representation doesn’t support
unaligned lengths. Writes through the view modify the original
multiprecision integer’s low part, while its high part beyond the view
is left alone. self remains mutably borrowed for as long as the view
is alive. The multiprecision integer’s value must fit into this length.
That is, all of its bytes at positions >= nbytes, counted from least
to most significant, must be zero.
§Arguments
nbytes- The length in units of bytes to shrink the view to. If it’s larger than the multiprecision integer’s length in units of bytes, the latter is retained.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".