wiwi/
builder.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
extern crate wiwiwiwiwi;

use crate::prelude_std::*;
use self::private::AcceptDefaultSealed;

pub use wiwiwiwiwi::builder;

pub struct Uninit {
	__private: ()
}

pub struct Init {
	__private: ()
}

/// Trait for required items that can take [`None`] for convenience, because
/// they implement [`Default`]
pub trait AcceptDefault<T>
where
	Self: AcceptDefaultSealed<T>
{
	fn unwrap_or_default(self) -> T;
}

impl<T> AcceptDefault<T> for T {
	#[inline]
	fn unwrap_or_default(self) -> T {
		self
	}
}

impl<T> AcceptDefaultSealed<T> for T {}

impl<T> AcceptDefault<T> for Option<T>
where
	T: Default
{
	#[inline]
	fn unwrap_or_default(self) -> T {
		self.unwrap_or_default()
	}
}

impl<T> AcceptDefaultSealed<T> for Option<T> {}

/// notouchie
mod private {
	/// notouchie
	pub trait AcceptDefaultSealed<T> {}
}