@@ -15,6 +15,7 @@ matrix:
|
|||||||
- NODROP_FEATURES='use_needs_drop'
|
- NODROP_FEATURES='use_needs_drop'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env:
|
env:
|
||||||
|
- FEATURES='use_union'
|
||||||
- NODROP_FEATURES='use_union'
|
- NODROP_FEATURES='use_union'
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
version = "0.3.16"
|
version = "0.3.17"
|
||||||
authors = ["bluss"]
|
authors = ["bluss"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
@@ -15,10 +15,11 @@ version = "0.2.12"
|
|||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dependencies.nodrop]
|
[dependencies.nodrop]
|
||||||
version = "0.1.6"
|
version = "0.1.8"
|
||||||
path = "nodrop"
|
path = "nodrop"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = ["odds/std", "nodrop/std"]
|
std = ["odds/std", "nodrop/std"]
|
||||||
|
use_union = ["nodrop/use_union"]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
DOCCRATES = arrayvec nodrop odds
|
DOCCRATES = arrayvec nodrop nodrop_union odds
|
||||||
|
|
||||||
# deps to delete the generated docs
|
# deps to delete the generated docs
|
||||||
RMDOCS =
|
RMDOCS =
|
||||||
|
|
||||||
FEATURES = odds/unstable
|
FEATURES = "odds/unstable nodrop/use_union"
|
||||||
|
|
||||||
VERSIONS = $(patsubst %,target/VERS/%,$(DOCCRATES))
|
VERSIONS = $(patsubst %,target/VERS/%,$(DOCCRATES))
|
||||||
|
|
||||||
|
|||||||
+16
@@ -22,6 +22,11 @@ __ http://bluss.github.io/arrayvec
|
|||||||
Recent Changes (arrayvec)
|
Recent Changes (arrayvec)
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
- 0.3.17
|
||||||
|
|
||||||
|
- Added crate feature ``use_union`` which forwards to the nodrop crate feature
|
||||||
|
- Added methods ``.is_full()`` to ``ArrayVec`` and ``ArrayString``.
|
||||||
|
|
||||||
- 0.3.16
|
- 0.3.16
|
||||||
|
|
||||||
- Added method ``.retain()`` to ``ArrayVec``.
|
- Added method ``.retain()`` to ``ArrayVec``.
|
||||||
@@ -91,6 +96,17 @@ Recent Changes (nodrop)
|
|||||||
optimization, which skips overwriting if the inner value does not need
|
optimization, which skips overwriting if the inner value does not need
|
||||||
drop.
|
drop.
|
||||||
|
|
||||||
|
Recent Changes (nodrop-union)
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
- 0.1.9
|
||||||
|
|
||||||
|
- Add ``Copy, Clone`` implementations
|
||||||
|
|
||||||
|
- 0.1.8
|
||||||
|
|
||||||
|
- Initial release
|
||||||
|
|
||||||
|
|
||||||
License
|
License
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nodrop-union"
|
name = "nodrop-union"
|
||||||
version = "0.1.8"
|
version = "0.1.9"
|
||||||
authors = ["bluss"]
|
authors = ["bluss"]
|
||||||
|
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
description = "A wrapper type to inhibit drop (destructor). Implementation crate for nodrop, the untagged unions implementation (which is unstable / requires nightly) as of this writing."
|
description = "A wrapper type to inhibit drop (destructor). Implementation crate for nodrop, the untagged unions implementation (which is unstable / requires nightly) as of this writing."
|
||||||
documentation = "http://bluss.github.io/arrayvec/doc/nodrop"
|
documentation = "http://bluss.github.io/arrayvec/doc/nodrop_union"
|
||||||
repository = "https://github.com/bluss/arrayvec"
|
repository = "https://github.com/bluss/arrayvec"
|
||||||
|
|
||||||
keywords = ["container", "drop", "no_std"]
|
keywords = ["container", "drop", "no_std"]
|
||||||
|
|||||||
+30
-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)]
|
||||||
@@ -25,10 +27,24 @@ extern crate core as std;
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
#[allow(unions_with_drop_fields)]
|
#[allow(unions_with_drop_fields)]
|
||||||
|
#[derive(Copy)]
|
||||||
union UnionFlag<T> {
|
union UnionFlag<T> {
|
||||||
value: T,
|
value: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Clone> Clone for UnionFlag<T> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
unsafe {
|
||||||
|
UnionFlag { value: self.value.clone() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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)]
|
||||||
pub struct NoDrop<T>(UnionFlag<T>);
|
pub struct NoDrop<T>(UnionFlag<T>);
|
||||||
|
|
||||||
impl<T> NoDrop<T> {
|
impl<T> NoDrop<T> {
|
||||||
|
|||||||
@@ -7,6 +7,12 @@
|
|||||||
//! - Optional, enabled by default
|
//! - Optional, enabled by default
|
||||||
//! - Requires Rust 1.6 *to disable*
|
//! - Requires Rust 1.6 *to disable*
|
||||||
//! - Use libstd
|
//! - Use libstd
|
||||||
|
//!
|
||||||
|
//! - `use_union`
|
||||||
|
//! - Optional
|
||||||
|
//! - Requires Rust nightly channel
|
||||||
|
//! - Use the unstable feature untagged unions for the internal implementation,
|
||||||
|
//! which has reduced space overhead
|
||||||
#![cfg_attr(not(feature="std"), no_std)]
|
#![cfg_attr(not(feature="std"), no_std)]
|
||||||
extern crate odds;
|
extern crate odds;
|
||||||
extern crate nodrop;
|
extern crate nodrop;
|
||||||
|
|||||||
Reference in New Issue
Block a user