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_id_repo.rs
    path of file: ./repos/amqprs/amqprs/src/net
    
    the code of the file until where you have to start completion: use amqp_serde::types::{AmqpChannelId, ShortUint};

const INITIAL_BIT_MASK: u8 = 0b1000_0000;
pub(crate) struct ChannelIdRepository {
    /// Each bit represent two states: 1: occupied, 0: free.
    /// Real i
    
    pub fn allocate(&mut self) -> AmqpChannelId {
        let pos = self
            .id_state
            .iter()
            .position(|&v| v != 0b1111_1111)
            .expect("id allocation never fail");
        for i in 0..8 {
            let mask = INITIAL_BIT_MASK >> i;
            if self.is_free(pos, mask) {
                // mark it as occupied
                self.set_occupied(pos, mask);
                // calculate the real id
                let channel_id = pos as AmqpChannelId * 8 + i + 1;
                return channel_id;
            }
        }
        unreachable!("id allocation should always return");
    }