You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: channel.rs
    path of file: ./repos/aero/src/aero_kernel/src/drivers/block/ide
    
    the code of the file until where you have to start completion: // Copyright (C) 2021-2024 The Aero Project Developers.
//
// This file is part of The Aero Project.
//
// Aero is free software: you can redistribute it and/or modify
// it under the terms of the GNU
    
    pub fn load_dma(&mut self, buf: &[DmaBuffer], sectors: usize) -> usize {
        let mut rem = sectors;

        for (i, b) in buf.iter().enumerate() {
            let cur_sectors = b.sectors();

            let is_last = (i == buf.len() - 1) || (rem == cur_sectors);

            let entry = self.entry_at(i);

            entry.set_addr(b.start());
            entry.set_byte_count(b.data_size());
            entry.set_last_entry(is_last);

            rem -= cur_sectors;

            if is_last {
                break;
            }
        }

        sectors - rem
    }