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: region_context.rs
    path of file: ./repos/incubator-horaedb/src/wal/src/message_queue_impl
    
    the code of the file until where you have to start completion: // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF 
    
    pub fn safe_delete_offset(&self) -> Offset {
        let mut safe_delete_offset = Offset::MAX;
        let mut high_watermark = 0;
        // Calc the min offset in message queue.
        for table_meta in &self.entries {
            if let Some(offset) = table_meta.safe_delete_offset {
                safe_delete_offset = cmp::min(safe_delete_offset, offset);
            }
            high_watermark = cmp::max(high_watermark, table_meta.current_high_watermark);
        }

        if safe_delete_offset == Offset::MAX {
            // All tables are in such states: after init/flush, but not written.
            // So, we can directly delete it up to the high_watermark.
            high_watermark
        } else {
            safe_delete_offset
        }
    }