Enum LayoutStrategy
pub enum LayoutStrategy {
Sized(Size, Align),
Slice(Size, Align),
TraitObject(TraitName),
Tuple {
head: TupleHeadLayout,
tail: GcCow<LayoutStrategy>,
},
}Expand description
Describes how the size and align of the value can be determined.
Variants§
Sized(Size, Align)
The type is statically Sized with the given size and align.
Slice(Size, Align)
The type contains zero or more elements of the inner layout. The total size is a multiple of the element size and the align is exactly the element align.
TraitObject(TraitName)
The size of the type must be looked up in the VTable of a wide pointer. Additionally, the vtable must be for the given trait.
Tuple
The type consists of a sized head an unsized tail.
Implementations§
§impl LayoutStrategy
impl LayoutStrategy
pub fn is_sized(self) -> bool
pub fn expect_size(self, msg: &str) -> Size
pub fn expect_size(self, msg: &str) -> Size
Returns the size when the type must be statically sized.
pub fn expect_align(self, msg: &str) -> Align
pub fn expect_align(self, msg: &str) -> Align
Returns the alignment when the type must be statically sized.
pub fn compute_size_and_align<Provenance>(
self,
meta: Option<PointerMeta<Provenance>>,
vtables: impl FnOnce(ThinPointer<Provenance>) -> VTable,
) -> (Size, Align)where
Provenance: Obj,
pub fn compute_size_and_align<Provenance>(
self,
meta: Option<PointerMeta<Provenance>>,
vtables: impl FnOnce(ThinPointer<Provenance>) -> VTable,
) -> (Size, Align)where
Provenance: Obj,
Computes the dynamic size and alignment, but the caller must provide compatible metadata.
The size and align of unsized structs depend on each other, thus we must recursively compute them at the same time.
pub fn meta_kind(self) -> PointerMetaKind
pub fn meta_kind(self) -> PointerMetaKind
Returns the metadata kind which is needed to compute this strategy,
i.e machine.check_pointer_metadata(meta, self.meta_kind()).is_ok() implies machine.compute_*(meta) is well-defined.
Trait Implementations§
§impl Clone for LayoutStrategy
impl Clone for LayoutStrategy
§fn clone(&self) -> LayoutStrategy
fn clone(&self) -> LayoutStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LayoutStrategy
§impl Debug for LayoutStrategy
impl Debug for LayoutStrategy
§impl<'de> Deserialize<'de> for LayoutStrategy
impl<'de> Deserialize<'de> for LayoutStrategy
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayoutStrategy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayoutStrategy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for LayoutStrategy
§impl Hash for LayoutStrategy
impl Hash for LayoutStrategy
§impl Ord for LayoutStrategy
impl Ord for LayoutStrategy
§fn cmp(&self, other: &LayoutStrategy) -> Ordering
fn cmp(&self, other: &LayoutStrategy) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for LayoutStrategy
impl PartialEq for LayoutStrategy
§impl PartialOrd for LayoutStrategy
impl PartialOrd for LayoutStrategy
§impl Serialize for LayoutStrategy
impl Serialize for LayoutStrategy
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for LayoutStrategy
Auto Trait Implementations§
impl !Send for LayoutStrategy
impl !Sync for LayoutStrategy
impl Freeze for LayoutStrategy
impl RefUnwindSafe for LayoutStrategy
impl Unpin for LayoutStrategy
impl UnsafeUnpin for LayoutStrategy
impl UnwindSafe for LayoutStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more