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: proc_mem_monitor.rs
    path of file: ./repos/rd/src/file_monitor
    
    the code of the file until where you have to start completion: use crate::{
    event::Switchable,
    file_monitor::{FileMonitor, FileMonitorType, LazyOffset, Range},
    remote_ptr::RemotePtr,
    session::task::Task,
    taskish_uid::TaskUid,
};
use libc::pid_t;
use std::{
    convert::TryInto,
    ffi::OsStr,
    os::unix::ffi::OsStrExt,
    path::{Component, Path},
};

pub struct ProcMemMonitor {
    maybe_tuid: Option<TaskUid>,
}

impl ProcMemMonitor {
    pub fn new(t: &dyn Task, pathname: &OsStr) -> ProcMemMonitor {
        let pathname = Path::new(pathname
    
    fn did_write<'b, 'a: 'b>(&mut self, ranges: &[Range], lazy_offset: &LazyOffset<'b, 'a>) {
        if self.maybe_tuid.is_none() {
            return;
        }

        let tuid = self.maybe_tuid.unwrap();
        if lazy_offset.t.session().is_replaying() || ranges.is_empty() {
            return;
        }

        let mut offset = lazy_offset.retrieve(false).unwrap();
        let target_rc;
        let task: &dyn Task = if lazy_offset.t.tuid() == tuid {
            &*lazy_offset.t
        } else {
            let maybe_target = lazy_offset.t.session().find_task_from_task_uid(tuid);
            match maybe_target {
                None => return,
                Some(target) => {
                    target_rc = target;
                    &**target_rc
                }
            }
        };

        let record_task = task.as_record_task().unwrap();
        for r in ranges {
            record_task.record_remote(RemotePtr::new(offset.try_into().unwrap()), r.length);
            offset += r.length as u64;
        }
    }