lemon_bugsnag_rs 0.1.2

A library for interacting with the BugSnag error-reporting and sessions APIs.
Documentation
use serde::Serialize;

/// Struct corresponding to the `events -> feature_flag` key in the BugSnag
/// error-reporting API payload. Contains details about active feature flag
/// and variants when the error occured.
///
/// ```
/// use lemon_bugsnag_rs::error::payload::events::FeatureFlag;
///
/// let feature_flag = FeatureFlag {
///     feature_flag: "Feature Flag Test".into(),
///     variant: Some("Feature Flag Variant Test".into())
/// };
/// ```
#[derive(Clone, Debug, Serialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct FeatureFlag {
    /// Name of active feature flag when the error occured
    pub feature_flag: String,
    /// Name of active variant when the error occured
    pub variant: Option<String>,
}

#[cfg_attr(docsrs, doc(cfg(feature = "convenience-intos")))]
#[cfg(feature = "convenience-intos")]
impl Into<Vec<FeatureFlag>> for FeatureFlag {
    fn into(self) -> Vec<FeatureFlag> {
        [self].into()
    }
}

#[cfg_attr(docsrs, doc(cfg(feature = "convenience-intos")))]
#[cfg(feature = "convenience-intos")]
impl Into<Option<Vec<FeatureFlag>>> for FeatureFlag {
    fn into(self) -> Option<Vec<FeatureFlag>> {
        Some([self].into())
    }
}