Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Dec 15, 2023
1 parent 4843b0f commit bdff691
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 37 deletions.
4 changes: 2 additions & 2 deletions identified_vec/src/is_identifiable_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
///
/// ```
/// extern crate identified_vec;
/// use identified_vec::{IsIdentifiableVec, IdentifiedVec, Identifiable, IdentifiedVecOf};
/// use identified_vec::{IsIdentifiableVec, IsIdentifiableVecOf, IdentifiedVec, Identifiable, IdentifiedVecOf};
///
/// #[derive(Eq, PartialEq, Clone, Debug, Hash)]
/// struct User {
Expand Down Expand Up @@ -174,7 +174,7 @@ where
///
/// ```
/// extern crate identified_vec;
/// use identified_vec::{IsIdentifiableVec, IdentifiedVec, Identifiable, IdentifiedVecOf};
/// use identified_vec::{IsIdentifiableVec, IsIdentifiableVecOf, IdentifiedVec, Identifiable, IdentifiedVecOf};
///
/// #[derive(Eq, PartialEq, Clone, Debug, Hash)]
/// struct User {
Expand Down
4 changes: 0 additions & 4 deletions identified_vec/src/is_identified_vec_via.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
use std::borrow::BorrowMut;
use std::cell::RefMut;
use std::ops::Deref;

use crate::conflict_resolution_choice::ConflictResolutionChoice;
use crate::{Identifiable, IdentifiedVecOf, IsIdentifiableVec, IsIdentifiableVecOf};

Expand Down
2 changes: 1 addition & 1 deletion identified_vec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//!
//! ```
//! extern crate identified_vec;
//! use identified_vec::{IsIdentifiableVec, IdentifiedVec, IdentifiedVecOf, Identifiable};
//! use identified_vec::{IsIdentifiableVec, IsIdentifiableVecOf, IdentifiedVec, IdentifiedVecOf, Identifiable};
//! use std::cell::RefCell;
//!
//! #[derive(Eq, PartialEq, Clone, Debug)]
Expand Down
8 changes: 4 additions & 4 deletions identified_vec/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::is_identifiable_vec::IsIdentifiableVec;
///
/// ```
/// extern crate identified_vec;
/// use identified_vec::{IdentifiedVec, Identifiable, IdentifiedVecOf, IsIdentifiableVec};
/// use identified_vec::{IdentifiedVec, Identifiable, IdentifiedVecOf, IsIdentifiableVec, IsIdentifiableVecOf};
/// use std::cell::RefCell;
///
/// #[derive(Eq, PartialEq, Clone, Debug)]
Expand Down Expand Up @@ -121,7 +121,7 @@ use crate::is_identifiable_vec::IsIdentifiableVec;
///
/// ```
/// /// extern crate identified_vec;
/// use identified_vec::{IdentifiedVec, Identifiable, IdentifiedVecOf, IsIdentifiableVec};
/// use identified_vec::{IdentifiedVec, Identifiable, IdentifiedVecOf, IsIdentifiableVec, IsIdentifiableVecOf};
///
/// let numbers = IdentifiedVec::<u32, u32>::new_identifying_element(|e| *e);
/// ```
Expand Down Expand Up @@ -325,7 +325,7 @@ where
///
/// ```
/// extern crate identified_vec;
/// use identified_vec::{IsIdentifiableVec, IdentifiedVec, Identifiable, IdentifiedVecOf};
/// use identified_vec::{IsIdentifiableVec, IsIdentifiableVecOf, IdentifiedVec, Identifiable, IdentifiedVecOf};
///
/// #[derive(Eq, PartialEq, Clone, Debug, Hash)]
/// struct User {
Expand Down Expand Up @@ -512,7 +512,7 @@ where
///
/// ```
/// extern crate identified_vec;
/// use identified_vec::{IsIdentifiableVec, IdentifiedVec, Identifiable, IdentifiedVecOf};
/// use identified_vec::{IsIdentifiableVec, IsIdentifiableVecOf, IdentifiedVec, Identifiable, IdentifiedVecOf};
///
/// #[derive(Eq, PartialEq, Clone, Debug, Hash)]
/// struct User {
Expand Down
41 changes: 15 additions & 26 deletions tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
use std::{
cell::{Ref, RefCell, RefMut},
collections::HashSet,
fmt::Debug,
ops::Deref,
};
use std::{cell::RefCell, collections::HashSet, fmt::Debug, ops::Deref};

use identified_vec::{
ConflictResolutionChoice, Identifiable, IdentifiedVec, IdentifiedVecOf,
Expand Down Expand Up @@ -127,6 +122,7 @@ fn get() {
// identified_vec.get(id),
// Some(&User::new(id.clone(), "Blob, Esq."))
// );
// identified_vec.upd

// // 2
// id = &2;
Expand All @@ -148,19 +144,19 @@ fn get() {
// .drain(4..9);
// assert_eq!(identified_vec.get(id), Some(&User::new(id.clone(), "Blob")));

identified_vec.remove_by_id(id);
assert_eq!(identified_vec.get(id), None);
identified_vec.append(User::new(4, "Blob, Sr."));
assert_eq!(
identified_vec.elements(),
[
User::new(1, "Blob, Esq."),
User::new(2, "Blob"),
User::new(4, "Blob, Sr."),
]
.iter()
.collect::<Vec<&User>>()
);
// identified_vec.remove_by_id(id);
// assert_eq!(identified_vec.get(id), None);
// identified_vec.append(User::new(4, "Blob, Sr."));
// assert_eq!(
// identified_vec.elements(),
// [
// User::new(1, "Blob, Esq."),
// User::new(2, "Blob"),
// User::new(4, "Blob, Sr."),
// ]
// .iter()
// .collect::<Vec<&User>>()
// );
}

#[test]
Expand Down Expand Up @@ -592,10 +588,3 @@ fn test_macro() {
sut.update_or_append(User::blob_jr());
assert_eq!(sut.items(), [User::blob_sr(), User::blob_jr()]);
}

// #[test]
// fn test_macro() {
// let mut users = CollectionOfUsers::new();
// users.0.append(User::blob());
// assert_eq!(users.0.items(), [User::blob()])
// }

0 comments on commit bdff691

Please sign in to comment.