nodrop-union: Update docs
This commit is contained in:
+20
-14
@@ -1,19 +1,21 @@
|
|||||||
//!
|
//!
|
||||||
//! The **nodrop** crate has the following cargo feature flags:
|
//! **nodrop-union** is the untagged unions (requires Rust nightly channel and
|
||||||
|
//! unstable as of this writing) implementation for the **nodrop** crate.
|
||||||
//!
|
//!
|
||||||
//! - `std`
|
//! It is intended you use this through the **nodrop** crate with the `use_union`
|
||||||
//! - Optional, enabled by default
|
//! crate feature enabled.
|
||||||
//! - Requires Rust 1.6 *to disable*
|
//!
|
||||||
//! - Use libstd
|
//! This is the future implementation of nodrop, once it is stable.
|
||||||
//! - `use_needs_drop`
|
//!
|
||||||
//! - Optional
|
//! This implementation is a lot better:
|
||||||
//! - Requires nightly channel.
|
//!
|
||||||
//! - Use `needs_drop` to skip overwriting if not necessary
|
//! - Does not have a destructor at all
|
||||||
//! - `use_union`
|
//! - Can be Copy if T is Copy
|
||||||
//! - Optional
|
//! - No space overhead / no runtime flag
|
||||||
//! - Requires nightly channel
|
//!
|
||||||
//! - Using untagged union, finally we have an implementation of `NoDrop` without hacks,
|
//! This means that this implementation has extensions that the
|
||||||
//! for example the fact that `NoDrop<T>` never has a destructor anymore.
|
//! stable nodrop does not yet have, which is something to be aware of if
|
||||||
|
//! you are switching.
|
||||||
//!
|
//!
|
||||||
|
|
||||||
#![feature(untagged_unions)]
|
#![feature(untagged_unions)]
|
||||||
@@ -38,6 +40,10 @@ impl<T: Clone> Clone for UnionFlag<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A type holding **T** that will not call its destructor on drop
|
||||||
|
///
|
||||||
|
/// The untagged unions implementation of `NoDrop<T>` is Copy where T: Copy,
|
||||||
|
/// which was not possible in the stable implementation.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct NoDrop<T>(UnionFlag<T>);
|
pub struct NoDrop<T>(UnionFlag<T>);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user