pub fn push(&mut self, item: T) {
        if let Some(index) = self.find(&item) {
            if index < self.shared {
                // if it is in read exclusive, move it up into shared
                self.items.swap(index, self.shared - 1);
                self.shared -= 1;
            } else if index > self.write {
                // if it is in write exclusive, move it down into shared
                self.items.swap(index, self.write);
                self.write += 1;
            }
        } else {
            // add the item
            self.items.push(item);

            // swap it down into shared
            let index = self.items.len() - 1;
            self.items.swap(index, self.write);
            self.write += 1;
        }
    }
/// Adds a resource to the permissions set as both readable and writable.
Adds a resource to the permissions set as both readable and writable.
Adds a resource to the permissions set as both readable and writable .
pub fn push(&mut self, item: T) {
        if let Some(index) = self.find(&item) {
            if index < self.shared {
                // if it is in read exclusive, move it up into shared
                self.items.swap(index, self.shared - 1);
                self.shared -= 1;
            } else if index > self.write {
                // if it is in write exclusive, move it down into shared
                self.items.swap(index, self.write);
                self.write += 1;
            }
        } else {
            // add the item
            self.items.push(item);
            // swap it down into shared
            let index = self.items.len() - 1;
            self.items.swap(index, self.write);
            self.write += 1;
        }
    }
pub fn push ( & mut self , item : T ) { if let Some ( index ) = self . find ( & item ) { if index < self . shared { // if it is in read exclusive, move it up into shared self . items . swap ( index , self . shared - 1 ) ; self . shared -= 1 ; } else if index > self . write { // if it is in write exclusive, move it down into shared self . items . swap ( index , self . write ) ; self . write += 1 ; } } else { // add the item self . items . push ( item ) ; // swap it down into shared let index = self . items . len ( ) - 1 ; self . items . swap ( index , self . write ) ; self . write += 1 ; } }
Adds a resource to the permissions set as both readable and writable.
Adds a resource to the permissions set as both readable and writable .
&mut self
item
T
&mut self
item
T