feat: add display UI with splash screen, dashboard, and RSSI sparkline
Implement full SSD1306 OLED display support: - Splash screen on boot (1.5s) with project name, version, board - Dashboard showing radio state, config, counters, RSSI/SNR - RSSI history sparkline (64-sample ring buffer, 2px-wide bars) - DisplayOn/DisplayOff host commands routed via dedicated channel - Pure render functions against generic DrawTarget (no hardware coupling) - Display on/off control bypasses radio task entirely Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
17624 files changed
+4564928
-38
No files matched your search
@@ -0,0 +1,17 @@
|
||||
impl<T: Clone> ::zerocopy::util::macro_util::core_reexport::cmp::PartialEq for Foo<T>
|
||||
where
|
||||
Self: ::zerocopy::IntoBytes + ::zerocopy::Immutable,
|
||||
Self: Sized,
|
||||
{
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
::zerocopy::util::macro_util::core_reexport::cmp::PartialEq::eq(
|
||||
::zerocopy::IntoBytes::as_bytes(self),
|
||||
::zerocopy::IntoBytes::as_bytes(other),
|
||||
)
|
||||
}
|
||||
}
|
||||
impl<T: Clone> ::zerocopy::util::macro_util::core_reexport::cmp::Eq for Foo<T>
|
||||
where
|
||||
Self: ::zerocopy::IntoBytes + ::zerocopy::Immutable,
|
||||
Self: Sized,
|
||||
{}
|
||||
@@ -0,0 +1,68 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::TryFromBytes for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
#[inline(always)]
|
||||
fn is_bit_valid<___ZcAlignment>(
|
||||
_candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>,
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool
|
||||
where
|
||||
___ZcAlignment: ::zerocopy::invariant::Alignment,
|
||||
{
|
||||
if false {
|
||||
fn assert_is_from_bytes<T>()
|
||||
where
|
||||
T: ::zerocopy::FromBytes,
|
||||
T: ?::zerocopy::util::macro_util::core_reexport::marker::Sized,
|
||||
{}
|
||||
assert_is_from_bytes::<Self>();
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
};
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::FromZeros for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::FromBytes for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::TryFromBytes for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
#[inline(always)]
|
||||
fn is_bit_valid<___ZcAlignment>(
|
||||
_candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>,
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool
|
||||
where
|
||||
___ZcAlignment: ::zerocopy::invariant::Alignment,
|
||||
{
|
||||
if false {
|
||||
fn assert_is_from_bytes<T>()
|
||||
where
|
||||
T: ::zerocopy::FromBytes,
|
||||
T: ?::zerocopy::util::macro_util::core_reexport::marker::Sized,
|
||||
{}
|
||||
assert_is_from_bytes::<Self>();
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
};
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::FromZeros for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::FromBytes for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::TryFromBytes for Foo
|
||||
where
|
||||
u8: ::zerocopy::TryFromBytes,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
#[inline(always)]
|
||||
fn is_bit_valid<___ZcAlignment>(
|
||||
_candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>,
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool
|
||||
where
|
||||
___ZcAlignment: ::zerocopy::invariant::Alignment,
|
||||
{
|
||||
if false {
|
||||
fn assert_is_from_bytes<T>()
|
||||
where
|
||||
T: ::zerocopy::FromBytes,
|
||||
T: ?::zerocopy::util::macro_util::core_reexport::marker::Sized,
|
||||
{}
|
||||
assert_is_from_bytes::<Self>();
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
enum ẕa {}
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::HasTag for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
type Tag = ();
|
||||
type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit;
|
||||
}
|
||||
};
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::HasField<
|
||||
ẕa,
|
||||
{ ::zerocopy::UNION_VARIANT_ID },
|
||||
{ ::zerocopy::ident_id!(a) },
|
||||
> for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
type Type = u8;
|
||||
#[inline(always)]
|
||||
fn project(
|
||||
slf: ::zerocopy::pointer::PtrInner<'_, Self>,
|
||||
) -> *mut <Self as ::zerocopy::HasField<
|
||||
ẕa,
|
||||
{ ::zerocopy::UNION_VARIANT_ID },
|
||||
{ ::zerocopy::ident_id!(a) },
|
||||
>>::Type {
|
||||
let slf = slf.as_ptr();
|
||||
unsafe {
|
||||
::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!(
|
||||
(* slf).a
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::FromZeros for Foo
|
||||
where
|
||||
u8: ::zerocopy::FromZeros,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::FromBytes for Foo
|
||||
where
|
||||
u8: ::zerocopy::FromBytes,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::TryFromBytes for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
#[inline]
|
||||
fn is_bit_valid<___ZcAlignment>(
|
||||
mut candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>,
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool
|
||||
where
|
||||
___ZcAlignment: ::zerocopy::invariant::Alignment,
|
||||
{
|
||||
true
|
||||
}
|
||||
}
|
||||
};
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::FromZeros for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
impl<T: Clone> ::zerocopy::util::macro_util::core_reexport::hash::Hash for Foo<T>
|
||||
where
|
||||
Self: ::zerocopy::IntoBytes + ::zerocopy::Immutable,
|
||||
Self: Sized,
|
||||
{
|
||||
fn hash<H: ::zerocopy::util::macro_util::core_reexport::hash::Hasher>(
|
||||
&self,
|
||||
state: &mut H,
|
||||
) {
|
||||
::zerocopy::util::macro_util::core_reexport::hash::Hasher::write(
|
||||
state,
|
||||
::zerocopy::IntoBytes::as_bytes(self),
|
||||
)
|
||||
}
|
||||
fn hash_slice<H: ::zerocopy::util::macro_util::core_reexport::hash::Hasher>(
|
||||
data: &[Self],
|
||||
state: &mut H,
|
||||
) {
|
||||
::zerocopy::util::macro_util::core_reexport::hash::Hasher::write(
|
||||
state,
|
||||
::zerocopy::IntoBytes::as_bytes(data),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::Immutable for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(C)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(i128)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(i16)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(i32)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(i64)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(i8)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(isize)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(u128)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(u16)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(u32)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(u64)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(u8)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
#[repr(usize)]
|
||||
#[allow(dead_code)]
|
||||
pub enum ___ZerocopyTag {
|
||||
Bar,
|
||||
}
|
||||
unsafe impl ::zerocopy::Immutable for ___ZerocopyTag {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
::zerocopy::enum_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
___ZerocopyTag, []
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
u8: ::zerocopy::IntoBytes,
|
||||
u8: ::zerocopy::IntoBytes,
|
||||
(): ::zerocopy::util::macro_util::PaddingFree<
|
||||
Self,
|
||||
{
|
||||
::zerocopy::struct_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
[(u8), (u8)]
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::IntoBytes for Foo
|
||||
where
|
||||
u8: ::zerocopy::IntoBytes,
|
||||
[Trailing]: ::zerocopy::IntoBytes,
|
||||
(): ::zerocopy::util::macro_util::DynamicPaddingFree<
|
||||
Self,
|
||||
{
|
||||
::zerocopy::repr_c_struct_has_padding!(
|
||||
Self,
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
(::zerocopy::util::macro_util::core_reexport::option::Option::None::
|
||||
< ::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize >),
|
||||
[(u8), ([Trailing])]
|
||||
)
|
||||
},
|
||||
>,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl<Trailing> ::zerocopy::IntoBytes for Foo<Trailing>
|
||||
where
|
||||
u8: ::zerocopy::IntoBytes + ::zerocopy::Unaligned,
|
||||
[Trailing]: ::zerocopy::IntoBytes + ::zerocopy::Unaligned,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl<T, U> ::zerocopy::KnownLayout for Foo<T, U>
|
||||
where
|
||||
U: ::zerocopy::KnownLayout,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
type PointerMetadata = <U as ::zerocopy::KnownLayout>::PointerMetadata;
|
||||
type MaybeUninit = __ZerocopyKnownLayoutMaybeUninit<T, U>;
|
||||
const LAYOUT: ::zerocopy::DstLayout = ::zerocopy::DstLayout::for_repr_c_struct(
|
||||
::zerocopy::util::macro_util::core_reexport::num::NonZeroUsize::new(
|
||||
2u32 as usize,
|
||||
),
|
||||
::zerocopy::util::macro_util::core_reexport::option::Option::None,
|
||||
&[
|
||||
::zerocopy::DstLayout::for_type::<T>(),
|
||||
<U as ::zerocopy::KnownLayout>::LAYOUT,
|
||||
],
|
||||
);
|
||||
#[inline(always)]
|
||||
fn raw_from_ptr_len(
|
||||
bytes: ::zerocopy::util::macro_util::core_reexport::ptr::NonNull<u8>,
|
||||
meta: <Self as ::zerocopy::KnownLayout>::PointerMetadata,
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::ptr::NonNull<Self> {
|
||||
let trailing = <U as ::zerocopy::KnownLayout>::raw_from_ptr_len(bytes, meta);
|
||||
let slf = trailing.as_ptr() as *mut Self;
|
||||
unsafe {
|
||||
::zerocopy::util::macro_util::core_reexport::ptr::NonNull::new_unchecked(
|
||||
slf,
|
||||
)
|
||||
}
|
||||
}
|
||||
#[inline(always)]
|
||||
fn pointer_to_metadata(
|
||||
ptr: *mut Self,
|
||||
) -> <Self as ::zerocopy::KnownLayout>::PointerMetadata {
|
||||
<U>::pointer_to_metadata(ptr as *mut _)
|
||||
}
|
||||
}
|
||||
struct __Zerocopy_Field_0;
|
||||
struct __Zerocopy_Field_1;
|
||||
unsafe impl<T, U> ::zerocopy::util::macro_util::Field<__Zerocopy_Field_0>
|
||||
for Foo<T, U> {
|
||||
type Type = T;
|
||||
}
|
||||
unsafe impl<T, U> ::zerocopy::util::macro_util::Field<__Zerocopy_Field_1>
|
||||
for Foo<T, U> {
|
||||
type Type = U;
|
||||
}
|
||||
#[repr(C)]
|
||||
#[repr(align(2))]
|
||||
#[doc(hidden)]
|
||||
struct __ZerocopyKnownLayoutMaybeUninit<T, U>(
|
||||
::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit<
|
||||
<Foo<T, U> as ::zerocopy::util::macro_util::Field<__Zerocopy_Field_0>>::Type,
|
||||
>,
|
||||
::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop<
|
||||
<<Foo<
|
||||
T,
|
||||
U,
|
||||
> as ::zerocopy::util::macro_util::Field<
|
||||
__Zerocopy_Field_1,
|
||||
>>::Type as ::zerocopy::KnownLayout>::MaybeUninit,
|
||||
>,
|
||||
)
|
||||
where
|
||||
<Foo<
|
||||
T,
|
||||
U,
|
||||
> as ::zerocopy::util::macro_util::Field<
|
||||
__Zerocopy_Field_1,
|
||||
>>::Type: ::zerocopy::KnownLayout;
|
||||
unsafe impl<T, U> ::zerocopy::KnownLayout for __ZerocopyKnownLayoutMaybeUninit<T, U>
|
||||
where
|
||||
<Foo<
|
||||
T,
|
||||
U,
|
||||
> as ::zerocopy::util::macro_util::Field<
|
||||
__Zerocopy_Field_1,
|
||||
>>::Type: ::zerocopy::KnownLayout,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
type PointerMetadata = <Foo<T, U> as ::zerocopy::KnownLayout>::PointerMetadata;
|
||||
type MaybeUninit = Self;
|
||||
const LAYOUT: ::zerocopy::DstLayout = <Foo<
|
||||
T,
|
||||
U,
|
||||
> as ::zerocopy::KnownLayout>::LAYOUT;
|
||||
#[inline(always)]
|
||||
fn raw_from_ptr_len(
|
||||
bytes: ::zerocopy::util::macro_util::core_reexport::ptr::NonNull<u8>,
|
||||
meta: <Self as ::zerocopy::KnownLayout>::PointerMetadata,
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::ptr::NonNull<Self> {
|
||||
let trailing = <<<Foo<
|
||||
T,
|
||||
U,
|
||||
> as ::zerocopy::util::macro_util::Field<
|
||||
__Zerocopy_Field_1,
|
||||
>>::Type as ::zerocopy::KnownLayout>::MaybeUninit as ::zerocopy::KnownLayout>::raw_from_ptr_len(
|
||||
bytes,
|
||||
meta,
|
||||
);
|
||||
let slf = trailing.as_ptr() as *mut Self;
|
||||
unsafe {
|
||||
::zerocopy::util::macro_util::core_reexport::ptr::NonNull::new_unchecked(
|
||||
slf,
|
||||
)
|
||||
}
|
||||
}
|
||||
#[inline(always)]
|
||||
fn pointer_to_metadata(
|
||||
ptr: *mut Self,
|
||||
) -> <Self as ::zerocopy::KnownLayout>::PointerMetadata {
|
||||
<<<Foo<
|
||||
T,
|
||||
U,
|
||||
> as ::zerocopy::util::macro_util::Field<
|
||||
__Zerocopy_Field_1,
|
||||
>>::Type as ::zerocopy::KnownLayout>::MaybeUninit>::pointer_to_metadata(
|
||||
ptr as *mut _,
|
||||
)
|
||||
}
|
||||
}
|
||||
};
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::KnownLayout for Foo
|
||||
where
|
||||
Self: ::zerocopy::util::macro_util::core_reexport::marker::Sized,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
type PointerMetadata = ();
|
||||
type MaybeUninit = ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit<
|
||||
Self,
|
||||
>;
|
||||
const LAYOUT: ::zerocopy::DstLayout = ::zerocopy::DstLayout::for_type::<Self>();
|
||||
#[inline(always)]
|
||||
fn raw_from_ptr_len(
|
||||
bytes: ::zerocopy::util::macro_util::core_reexport::ptr::NonNull<u8>,
|
||||
_meta: (),
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::ptr::NonNull<Self> {
|
||||
bytes.cast::<Self>()
|
||||
}
|
||||
#[inline(always)]
|
||||
fn pointer_to_metadata(_ptr: *mut Self) -> () {}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl<T: ?Sized + Copy> ::zerocopy::SplitAt for Foo<T>
|
||||
where
|
||||
Self: Copy,
|
||||
T: ::zerocopy::SplitAt,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
type Elem = <T as ::zerocopy::SplitAt>::Elem;
|
||||
}
|
||||
};
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl<T: ?Sized + Copy> ::zerocopy::SplitAt for Foo<T>
|
||||
where
|
||||
Self: Copy,
|
||||
T: ::zerocopy::SplitAt,
|
||||
{
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
type Elem = <T as ::zerocopy::SplitAt>::Elem;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::TryFromBytes for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
#[inline]
|
||||
fn is_bit_valid<___ZcAlignment>(
|
||||
mut candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>,
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool
|
||||
where
|
||||
___ZcAlignment: ::zerocopy::invariant::Alignment,
|
||||
{
|
||||
true
|
||||
}
|
||||
}
|
||||
};
|
||||
+2814
File diff suppressed because it is too large.
Load diff
+2814
File diff suppressed because it is too large.
Load diff
+2814
File diff suppressed because it is too large.
Load diff
+26
@@ -0,0 +1,26 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::TryFromBytes for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
#[inline(always)]
|
||||
fn is_bit_valid<___ZcAlignment>(
|
||||
_candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>,
|
||||
) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool
|
||||
where
|
||||
___ZcAlignment: ::zerocopy::invariant::Alignment,
|
||||
{
|
||||
true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#[allow(
|
||||
deprecated,
|
||||
private_bounds,
|
||||
non_local_definitions,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals,
|
||||
non_snake_case,
|
||||
non_ascii_idents,
|
||||
clippy::missing_inline_in_public_items,
|
||||
)]
|
||||
#[deny(ambiguous_associated_items)]
|
||||
#[automatically_derived]
|
||||
const _: () = {
|
||||
unsafe impl ::zerocopy::Unaligned for Foo {
|
||||
fn only_derive_is_allowed_to_implement_this_trait() {}
|
||||
}
|
||||
};
|
||||
+960
@@ -0,0 +1,960 @@
|
||||
// Copyright 2024 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use dissimilar::Chunk;
|
||||
use proc_macro2::TokenStream;
|
||||
|
||||
use crate::IntoTokenStream;
|
||||
|
||||
macro_rules! use_as_trait_name {
|
||||
($($alias:ident => $derive:path),* $(,)?) => {
|
||||
$(use $derive as $alias;)*
|
||||
};
|
||||
}
|
||||
|
||||
// This permits invocations of `test!` to be more ergonomic, passing the name of
|
||||
// the trait under test rather than the name of the inner derive function.
|
||||
use_as_trait_name!(
|
||||
KnownLayout => super::derive::known_layout::derive,
|
||||
Immutable => super::derive::derive_immutable,
|
||||
TryFromBytes => super::derive::try_from_bytes::derive_try_from_bytes,
|
||||
FromZeros => super::derive::from_bytes::derive_from_zeros,
|
||||
FromBytes => super::derive::from_bytes::derive_from_bytes,
|
||||
IntoBytes => super::derive::into_bytes::derive_into_bytes,
|
||||
Unaligned => super::derive::unaligned::derive_unaligned,
|
||||
ByteHash => super::derive::derive_hash,
|
||||
ByteEq => super::derive::derive_eq,
|
||||
SplitAt => super::derive::derive_split_at,
|
||||
);
|
||||
|
||||
/// Test that the given derive input expands to the expected output.
|
||||
///
|
||||
/// Equality is tested by formatting both token streams using `prettyplease` and
|
||||
/// performing string equality on the results. This has the effect of making the
|
||||
/// tests less brittle and robust against meaningless formatting changes.
|
||||
// Adapted from https://github.com/joshlf/synstructure/blob/400499aaf54840056ff56718beb7810540e6be59/src/macros.rs#L212-L317
|
||||
macro_rules! test {
|
||||
($name:ident { $($i:tt)* } expands to { $($o:tt)* }) => {
|
||||
{
|
||||
#[allow(dead_code)]
|
||||
fn ensure_compiles() {
|
||||
$($i)*
|
||||
$($o)*
|
||||
}
|
||||
|
||||
test!($name { $($i)* } expands to { $($o)* } no_build);
|
||||
}
|
||||
};
|
||||
|
||||
($name:ident { $($i:tt)* } expands to { $($o:tt)* } no_build) => {
|
||||
{
|
||||
let ts: proc_macro2::TokenStream = quote::quote!( $($i)* );
|
||||
let ast = syn::parse2::<syn::DeriveInput>(ts).unwrap();
|
||||
let ctx = crate::Ctx::try_from_derive_input(ast).unwrap();
|
||||
let res = $name(&ctx, crate::util::Trait::$name);
|
||||
let expected_toks = quote::quote!( $($o)* );
|
||||
let expected = pretty_print(expected_toks);
|
||||
let actual = pretty_print(res.into_ts().into());
|
||||
assert_eq_or_diff(&expected, &actual);
|
||||
}
|
||||
};
|
||||
|
||||
($name:ident { $($i:tt)* } expands to $path:expr) => {
|
||||
test!($name { $($i)* } expands to $path; no_build);
|
||||
};
|
||||
|
||||
($name:ident { $($i:tt)* } expands to $path:expr; no_build) => {
|
||||
{
|
||||
let ts: proc_macro2::TokenStream = quote::quote!( $($i)* );
|
||||
let ast = syn::parse2::<syn::DeriveInput>(ts).unwrap();
|
||||
let ctx = crate::Ctx::try_from_derive_input(ast).unwrap();
|
||||
let res = $name(&ctx, crate::util::Trait::$name);
|
||||
let actual = pretty_print(res.into_ts().into());
|
||||
|
||||
if std::env::var("ZEROCOPY_BLESS").is_ok() {
|
||||
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("src/output_tests")
|
||||
.join($path);
|
||||
std::fs::write(&path, &actual).expect("failed to bless output");
|
||||
} else {
|
||||
let expected_str = include_str!($path);
|
||||
let expected_ts: proc_macro2::TokenStream = expected_str.parse().expect("failed to parse expected output");
|
||||
let expected = pretty_print(expected_ts);
|
||||
assert_eq_or_diff(&expected, &actual);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn pretty_print(ts: TokenStream) -> String {
|
||||
prettyplease::unparse(&syn::parse_file(&ts.to_string()).unwrap())
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn assert_eq_or_diff(expected: &str, actual: &str) {
|
||||
if expected != actual {
|
||||
let diff = dissimilar::diff(expected, actual)
|
||||
.into_iter()
|
||||
.flat_map(|chunk| {
|
||||
let (prefix, chunk) = match chunk {
|
||||
Chunk::Equal(chunk) => (" ", chunk),
|
||||
Chunk::Delete(chunk) => ("-", chunk),
|
||||
Chunk::Insert(chunk) => ("+", chunk),
|
||||
};
|
||||
[prefix, chunk, "\n"]
|
||||
})
|
||||
.collect::<String>();
|
||||
|
||||
panic!(
|
||||
"\
|
||||
test failed:
|
||||
got:
|
||||
```
|
||||
{}
|
||||
```
|
||||
|
||||
diff (expected vs got):
|
||||
```
|
||||
{}
|
||||
```\n",
|
||||
actual, diff
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_known_layout_struct() {
|
||||
test! {
|
||||
KnownLayout {
|
||||
struct Foo;
|
||||
} expands to "expected/known_layout_struct.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_known_layout_repr_c_struct() {
|
||||
test! {
|
||||
KnownLayout {
|
||||
#[repr(C, align(2))]
|
||||
struct Foo<T, U>(T, U);
|
||||
}
|
||||
expands to "expected/known_layout_repr_c_struct.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_immutable() {
|
||||
test! {
|
||||
Immutable {
|
||||
struct Foo;
|
||||
} expands to "expected/immutable.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_try_from_bytes() {
|
||||
test! {
|
||||
TryFromBytes {
|
||||
struct Foo;
|
||||
} expands to "expected/try_from_bytes.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_zeros() {
|
||||
test! {
|
||||
FromZeros {
|
||||
struct Foo;
|
||||
} expands to "expected/from_zeros.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_bytes_struct() {
|
||||
test! {
|
||||
FromBytes {
|
||||
struct Foo;
|
||||
} expands to "expected/from_bytes_struct.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_bytes_union() {
|
||||
test! {
|
||||
FromBytes {
|
||||
union Foo {
|
||||
a: u8,
|
||||
}
|
||||
} expands to "expected/from_bytes_union.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_bytes_struct_empty() {
|
||||
test! {
|
||||
IntoBytes {
|
||||
#[repr(C)]
|
||||
struct Foo;
|
||||
} expands to "expected/into_bytes_struct_empty.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_bytes_struct_basic() {
|
||||
test! {
|
||||
IntoBytes {
|
||||
#[repr(C)]
|
||||
struct Foo {
|
||||
a: u8,
|
||||
b: u8,
|
||||
}
|
||||
} expands to "expected/into_bytes_struct_basic.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_bytes_struct_trailing() {
|
||||
test! {
|
||||
IntoBytes {
|
||||
#[repr(C)]
|
||||
struct Foo {
|
||||
a: u8,
|
||||
b: [Trailing],
|
||||
}
|
||||
} expands to "expected/into_bytes_struct_trailing.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_bytes_struct_trailing_generic() {
|
||||
test! {
|
||||
IntoBytes {
|
||||
#[repr(C)]
|
||||
struct Foo<Trailing> {
|
||||
a: u8,
|
||||
b: [Trailing],
|
||||
}
|
||||
} expands to "expected/into_bytes_struct_trailing_generic.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_bytes_enum() {
|
||||
macro_rules! test_repr {
|
||||
($(#[$attr:meta])*) => {
|
||||
$(test! {
|
||||
IntoBytes {
|
||||
#[$attr]
|
||||
enum Foo {
|
||||
Bar,
|
||||
}
|
||||
} expands to concat!("expected/into_bytes_enum.", stringify!($attr), ".expected.rs")
|
||||
})*
|
||||
};
|
||||
}
|
||||
|
||||
test_repr! {
|
||||
#[repr(C)]
|
||||
#[repr(u8)]
|
||||
#[repr(u16)]
|
||||
#[repr(u32)]
|
||||
#[repr(u64)]
|
||||
#[repr(u128)]
|
||||
#[repr(usize)]
|
||||
#[repr(i8)]
|
||||
#[repr(i16)]
|
||||
#[repr(i32)]
|
||||
#[repr(i64)]
|
||||
#[repr(i128)]
|
||||
#[repr(isize)]
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unaligned() {
|
||||
test! {
|
||||
Unaligned {
|
||||
#[repr(C)]
|
||||
struct Foo;
|
||||
} expands to "expected/unaligned.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_try_from_bytes_enum() {
|
||||
test! {
|
||||
TryFromBytes {
|
||||
#[repr(u8)]
|
||||
enum ComplexWithGenerics<'a: 'static, const N: usize, X, Y: Deref>
|
||||
where
|
||||
X: Deref<Target = &'a [(X, Y); N]>,
|
||||
{
|
||||
UnitLike,
|
||||
StructLike { a: u8, b: X, c: X::Target, d: Y::Target, e: [(X, Y); N] },
|
||||
TupleLike(bool, Y, PhantomData<&'a [(X, Y); N]>),
|
||||
}
|
||||
} expands to "expected/try_from_bytes_enum_1.expected.rs"
|
||||
}
|
||||
|
||||
test! {
|
||||
TryFromBytes {
|
||||
#[repr(u32)]
|
||||
enum ComplexWithGenerics<'a: 'static, const N: usize, X, Y: Deref>
|
||||
where
|
||||
X: Deref<Target = &'a [(X, Y); N]>,
|
||||
{
|
||||
UnitLike,
|
||||
StructLike { a: u8, b: X, c: X::Target, d: Y::Target, e: [(X, Y); N] },
|
||||
TupleLike(bool, Y, PhantomData<&'a [(X, Y); N]>),
|
||||
}
|
||||
} expands to "expected/try_from_bytes_enum_2.expected.rs"
|
||||
}
|
||||
|
||||
test! {
|
||||
TryFromBytes {
|
||||
#[repr(C)]
|
||||
enum ComplexWithGenerics<'a: 'static, const N: usize, X, Y: Deref>
|
||||
where
|
||||
X: Deref<Target = &'a [(X, Y); N]>,
|
||||
{
|
||||
UnitLike,
|
||||
StructLike { a: u8, b: X, c: X::Target, d: Y::Target, e: [(X, Y); N] },
|
||||
TupleLike(bool, Y, PhantomData<&'a [(X, Y); N]>),
|
||||
}
|
||||
} expands to "expected/try_from_bytes_enum_3.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
// This goes at the bottom because it's so verbose and it makes scrolling past
|
||||
// other code a pain.
|
||||
#[test]
|
||||
fn test_from_bytes_enum() {
|
||||
test! {
|
||||
FromBytes {
|
||||
#[repr(u8)]
|
||||
enum Foo {
|
||||
Variant0,
|
||||
Variant1,
|
||||
Variant2,
|
||||
Variant3,
|
||||
Variant4,
|
||||
Variant5,
|
||||
Variant6,
|
||||
Variant7,
|
||||
Variant8,
|
||||
Variant9,
|
||||
Variant10,
|
||||
Variant11,
|
||||
Variant12,
|
||||
Variant13,
|
||||
Variant14,
|
||||
Variant15,
|
||||
Variant16,
|
||||
Variant17,
|
||||
Variant18,
|
||||
Variant19,
|
||||
Variant20,
|
||||
Variant21,
|
||||
Variant22,
|
||||
Variant23,
|
||||
Variant24,
|
||||
Variant25,
|
||||
Variant26,
|
||||
Variant27,
|
||||
Variant28,
|
||||
Variant29,
|
||||
Variant30,
|
||||
Variant31,
|
||||
Variant32,
|
||||
Variant33,
|
||||
Variant34,
|
||||
Variant35,
|
||||
Variant36,
|
||||
Variant37,
|
||||
Variant38,
|
||||
Variant39,
|
||||
Variant40,
|
||||
Variant41,
|
||||
Variant42,
|
||||
Variant43,
|
||||
Variant44,
|
||||
Variant45,
|
||||
Variant46,
|
||||
Variant47,
|
||||
Variant48,
|
||||
Variant49,
|
||||
Variant50,
|
||||
Variant51,
|
||||
Variant52,
|
||||
Variant53,
|
||||
Variant54,
|
||||
Variant55,
|
||||
Variant56,
|
||||
Variant57,
|
||||
Variant58,
|
||||
Variant59,
|
||||
Variant60,
|
||||
Variant61,
|
||||
Variant62,
|
||||
Variant63,
|
||||
Variant64,
|
||||
Variant65,
|
||||
Variant66,
|
||||
Variant67,
|
||||
Variant68,
|
||||
Variant69,
|
||||
Variant70,
|
||||
Variant71,
|
||||
Variant72,
|
||||
Variant73,
|
||||
Variant74,
|
||||
Variant75,
|
||||
Variant76,
|
||||
Variant77,
|
||||
Variant78,
|
||||
Variant79,
|
||||
Variant80,
|
||||
Variant81,
|
||||
Variant82,
|
||||
Variant83,
|
||||
Variant84,
|
||||
Variant85,
|
||||
Variant86,
|
||||
Variant87,
|
||||
Variant88,
|
||||
Variant89,
|
||||
Variant90,
|
||||
Variant91,
|
||||
Variant92,
|
||||
Variant93,
|
||||
Variant94,
|
||||
Variant95,
|
||||
Variant96,
|
||||
Variant97,
|
||||
Variant98,
|
||||
Variant99,
|
||||
Variant100,
|
||||
Variant101,
|
||||
Variant102,
|
||||
Variant103,
|
||||
Variant104,
|
||||
Variant105,
|
||||
Variant106,
|
||||
Variant107,
|
||||
Variant108,
|
||||
Variant109,
|
||||
Variant110,
|
||||
Variant111,
|
||||
Variant112,
|
||||
Variant113,
|
||||
Variant114,
|
||||
Variant115,
|
||||
Variant116,
|
||||
Variant117,
|
||||
Variant118,
|
||||
Variant119,
|
||||
Variant120,
|
||||
Variant121,
|
||||
Variant122,
|
||||
Variant123,
|
||||
Variant124,
|
||||
Variant125,
|
||||
Variant126,
|
||||
Variant127,
|
||||
Variant128,
|
||||
Variant129,
|
||||
Variant130,
|
||||
Variant131,
|
||||
Variant132,
|
||||
Variant133,
|
||||
Variant134,
|
||||
Variant135,
|
||||
Variant136,
|
||||
Variant137,
|
||||
Variant138,
|
||||
Variant139,
|
||||
Variant140,
|
||||
Variant141,
|
||||
Variant142,
|
||||
Variant143,
|
||||
Variant144,
|
||||
Variant145,
|
||||
Variant146,
|
||||
Variant147,
|
||||
Variant148,
|
||||
Variant149,
|
||||
Variant150,
|
||||
Variant151,
|
||||
Variant152,
|
||||
Variant153,
|
||||
Variant154,
|
||||
Variant155,
|
||||
Variant156,
|
||||
Variant157,
|
||||
Variant158,
|
||||
Variant159,
|
||||
Variant160,
|
||||
Variant161,
|
||||
Variant162,
|
||||
Variant163,
|
||||
Variant164,
|
||||
Variant165,
|
||||
Variant166,
|
||||
Variant167,
|
||||
Variant168,
|
||||
Variant169,
|
||||
Variant170,
|
||||
Variant171,
|
||||
Variant172,
|
||||
Variant173,
|
||||
Variant174,
|
||||
Variant175,
|
||||
Variant176,
|
||||
Variant177,
|
||||
Variant178,
|
||||
Variant179,
|
||||
Variant180,
|
||||
Variant181,
|
||||
Variant182,
|
||||
Variant183,
|
||||
Variant184,
|
||||
Variant185,
|
||||
Variant186,
|
||||
Variant187,
|
||||
Variant188,
|
||||
Variant189,
|
||||
Variant190,
|
||||
Variant191,
|
||||
Variant192,
|
||||
Variant193,
|
||||
Variant194,
|
||||
Variant195,
|
||||
Variant196,
|
||||
Variant197,
|
||||
Variant198,
|
||||
Variant199,
|
||||
Variant200,
|
||||
Variant201,
|
||||
Variant202,
|
||||
Variant203,
|
||||
Variant204,
|
||||
Variant205,
|
||||
Variant206,
|
||||
Variant207,
|
||||
Variant208,
|
||||
Variant209,
|
||||
Variant210,
|
||||
Variant211,
|
||||
Variant212,
|
||||
Variant213,
|
||||
Variant214,
|
||||
Variant215,
|
||||
Variant216,
|
||||
Variant217,
|
||||
Variant218,
|
||||
Variant219,
|
||||
Variant220,
|
||||
Variant221,
|
||||
Variant222,
|
||||
Variant223,
|
||||
Variant224,
|
||||
Variant225,
|
||||
Variant226,
|
||||
Variant227,
|
||||
Variant228,
|
||||
Variant229,
|
||||
Variant230,
|
||||
Variant231,
|
||||
Variant232,
|
||||
Variant233,
|
||||
Variant234,
|
||||
Variant235,
|
||||
Variant236,
|
||||
Variant237,
|
||||
Variant238,
|
||||
Variant239,
|
||||
Variant240,
|
||||
Variant241,
|
||||
Variant242,
|
||||
Variant243,
|
||||
Variant244,
|
||||
Variant245,
|
||||
Variant246,
|
||||
Variant247,
|
||||
Variant248,
|
||||
Variant249,
|
||||
Variant250,
|
||||
Variant251,
|
||||
Variant252,
|
||||
Variant253,
|
||||
Variant254,
|
||||
Variant255,
|
||||
}
|
||||
} expands to "expected/from_bytes_enum.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_try_from_bytes_trivial_is_bit_valid_enum() {
|
||||
// Even when we aren't deriving `FromBytes` as the top-level trait,
|
||||
// `TryFromBytes` on enums still detects whether we *could* derive
|
||||
// `FromBytes`, and if so, performs the same "trivial `is_bit_valid`"
|
||||
// optimization.
|
||||
test! {
|
||||
TryFromBytes {
|
||||
#[repr(u8)]
|
||||
enum Foo {
|
||||
Variant0,
|
||||
Variant1,
|
||||
Variant2,
|
||||
Variant3,
|
||||
Variant4,
|
||||
Variant5,
|
||||
Variant6,
|
||||
Variant7,
|
||||
Variant8,
|
||||
Variant9,
|
||||
Variant10,
|
||||
Variant11,
|
||||
Variant12,
|
||||
Variant13,
|
||||
Variant14,
|
||||
Variant15,
|
||||
Variant16,
|
||||
Variant17,
|
||||
Variant18,
|
||||
Variant19,
|
||||
Variant20,
|
||||
Variant21,
|
||||
Variant22,
|
||||
Variant23,
|
||||
Variant24,
|
||||
Variant25,
|
||||
Variant26,
|
||||
Variant27,
|
||||
Variant28,
|
||||
Variant29,
|
||||
Variant30,
|
||||
Variant31,
|
||||
Variant32,
|
||||
Variant33,
|
||||
Variant34,
|
||||
Variant35,
|
||||
Variant36,
|
||||
Variant37,
|
||||
Variant38,
|
||||
Variant39,
|
||||
Variant40,
|
||||
Variant41,
|
||||
Variant42,
|
||||
Variant43,
|
||||
Variant44,
|
||||
Variant45,
|
||||
Variant46,
|
||||
Variant47,
|
||||
Variant48,
|
||||
Variant49,
|
||||
Variant50,
|
||||
Variant51,
|
||||
Variant52,
|
||||
Variant53,
|
||||
Variant54,
|
||||
Variant55,
|
||||
Variant56,
|
||||
Variant57,
|
||||
Variant58,
|
||||
Variant59,
|
||||
Variant60,
|
||||
Variant61,
|
||||
Variant62,
|
||||
Variant63,
|
||||
Variant64,
|
||||
Variant65,
|
||||
Variant66,
|
||||
Variant67,
|
||||
Variant68,
|
||||
Variant69,
|
||||
Variant70,
|
||||
Variant71,
|
||||
Variant72,
|
||||
Variant73,
|
||||
Variant74,
|
||||
Variant75,
|
||||
Variant76,
|
||||
Variant77,
|
||||
Variant78,
|
||||
Variant79,
|
||||
Variant80,
|
||||
Variant81,
|
||||
Variant82,
|
||||
Variant83,
|
||||
Variant84,
|
||||
Variant85,
|
||||
Variant86,
|
||||
Variant87,
|
||||
Variant88,
|
||||
Variant89,
|
||||
Variant90,
|
||||
Variant91,
|
||||
Variant92,
|
||||
Variant93,
|
||||
Variant94,
|
||||
Variant95,
|
||||
Variant96,
|
||||
Variant97,
|
||||
Variant98,
|
||||
Variant99,
|
||||
Variant100,
|
||||
Variant101,
|
||||
Variant102,
|
||||
Variant103,
|
||||
Variant104,
|
||||
Variant105,
|
||||
Variant106,
|
||||
Variant107,
|
||||
Variant108,
|
||||
Variant109,
|
||||
Variant110,
|
||||
Variant111,
|
||||
Variant112,
|
||||
Variant113,
|
||||
Variant114,
|
||||
Variant115,
|
||||
Variant116,
|
||||
Variant117,
|
||||
Variant118,
|
||||
Variant119,
|
||||
Variant120,
|
||||
Variant121,
|
||||
Variant122,
|
||||
Variant123,
|
||||
Variant124,
|
||||
Variant125,
|
||||
Variant126,
|
||||
Variant127,
|
||||
Variant128,
|
||||
Variant129,
|
||||
Variant130,
|
||||
Variant131,
|
||||
Variant132,
|
||||
Variant133,
|
||||
Variant134,
|
||||
Variant135,
|
||||
Variant136,
|
||||
Variant137,
|
||||
Variant138,
|
||||
Variant139,
|
||||
Variant140,
|
||||
Variant141,
|
||||
Variant142,
|
||||
Variant143,
|
||||
Variant144,
|
||||
Variant145,
|
||||
Variant146,
|
||||
Variant147,
|
||||
Variant148,
|
||||
Variant149,
|
||||
Variant150,
|
||||
Variant151,
|
||||
Variant152,
|
||||
Variant153,
|
||||
Variant154,
|
||||
Variant155,
|
||||
Variant156,
|
||||
Variant157,
|
||||
Variant158,
|
||||
Variant159,
|
||||
Variant160,
|
||||
Variant161,
|
||||
Variant162,
|
||||
Variant163,
|
||||
Variant164,
|
||||
Variant165,
|
||||
Variant166,
|
||||
Variant167,
|
||||
Variant168,
|
||||
Variant169,
|
||||
Variant170,
|
||||
Variant171,
|
||||
Variant172,
|
||||
Variant173,
|
||||
Variant174,
|
||||
Variant175,
|
||||
Variant176,
|
||||
Variant177,
|
||||
Variant178,
|
||||
Variant179,
|
||||
Variant180,
|
||||
Variant181,
|
||||
Variant182,
|
||||
Variant183,
|
||||
Variant184,
|
||||
Variant185,
|
||||
Variant186,
|
||||
Variant187,
|
||||
Variant188,
|
||||
Variant189,
|
||||
Variant190,
|
||||
Variant191,
|
||||
Variant192,
|
||||
Variant193,
|
||||
Variant194,
|
||||
Variant195,
|
||||
Variant196,
|
||||
Variant197,
|
||||
Variant198,
|
||||
Variant199,
|
||||
Variant200,
|
||||
Variant201,
|
||||
Variant202,
|
||||
Variant203,
|
||||
Variant204,
|
||||
Variant205,
|
||||
Variant206,
|
||||
Variant207,
|
||||
Variant208,
|
||||
Variant209,
|
||||
Variant210,
|
||||
Variant211,
|
||||
Variant212,
|
||||
Variant213,
|
||||
Variant214,
|
||||
Variant215,
|
||||
Variant216,
|
||||
Variant217,
|
||||
Variant218,
|
||||
Variant219,
|
||||
Variant220,
|
||||
Variant221,
|
||||
Variant222,
|
||||
Variant223,
|
||||
Variant224,
|
||||
Variant225,
|
||||
Variant226,
|
||||
Variant227,
|
||||
Variant228,
|
||||
Variant229,
|
||||
Variant230,
|
||||
Variant231,
|
||||
Variant232,
|
||||
Variant233,
|
||||
Variant234,
|
||||
Variant235,
|
||||
Variant236,
|
||||
Variant237,
|
||||
Variant238,
|
||||
Variant239,
|
||||
Variant240,
|
||||
Variant241,
|
||||
Variant242,
|
||||
Variant243,
|
||||
Variant244,
|
||||
Variant245,
|
||||
Variant246,
|
||||
Variant247,
|
||||
Variant248,
|
||||
Variant249,
|
||||
Variant250,
|
||||
Variant251,
|
||||
Variant252,
|
||||
Variant253,
|
||||
Variant254,
|
||||
Variant255,
|
||||
}
|
||||
} expands to "expected/try_from_bytes_trivial_is_bit_valid_enum.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hash() {
|
||||
test! {
|
||||
ByteHash {
|
||||
struct Foo<T: Clone>(T) where Self: Sized;
|
||||
} expands to "expected/hash.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_eq() {
|
||||
test! {
|
||||
ByteEq {
|
||||
struct Foo<T: Clone>(T) where Self: Sized;
|
||||
} expands to "expected/eq.expected.rs"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_split_at() {
|
||||
test! {
|
||||
SplitAt {
|
||||
#[repr(C)]
|
||||
struct Foo<T: ?Sized + Copy>(T) where Self: Copy;
|
||||
} expands to "expected/split_at_repr_c.expected.rs"
|
||||
}
|
||||
|
||||
test! {
|
||||
SplitAt {
|
||||
#[repr(transparent)]
|
||||
struct Foo<T: ?Sized + Copy>(T) where Self: Copy;
|
||||
} expands to "expected/split_at_repr_transparent.expected.rs"
|
||||
}
|
||||
|
||||
test! {
|
||||
SplitAt {
|
||||
#[repr(packed)]
|
||||
struct Foo<T: ?Sized + Copy>(T) where Self: Copy;
|
||||
} expands to {
|
||||
::core::compile_error! {
|
||||
"must not have #[repr(packed)] attribute"
|
||||
}
|
||||
} no_build
|
||||
}
|
||||
|
||||
test! {
|
||||
SplitAt {
|
||||
#[repr(packed(2))]
|
||||
struct Foo<T: ?Sized + Copy>(T) where Self: Copy;
|
||||
} expands to {
|
||||
::core::compile_error! {
|
||||
"must not have #[repr(packed)] attribute"
|
||||
}
|
||||
} no_build
|
||||
}
|
||||
|
||||
test! {
|
||||
SplitAt {
|
||||
enum Foo {}
|
||||
} expands to {
|
||||
::core::compile_error! {
|
||||
"can only be applied to structs"
|
||||
}
|
||||
} no_build
|
||||
}
|
||||
|
||||
test! {
|
||||
SplitAt {
|
||||
union Foo { a: () }
|
||||
} expands to {
|
||||
::core::compile_error! {
|
||||
"can only be applied to structs"
|
||||
}
|
||||
} no_build
|
||||
}
|
||||
|
||||
test! {
|
||||
SplitAt {
|
||||
struct Foo<T: ?Sized + Copy>(T) where Self: Copy;
|
||||
} expands to {
|
||||
::core::compile_error! {
|
||||
"must have #[repr(C)] or #[repr(transparent)] in order to guarantee this type's layout is splitable"
|
||||
}
|
||||
} no_build
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user