Skip to content

Implement TryFrom<Vec<T>> for ArrayVec<T, N>#202

Closed
c410-f3r wants to merge 1 commit into
bluss:masterfrom
c410-f3r:try-harder
Closed

Implement TryFrom<Vec<T>> for ArrayVec<T, N>#202
c410-f3r wants to merge 1 commit into
bluss:masterfrom
c410-f3r:try-harder

Conversation

@c410-f3r

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread tests/tests.rs
use std::mem;
use arrayvec::CapacityError;

use std::collections::HashMap;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is only used inside test_string

Comment thread src/lib.rs
Comment on lines +21 to +34
#[cfg(not(feature="std"))]
extern crate alloc;

#[cfg(feature="serde")]
extern crate serde;

#[cfg(not(feature="std"))]
extern crate core as std;

#[cfg(feature="std")]
pub use std::vec::Vec as Vec;
#[cfg(not(feature="std"))]
pub use alloc::vec::Vec as Vec;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible to avoid all cfg by simply declaring extern crate alloc; regardless of no_std.

@c410-f3r

Copy link
Copy Markdown
Contributor Author

Unlike most extend-like methods, this implementation does not require T: Clone.

@bluss bluss added this to the 0.8 milestone Oct 28, 2021
@c410-f3r

c410-f3r commented Nov 6, 2023

Copy link
Copy Markdown
Contributor Author

Closing due to the lack of feedback.

@c410-f3r c410-f3r closed this Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants