/// Construct a vector from an existing slice. #[inline] pubfn try_from(x: &[bigint::Limb]) -> Option<Self> { letmut vec = Self::new();
vec.try_extend(x)?;
Some(vec)
}
/// Sets the length of a vector. /// /// This will explicitly set the size of the vector, without actually /// modifying its buffers, so it is up to the caller to ensure that the /// vector is actually the specified size. /// /// # Safety /// /// Safe as long as `len` is less than `self.capacity()` and has been initialized. #[inline] pubunsafefn set_len(&mutself, len: usize) {
debug_assert!(len <= bigint::BIGINT_LIMBS); unsafe { self.data.set_len(len) };
}
/// The number of elements stored in the vector. #[inline] pubfn len(&self) -> usize { self.data.len()
}
/// If the vector is empty. #[inline] pubfn is_empty(&self) -> bool { self.len() == 0
}
/// The number of items the vector can hold. #[inline] pubfn capacity(&self) -> usize { self.data.capacity()
}
/// Append an item to the vector. #[inline] pubfn try_push(&mutself, value: bigint::Limb) -> Option<()> { self.data.push(value);
Some(())
}
/// Remove an item from the end of the vector and return it, or None if empty. #[inline] pubfn pop(&mutself) -> Option<bigint::Limb> { self.data.pop()
}
/// Copy elements from a slice and append them to the vector. #[inline] pubfn try_extend(&mutself, slc: &[bigint::Limb]) -> Option<()> { self.data.extend_from_slice(slc);
Some(())
}
/// Try to resize the buffer. /// /// If the new length is smaller than the current length, truncate /// the input. If it's larger, then append elements to the buffer. #[inline] pubfn try_resize(&mutself, len: usize, value: bigint::Limb) -> Option<()> { self.data.resize(len, value);
Some(())
}
// HI
/// Get the high 64 bits from the vector. #[inline(always)] pubfn hi64(&self) -> (u64, bool) {
bigint::hi64(&self.data)
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.