#
unsafe_libyaml/
success.rs

    1use core::ops::Deref;
    2
    3pub const OK: Success = Success { ok: true };
    4pub const FAIL: Success = Success { ok: false };
    5
    6#[must_use]
    7pub struct Success {
    8    pub ok: bool,
    9}
    10
    11pub struct Failure {
    12    pub fail: bool,
    13}
    14
    15impl Deref for Success {
    16    type Target = Failure;
    17
    18    fn deref(&self) -> &Self::Target {
    19        if self.ok {
    20            &Failure { fail: false }
    21        } else {
    22            &Failure { fail: true }
    23        }
    24    }
    25}