Trait TrustedRandomAccessNoCoerce

pub unsafe trait TrustedRandomAccessNoCoerce: Sized

Like TrustedRandomAccess but without any of the requirements / guarantees around coercions to supertypes after __iterator_get_unchecked (they aren’t allowed here!), and without the requirement that subtypes / supertypes implement TrustedRandomAccessNoCoerce.

This trait was created in PR #85874 to fix soundness issue #85873 without performance regressions. It is subject to change as we might want to build a more generally useful (for performance optimizations) and more sophisticated trait or trait hierarchy that replaces or extends TrustedRandomAccess and TrustedRandomAccessNoCoerce.

Associated Constants

const MAY_HAVE_SIDE_EFFECT: bool;

true if getting an iterator element may have side effects. Remember to take inner iterators into account.

Provided Methods

fn size(&self) -> usize
where
    Self: Iterator,

Implementors