lemon_bugsnag_rs 0.1.2

A library for interacting with the BugSnag error-reporting and sessions APIs.
Documentation
/// Trait to implement on client builders that provide both synchronous
/// and asynchronous clients. For a builder that provides only one or the
/// other, you can skip this trait and allow the user to call build() without
/// first calling blocking() or non_blocking().
///
/// See also [DeciderTraitAsync](crate::common::traits::decider_trait_sync::DeciderTraitSync)
///
/// This trait provides the blocking() function, which should return a
/// synchronous client. See [Implementors](#implementors).
///
/// # Example
/// ```
/// use lemon_bugsnag_rs::common::traits::decider_trait_sync::DeciderTraitSync;
///
/// struct MySyncDecider {}
/// // A struct implementing BackendBuilderTrait. Impl not shown here.
/// struct MySyncBuilder {}
/// impl DeciderTraitSync<MySyncBuilder> for MySyncDecider {
///   fn blocking(self) -> MySyncBuilder {
///     MySyncBuilder {}
///   }
/// }
/// ```
#[cfg_attr(docsrs, doc(cfg(feature = "sync")))]
#[cfg(feature = "sync")]
pub trait DeciderTraitSync<S> {
    /// Returns S where S is a [synchronous client](crate::common::traits::client_trait_sync::ClientTraitSync).
    /// See [ReqwestErrorDecider::blocking()](crate::error::reqwest::builder::decider::ReqwestErrorDecider::blocking()).
    ///
    /// # Examples
    /// ```
    /// // For network backends that support both blocking and non-blocking
    /// // requests, such as Reqwest.
    /// use lemon_bugsnag_rs::common::builder::client_builder::ClientBuilder;
    /// use lemon_bugsnag_rs::common::traits::{
    ///   decider_trait_sync::DeciderTraitSync,
    ///   backend_builder_trait_sync::BackendBuilderTraitSync
    /// };
    ///
    /// let mut cb = ClientBuilder::session();
    /// cb.configure(
    ///   "Fake API Key",
    ///   "NAB BugSnag library notifier",
    ///   "Version 2.0",
    ///   Some("development"),
    ///   Some("1.0.0")
    /// );
    ///
    /// // Get your blocking client using the Reqwest backend, like so:
    /// let client = cb.reqwest().blocking().build();
    /// ```
    ///
    /// ```
    /// // For network backends that support only a single request type,
    /// // such as Ureq, which provides only synchronous methods, you
    /// // do not need to use the blocking() or non_blocking() methods.
    /// use lemon_bugsnag_rs::common::builder::client_builder::ClientBuilder;
    /// use lemon_bugsnag_rs::common::traits::{
    ///   decider_trait_sync::DeciderTraitSync,
    ///   backend_builder_trait_sync::BackendBuilderTraitSync
    /// };
    ///
    /// let mut cb = ClientBuilder::session();
    /// cb.configure(
    ///   "Fake API Key",
    ///   "NAB BugSnag library notifier",
    ///   "Version 2.0",
    ///   Some("development"),
    ///   Some("1.0.0")
    /// );
    ///
    /// // Get your blocking client using the Ureq backend, like so:
    /// let client = cb.ureq().build();
    /// ```
    fn blocking(self) -> S;
}