//! that define a set of options:
//!
//! ```
+//! # #[allow(dead_code)]
//! struct SomeOptions {
//! foo: i32,
//! bar: f32,
//! How can we define some default values? You can use `Default`:
//!
//! ```
+//! # #[allow(dead_code)]
//! #[derive(Default)]
//! struct SomeOptions {
//! foo: i32,
//! If you have your own type, you need to implement `Default` yourself:
//!
//! ```
+//! # #![allow(dead_code)]
//! enum Kind {
//! A,
//! B,
//! If you want to override a particular option, but still retain the other defaults:
//!
//! ```
+//! # #[allow(dead_code)]
//! # #[derive(Default)]
//! # struct SomeOptions {
//! # foo: i32,
/// # Examples
///
/// ```
+/// # #[allow(dead_code)]
/// #[derive(Default)]
/// struct SomeOptions {
/// foo: i32,
/// Making your own:
///
/// ```
+ /// # #[allow(dead_code)]
/// enum Kind {
/// A,
/// B,
#[stable(feature = "rust1", since = "1.0.0")]
impl Default for $t {
#[inline]
- #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> $t { $v }
}
}