Skip to content

Commit

Permalink
Merge pull request #122 from quartiq/rj/transparent
Browse files Browse the repository at this point in the history
repr(transparent) for option and array
  • Loading branch information
jordens authored Nov 14, 2022
2 parents 7f1a7ae + ae0a966 commit 47c6263
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/quartiq/miniconf/compare/v0.6.2...HEAD)

* `Array` and `Option` are `repr(transparent)`

## [0.6.2](https://github.com/quartiq/miniconf/compare/v0.6.1...v0.6.2) - 2022-11-09

* Renaming and reorganization of the the derive macro
Expand Down
1 change: 1 addition & 0 deletions src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use core::ops::{Deref, DerefMut};
/// An `Array` can be constructed using [`From<[T; N]>`](From)/[`Into<miniconf::Array>`]
/// and the contained value can be accessed through [`Deref`]/[`DerefMut`].
#[derive(Clone, Copy, PartialEq, Eq, Debug, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct Array<T, const N: usize>([T; N]);

impl<T, const N: usize> Deref for Array<T, N> {
Expand Down
1 change: 1 addition & 0 deletions src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use core::ops::{Deref, DerefMut};
serde::Serialize,
serde::Deserialize,
)]
#[repr(transparent)]
pub struct Option<T>(core::option::Option<T>);

impl<T> Deref for Option<T> {
Expand Down

0 comments on commit 47c6263

Please sign in to comment.