Skip to main content

Field

Trait Field 

Source
pub unsafe trait Field:
    Send
    + Sync
    + Copy {
    type Base;
    type Type;

    const OFFSET: usize = _;
}
🔬This is a nightly-only experimental API. (field_projections #145383)
Expand description

Type representing a field of a struct, union, enum variant or tuple.

§Safety

Given a valid value of type Self::Base, there exists a valid value of type Self::Type at byte offset OFFSET

Provided Associated Constants§

Source

const OFFSET: usize = _

🔬This is a nightly-only experimental API. (field_projections #145383)

The offset of the field in bytes.

Required Associated Types§

Source

type Base

🔬This is a nightly-only experimental API. (field_projections #145383)

The type of the base where this field exists in.

Source

type Type

🔬This is a nightly-only experimental API. (field_projections #145383)

The type of the field.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§