rjango 0.1.1

A full-stack Rust backend framework inspired by Django
Documentation
/// Method decorator marker (used as documentation/convention in Rust).
///
/// In Django, this converts function decorators for class methods.
/// In Rust, we document the pattern but it is handled by traits and wrapper
/// functions rather than runtime descriptor mutation.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MethodDecorator {
    pub name: String,
    pub description: String,
}

impl MethodDecorator {
    #[must_use]
    pub fn new(name: &str, description: &str) -> Self {
        Self {
            name: name.to_string(),
            description: description.to_string(),
        }
    }
}

#[cfg(test)]
mod tests {
    use super::MethodDecorator;

    #[test]
    fn new_method_decorator_stores_fields() {
        let decorator = MethodDecorator::new(
            "login_required",
            "Marks methods that require authentication.",
        );

        assert_eq!(decorator.name, "login_required");
        assert_eq!(
            decorator.description,
            "Marks methods that require authentication."
        );
    }

    #[test]
    fn method_decorator_derives_clone_and_equality() {
        let original = MethodDecorator::new("csrf_exempt", "Documents a CSRF exemption marker.");
        let cloned = original.clone();

        assert_eq!(original, cloned);
    }
}