deepslate 0.3.1

A high-performance Minecraft server proxy written in Rust.
Documentation
//! Result traits for events that carry mutable outcomes.
//!
//! Modeled after Velocity's `ResultedEvent` pattern: events that can be
//! cancelled or have their outcome modified implement [`ResultedEvent`] with a
//! domain-specific [`EventResult`] type.

/// Trait for result types that indicate whether an action is allowed.
///
/// This is the Rust equivalent of Velocity's `ResultedEvent.Result` interface.
pub trait EventResult {
    /// Returns `true` if the action should proceed.
    fn is_allowed(&self) -> bool;
}

/// Trait for events that carry a mutable result.
///
/// Handlers can inspect and modify the result to cancel or alter the outcome
/// of an action. Multiple handlers execute in priority order, so later
/// handlers can override earlier decisions.
///
/// This mirrors Velocity's `ResultedEvent<R>` interface.
pub trait ResultedEvent {
    /// The result type associated with this event.
    type Result: EventResult;

    /// Get a reference to the current result.
    fn result(&self) -> &Self::Result;

    /// Set a new result, overriding whatever was set by earlier handlers.
    fn set_result(&mut self, result: Self::Result);
}