pub struct ArraySet { /* private fields */ }Implementations§
Source§impl ArraySet
impl ArraySet
Sourcepub fn new() -> Self
pub fn new() -> Self
What is the element at the given index?
§Examples
use rusty_source_map::array_set;
let set = array_set::ArraySet::new();
assert_eq!(set.size(), 0);Sourcepub fn from_array(arr: Vec<String>, allow_duplicates: bool) -> Self
pub fn from_array(arr: Vec<String>, allow_duplicates: bool) -> Self
What is the element at the given index?
§Examples
use rusty_source_map::array_set;
let set = array_set::ArraySet::from_array(vec!["a".to_owned()], false);
assert_eq!(set.size(), 1);Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
What is the element at the given index?
§Examples
use rusty_source_map::array_set;
let set = array_set::ArraySet::from_array(vec!["a".to_owned()], false);
assert_eq!(set.size(), 1);Sourcepub fn add(&mut self, data: String, allow_duplicates: bool)
pub fn add(&mut self, data: String, allow_duplicates: bool)
What is the element at the given index?
§Examples
use rusty_source_map::array_set;
let mut set = array_set::ArraySet::from_array(vec!["a".to_owned()], false);
set.add("string".to_owned(), false);
assert_eq!(set.size(), 2);Sourcepub fn has(&self, data: String) -> bool
pub fn has(&self, data: String) -> bool
What is the element at the given index?
§Examples
use rusty_source_map::array_set;
let set = array_set::ArraySet::from_array(vec!["a".to_owned()], false);
assert_eq!(set.has("a".to_owned()), true);Sourcepub fn index_of(&self, data: String) -> Option<usize>
pub fn index_of(&self, data: String) -> Option<usize>
What is the element at the given index?
§Examples
use rusty_source_map::array_set;
let set = array_set::ArraySet::from_array(vec!["a".to_owned()], false);
assert_eq!(set.index_of("a".to_owned()), Some(0));Sourcepub fn at(&self, idx: i32) -> Option<String>
pub fn at(&self, idx: i32) -> Option<String>
What is the element at the given index?
§Examples
use rusty_source_map::array_set;
let set = array_set::ArraySet::from_array(vec!["a".to_owned()], false);
assert_eq!(set.at(0), Some("a".to_owned()));Sourcepub fn to_vec(&self) -> Vec<String>
pub fn to_vec(&self) -> Vec<String>
Returns the array representation of this set (which has the proper indices indicated by indexOf). Note that this is a copy of the internal array used for storing the members so that no one can mess with internal state.
§Examples
use rusty_source_map::array_set;
let set = array_set::ArraySet::from_array(vec!["a".to_owned()], false);
assert_eq!(set.to_vec().len(), 1);Trait Implementations§
Auto Trait Implementations§
impl Freeze for ArraySet
impl RefUnwindSafe for ArraySet
impl Send for ArraySet
impl Sync for ArraySet
impl Unpin for ArraySet
impl UnwindSafe for ArraySet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more