Lines Matching defs:U
187 pub fn project<U: ?Sized, C: cast::Project<T, U>>(self) -> PtrInner<'a, U> {
538 /// Attempts to cast `self` to a `U` using the given cast type.
540 /// If `U` is a slice DST and pointer metadata (`meta`) is provided, then
544 /// Returns `None` if the resulting `U` would be invalidly-aligned, if no
545 /// `U` can fit in `self`, or if the provided pointer metadata describes an
546 /// invalid instance of `U`. On success, returns a pointer to the
547 /// largest-possible `U` which fits in `self`.
560 pub fn try_cast_into<U>(
563 meta: Option<U::PointerMetadata>,
564 ) -> Result<(PtrInner<'a, U>, PtrInner<'a, [u8]>), CastError<Self, U>>
566 U: 'a + ?Sized + KnownLayout,
573 // `validate_cast_and_convert_metadata` will only panic if `U` is a DST
575 let maybe_metadata = MetadataOf::<U>::validate_cast_and_convert_metadata(
586 // an alignment error, `U` must have an alignment requirement
588 let err = unsafe { AlignmentError::<_, U>::new_unchecked(self) };
609 let ptr = U::raw_from_ptr_len(base, elems.get());