fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
        methods.add_meta_method(MetaMethod::NewIndex, |_ctx, this: &DatalogRef, (key, value) : (String, rlua::Value)| {

            // Ignore if the inner Datalog is not set.
            let mut this = this.0.lock().unwrap();
            let datalog = match this.as_mut() {
                Some(d) => d,
                None => return Ok(rlua::Nil),
            };

            // set table entry.
            match key.as_str() {
                "account" => match value {
                    rlua::Value::String(v) => {
                        datalog.account = Some(v.to_str()?.to_owned());
                    },
                    _ => return Err(rlua::Error::external("log.account = val: must be a string")),
                },
                "status" => match value {
                    rlua::Value::Integer(v) => {
                        let n = v as usize;
                        datalog.status = Err(n.into());
                    },
                    _ => return Err(rlua::Error::external("log.status = val: must be a datalog.enum")),
                },
                x => return Err(rlua::Error::external(format!("log.{}: unknown key", x))),
            }
            Ok(rlua::Nil)
        });
    }
///
/// Add just the NewIndex method here, for log.<key> = value.
///
Add just the NewIndex method here, for log. = value.
Add just the NewIndex method here for log . = value .
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
        methods.add_meta_method(MetaMethod::NewIndex, |_ctx, this: &DatalogRef, (key, value) : (String, rlua::Value)| {
            // Ignore if the inner Datalog is not set.
            let mut this = this.0.lock().unwrap();
            let datalog = match this.as_mut() {
                Some(d) => d,
                None => return Ok(rlua::Nil),
            };
            // set table entry.
            match key.as_str() {
                "account" => match value {
                    rlua::Value::String(v) => {
                        datalog.account = Some(v.to_str()?.to_owned());
                    },
                    _ => return Err(rlua::Error::external("log.account = val: must be a string")),
                },
                "status" => match value {
                    rlua::Value::Integer(v) => {
                        let n = v as usize;
                        datalog.status = Err(n.into());
                    },
                    _ => return Err(rlua::Error::external("log.status = val: must be a datalog.enum")),
                },
                x => return Err(rlua::Error::external(format!("log.{}: unknown key", x))),
            }
            Ok(rlua::Nil)
        });
    }
fn add_methods < ' lua , M : UserDataMethods < ' lua , Self > > ( methods : & mut M ) { methods . add_meta_method ( MetaMethod :: NewIndex , | _ctx , this : & DatalogRef , ( key , value ) : ( String , rlua :: Value ) | { // Ignore if the inner Datalog is not set. let mut this = this . 0 . lock ( ) . unwrap ( ) ; let datalog = match this . as_mut ( ) { Some ( d ) => d , None => return Ok ( rlua :: Nil ) , } ; // set table entry. match key . as_str ( ) { " " => match value { rlua :: Value :: String ( v ) => { datalog . account = Some ( v . to_str ( ) ? . to_owned ( ) ) ; } , _ => return Err ( rlua :: Error :: external ( " " ) ) , } , " " => match value { rlua :: Value :: Integer ( v ) => { let n = v as usize ; datalog . status = Err ( n . into ( ) ) ; } , _ => return Err ( rlua :: Error :: external ( " " ) ) , } , x => return Err ( rlua :: Error :: external ( format ! ( " " x ) ) ) , } Ok ( rlua :: Nil ) } ) ; }
Add just the NewIndex method here, for log.<key> = value.
Add just the NewIndex method here for log . <key > = value .
methods
&mut M