pdk-flex-abi 1.7.0

PDK Flex ABI
Documentation
// Copyright (c) 2026, Salesforce, Inc.,
// All rights reserved.
// For full license text, see the LICENSE.txt file

use std::fmt;
use thiserror::Error;

#[repr(C)]
#[derive(PartialEq, Eq, Debug, Error)]
pub enum Status {
    Ok = 0,
    NotFound = 1,
    BadArgument = 2,
    ParseFailure = 4,
    Empty = 7,
    CasMismatch = 8,
    InternalFailure = 10,
}

impl fmt::Display for Status {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl Status {
    pub fn as_str(&self) -> &'static str {
        match self {
            Status::Ok => "Ok",
            Status::NotFound => "NotFound",
            Status::BadArgument => "BadArgument",
            Status::ParseFailure => "ParseFailure",
            Status::Empty => "Empty",
            Status::CasMismatch => "CasMismatch",
            Status::InternalFailure => "InternalFailure",
        }
    }
}