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: port_manager.rs
    path of file: ./repos/lodestone/core/src
    
    the code of the file until where you have to start completion: use std::{collections::HashSet, net::SocketAddrV4};

use color_eyre::eyre::{eyre, Context};
use serde::{Deserialize, Serialize};

use crate::error::Error;

pub struct PortManager {
    allocated_ports: HashSet<u32>,
}

#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
pub struct PortStatus {
    pub is_in_use: bool,
    pub is_all
    
    pub fn allocate(&mut self, start_port: u32) -> u32 {
        if self.allocated_ports.contains(&start_port) {
            let mut new_port = start_port + 1;
            while self.allocated_ports.contains(&new_port)
                || !port_scanner::local_port_available(new_port as u16)
            {
                new_port += 1;
            }
            self.allocated_ports.insert(new_port);
            new_port
        } else {
            self.allocated_ports.insert(start_port);
            start_port
        }
    }