fn split_bucket(&mut self, bucket_index: usize) -> bool {
        if !can_split_bucket(self.buckets.len(), bucket_index) {
            return false;
        }

        // Implementation is easier if we just remove the whole bucket, pretty
        // cheap to copy and we can manipulate the new buckets while they are
        // in the RoutingTable already.
        let split_bucket = match self.buckets.pop() {
            Some(bucket) => bucket,
            None => panic!("no buckets present in RoutingTable - implementation error"),
        };

        // Push two more buckets to distribute nodes between
        self.buckets.push(Bucket::new());
        self.buckets.push(Bucket::new());

        for node in split_bucket.iter() {
            self.add_node(node.clone());
        }

        true
    }
/// Tries to split the bucket at the specified index.
///
/// Returns false if the split cannot be performed.
Tries to split the bucket at the specified index.
Returns false if the split cannot be performed.
Tries to split the bucket at the specified index . Returns false if the split cannot be performed .
fn split_bucket(&mut self, bucket_index: usize) -> bool {
        if !can_split_bucket(self.buckets.len(), bucket_index) {
            return false;
        }
        // Implementation is easier if we just remove the whole bucket, pretty
        // cheap to copy and we can manipulate the new buckets while they are
        // in the RoutingTable already.
        let split_bucket = match self.buckets.pop() {
            Some(bucket) => bucket,
            None => panic!("no buckets present in RoutingTable - implementation error"),
        };
        // Push two more buckets to distribute nodes between
        self.buckets.push(Bucket::new());
        self.buckets.push(Bucket::new());
        for node in split_bucket.iter() {
            self.add_node(node.clone());
        }
        true
    }
fn split_bucket ( & mut self , bucket_index : usize ) -> bool { if ! can_split_bucket ( self . buckets . len ( ) , bucket_index ) { return false ; } // Implementation is easier if we just remove the whole bucket, pretty // cheap to copy and we can manipulate the new buckets while they are // in the RoutingTable already. let split_bucket = match self . buckets . pop ( ) { Some ( bucket ) => bucket , None => panic ! ( " " ) , } ; // Push two more buckets to distribute nodes between self . buckets . push ( Bucket :: new ( ) ) ; self . buckets . push ( Bucket :: new ( ) ) ; for node in split_bucket . iter ( ) { self . add_node ( node . clone ( ) ) ; } true }
Tries to split the bucket at the specified index.
Tries to split the bucket at the specified index .
&mut self
bucket_index
usize
&mut self
bucket_index
usize