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: i2c.rs
    path of file: ./repos/tock/chips/lowrisc/src
    
    the code of the file until where you have to start completion: // Licensed under the Apache License, Version 2.0 or the MIT License.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright Tock Contributors 2022.

//! I2C Master Driver

use crate::registers::i2c_regs::{
    CTRL, FDATA, FIFO_CTRL, INTR, RDATA, STATUS, TIMING0, TIMING1, TIMING2, TIMING3, TIMING4,
};
use core::cell::Cell;
use kernel::hil;
use kernel::hil::i2c;
use kerne
    
    pub fn handle_interrupt(&self) {
        let regs = self.registers;
        let irqs = regs.intr_state.extract();

        // Clear all interrupts
        regs.intr_state.modify(
            INTR::FMT_THRESHOLD::SET
                + INTR::RX_THRESHOLD::SET
                + INTR::FMT_OVERFLOW::SET
                + INTR::RX_OVERFLOW::SET
                + INTR::NAK::SET
                + INTR::SCL_INTERFERENCE::SET
                + INTR::SDA_INTERFERENCE::SET
                + INTR::STRETCH_TIMEOUT::SET
                + INTR::SDA_UNSTABLE::SET,
        );

        if irqs.is_set(INTR::FMT_THRESHOLD) {
            // FMT Watermark
            if self.slave_read_address.get() != 0 {
                self.write_read_data();
            } else {
                self.write_data();
            }
        }

        if irqs.is_set(INTR::RX_THRESHOLD) {
            // RX Watermark
            self.read_data();
        }
    }