eio_okta_client/
lib.rs

1#![allow(clippy::result_large_err)]
2
3pub(crate) mod client;
4pub mod command;
5pub(crate) mod options;
6
7pub use client::Client;
8pub use command::Command;
9pub use options::*;
10
11#[derive(Debug, thiserror::Error, miette::Diagnostic)]
12#[allow(clippy::large_enum_variant)]
13#[remain::sorted]
14pub enum Error {
15  #[error(transparent)]
16  Endpoint(#[from] eio_okta_api::traits::endpoint::Error),
17  #[error(transparent)]
18  Http(#[from] http::Error),
19  #[error(transparent)]
20  IO(#[from] std::io::Error),
21  #[error(transparent)]
22  Json(#[from] serde_json::Error),
23  #[error(transparent)]
24  ParseLinkHeader(#[from] parse_link_header::Error),
25  #[error(transparent)]
26  Service(#[from] eio_okta_api::traits::service::Error),
27  #[error(transparent)]
28  Ureq(#[from] ureq::Error),
29}
30
31pub trait MapInto<T, E> {
32  fn map_into(self) -> Result<T, E>;
33}
34
35impl<OkFrom, ErrFrom, OkInto, ErrInto> MapInto<OkInto, ErrInto> for Result<OkFrom, ErrFrom>
36where
37  OkFrom: Into<OkInto>,
38  ErrFrom: Into<ErrInto>,
39{
40  fn map_into(self) -> Result<OkInto, ErrInto> {
41    self.map(Into::into).map_err(Into::into)
42  }
43}