grist_lens 1.2.4

Unsafe Nightly Ergonomic Lens API
Documentation
/// Provides `OFFSET`, `INDEX`, `Base` to ZST lens field types' to index usages.
/// # Safety
/// When implementing this ensure `Type` is equal to the field type you want to select.
/// Ensure that `Base` is equal to the base type you are borrowing from.
///
/// Ensure that `INDEX` is unique per field.
/// Ensure that `OFFSET` represents the offset of the field in the struct.
pub unsafe trait FieldMarker {
    const INDEX: usize;
    const OFFSET: usize;

    type Type;
    type Base;
}

/// Provides `FIELD_COUNT`
/// # Safety
/// When implementing this ensure `FIELD_COUNT` is the total number of fields
/// that the struct contains.
///
/// Do not implement for non struct types.
pub unsafe trait StructMarker {
    const FIELD_COUNT: usize;
}