[][src]Struct exonum_rust_runtime::api::ServiceApiScope

pub struct ServiceApiScope { /* fields omitted */ }

Exonum API builder for the concrete service API scope.

Methods

impl ServiceApiScope[src]

pub fn endpoint<Q, I, F, R>(
    &mut self,
    name: &'static str,
    handler: F
) -> &mut Self where
    Q: DeserializeOwned + 'static + Send,
    I: Serialize + 'static,
    F: Fn(ServiceApiState, Q) -> R + 'static + Clone + Send + Sync,
    R: Future<Output = Result<I>>, 
[src]

Adds a readonly endpoint handler to the service API scope.

In HTTP backends this type of endpoint corresponds to GET requests.

pub fn endpoint_mut<Q, I, F, R>(
    &mut self,
    name: &'static str,
    handler: F
) -> &mut Self where
    Q: DeserializeOwned + 'static,
    I: Serialize + 'static,
    F: Fn(ServiceApiState, Q) -> R + 'static + Clone + Send + Sync,
    R: Future<Output = Result<I>>, 
[src]

Adds an endpoint handler to the service API scope.

In HTTP backends this type of endpoint corresponds to POST requests.

pub fn pb_endpoint_mut<Q, I, F, R>(
    &mut self,
    name: &'static str,
    handler: F
) -> &mut Self where
    Q: DeserializeOwned + ProtobufConvert + 'static,
    Q::ProtoStruct: Message,
    I: Serialize + 'static,
    F: Fn(ServiceApiState, Q) -> R + 'static + Clone + Send + Sync,
    R: Future<Output = Result<I>>, 
[src]

Adds an endpoint handler to the service API scope.

In HTTP backends this type of endpoint corresponds to POST requests. Unlike [endpoint_mut], this method supports deserializing the payload both from JSON (if Content-Type of the request is application/json) or from Protobuf (if Content-Type is application/octet-stream). This comes at the cost of more requirements to the response type.

pub fn deprecated_endpoint<Q, I, F, R>(
    &mut self,
    name: &'static str,
    deprecated: Deprecated<Q, I, R, F>
) -> &mut Self where
    Q: DeserializeOwned + 'static,
    I: Serialize + 'static,
    F: Fn(ServiceApiState, Q) -> R + 'static + Clone + Send + Sync,
    R: Future<Output = Result<I>>, 
[src]

Same as endpoint, but the response will contain a warning about the endpoint being deprecated. The endpoint expiration date and deprecation-related information (e.g., a link to documentation for a new API) can be included in the warning.

pub fn deprecated_endpoint_mut<Q, I, F, R>(
    &mut self,
    name: &'static str,
    deprecated: Deprecated<Q, I, R, F>
) -> &mut Self where
    Q: DeserializeOwned + 'static,
    I: Serialize + 'static,
    F: Fn(ServiceApiState, Q) -> R + 'static + Clone + Send + Sync,
    R: Future<Output = Result<I>>, 
[src]

Same as endpoint_mut, but the response will contain a warning about the endpoint being deprecated. The endpoint expiration date and deprecation-related information (e.g., a link to documentation for a new API) can be included in the warning.

pub fn web_backend(&mut self) -> &mut ApiBuilder[src]

Return a mutable reference to the underlying web backend.

Trait Implementations

impl Clone for ServiceApiScope[src]

impl Debug for ServiceApiScope[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,