mirror of
https://github.com/Noratrieb/mono-fmt.git
synced 2026-01-14 15:25:08 +01:00
opt
This commit is contained in:
parent
8a57db3409
commit
dec361efa9
1 changed files with 10 additions and 1 deletions
11
src/opts.rs
11
src/opts.rs
|
|
@ -8,6 +8,13 @@ pub enum Alignment {
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod sealed {
|
||||||
|
pub trait SealedOpts {}
|
||||||
|
|
||||||
|
impl SealedOpts for () {}
|
||||||
|
impl<O: super::FmtOpts> SealedOpts for &'_ O {}
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! options {
|
macro_rules! options {
|
||||||
(
|
(
|
||||||
$(
|
$(
|
||||||
|
|
@ -21,7 +28,7 @@ macro_rules! options {
|
||||||
)*
|
)*
|
||||||
) => {
|
) => {
|
||||||
// FIXME: We can get rid of this Copy can't we
|
// FIXME: We can get rid of this Copy can't we
|
||||||
pub trait FmtOpts: Copy {
|
pub trait FmtOpts: sealed::SealedOpts + Copy {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
type Inner: FmtOpts;
|
type Inner: FmtOpts;
|
||||||
|
|
||||||
|
|
@ -103,6 +110,8 @@ macro_rules! options {
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct $with_name<I, $($(const $const_gen_name: $with_ty),*)?>(#[doc(hidden)] pub I);
|
pub struct $with_name<I, $($(const $const_gen_name: $with_ty),*)?>(#[doc(hidden)] pub I);
|
||||||
|
|
||||||
|
impl<I: FmtOpts, $($(const $const_gen_name: $with_ty),*)?> sealed::SealedOpts for $with_name<I, $($($const_gen_name),*)?> {}
|
||||||
|
|
||||||
impl<I: FmtOpts, $($(const $const_gen_name: $with_ty),*)?> FmtOpts for $with_name<I, $($($const_gen_name),*)?> {
|
impl<I: FmtOpts, $($(const $const_gen_name: $with_ty),*)?> FmtOpts for $with_name<I, $($($const_gen_name),*)?> {
|
||||||
type Inner = I;
|
type Inner = I;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue