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: scan.rs
    path of file: ./repos/ferrocarril/mruby/src/extn/core/string
    
    the code of the file until where you have to start completion: use std::cmp;
use std::mem;

use crate::convert::{FromMrb, RustBackedValue, TryFromMrb};
use crate::extn::core::matchdata::MatchData;
use crate::extn::core::regexp::enc::Encoding;
use crate::extn::core::regexp::opts::Options;
use crate::extn::core::regexp::{syntax, Regexp};
use crate::gc::MrbGarbageCollection;
use crate::sys;
use crate::value::{Value, ValueLike};
use crate::Mrb;

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub enum Error {
    Fatal,
    WrongType,
}

#[derive(Debug)]
pub struct Args {
    pub regexp: Option<Regexp>,
    pub block: Option<Value>,
}

impl Args {
    const ARGSPEC: &'static [u8] = b"o&\0";

    pub unsafe fn extract(interp: &Mrb) -> Result<Self, Error> {
        let mut pattern = <mem::MaybeUninit<sys::mrb_value>>::uninit();
        let mut block = <mem::MaybeUninit<sys::mrb_value>>::uninit();
        sys::mrb_get_args(
            interp.borrow().mrb,
            Self::ARGSPEC.as_ptr() as *const i8,
            pattern.as_mut_ptr(),
            block.as_mut_ptr(),
        );
        let pattern = pattern.assume_in
    
    pub unsafe fn extract(interp: &Mrb) -> Result<Self, Error> {
        let mut pattern = <mem::MaybeUninit<sys::mrb_value>>::uninit();
        let mut block = <mem::MaybeUninit<sys::mrb_value>>::uninit();
        sys::mrb_get_args(
            interp.borrow().mrb,
            Self::ARGSPEC.as_ptr() as *const i8,
            pattern.as_mut_ptr(),
            block.as_mut_ptr(),
        );
        let pattern = pattern.assume_init();
        let block = block.assume_init();
        let regexp = if let Ok(regexp) = Regexp::try_from_ruby(interp, &Value::new(interp, pattern))
        {
            Some(regexp.borrow().clone())
        } else if let Some(ref pattern) = Value::new(interp, pattern)
            .funcall::<Option<String>, _, _>("to_str", &[])
            .map_err(|_| Error::WrongType)?
        {
            Regexp::new(
                syntax::escape(pattern),
                syntax::escape(pattern),
                Options::default(),
                Options::default(),
                Encoding::default(),
            )
        } else {
            None
        };
        let block = if sys::mrb_sys_value_is_nil(block) {
            None
        } else {
            Some(Value::new(interp, block))
        };
        Ok(Self { regexp, block })
    }