#[derive(Clone)]
#[magnus::wrap(class = "{{ class_path }}")]
pub struct {{ struct_name }} {
    {%- if needs_mutex %}
    inner: Arc<std::sync::Mutex<{{ core_path }}>>,
    {%- else %}
    inner: Arc<{{ core_path }}>,
    {%- endif %}
}

unsafe impl IntoValueFromNative for {{ struct_name }} {}

impl magnus::TryConvert for {{ struct_name }} {
    fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
        let r: &{{ struct_name }} = magnus::TryConvert::try_convert(val)?;
        Ok(r.clone())
    }
}

unsafe impl TryConvertOwned for {{ struct_name }} {}
