Home
last modified time | relevance | path

Searched refs:Dst (Results 1 – 8 of 8) sorted by relevance

/linux/rust/zerocopy/src/
H A Derror.rs164 impl<Src, Dst: ?Sized + Unaligned, S, V> From<ConvertError<AlignmentError<Src, Dst>, S, V>>
200 fn from(err: ConvertError<AlignmentError<Src, Dst>, S, V>) -> ConvertError<Infallible, S, V> { in from() argument
250 pub struct AlignmentError<Src, Dst: ?Sized> {
257 _dst: SendSyncPhantomData<Dst>,
260 impl<Src, Dst: ?Sized> AlignmentError<Src, Dst> {
277 pub(crate) fn with_src<NewSrc>(self, new_src: NewSrc) -> AlignmentError<NewSrc, Dst> { in with_src() argument
305 pub fn map_src<NewSrc>(self, f: impl FnOnce(Src) -> NewSrc) -> AlignmentError<NewSrc, Dst> { in map_src() argument
319 Dst: KnownLayout, in display_verbose_extras()
335 f.write_str(core::any::type_name::<Dst>())?; in display_verbose_extras()
338 <Dst as KnownLayout>::LAYOUT.align.get().fmt(f)?; in display_verbose_extras()
[all …]
H A Dlayout.rs761 pub(crate) struct CastFrom<Dst: ?Sized> {
763 _marker: PhantomData<Dst>,
768 unsafe impl<Src, Dst> crate::pointer::cast::Cast<Src, Dst> for CastFrom<Dst>
771 Dst: KnownLayout + ?Sized,
777 unsafe impl<Src, Dst> crate::pointer::cast::CastExact<Src, Dst> for CastFrom<Dst>
780 Dst: KnownLayout + ?Sized,
788 unsafe impl<Src, Dst> crate::pointer::cast::Project<Src, Dst> for CastFrom<Dst>
791 Dst: KnownLayout + ?Sized,
799 fn project(src: PtrInner<'_, Src>) -> *mut Dst { in project() argument
809 struct CastParams<Src: ?Sized, Dst: ?Sized> { in project()
[all …]
H A Dmacros.rs84 fn transmute<Src, Dst>(src: Src) -> Dst
87 Dst: $crate::FromBytes,
107 union Transmute<Src, Dst> {
109 dst: ManuallyDrop<Dst>,
168 fn transmute<Src, Dst>(src: Src) -> Dst
171 Dst: $crate::FromBytes,
/linux/rust/zerocopy/src/pointer/
H A Dmod.rs60 pub unsafe trait Project<Src: ?Sized, Dst: ?Sized> {
73 fn project(src: PtrInner<'_, Src>) -> *mut Dst; in project() argument
83 pub unsafe trait Cast<Src: ?Sized, Dst: ?Sized>: Project<Src, Dst> {}
90 pub unsafe trait CastExact<Src: ?Sized, Dst: ?Sized>: Cast<Src, Dst> {}
128 unsafe impl<Src, Dst> Project<Src, Dst> for CastSized {
130 fn project(src: PtrInner<'_, Src>) -> *mut Dst { in project() argument
131 static_assert!(Src, Dst => mem::size_of::<Src>() >= mem::size_of::<Dst>()); in project()
132 src.as_ptr().cast::<Dst>() in project()
137 unsafe impl<Src, Dst> Cast<Src, Dst> for CastSized {}
155 unsafe impl<Src, Dst> Project<Src, Dst> for CastSizedExact {
[all …]
H A Dtransmute.rs152 unsafe impl<Src, Dst, SV, DV, A, C, R> implementation
153 TryTransmuteFromPtr<Src, A, SV, DV, C, (BecauseMutationCompatible, R)> for Dst
158 Src: TransmuteFrom<Dst, DV, SV> + ?Sized,
159 Dst: MutationCompatible<Src, A, SV, DV, R> + ?Sized,
160 C: CastExact<Src, Dst>,
171 unsafe impl<Src, Dst, SV, DV, C> TryTransmuteFromPtr<Src, Shared, SV, DV, C, BecauseImmutable> implementation
172 for Dst
177 Dst: Immutable + ?Sized,
178 C: CastExact<Src, Dst>,
199 unsafe impl<Src: ?Sized, Dst: ?Sized, A: Aliasing, SV: Validity, DV: Validity, R> implementation
[all …]
H A Dptr.rs1539 struct Dst { in test_try_cast_into_explicit_count() struct
1544 test!(Dst, 8, 0, Some(0)); in test_try_cast_into_explicit_count()
1545 test!(Dst, 7, 0, None); in test_try_cast_into_explicit_count()
1547 test!(Dst, 9, 1, Some(1)); in test_try_cast_into_explicit_count()
1548 test!(Dst, 8, 1, None); in test_try_cast_into_explicit_count()
1553 test!(Dst, 8, usize::MAX - 8 + 1, None); in test_try_cast_into_explicit_count()
/linux/rust/zerocopy/src/util/
H A Dmacro_util.rs525 pub fn try_transmute<Src, Dst>(src: Src) -> Result<Dst, ValidityError<Src, Dst>> in try_transmute() argument
528 Dst: TryFromBytes, in try_transmute()
530 static_assert!(Src, Dst => mem::size_of::<Dst>() == mem::size_of::<Src>()); in try_transmute()
534 let mu_dst: mem::MaybeUninit<ReadOnly<Dst>> = in try_transmute()
545 if Dst::is_bit_valid(ptr.cast::<_, CastSized, _>()) { in try_transmute()
561 type Dst: ?Sized; typedef
564 fn try_transmute_ref(self) -> Result<&'a Self::Dst, ValidityError<&'a Self::Src, Self::Dst>> in try_transmute_ref() argument
568 Self::Dst: TryFromBytes + Immutable + KnownLayout; in try_transmute_ref()
575 impl<'a, Src, Dst> TryTransmuteRefSrc<'a> for Wrap<&'a Src, &'a Dst>
578 Dst: ?Sized,
[all …]
H A Dmod.rs305 pub(crate) const unsafe fn transmute_unchecked<Src, Dst>(src: Src) -> Dst { in transmute_unchecked() argument
306 static_assert!(Src, Dst => core::mem::size_of::<Src>() == core::mem::size_of::<Dst>()); in transmute_unchecked()
309 union Transmute<Src, Dst> { in transmute_unchecked()
311 dst: ManuallyDrop<Dst>, in transmute_unchecked()
339 pub(crate) unsafe fn transmute_ref<Src, Dst, R>(src: &Src) -> &Dst in transmute_ref() argument
342 Dst: SizeEq<Src> in transmute_ref()
343 + TransmuteFromPtr<Src, Shared, Valid, Valid, <Dst as SizeEq<Src>>::CastFrom, R> in transmute_ref()
356 pub(crate) unsafe fn transmute_mut<Src, Dst, R>(src: &mut Src) -> &mut Dst in transmute_mut() argument
359 Dst: SizeEq<Src> in transmute_mut()
360 + TransmuteFromPtr<Src, Exclusive, Valid, Valid, <Dst as SizeEq<Src>>::CastFrom, R> in transmute_mut()