pub fn split_off(&mut self, offset: usize) -> ExtractedFlashData<'data> {
        match offset.cmp(&self.data.len()) {
            Ordering::Less => {
                let (first, second) = self.data.split_at(offset);

                let first_address = self.address;

                self.data = second;
                self.address += offset as u32;

                ExtractedFlashData {
                    section_names: self.section_names.clone(),
                    address: first_address,
                    data: first,
                }
            }
            Ordering::Equal => {
                let return_value = ExtractedFlashData {
                    section_names: self.section_names.clone(),
                    address: self.address,
                    data: self.data,
                };

                self.data = &[];

                return_value
            }
            Ordering::Greater => {
                panic!("Offset is out of bounds!");
            }
        }
    }
/// Split off data from the beginning, and return it. If the offset is
/// out of bounds, this function will panic.
Split off data from the beginning, and return it. If the offset is
out of bounds, this function will panic.
Split off data from the beginning and return it . If the offset is out of bounds this function will panic .
pub fn split_off(&mut self, offset: usize) -> ExtractedFlashData<'data> {
        match offset.cmp(&self.data.len()) {
            Ordering::Less => {
                let (first, second) = self.data.split_at(offset);
                let first_address = self.address;
                self.data = second;
                self.address += offset as u32;
                ExtractedFlashData {
                    section_names: self.section_names.clone(),
                    address: first_address,
                    data: first,
                }
            }
            Ordering::Equal => {
                let return_value = ExtractedFlashData {
                    section_names: self.section_names.clone(),
                    address: self.address,
                    data: self.data,
                };
                self.data = &[];
                return_value
            }
            Ordering::Greater => {
                panic!("Offset is out of bounds!");
            }
        }
    }
pub fn split_off ( & mut self , offset : usize ) -> ExtractedFlashData < ' data > { match offset . cmp ( & self . data . len ( ) ) { Ordering :: Less => { let ( first , second ) = self . data . split_at ( offset ) ; let first_address = self . address ; self . data = second ; self . address += offset as u32 ; ExtractedFlashData { section_names : self . section_names . clone ( ) , address : first_address , data : first , } } Ordering :: Equal => { let return_value = ExtractedFlashData { section_names : self . section_names . clone ( ) , address : self . address , data : self . data , } ; self . data = & [ ] ; return_value } Ordering :: Greater => { panic ! ( " " ) ; } } }
Split off data from the beginning, and return it.
Split off data from the beginning and return it .
&mut self
offset
usize
&mut self
offset
usize