mirror of
https://git.proxmox.com/git/proxmox
synced 2025-06-25 02:57:33 +00:00

Drop #!feature(specialization) in favor of having a `cli` property for types to decide whether they are CLI compatible. The unconstrained_type! macro now has both ParseCli and ParseCliFromStr in view, and requires one of the two to be implemented for a type. This means that if a type implements FromStr, it should "just work". For types created without the help of the #[api] macro, there's a shortcut to exclude a type from the CLI via the no_cli_type!{typename} macro. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
31 lines
863 B
Rust
31 lines
863 B
Rust
//! Proxmox API module. This provides utilities for HTTP and command line APIs.
|
|
//!
|
|
//! The main component here is the [`Router`] which is filled with entries pointing to
|
|
//! [`ApiMethodInfos`](crate::ApiMethodInfo).
|
|
//!
|
|
//! Note that you'll rarely need the [`Router`] type itself, as you'll most likely be creating them
|
|
//! with the `router` macro provided by the `proxmox-api-macro` crate.
|
|
|
|
use std::future::Future;
|
|
use std::pin::Pin;
|
|
|
|
use failure::Error;
|
|
use http::Response;
|
|
|
|
mod api_output;
|
|
pub use api_output::*;
|
|
|
|
mod api_type;
|
|
pub use api_type::*;
|
|
|
|
mod router;
|
|
pub use router::*;
|
|
|
|
pub mod cli;
|
|
|
|
/// Return type of an API method.
|
|
pub type ApiOutput<Body> = Result<Response<Body>, Error>;
|
|
|
|
/// Future type of an API method. In order to support `async fn` this is a pinned box.
|
|
pub type ApiFuture<Body> = Pin<Box<dyn Future<Output = ApiOutput<Body>> + Send>>;
|